开发者

Alternate to using backspace in vim

When I do a mistake in vim, I use backspace, becaus开发者_JS百科e changing to command mode and use 'x' is longer, but maybe is other way to do it vim-way?


ctrl-w to erase the last word, ctrl-u to erase the entire line you're on.


In insert mode ctrl+h does the same thing as the backspace key (i.e. deletes one character backwards).


You can use u to undo. However it tends to erase the whole last line you typed...

Depending on the situation you can use the following text objects :

  • ciw to erase and rewrite the current word
  • c$ to erase and rewrite everything to the end of the line
  • c^ to erase and rewrite everything to the beginning of the line
  • ci) to change the content of parentheses

See :help text-objects for more.

If you need to change a single letter, the Vim way could be to use r to replace the wrong letter.

  1. type tje home
  2. Put your cursor on j using fj or Fj depending if your cursor is after or before j
  3. Type r and then h
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜