Customising word separators in vi

Joe Watkins picture Joe Watkins · Oct 22, 2008 · Viewed 12.3k times · Source

vi treats dash - and space   as word separators for commands such as dw and cw.

Is there a way to add underscore _ as well?

I quite often want to change part of a variable name containing underscores, such as changing src_branch to dest_branch. I end up counting characters and using s (like 3sdest), but it would be much easier to use cw (like cwdest).

Answer

g33kz0r picture g33kz0r · Jun 23, 2009

Is there a way to add underscore _ as well?

:set iskeyword-=_