Today, we use vim to write code in Ubuntu. As usual, we set the vim line number first. Every time I think about it, I think about it today, can I enable the initialization line when vim is enabled ??? I checked the relevant information online and practiced it myself. If it is feasible, I will post it to share it with you !!! (The vim row number is valid for all users (including root users. open the terminal, enter cd/etc/vim in the command line, and press enter to enter the/etc/vim directory;
Today, we use vim to write code in Ubuntu. As usual, we set the vim line number first. Every time I think about it, I think about it today, can I enable the initialization line when vim is enabled ???
I checked the relevant information online and practiced it myself. If it is feasible, I will post it to share it with you !!! (The vim row number is valid for all users (including root users ))
1. Open the terminal, enter cd/etc/vim in the command line, and press enter to enter the/etc/vim directory;
2. go to the etc/vim directory, find the vimrc file (vim's initialization file), and use the cp command to back up the file. The command is cp vimrc. bak (backup is a security mechanism that must be kept in mind );
3. Open vimrc with the Administrator permission and run the following command: sudo vi vimrc.
4. After opening the file, add the following command to the end of the vimrc file: set nu;
5. After adding, write, exit, and restart vim to find the row number.