2

I now have Vim version 8.1.2102 from Sep 30 2019 15:45:59 on Fedora 30. For some reason the word boundary in C++ code now also includes the underscore somehow, so I see this:

When I have the cursor over that and press *, it will only search for quark. When I do <C-[> it will try to search for the tag quark.

There are a bunch of plugins:

$ ls .vim/bundle
molokai/             vim-eunuch/         vim-regex-collection/
SingleCompile/       vim-fish/           vim-repeat/
syntastic/           vim-fswitch/        vim-snipmate/
tlib_vim/            vim-gutentags/      vim-surround/
vim-addon-mw-utils/  vim-headings/       vim-unimpaired/
vim-dirvish/         Vim-Jinja2-Syntax/  VOoM/
vim-dokuwiki/        vim-mathematica/

I have not changed the plugins but Vim got updated and somehow this has changed. How can I further triage and fix this issue?


In the C++ code file I have this setting:

iskeyword=a-z,A-Z

In my whole .vim directory there is not a single spot where this is set to anything nonsensical:

$ grep -R iskeyword .
./bundle/vim-fish/ftplugin/fish.vim:setlocal iskeyword=@,48-57,-,_,.,/
./bundle/vim-mathematica/syntax/mma.vim:setlocal iskeyword+=`,$
./bundle/vim-mathematica/syntax/mma.vim:setlocal iskeyword-=:,-

Fish is a shell and mma is for Wolfram Language code. Since the filetype is set to cpp, neither of them should be invoked.

I could just add set iskeyword+=_ to my .vimrc but that does not seem right.

2
  • 1
    What about grep -R isk .? (Vim commands/options can be abbreviated.) – Rich Oct 17 '19 at 13:20
  • Please update the question with verbatim output of :verbose set iskeyword? since that would be a great clue into troubleshooting this! Also, what does :set ft? say? – filbranden Oct 17 '19 at 14:07
3

This is configured by the 'iskeyword' setting. You can check the current value and what set that value by running the command:

:verbose set iskeyword?

See :help 'iskeyword' and :help 'isfname' for details of this setting. It is a comma delimited string which usually contains a specific _ item.

If the thing that is setting the option incorrectly cannot be configured not to do so, you can fix this by placing settings in a file in a subdirectory of your .vim/after directory: the precise best location depends on exactly what is breaking the setting in the first place, but I'm guessing adding either of the following lines to .vim/after/ftplugin/cpp.vim would work for you:

" Just add an underscore
setlocal iskeyword+=_

" Reset to default
setlocal iskeyword&
9
  • It says: iskeyword=a-z,A-Z and no mapping found for * and no mapping found for <C-]>. So shouldn't there also be numbers in there? – Martin Ueding Oct 17 '19 at 10:37
  • I've updated the question. – Martin Ueding Oct 17 '19 at 10:41
  • @MartinUeding The numbers just specify ASCII characters by their byte value, so they're not 100% necessary. But for your purposes there should definitely be an _. Does it not tell you what set the value? – Rich Oct 17 '19 at 10:41
  • For ft it tells where it is set, but for iskeyword it does not tell me any location. – Martin Ueding Oct 17 '19 at 10:42
  • 1
    @MartinUeding Looks like it: I just don't understand why it's not reported by :verbose (which normally works fine for system and user plugins alike). You might be able to get a head start on your grepping by viewing the output of :scriptnames in your C++ buffer, which will show you which Vimscript files have been loaded. – Rich Oct 17 '19 at 13:18

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.