When I write a German text containing something like abücd for instance and to a dw in front, it will only delete the ab since it does not interpret ü as a word character.

When I edit reStructuredText, I have


That explains why the umlauts are not marked, but I do not understand where this comes from. When I just open gVim this is set to


Where could this be coming from?

  • 3
    Put set encoding=utf-8 in your .vimrc. – cuonglm Nov 6 '15 at 18:08
  • That is already in my .vim/vimrc and :set enc? gives me utf-8. Same with fenc. Still it does not work. – Martin Ueding Nov 6 '15 at 21:06
  • After :set iskeyword& is ü still not recognized as a part of a word? – ryuichiro Nov 7 '15 at 1:04
  • Show as your iskeyword (set iskeyword). It should be something like "@,48-57,_,128-167,224-235"or "@,48-57,_,192-255". Are you using Vim or Vi ? (the default value in Vi ("@,48-57,_") does not recognize ü; the default value in Vim is fine) – JJoao Nov 7 '15 at 13:37
  • 1
    I use gVim and have iskeyword=@,48-57,_,192-255. It magically works in a fresh Vim instance now. That is strange, I have to observe that more carefully. – Martin Ueding Nov 7 '15 at 15:40

The @ character in iskeyword includes all characters for which isalpha() (C function) is TRUE; in modern (last 20 years) libc implementations this also looks for unicode characters.

Your second iskeyword uses 97-122 (a-z) and 64-90 (A-Z), which doesn't include all the variants with the various diacritics (such as the umlaut/diaeresis/trema).

So the solution is to replace 97-122 and 64-90 with @.

This funky iskeyword comes from the LISP syntax file; the rst syntax file includes a bunch of other syntax files for highlighting the code blocks.

Luckily you can set which languages to include with the g:rst_syntax_code_list variable. The default is:

let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', 'python', 'perl']

Since it's unlikely that you need LISP syntax highlighting in your reStructuredText file, you can probably just remove it. Just add it anywhere in your vimrc file, if it's defined, the syntax file will use that value instead of defining its own.

In my opinion, you probably want to use:

let g:rst_syntax_code_list = []

Because who knows what funky side-effects the other syntax files cause...

| improve this answer | |
  • Cool, thank you! This did not happen to me on Ubuntu so far, it only has happened here on Fedora 22. Probably their syntax files are a bit different. It works now. – Martin Ueding Nov 8 '15 at 14:17
  • The hint with the @ standing for alphanumerical characters was really helpful. – Zelphir Kaltstahl Oct 25 '16 at 20:08

If one inlines grammars from other languages in for example markdown files, then the settings of those languages seem to override the settings for markdown syntax. One can check if that is the case using:

:verbose set iskeyword?

In order to fix this, one can define an auto command to be run each time one enters a markdown file (and probably other languages as well):

autocmd BufEnter,BufNewFile *.md set iskeyword=38,42,43,45,47-58,60-62,_,@

Putting this in my .vimrc fixed the issue for me. I was using vim-pandoc syntax and inlined languages including racket, python, sh and some. I think it is not necessary to define an auto command for leaving markdown files, because when you enter files of other languages, their syntax files should set their keywords, if I understand correctly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.