In Vim/Vi, how do you move the cursor to the end of the previous word?

前端 未结 4 708
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 22:30

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
相关标签:
4条回答
  • 2021-01-29 23:05

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

    0 讨论(0)
  • 2021-01-29 23:08

    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
    0 讨论(0)
  • 2021-01-29 23:17

    Try ge:

    ge                      Backward to the end of word [count] |inclusive|.
    
                                                            *gE*
    gE                      Backward to the end of WORD [count] |inclusive|.
    
    0 讨论(0)
  • 2021-01-29 23:18

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

    0 讨论(0)
提交回复
热议问题