您的位置:首页 > 其它

How To Show Line Numbers In vi / vim Text Editor

2013-01-29 13:31 375 查看
Q. How do I display vi / vim text editor line numbers while writing a shell script or c program? How can I turn on or off this feature?

A. Displaying line numbers under vi / vim can be very useful for debugging code errors and to improve overall readability of a program.


vi / vim show line number command

To display line numbers along the left side of a window, type any one of the following:

:set
numberor

:set
nu


(Fig.01:
Vi / Vim line numbers in action - click to enlarge image)

To turn off line number again enter the same command:

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

set
numberSave and close the file.

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

$ vi +linenumber file.c$
vi +300 initlib.c
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: