The VI in CentOS only installs the vim-minimal-7.x by default. So whether the input VI or VIM to view the file, the syntax function is not enabled properly. It is therefore necessary to install the other two components with Yum: vim-common-7.x and vim-enhanced-7.x.
On the command line: yum-y install vim-enhanced, Yum automatically installs the two components. You can then add syntax on to the. VIMRC in the current user directory to take effect.
Other configurations add by themselves, and below I just add what I need:
Number of rows displayed: Set Nu
Tab interval: Set tabstop=4
Row interval: Set shiftwidth=4
Sets the matching pattern, similar to the corresponding closing parenthesis when an opening parenthesis is entered: Set Showmatch
In the edit process, the status line at the cursor position is displayed in the lower-right corner: set ruler
Query is very convenient, such as to find the book word, when input to/b, will automatically find the first B word, when entered into the/bo, will automatically find the first Bo beginning word, and so on, to find, use this setting will quickly find the answer, when you find the word to match, do not forget to enter: Set Incsearch
Get rid of nasty about VI consistency mode, avoid some bugs and limitations of previous versions: set nocompatible
Detection file type: filetype on
Number of rows recorded history: Set history=1000
Turn on automatic backup:
If has ("VMS")
Set Nobackup Keep a backup file, use versions instead
Else
Set backup "Keep a backup file
endif
The remaining configuration can be viewed in the table of contents:/etc/usr/share/vim/vim74 (different version number, different name)/vimrc_example.vim, modify it, add it, or copy it directly.
Thank you for reading, if you have a good configuration, please add the Garden friends.
The configuration of the Centos vim in Xshell