summaryrefslogtreecommitdiffstats
path: root/after/ftplugin/tsx.vim
diff options
context:
space:
mode:
Diffstat (limited to 'after/ftplugin/tsx.vim')
-rw-r--r--after/ftplugin/tsx.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/after/ftplugin/tsx.vim b/after/ftplugin/tsx.vim
new file mode 100644
index 00000000..e29d1e41
--- /dev/null
+++ b/after/ftplugin/tsx.vim
@@ -0,0 +1,32 @@
+if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
+
+" modified from html.vim
+" For matchit plugin
+
+if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
+ finish
+endif
+
+if exists("loaded_matchit")
+ let b:match_ignorecase = 0
+ let b:match_words = '(:),\[:\],{:},<:>,' .
+ \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
+endif
+
+" For andymass/vim-matchup plugin
+if exists("loaded_matchup")
+ setlocal matchpairs=(:),{:},[:],<:>
+ let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
+ let b:match_skip = 's:comment\|string'
+endif
+
+let b:original_commentstring = &l:commentstring
+
+augroup jsx_comment
+ autocmd! CursorMoved <buffer>
+ autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring)
+augroup end
+
+setlocal suffixesadd+=.tsx
+
+endif