Home > Article > Operation and Maintenance > vim common configuration-make vim easier to use
Copy the following code to the user directory and create a new file as .vimrc
Save it and it will take effect; if you want it to take effect for all users, please modify /etc/vimrc (it is recommended to cp a copy first)
set nocompatible "Turn off vi compatibility mode
syntax on "Automatic syntax highlighting
colorscheme molokai "Set color scheme
set number "Display line number
set cursorline " Highlight the current line
set ruler " Turn on the status bar ruler
set shiftwidth=4 " Set the width of the << and >> commands when moving. 4
set softtabstop=4 " Allows you to delete 4 spaces at a time when pressing the backspace key
set tabstop=4 " Set the tab length to 4
set nobackup " Do not back up when overwriting files
set autochdir " Automatically switch the current directory to the directory where the current file is located
filetype plugin indent on " Turn on the plugin
set backupcopy=yes " Set The behavior when backing up is to override
set ignorecase smartcase " Ignore case when searching, but remain case-sensitive when there are one or more uppercase letters
set nowrapscan " Disable searching for Search again at both ends of the file
set incsearch "Display search results when entering search content
set hlsearch "Highlight the found text when searching
set noerrorbells " Turn off the error message bell
set novisualbell " Turn off the use of the visual bell instead of calling
set t_vb= " Null the terminal code of the error bell
" set showmatch " insert bracket, briefly jump to the matching corresponding bracket
" set matchtime=2 "Briefly jump to the time of the matching bracket
set magic "Set magic
set hidden " Allows switching buffers when there are unsaved modifications. The modifications at this time are saved by vim
set guioptions-=T " Hide toolbar
set guioptions-=m " Hide Menu bar
set smartindent "Use smart automatic indentation when opening a new line
set backspace=indent,eol,start
" If you do not set it, you cannot use backspace in the insert state. Use the space key and Delete key to delete the carriage return
set cmdheight=1 "Set the number of lines in the command line to 1
set laststatus=2 "Show the status bar (the default value is 1, cannot Show status bar)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{ &encoding}\ %c:%l/%L%)\
" Set the information displayed in the status line
set foldenable " Start folding
set foldmethod=syntax " Set syntax folding
set foldcolumn=0 "Set the width of the folding area
setlocal foldlevel=1 "Set the number of folding levels to
" set foldclose=all "Set to automatic Close the fold
" Use the space bar to open and close the fold
" nnoremap
" Configure multi-language environment
if has("multi_byte")
" UTF-8 encoding
set encoding =utf-8
set termencoding=utf-8
set formatoptions+=mM
set fencs=utf-8,gbk
" when selected Ctrl+c copy
vmap
The above is the detailed content of vim common configuration-make vim easier to use. For more information, please follow other related articles on the PHP Chinese website!