From c7322292da5fc899d4582d6aa88ec5eeba83a903 Mon Sep 17 00:00:00 2001 From: don philipe Date: Thu, 11 Apr 2024 01:25:54 +0200 Subject: [PATCH] Fix HTML tag auto-closing --- .vim/after/ftplugin/html.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.vim/after/ftplugin/html.vim b/.vim/after/ftplugin/html.vim index 625171a..1dd444d 100644 --- a/.vim/after/ftplugin/html.vim +++ b/.vim/after/ftplugin/html.vim @@ -2,4 +2,12 @@ setlocal shiftwidth=4 setlocal tabstop=4 " create closing xml tag when typing > -inoremap > >% +" first write the actual closing bracket (>), then got to normal mode (), 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"), add closing bracket (>), leave +" insert mode (), go back to opening bracket (F<), enter insert mode (i) +inoremap > >Fa">F