Allow hotfix for dotted &filetype, fixes #46

This commit is contained in:
Andy K. Massimino
2018-12-20 08:06:57 -05:00
parent 35de619c11
commit 55cff87749
5 changed files with 63 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
const Sample = <Sample prop='highlight test'>
some body
</Sample>;

26
test/issues/46/minvimrc1 Normal file
View File

@@ -0,0 +1,26 @@
set nocompatible
" load match-up
let s:path = simplify(expand('<sfile>:h').'/../../..')
let &rtp = s:path.',' . &rtp
let &rtp .= ','.s:path.'/after'
autocmd FileType * echo &ft | sleep 1
call plug#begin('~/.vim/plugged')
Plug 'mxw/vim-jsx'
Plug 'othree/yajs.vim'
Plug 'othree/es.next.syntax.vim'
call plug#end()
filetype plugin indent on
syntax enable
" match-up options go here
function! JsxHotfix()
echo 'JsxHotfix'
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endfunction
let g:matchup_hotfix = { 'javascript.jsx': 'JsxHotfix' }

26
test/issues/46/minvimrc2 Normal file
View File

@@ -0,0 +1,26 @@
set nocompatible
" load match-up
let s:path = simplify(expand('<sfile>:h').'/../../..')
let &rtp = s:path.',' . &rtp
let &rtp .= ','.s:path.'/after'
autocmd FileType * echo &ft | sleep 1
call plug#begin('~/.vim/plugged')
Plug 'mxw/vim-jsx'
Plug 'othree/yajs.vim'
Plug 'othree/es.next.syntax.vim'
call plug#end()
filetype plugin indent on
syntax enable
" match-up options go here
function! JsxHotfix()
echo 'JsxHotfix'
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endfunction
autocmd FileType javascript.jsx let b:matchup_hotfix = 'JsxHotfix'