summaryrefslogtreecommitdiffstats
path: root/after/ftplugin/javascript.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-06-08 13:25:41 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2019-06-08 13:25:41 +0200
commit26c678b08d88b658ec6069eb2ada2b2ba21c5d39 (patch)
treeebf7500bafee56b195bf52ced286fe29e5b3f485 /after/ftplugin/javascript.vim
parent17ecfbdabcfdf294dae27c506fb68b58175199b5 (diff)
downloadvim-polyglot-26c678b08d88b658ec6069eb2ada2b2ba21c5d39.tar.gz
vim-polyglot-26c678b08d88b658ec6069eb2ada2b2ba21c5d39.zip
Change jsx/tsx provider, closes #400
Diffstat (limited to 'after/ftplugin/javascript.vim')
-rw-r--r--after/ftplugin/javascript.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim
index 9efbb8d9..26d00bf2 100644
--- a/after/ftplugin/javascript.vim
+++ b/after/ftplugin/javascript.vim
@@ -14,3 +14,38 @@ if exists('b:undo_ftplugin')
else
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
endif
+if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
+ finish
+endif
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Vim ftplugin file
+"
+" Language: javascript.jsx
+" Maintainer: MaxMEllon <maxmellon1994@gmail.com>
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+" modified from html.vim
+" For matchit plugin
+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+=.jsx