Is it possible to override the meaning of a word in vim?
In vim, a string separated by "-" will be treated as multiple words, so if I name a variable like "this-is-very-long-variable-name" then vim treats that variable name as two words so I can easily find the start or end of "variables" and "name".
However, in most programming languages I am not allowed to specify such a variable, the only programming language that supports and prefers the Lisp naming style. in most other programming languages I have to use "_".
So if I have a variable named "this_is_a_very_long_variable_name", is there a way I could move that variable name by pressing "w / b / e" to move word by word instead of pressing "h / l" to move through characters?
source to share
If it's just for navigation, my camelcasemotion plugin provides alternate movements ,w
/ ,b
/ ,e
(and the corresponding text objects), but leaves only the Vim word definition; those. you can still change the whole variable_name
to iw
. Alternatively, you can also override Vim's built-in movements using plugins.
The change 'iskeyword'
(as suggested by @Rob) may affect syntax highlighting and other plugins, so it will be a less intrusive solution.
source to share