Add the following content to the. vimrc file.
Inoremap (() <esc>iinoremap [[]<esc>iinoremap {{<cr>}<esc>oautocmd Syntax Html,vim Inoremap & Lt <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 endifendffunction closebracket () if Match (Getline (line (‘.‘) + 1), ' \s*} ') < 0 return "\<CR>}" Else return "\<esc>j0f}a" Endifendffunction Quotedelim (char) let line = g Etline ('. ') Let col = col ('. ') if line[col-2] = = "\ \" "Inserting a quoted quotation mark into the string return A:char E Lseif Line[col-1] = = A:char "Escaping out of the string return" \<right> "Else" starting a string return A:CHAR.A: Char. " \<esc>i "EndiFendf
Automatic completion of parentheses and quotes in vim