0

: 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.

4

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.

Update:

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 Oct 7 '16 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 Oct 7 '16 at 19:57

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.