vim 命令记录

注释块:转自:https://unix.stackexchange.com/questions/120615/how-to-comment-multiple-lines-at-once

To comment out blocks in vim:

  1. press Esc (to leave editing or other mode)
  2. hit ctrl + v (visual block mode)
  3. use the ↑ / ↓ arrow keys to select lines you want (it won't highlight everything - it's OK!)
  4. Shift + i (capital I)
  5. insert the text you want, e.g. %
  6. press Esc Esc.

 

Ranges:

You can do it with the following commands:

for commenting:

:66,70s/^/#

for uncommenting:

:66,70s/^#/

Obviously, here we're commenting lines from 66 to 70 (inclusive).

显示行数:

esc

:set number

转跳到某一行(第n 行):

esc

:n 

撤销:

esc

 

 

你可能感兴趣的:(Linux)