diff options
Diffstat (limited to 'after/ftplugin')
-rw-r--r-- | after/ftplugin/javascript.vim | 35 | ||||
-rw-r--r-- | after/ftplugin/jsx.vim | 31 | ||||
-rw-r--r-- | after/ftplugin/tsx.vim | 21 | ||||
-rw-r--r-- | after/ftplugin/typescript.vim | 27 |
4 files changed, 62 insertions, 52 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 diff --git a/after/ftplugin/jsx.vim b/after/ftplugin/jsx.vim deleted file mode 100644 index e1d689aa..00000000 --- a/after/ftplugin/jsx.vim +++ /dev/null @@ -1,31 +0,0 @@ -if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1 - finish -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Vim ftplugin file -" -" Language: JSX (JavaScript) -" Maintainer: Max Wang <mxawng@gmail.com> -" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -" modified from html.vim -if exists("loaded_matchit") - let b:match_ignorecase = 0 - let s:jsx_match_words = '<\([a-zA-Z0-9.]\+\)\(>\|$\|\s\):<\/\1>' - - if !exists('b:loaded_jsx_match_words') - let b:loaded_jsx_match_words = 0 - endif - - if b:loaded_jsx_match_words == 0 - let b:match_words = exists('b:match_words') - \ ? b:match_words . ',' . s:jsx_match_words - \ : s:jsx_match_words - endif - - let b:loaded_jsx_match_words = 1 -endif - -setlocal suffixesadd+=.jsx diff --git a/after/ftplugin/tsx.vim b/after/ftplugin/tsx.vim deleted file mode 100644 index 62112bba..00000000 --- a/after/ftplugin/tsx.vim +++ /dev/null @@ -1,21 +0,0 @@ -if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'tsx') != -1 - finish -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Vim ftplugin file -" -" Language: TSX (JavaScript) -" Maintainer: Ian Ker-Seymer <i.kerseymer@gmail.com> -" Depends: leafgarland/typescript-vim -" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -" modified from html.vim -if exists("loaded_matchit") - let b:match_ignorecase = 0 - let b:match_words = '(:),\[:\],{:},<:>,' . - \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' -endif - -setlocal suffixesadd+=.tsx diff --git a/after/ftplugin/typescript.vim b/after/ftplugin/typescript.vim new file mode 100644 index 00000000..29ac50a6 --- /dev/null +++ b/after/ftplugin/typescript.vim @@ -0,0 +1,27 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1 + finish +endif + +" 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+=.tsx |