summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaoaki Ueda <nao.uedder@gmail.com>2022-01-12 21:04:20 +0900
committerNaoaki Ueda <nao.uedder@gmail.com>2022-01-12 21:04:20 +0900
commitd82cb3e26d386e623e7746647f1df5152049ede7 (patch)
tree386e6199be5be4fd92ac2e99d5a0eef3e5553233
parenta56bb643f2942c27344fa383cec9e28fd8dfc5bb (diff)
downloadvimrc-d82cb3e26d386e623e7746647f1df5152049ede7.tar.gz
vimrc-d82cb3e26d386e623e7746647f1df5152049ede7.tar.bz2
vimrc-d82cb3e26d386e623e7746647f1df5152049ede7.zip
Add closetag plugin
-rw-r--r--_config/302-lit-element.vim11
-rw-r--r--_config/304-closetag.vim56
-rw-r--r--vimrc1
3 files changed, 68 insertions, 0 deletions
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. `<Link>` will be closed while `<link>` 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 = '<leader>>'
+
+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