You can control that with the 'iskeyword'
option. To include dashes, you can use this command:
set iskeyword+=-
You'll probably want to use setlocal
and limit that to the specific filetype where you want dashes to be recognized as identifiers.
You can create a file ~/.vim/after/ftplugin/<your-filetype>.vim
with that setlocal
command to ensure -
is always included in words when editing files of that specific type.
See also :help word
:
A word consists of a sequence of letters, digits and underscores, or a sequence of other non-blank characters, separated with white space (spaces, tabs, <EOL>
). This can be changed with the 'iskeyword'
option. An empty line is also considered to be a word.