How to set Vim's permanent display line number function under CentOS?

Source: Internet
Author: User

in the Linux system, we often use the VI or VIM command to manipulate the text, sometimes, our script file error, will throw a line number of exceptions, and then we follow the prompts, reopen, our source to view, and this time, If your vim is not set to display line number function, we look for the problem of the line of code, it is very inconvenient, do not know if you have encountered this situation.

The solution is as follows:

(1) The Cat-n command is able to display the line number of the text at once, which is easy for us to observe, but it doesn't work in the editing state.

(2) Configure the line number function of vim so that you can quickly locate line numbers at any time, in the editing state.




Scattered cents, we recommend that you use the second method, the following look at the specific configuration method;

(1) root user, directly compile the/ETC/VIMRC file, add the following two lines to the end of the file set command:

Java code
  1. #显示行号
  2. Set Nu
  3. #设置缩进
  4. Set tabstop=4



(2) Non-root user, directly edit vi vimrc file, add command and (1) Like, save, exit, we again use the VI command, to edit the file, will show the line number, examples are as follows:

Java code
  1. [Search@dnode1 ~]$ VI Word
  2. 1 I am Hadoop
  3. 2 I am Hadoop
  4. 3 I am lucene
  5. 4 I am hbase
  6. 5 I am hive
  7. 6 I am hive sql
  8. 7 I am pig

How to set Vim's permanent display line number function under CentOS?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.