In UBUNTU, the vim configuration file is stored in the /etc/vim directory, and the configuration file name is vimrc
. In Fedora, the vim configuration file is stored in the /etc directory, and the configuration file name is vimrc
. In Fedora, the vim configuration file is stored in the /etc directory, and the configuration file name is vimrc
In Red Hat Linux, the configuration file of vim is stored in the /etc directory, and the configuration file is named vimrc
set nocompatible " Remove related vi consistency mode, avoid bugs and limitations of previous versions set nu! " Display line number set guifont=Luxi/ Mono/ 9 " Set font, font name and font size filetype on " Detect file type set history= 1000 " The number of lines to record the history set background=dark "The background uses black syntax on " syntax highlighting set autoindent " vim uses automatic alignment, that is, the alignment format of the current line is applied to the next line (automatic indentation) setcindent " (cindent is automatically indented for C language syntax) set smartindent " According to the above alignment format, intelligently select the alignment, useful for writing similar to C language set tabstop= 4 " Set the tab key to 4 spaces, set shiftwidth = 4 " Set to use 4 spaces when the lines are interleaved set ai! " Set automatic indentation set showmatch " Set the matching mode, similar to when entering an opening bracket, it will match the corresponding closing bracket set guioptions-=T " Remove vim The GUI version has toolbar set vb t_vb= "When vim is editing, if the command is wrong, an alarm will be issued, this setting removes the alarm set ruler " During the editing process, the status line showing the cursor position in the lower right corner is set nohls " By default, the search for a match is highlighted, the Set off highlighting set incsearch " Search for a word in the program and automatically match the position of the word; such as querying the word desk, when entering /d, it will automatically find the first word starting with d, when entering /de , it will automatically find the first word starting with ds, and so on, to search; when you find the word you want to match, don't forget to enter set backspace= 2 " Set the backspace key to automatically back up after modifying a file , the backup file name is the original file name plus "~ " suffix if has( " vms " ) set nobackup else set backup endif
If the function does not work after the setting is completed, check whether the vim-enhanced package is installed in the system. The query command is:
$rpm -q vim-enhanced
Note: If VIM does not take corresponding actions after setting the above settings, then please upgrade your VIM to the latest version, generally just enter the following command in the terminal: sudo apt-get install vim
Reprinted from: https://blog.csdn.net/chuanj1985/article/details/6873830