注释块:转自:https://unix.stackexchange.com/questions/120615/how-to-comment-multiple-lines-at-once
To comment out blocks in vim:
- press Esc (to leave editing or other mode)
- hit ctrl + v (visual block mode)
- use the ↑ / ↓ arrow keys to select lines you want (it won't highlight everything - it's OK!)
- Shift + i (capital I)
- insert the text you want, e.g. %
- 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 行):
扫描二维码关注公众号,回复:
12568695 查看本文章
esc
:n
撤销:
esc
u