In the VSCode Vim plugin, there are various normal mode commands that depend on the boundaries of the word/token under the cursor (e.g. *, w, e, etc). These don't work well with the R language which uses the dot (.) as an ordinary token character and not as an operator as most languages do.
This means that, for example, if you search (*) for a variable under the cursor like my.data, the vim plugin will either search for my or data, but not my.data as it should.
Curiously, with the R plugin installed (which has the correct syntax definitions), built in VSCode features like the Rename Symbol Command work as they should (e.g. hitting F2 when the cursor is over my.data will replace the whole variable and not just my or data).
Is there a way to get VSCode Vim to respect the R syntax via user configuration or would this require an update to the R or VSCode vim plugins?
The VS Code Vim extension is supposed to honour its
vim.iskeywordsetting, which is really just a higher-priority alias of theeditor.wordSeparatorssetting for the Vim extension. If you don't setvim.iskeyword, it will fall back toeditor.wordSeparators, and if neither are set, it defaults to using/\\()"\':,.;<>~!@#$%^&*|+=[]{}`?-. The source code for this behaviour is in https://github.com/VSCodeVim/Vim/blob/master/src/configuration/configuration.ts. Interestingly,vim.iskeywordisn't registered as a language-overridable setting, but doing something like this should work:I've tested that it works for selecting the inner word in visual mode (viw). Weird things happen with forward word search (*, but I think that's probably just a bug, in which case I'd suggest that you raise a bug ticket). If you want to trace the source code for this, you can go through the following: