Remove diacritics in selections with iconv transliteration

While working on French documents, I sometimes need to extract some parts to turn them in a more neutral form. Like turning an article title with accents into a filename or a slug for a URL.

So to remove diacritics from a selection le garçon hérétiquele garcon heretique, I use the filter command | with iconv

define-command to-ascii %{
  execute-keys '|iconv -f utf8 -t ascii//TRANSLIT<ret>'
}

Beware, for some characters it can expand selections, like in German with ß replaced by ss.

3 Likes

Another quick command also related to codepoints:

map global user -docstring 'codepoint' i ': echo %sh{ printf "codepoint: U+%04x" "$kak_cursor_char_value" }<ret>'

found in maximbaz kakrc: https://github.com/maximbaz/dotfiles/blob/bb739436d88ec5b6009a68eb2f99325b6a376463/.config/kak/mappings.kak#L34