From d82cb3e26d386e623e7746647f1df5152049ede7 Mon Sep 17 00:00:00 2001 From: Naoaki Ueda Date: Wed, 12 Jan 2022 21:04:20 +0900 Subject: Add closetag plugin --- _config/302-lit-element.vim | 11 +++++++++ _config/304-closetag.vim | 56 +++++++++++++++++++++++++++++++++++++++++++++ vimrc | 1 + 3 files changed, 68 insertions(+) create mode 100644 _config/304-closetag.vim diff --git a/_config/302-lit-element.vim b/_config/302-lit-element.vim index ba86bac..a042c3f 100644 --- a/_config/302-lit-element.vim +++ b/_config/302-lit-element.vim @@ -1,3 +1,14 @@ UsePlugin 'vim-html-template-literals' let g:htl_css_templates = 1 + + +UsePlugin 'vim-closetag' + +let g:closetag_filetypes = 'html,xhtml,phtml,javascript,typescript' +let g:closetag_regions = { + \ 'typescript.tsx': 'jsxRegion,tsxRegion,litHtmlRegion', + \ 'javascript.jsx': 'jsxRegion,litHtmlRegion', + \ 'javascript': 'litHtmlRegion', + \ 'typescript': 'litHtmlRegion', + \ } diff --git a/_config/304-closetag.vim b/_config/304-closetag.vim new file mode 100644 index 0000000..22d174f --- /dev/null +++ b/_config/304-closetag.vim @@ -0,0 +1,56 @@ +UsePlugin 'vim-closetag' + +" ref: https://github.com/alvan/vim-closetag + +" filenames like *.xml, *.html, *.xhtml, ... +" These are the file extensions where this plugin is enabled. +" +let g:closetag_filenames = '*.html,*.xhtml,*.phtml' + +" filenames like *.xml, *.xhtml, ... +" This will make the list of non-closing tags self-closing in the specified files. +" +let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' + +" filetypes like xml, html, xhtml, ... +" These are the file types where this plugin is enabled. +" +" let g:closetag_filetypes = 'html,xhtml,phtml' + +" filetypes like xml, xhtml, ... +" This will make the list of non-closing tags self-closing in the specified files. +" +let g:closetag_xhtml_filetypes = 'xhtml,jsx' + +" integer value [0|1] +" This will make the list of non-closing tags case-sensitive (e.g. `` will be closed while `` won't.) +" +let g:closetag_emptyTags_caseSensitive = 1 + +" dict +" Disables auto-close if not in a "valid" region (based on filetype) +" +" let g:closetag_regions = { +" \ 'typescript.tsx': 'jsxRegion,tsxRegion', +" \ 'javascript.jsx': 'jsxRegion', +" \ 'typescriptreact': 'jsxRegion,tsxRegion', +" \ 'javascriptreact': 'jsxRegion', +" \ } + +" Shortcut for closing tags, default is '>' +" +let g:closetag_shortcut = '>' + +" Add > at current position without closing the current tag, default is '' +" +let g:closetag_close_shortcut = '>' + +if !FindPlugin('vim-html-template-literals') + let g:closetag_regions = { + \ 'typescript.tsx': 'jsxRegion,tsxRegion', + \ 'javascript.jsx': 'jsxRegion', + \ 'typescriptreact': 'jsxRegion,tsxRegion', + \ 'javascriptreact': 'jsxRegion', + \ } + let g:closetag_filetypes = 'html,xhtml,phtml' +endif diff --git a/vimrc b/vimrc index ea8e958..1b6b935 100644 --- a/vimrc +++ b/vimrc @@ -111,6 +111,7 @@ Plug 'Yggdroot/indentline' Plug 'elzr/vim-json' " Plug 'docunext/closetag.vim' +Plug 'alvan/vim-closetag' Plug 'yggdroot/indentline' " file manager -- cgit v1.2.3-54-g00ecf