I'm having a hard time understanding how set nocompatible
(a line which, from this answer on StackOverflow, I understand I could also remove from my ~/.vimrc
, correct me if I'm wrong), syntax enable
and VimPlug are interacting as regards iskeyword
which changes upon sourcing my ~/.vimrc
, causing a change in the behavior of *.
I'm sure I had a similar issue some week ago with a TeX file, but I can't bother reproducing it now, as the present reproduction seems enough for asking a question.
My troubleshooting resulted in the following screencast, which I describe it below, if you find it more convenient
- At the time 00:35 I have reduced my
~/.vimrc
to a bare minimum:if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim au VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.vim/plugged') call plug#end() set nocompatible " to use Vim, not just vi syntax enable
- Then I go back to the terminal via Ctrl-Z, open a CSS file and, at time 00:44, I hit * while the cursor is at the beginning of the word
box-sizing
, and what gets searched is\<box-sizing\>
, which I think is correct for a CSS file; not shown in the screencast, I've verified that:echo &iskeyword
gives@,48-57,_,192-255,-
; - At the time ~00:53 I
:so ~/.vimrc
(which I've modified at step 1) then hit * again, showing that something\<box\>
is searched this time! I've verified (not shown) that:echo &iskeyword
give@,48-57,_,192-255
. - I
q
uit the CSS file, then I go back to my~/.vimrc
, and delete theset nocompatible
line at the time 01:05. - One more time, I reopen the CSS file and repeat the procedure, showing that this time, also after
:so ~/.vimrc
, * still searches\<box-sizing\>
. - I close the CSS file, go back to
~/.vimrc
, restore theset nocompatible
line, delete all VimPlug specific stuff, and:w
rite this content (time 01:29)set nocompatible syntax enable
- Finally I open the CSS file a third time, and show that * only searches
\<box\>
now. What is happening? Given the very scarce~/.vimrc
I show during the screencast, what in world could be messing around withiskeyword
? Should I ask for help to Junegunn Choi?
iskeyword
setting I bet. Try:verbose set isk?
Also, note github.com/vim/vim/blob/master/runtime/ftplugin/css.vim#L20 However, I am not sure, why filetype plugins are enabled initially with your minimum vimrc (check the output of:filetype
)plug#end()
will enable filetype plug-ins and I think it does that unconditionally. So that should explain why the minimal vimrc is still gettingftplugin/css.vim
sourced. github.com/junegunn/vim-plug/blob/…