Copy the following code ~ /. Vimrc (~ Is your main directory. If ~ /. Vimrc, touch one to be in ~ Touch. vimrc,
. Vimrc is a hidden file, in ~ Enter LS-a to check whether the file exists ):
Set nocompatible
Set number
Set autoindent
Set smartindent
Set showmatch
Set ruler
Set incsearch
Set tabstop = 4
Set shiftwidth = 4
Set softtabstop = 4
Set cindent
Set nobackup
Set clipboard + = unnamed
Inoremap () <ESC> I
Inoremap [[] <ESC> I
Inoremap {<CR >}< ESC> O
Autocmd syntax HTML, VIM inoremap <lt> <ESC> I | inoremap> <c-r> = closepair ('>') <CR>
Inoremap) <c-r> = closepair (') <CR>
Inoremap] <c-r> = closepair (']') <CR>
Inoremap} <c-r >= closebracket () <CR>
Inoremap "<c-r> = quotedelim ('"') <CR>
Inoremap' <c-r> = quotedelim ("'") <CR>
Function closepair (char)
If Getline ('.') [col ('.')-1] = A: Char
Return "\ <right>"
Else
Return A: Char
Endif
ENDF
Function closebracket ()
If match (Getline (line ('.') + 1), '\ s *}') <0
Return "\ <CR> }"
Else
Return "\ <ESC> j0f}"
Endif
ENDF
Function quotedelim (char)
Let line = Getline ('.')
Let Col = COL ('.')
If line [col-2] = "\\"
"Inserting a quoted quotation mark into the string
Return A: Char
Elseif line [col-1] = A: Char
"Escaping out of the string
Return "\ <right>"
Else
"Starting a string
Return A: Char. A: Char. "\ <ESC> I"
Endif
ENDF