delete word after or around cursor in VIM

前端 未结 16 619
一向
一向 2020-12-07 06:59

I\'m now switching to VIM from TextMate. I found ^+W in INSERT mode very useful. However, I\'d like to delete not only the word before cursor, but

16条回答
  •  时光取名叫无心
    2020-12-07 07:36

    Since there are so many ways to delete a word, let's illustrate them.

    Assuming you edit:

    foo-bar quux
    

    and invoke a command while the cursor is on the 'a' in 'bar':

    foo-bquux  # dw:  letters then spaces right of cursor
    foo-quux   # daw: letters on both sides of cursor then spaces on the right 
    foo- quux  # diw: letters on both sides of cursor
    foo-bquux  # dW:  non-whitespace then spaces right of cursor
    quux       # daW: non-whitespace on both sides of cursor then spaces on the right
     quux      # diW: non-whitespace on both sides of cursor
    

提交回复
热议问题