Where is centos vimrc

藏色散人
Release: 2022-01-11 14:29:53
Original
2306 people have browsed it

centos vimrc is in the "/etc/vim" directory. You can enter the "vim /etc/vimrc" or "/etc/vimrc" command in the terminal to edit the vimrc configuration file.

Where is centos vimrc

The operating environment of this article: centos 7.5 system, Dell G3 computer.

Where is centos vimrc?

The vim configuration file in centOS is stored in the /etc/vim directory, and the configuration file is named vimrc:

In centOS (the current host is centos 7.5), the vim configuration file is stored in the /etc/vim directory, and the configuration file is named vimrc

In the terminal Enter the following command to edit the vimrc configuration file:
vim /etc/vimrc or /etc/vimrc
This is slightly different from ubuntu

1. Display the line number
Add a line number at the end of the file New line, enter set nu

2, syntax highlighting
Find the line "syntax on" in the file and remove the double quotes in front of it. The double quotes mean comments

3 , automatic indentation
Add a line at the end of the file, enter set autoindent
Add a line, enter set cindent
where autoindent is automatic indentation; cindent is especially for automatic indentation of C language syntax
in Add the following code at the end (to set the indentation of the Tab key and change it to the equivalent of 4 spaces):

if has( "autocmd" )
    filetype plugin indent on
    autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandt    ab
endif
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
Copy after login
Copy after login

Then add the following code at the end to complete the brackets:

inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap < <><ESC>i
Copy after login
Copy after login

At this point, the basic settings are complete.

Note: If VIM does not take corresponding actions after setting the above settings, please upgrade your VIM to the latest version. Generally, you only need to enter the following command in the terminal: sudo apt-get install vim

The vim configuration file in centOS (the current host is centos 7.5) is stored in the /etc/vim directory, and the configuration file name For vimrc

, enter the following command in the terminal to edit the vimrc configuration file:
vim /etc/vimrc or /etc/vimrc
This is slightly different from ubuntu

1. Display Line number
Add a new line at the end of the file, enter set nu

2, syntax highlighting
Find the line "syntax on" in the file, remove the preceding double quotes", the double quotes are Meaning of comments

3. Auto-indent
Add a line at the end of the file and enter set autoindent
Add a line and enter set cindent
where autoindent is automatic indentation; cindent is specifically for C language syntax automatic indentation
Add the following code at the end (to set the indentation of the Tab key and change it to the equivalent of 4 spaces):

if has( "autocmd" )
    filetype plugin indent on
    autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandt    ab
endif
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
Copy after login
Copy after login

Then add the following code at the end to complete Full brackets:

inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap < <><ESC>i
Copy after login
Copy after login

Now, the basic settings are completed.

Note: If VIM does not take corresponding actions after setting the above settings, please upgrade your VIM to the latest version. Generally, you only need to enter the following command in the terminal: sudo apt-get install vim

Recommended tutorial: "centos tutorial"

The above is the detailed content of Where is centos vimrc. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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!