Code Monkey home page Code Monkey logo

Comments (9)

andymass avatar andymass commented on May 30, 2024 1

Thanks for clarifying. It seems there is no solution currently that works for everyone due to plugin incompatibilities. Future readers should use whichever works for them as both methods are valid. I'm glad you have a solution that works!

from vim-matchup.

andymass avatar andymass commented on May 30, 2024

If you install https://github.com/mxw/vim-jsx it appears to work. Are there any specific issues?

from vim-matchup.

hoschi avatar hoschi commented on May 30, 2024

That works, thanks! Never needed this, out of the box experience was good enough to not install the 51th plugin 😁

from vim-matchup.

hoschi avatar hoschi commented on May 30, 2024

I tried now configure the 'tagnameonly' option:

let g:matchup_matchpref = {
    \ 'html': { 'tagnameonly': 1, },
    \ 'javascript.jsx': { 'tagnameonly': 1, },
    \ 'javascript': { 'tagnameonly': 1, },
    \ 'jsx': { 'tagnameonly': 1, },
    \}

But this only work for HTML files, not for javascript. Do you have an idea why?

from vim-matchup.

hoschi avatar hoschi commented on May 30, 2024

It seems this file is enough. Because the whole plugins seems to break Onis syntax highlighting in functions in JSX.

from vim-matchup.

andymass avatar andymass commented on May 30, 2024

I don't know anything about oni but if I understand what you're seeing correctly, you should be able to just create your own file after/ftplugin/jsx.vim containing:

setlocal matchpairs=(:),{:},[:],<:>
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'

and then no need for the vim-jsx plugin. I'm not sure yet how to support tagnameonly as an option.

from vim-matchup.

hoschi avatar hoschi commented on May 30, 2024

thanks for the code snippet

from vim-matchup.

andymass avatar andymass commented on May 30, 2024

Closing, as the user can always use the code in comment #35 (comment) or the following in their vimrc:

function! JsxHotfix()
    setlocal matchpairs=(:),{:},[:],<:>
    let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endfunction
let g:matchup_hotfix_jsx = 'JsxHotfix'

from vim-matchup.

hoschi avatar hoschi commented on May 30, 2024

Thanks @andymass for the comment. I don't know why, but the hotfix solution only works in plain nvim not in Oni. I stick with the after/ftplugin/javascript.vim file solution which works in both.

from vim-matchup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.