vaichidrewar
vaichidrewar

Reputation: 9621

vim shortcut to traverse the word from right to left

Vim shortcut to traverse the words in forward direction i.e left to right is w / W What is the shortcut to go in the opposite direction?

Similarly x deletes character on which cursor is there. So continuously pressing it deletes characters from left to right. Is there a shortcut to delete characters from right to left i.e characters before the cursor.

Upvotes: 1

Views: 834

Answers (1)

Kevin
Kevin

Reputation: 56069

b goes backwards to the previous beginning of a word.
X will delete the character before the cursor
db will delete from the cursor position to the previous beginning of a word (excluding the letter at the cursor). e.g. ([] is the cursor position)

first middle la[s]t " type b
first middle [l]ast " type b again
first [m]iddle last " type db
[m]iddle last

Of course b is just a movement command, so you can tack it on to any command that takes a movement, e.g. cb will cut/change to the beginning of the word, vb will highlight it, etc.

Upvotes: 5

Related Questions