Vim Tip #9: More Basic Movement


tags: Vim

Vim Tips

Movement by words has several commands associated with it. In Normal Mode, w will move you to the next word ... but it depends on your definition of a word, because Vim thinks a number of things like "-" and "/" are word terminators. If you think only whitespace should be a word terminator, then W is the command for you: it ignores all word terminators except spaces and tabs.

Should you wish to move backwards by words, use b or B.

If you want to move to the end of the current word (rather than the beginning of the next one, as w/W would do), use e to get there. E will get you to the end of capital "W" words - try it, you'll see (so long as you get the w/W difference). The flip-side of that - move to the beginning of the current word, at least if you're not already at the beginning of the word - is b, which you already know.

Movement by sentences is done with ) and (, and movement by paragraphs is done with } and { - these will get you around a text document very fast.

Practise all of these, they`re very handy.