Edit. vimrc in the Home Directory (create if none exist ).
SYN on "syntax supports" common conf {general configuration set ai "automatic indent set BS = 2" in insert mode, use the return key to delete set showmatch "code matching set laststatus = 2" always show status line set expandtab "the following three configurations are used together, set the number of tab and indentation spaces set shiftwidth = 4 set tabstop = 4 set smartindent set cursorline "underline the row where the cursor is located set number" display row number set autoread "File Modified outside vim, ignore case-insensitive set fileencodings = uft-8 when automatically re-reading set ignorecase "retrieval, GBK "uses UTF-8 or GBK to open the file set HLS". The matching item set helplang = Cn is highlighted during retrieval. The help system sets it to Chinese set foldmethod = Syntax "code folding IMAP {}< ESC> I <CR> <ESC> v <o IMAP (() <ESC> I imap [[] <ESC> I "}" conf for tabs, for the tab configuration, use ctrl H/L to switch the label and other let mapleader = ', 'nnoremap <c-l> GT nnoremap <c-h> GT nnoremap <leader> T: tabe <CR> "conf for plugins {plug-in-related configuration" status bar configuration "Powerline {set guifont = powerlinesymbols \ for \ Powerline set nocompatible set t_co = 256 Let G: powerline_symbols = 'fancy '"}"}}
Note that the IMAP in the middle is to set the automatic matching and indentation of the braces.
Let's explain it.
IMAP is a command in VIM configuration, which is a ing, And the syntax is
What is mapped by IMAP
According to this understanding, the above sentence can be understood:
Map "{"
{}< ESC> I <CR> <ESC> v <o
The next thing is to execute these operations in sequence in Vim, one by one decomposition is as follows:
{} Is to insert parentheses directly.
<ESC> press the ESC key on the keyboard to switch to the command line mode.
I press the I key on the keyboard to enter the insert mode.
<CR> press enter to wrap the brackets
<ESC> press the ESC key on the keyboard to switch to the command line mode.
V press SHIFT + V to select the row where the current row is the right brace.
<Hold down SHIFT + and move the current row to the left. The right brackets are aligned with the left brackets.
O press SHIFT + O to insert the first row of the current row (right parenthesis)
In fact, it is to tell Vim that if we input {, then we will perform the above operations.
As for (and [is a truth.
Use Vim for IDE