Reputation: 41
For example, what I want:
http://vimdoc.sourceforge.net/htmldoc/motion.html
------>------>----------->
w w w
what Vim behaves:
http://vimdoc.sourceforge.net/htmldoc/motion.html
--->-->----->>---------->>
w w w w w w
Upvotes: 1
Views: 100
Reputation: 7669
You could do this:
nnoremap w /\v(^\|\A)\zs\a<cr>
onoremap w /\v(^\|\A)\zs\a<cr>
xnoremap w /\v(^\|\A)\zs\a<cr>
It maps the 'w' key to a search. This search looks for any alphabetic character that is preceded by either a non-alphabetic character, or a start of line. The various different mapping modes (nnoremap
, onoremap
, xnoremap
) are so that it works in visual mode and as an argument to an operator, e.g. dw
will delete our custom word rather than the default meaning of a word.
Upvotes: 3