: is set as keyword (set iskeyword) for C++ source file by default, is there a way to just disable that in my .vimrc file instead of doing set iskeyword-=: every time? It seems the plug-in set the keyword is loaded after loading .vimrc file.

1 Answer 1


You could put

setlocal iskeyword-=:

inside ~/.vim/after/ftplugin/cpp.vim

Loads automatically when you open files where the filetype is cpp. If it doesn't work, try setting filetype plugin on.


Or you could do

autocmd FileType cpp :setlocal iskeyword-=:

In your .vimrc, but I recommend you put it in a ftplugin - it keeps your .vimrc clutter-free.

  • 1
    It's better to put it inside ~/.vim/after/ftplugin/cpp.vim and also use: setlocal instead of set: setlocal iskeyword-=:
    – dNitro
    Commented Oct 7, 2016 at 19:51
  • That's true. I forgot about /after and kinda just copied the command from Q. Updated answer to reflect this, thanks.
    – Wolfie
    Commented Oct 7, 2016 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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