Home > System Tutorial > LINUX > body text

How to set the line number of vim in Ubuntu? How to set the line number of vim in Ubuntu

PHPz
Release: 2024-01-07 11:41:30
forward
844 people have browsed it

Today I used vim to write code under Ubuntu. As usual, I set the line number of vim first. I didn’t think about anything every time, but today I thought about it. Can vim be initialized when it is opened? Woolen cloth?

I checked the relevant information online and practiced it myself. If it works, I will post it and share it with everyone! (The set vim line number is valid for all users (including root user))

1. Open the terminal, enter cd /etc/vim in the command line and hit Enter to enter the /etc/vim directory;

2. After entering the etc/vim directory, find the vimrc file (vim’s initialization file) and use the cp command to back it up. The command is: cp vimrc vimrc.bak (backup is a security mechanism, please remember) ;

3. Open vimrc with administrator rights, the command is: sudo vi vimrc

4. After opening, add a line of command at the end of the vimrc file: set nu;

5. After adding, write, exit, restart vim, you can find the line number mark.

The above is the detailed content of How to set the line number of vim in Ubuntu? How to set the line number of vim in Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!