diff options
Diffstat (limited to 'after/ftplugin')
-rw-r--r-- | after/ftplugin/javascript.vim | 44 | ||||
-rw-r--r-- | after/ftplugin/javascriptreact.vim | 2 | ||||
-rw-r--r-- | after/ftplugin/jsx.vim | 35 |
3 files changed, 45 insertions, 36 deletions
diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim index a590e11d..8ff3938a 100644 --- a/after/ftplugin/javascript.vim +++ b/after/ftplugin/javascript.vim @@ -1,3 +1,12 @@ +if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1) + +if get(g:, 'vim_jsx_pretty_disable_js', 0) + finish +endif + +source <sfile>:h/jsx.vim + +endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 " Vim filetype plugin file @@ -14,38 +23,3 @@ else endif endif -if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1) - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" 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:jsx_pretty_old_cms = &l:commentstring - -augroup jsx_comment - autocmd! CursorMoved <buffer> - autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:jsx_pretty_old_cms) -augroup end - -setlocal suffixesadd+=.jsx - -endif diff --git a/after/ftplugin/javascriptreact.vim b/after/ftplugin/javascriptreact.vim index ab847072..265415d0 100644 --- a/after/ftplugin/javascriptreact.vim +++ b/after/ftplugin/javascriptreact.vim @@ -1,5 +1,5 @@ if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1) -source <sfile>:h/javascript.vim +source <sfile>:h/jsx.vim endif diff --git a/after/ftplugin/jsx.vim b/after/ftplugin/jsx.vim new file mode 100644 index 00000000..94f90c13 --- /dev/null +++ b/after/ftplugin/jsx.vim @@ -0,0 +1,35 @@ +if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1) + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" 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:jsx_pretty_old_cms = &l:commentstring + +augroup jsx_comment + autocmd! CursorMoved <buffer> + autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:jsx_pretty_old_cms) +augroup end + +setlocal suffixesadd+=.jsx + +endif |