Vim显示行号

If you need number every time you start vi/vim, append following line to your ~/.vimrc file:

vi ~/.vimrc

 


Append the following line:

set number

 


Save and close the file.

 

Tip: Open a file at particular location/line number

Jump to particular line number from a shell prompt, enter:

$ vi +linenumber file.c
$ vi +300 initlib.c 

 


Jump to particular line that contains main() function from a shell prompt, enter:

$ vi +/searchTermHere file.c
$ vi +/main initlib.c
### note shell escape done with \ ###
$ vi +/addUser\( initlib.c
$ vi +/addUser\(arg1\) initlib.c

 

http://www.cyberciti.biz/faq/vi-show-line-numbers/

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。