In linux, you can use vi to edit and modify the file configuration without the color display file content. In particular, some keywords cannot be displayed in color, causing great inconvenience during the configuration service process. Here is a solution.
Step 1: it may be because the vi version is too low and the highlight is not enabled. Check whether there are any updates # yum install vim update the latest vi version. # Rpm-qa | grep vim check whether vi has been installed. If not install is prompted, install the following rpm package: vim-enhance-version. rpm vim-common-version number. rpm vim-minimal-version number. rpm
Second, modify # vi/etc/bashrc and add "alias vi = vim" to the end, and then save and exit wq. In this way, vim is automatically opened when vi is typed in shell (vim is short for vi improve)
Third: Modify # vi/etc/vimrc and add "syntax on" to the following statement. Then restart vi to enable highlighting. If & t_Co> 2 | has ("gui_running") syntax on set hlsearch endif Note: if yes, you do not need to add more. Sometimes, in the # vi/etc/vimrc file, click esc --> input: syn on is to restart and run vi RedHat to display the color directory list. Open/etc/bashrc and add the following line: alias ls = "ls -- color" 4: Use init 6 to restart the linux server. After the restart is complete, it should be highlighted. To enable Linux vi to display the keyword color -www.2cto.com-And vimrc configuration, install the vim-enhanced package. In fact, the vi itself does not contain color. The command alias vi = vim is used to display the keyword color of vim. Vi will be colored later. Syntax on "syntax highlighting filetype indent on" Automatic File indent set showcmd "Show (partial) command in status line. set showmatch "Show matching brackets. set incsearch "Incremental searchset mouse = a" Enable mouse usage (all modes) in terminalsset syn = cpp "syntax highlighting set nu! "Display row number set hlsearchset nobackup" no backup file set r0000" During the editing process, in the lower right corner, the status line colorscheme evening "set autoindent" at the cursor position is displayed, that is, apply the current row format to the next line set smartindent "according to the above format, intelligently select the mode set tabstop = 4 "set the tab key to 4 spaces set shiftwidth = 4" use four spaces set enc = UTF-8 "to set encoding when the current line is staggered set fenc = UTF-8 "sets the file encoding set fencs = UTF-8, ucs-bom, gb18030, gbk, gb2312, cp936 "set file encoding detection type and supported formats set langmenu = zh_CN.UTF-8" specify menu language set helplang = cn "help Chinese
Author jerryswxs