Basically the title. When I include in my vimrc
set iskeyword-=_
and save it, when I reload gvim and type
:set iskeyword
I still see
iskeyword=@,48-57,_,192-255
As you can see, the '_' is still there. If I just :set iskeyword-=_
it works as intended. Why doesn't this work from my vimrc? Is there an alternate way I can get around this and if so how?
I had the problem with a .conf
file. So I did this in my .vimrc
:
autocmd BufReadPost *.conf set isk-=.
Check with :verbose set iskeyword?
where this got set. Note that many filetype plugins change this value (but for a no-argument, plain Vim launch with an empty buffer, none should have been set).
If :verbose
doesn't yield the answer, capture a full log of the Vim startup with vim -V20vimlog
, and search for the option.
Also, is your .vimrc
actually sourced? :scriptnames
tells you.
I had the same problem with settings coming from a global file type plugin (perl.vim in my case) where I wanted to change the iskeyword configuration in my .vimrc. Thanks to the hints in other answers I realized that the plugins are evaluated after my .vimrc, overriding changes I made.
The canonical answer to this situation is to create an "after" directory in your local configuration, like
~/.vim/after/ftplugin/perl.vim
and put the set iskeyword-=_
there. That solved it for me.
Just reset the option in your .vimrc after plugins. According the documentation you can do it like this.
set iskeyword=@,48-57,192-255
@ - stands for all alphabetic letters
48-57 - stands for ASCII characters 48 to 57, which are the numbers 0-9
192-255 - are the printable latin characters
Happy coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With