Fix HTML tag auto-closing

This commit is contained in:
don philipe
2024-04-11 01:25:54 +02:00
parent ecd9bff023
commit c7322292da

View File

@@ -2,4 +2,12 @@ setlocal shiftwidth=4
setlocal tabstop=4 setlocal tabstop=4
" create closing xml tag when typing > " create closing xml tag when typing >
inoremap <buffer> > ></<C-n><C-o>% " first write the actual closing bracket (>), then got to normal mode (<Esc>), find
" opening bracket (F<), go one step to the right (l), yank the tag name (yiw),
" find the closing bracket (f>), start appending opening bracket and slash (a</), paste
" yanked word from default register (<C-r>"), add closing bracket (>), leave
" insert mode (<Esc>), go back to opening bracket (F<), enter insert mode (i)
inoremap > ><Esc>F<lyiwf>a</<C-r>"><Esc>F<i
" overwrite automatic angle bracket closing from vimrc to make auto-closing
" tags work properly
inoremap < <