Closed bootleq closed 5 years ago
Can you tell me which plugins you use for JavaScript and jsx? And an example document?
I can see the filetype was latestly set by mxw/vim-jsx,
besides, othree/yajs
and othree/es.next.syntax.vim
are enabled for JavaScript.
Reproduced document named Sample.jsx
const Sample = <Sample prop='highlight test'> │ // vim: filetype=javascript
some body │
</Sample>;
The hotfix snippet is identical to issue 42 comment, except of g:matchup_hotfix_javascript
variable name (since my &filetype
is not javascript).
The simplest fix is to allow the syntax g:matchup_hotfix['javascript.jsx']
.
This allows the following:
function! JsxHotfix()
echo 'JsxHotfix'
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endfunction
let g:matchup_hotfix = { 'javascript.jsx': 'JsxHotfix' }
Note that this should also work:
autocmd FileType javascript.jsx let b:matchup_hotfix = 'JsxHotfix'
Thanks very much for your great work! Just confirmed both solution works.
Hi, similar to issue 42, I'm try to highlight only tagname in JSX file follow the
g:matchup_hotfix_javascript
solution https://github.com/andymass/vim-matchup/issues/42#issuecomment-437415565.I can confirm it works except that my
&:filetype
isjavascript.jsx
(contains a dot.
). Read Vim help that'filetype'
can contain dots, which means several separated types, could we add support for this? Maybe detect dots and try each filetype's hotfix. Thank you very much.