Using Neovim 0.6.1.
I use a lot of snake_case_variable_names and have a frequent need to navigate within their individual components instead of treating these names as a single word.
Right now, the only trick I've found is to put this line in my config: set iskeyword-=_
However this poses several problems:
When using the native completion engine, the individual components are registered in a list of available words. This tends to bloat completion lists with useless symbols (
some_integer
,some
,integer
).- For instance, if I declare
some_integer
in python, the jedi completion engine will recognisesome_integer
as a symbol available for completion. Which is good. - The native nvim completion engine, on the other hand, will recognise
some
andword
as symbols available for completion. Which is bad.
- For instance, if I declare
The ability to navigate around full_names with w,e,b motions is either removed or severely impaired.
- I can sometimes use
W,E,B
to select an entire_name, but it doesn't behave asw,e,b
used to behave before usingset iskeyword-=_
. It usually overshoots and selects special characters such as parentheses, punctuation, brackets, etc.
- I can sometimes use
*
and#
do not select the whole_name, but whatever word is delimited by underscores.
Does anyone know how I could get around either (hopefully both) of these problems?
Ideally, I'd like a setup that would function as follows:
w,e,b
to navigate within snake_case_namesW,E,B
behaving exactly as the defaultw,e,b