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.
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
Then add the following code at the end to complete the brackets:
inoremap ( ()<ESC>i inoremap [ []<ESC>i inoremap { {}<ESC>i inoremap < <><ESC>i
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
Then add the following code at the end to complete Full brackets:
inoremap ( ()<ESC>i inoremap [ []<ESC>i inoremap { {}<ESC>i inoremap < <><ESC>i
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!