236

In Vim's normal mode:

  • e goes to the end of the next word
  • w goes to the beginning of the next word
  • b goes to the beginning of the previous word

How do you move the cursor to the end of the previous word?

0

4 Answers 4

323

Unfortunately it's not a single key... but ge is what you're looking for, I think.

Sign up to request clarification or add additional context in comments.

7 Comments

For people like me wondering the difference between ge and be, it's that you can be in the middle of the word and you'll go to the end of the previous, while be you need to be on the first char of the initial word.
And gE for the end of the previous WORD. :)
seriously why isn't there a single key shortcut for this by default? this looks like something people would be using as frequently as w. am I missing something? (I know it can be mapped, just curious why)
While be is convenient, it's a combination of two commands, so you can't use it like: d be. Whereas d ge does work
@BalintG. I usually think of it as "Go End".
|
64

Try ge:

ge Backward to the end of word [count] |inclusive|. *gE* gE Backward to the end of WORD [count] |inclusive|. 

1 Comment

The difference between word and WORD: stackoverflow.com/questions/22931032/vim-word-vs-word
36

as seen on VIM manual (section 03.1), you can use ge to go to the end of previous word

Comments

6

You may also want to do these to go to the space preceding a word (one character after ge: (both are only 2 keys)

  1. FSpace will take you to the space after the previous word
  2. Bh will also do that, in most cases.

The exception is when you are at the beginning of a line, in which case

  1. k$ does something similar, in 3 keypresses

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.