Comments (6)
Sorry for the delay. I think currently it makes more sense to handle this locally using the hotfix feature. Then you can personalize the highlight however you like. For example, put this in your vimrc:
function! JsxHotfix()
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endfunction
let g:matchup_hotfix_javascript = 'JsxHotfix'
If you can, let me know whether this works. It's difficult to interoperate with other plugins that use different conventions.
from vim-matchup.
Don't worry for the delay, and thanks for the advice, I didn't know about the hotfix feature.
I did some tests and that works perfectly :-)
Thank you for the effort you put on matchup, it's really a great plugin, I think vim should replace matchin with matchup
from vim-matchup.
This looks like an html file, not a javascript file.. https://github.com/Polymer/lit-element/blob/master/demo/lit-element.html
The following should work:
let g:matchup_matchpref.html = {'tagnameonly': 1}
If it doesn't work, what is the output of :set filetype?
from vim-matchup.
You found the example I used, but I moved the javascript code to a js file. It looks like a html file, but is a javascript file, the html code is inside a template string. It's similar to JSX syntax, if you want to know more about it see https://polymer.github.io/lit-html/guide#lit-html-templates
You can see the same problem on this file: https://github.com/Polymer/lit-html/blob/master/demo/clock.js
I have this on my vimrc:
let g:matchup_matchpref = {
\ 'html': { 'tagnameonly': 1, },
\ 'javascript': { 'tagnameonly': 1, },
\}
It looks like the tagnameonly
option works for html
but not for javascript
.
If it doesn't work, what is the output of
:set filetype?
filetype=javascript
from vim-matchup.
Actually it seems to work correctly for me (in both html and javascript filetypes). Are you using any external filetype plugin for javascript? What is the output :scriptnames
?
from vim-matchup.
Yes, I'm using https://github.com/MaxMEllon/vim-jsx-pretty and looks like that is the reason.
I found that if here:
https://github.com/MaxMEllon/vim-jsx-pretty/blob/master/after/ftplugin/javascript.vim,
I replace it with (as you wrote in #35 (comment))
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
everything works as expected. I'm thinking about sending a PR to the vim-jsx-pretty project, with something like:
if exists("loaded_matchup")
let b:match_ignorecase = 0
setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
elseif exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words = '(:),\[:\],{:},<:>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
endif
Do you think is makes sense or do you have a better solution?
from vim-matchup.
Related Issues (20)
- [Feature Request]: Hybrid winbar/statusline option for offscreen matches HOT 11
- Treesitter integration broken on Javascript HOT 26
- Matchup error with treesitter in javascript files HOT 1
- Latest tree-sitter-c parser breaks vim-matchup HOT 1
- Add support for statuscolumn and foldcolumn in offscreen matches
- Error since last update → If treesitter matchup is enabled HOT 2
- Feature request: disable closing hint HOT 3
- offscreen doesn't display
- Wrong matching across strings HOT 2
- Crash when shell case is incomplete
- Matchup adding random characters on the beginning of the buffer. HOT 8
- clarification about lazy loading on keys HOT 6
- Incompatibility with nvim-cmp snippet completion HOT 8
- Matching string and char delimeters HOT 2
- how to activate ruby's `|` delimeter for block arguments HOT 4
- MatchParen(Cur) Highlight persists in virtual fold text
- invalid node type for language perl
- invalid node type for language bash HOT 5
- Svelte error was reported after treesitter's commit of svelte parsing HOT 4
- Quotes support for VIM HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-matchup.