monkoose / matchparen.nvim

alternative to matchparen neovim plugin
MIT License
113 stars 2 forks source link

Support `matchup_matchparen_hi_surround_always` option #1

Open kevinhwang91 opened 2 years ago

kevinhwang91 commented 2 years ago

The only reason I can't leave vim-matchup :(

monkoose commented 2 years ago

Hello @kevinhwang91, nice to see you this time in my plugin.

This plugin only about parentheses, brackets etc highlithing that are in 'matchpair' option. It doesn't highlight keywords, tags etc. If i understood you right, what you want is something like what indent-blanklike plugin would do for perfectly indented code, right? Something like on this image

It is definitely out of the scope of this plugin. Have you done some research, doesn't it already implemented with some treesitter text-objects or something? And isn't some background highlighting for such scopes better then just char/keywords highlighting?

If you need only surround characters in 'matchpair' option to be always highlighted inside of them - it can be done, but still maybe outside of this plugin (maybe with some identical functions, which can be then split into utils plugin, or just make this plugin as dependency), but not in this plugin for sure. I will need some time to think about that, because i wanted something like this too.

kevinhwang91 commented 2 years ago

If i understood you right, what you want is something like what indent-blanklike plugin would do for perfectly indented code, right? Something like on this image

No, I want to always show the surrounding matchpair to let me execute textobj like ci% as fast as possible.

If you need only surround characters in 'matchpair' option to be always highlighted inside of them - it can be done, but still maybe outside of this plugin

Yes, It's what I want. I think this feature should be added to this plugin. Because of the name of matchup_matchparen_hi_surround_always :)

monkoose commented 2 years ago

Ok, i will think about it. First i need to finish proper highlithing in comments and strings.

kevinhwang91 commented 2 years ago

Here's my remap for matchup:

    map('n', '%', '<Plug>(matchup-%)', {})
    map('x', '%', '<Plug>(matchup-%)', {})
    map('o', '%', '<Plug>(matchup-%)', {})
    map('n', '[5', '<Plug>(matchup-[%)', {})
    map('x', '[5', '<Plug>(matchup-[%)', {})
    map('o', '[5', '<Plug>(matchup-[%)', {})
    map('n', ']5', '<Plug>(matchup-]%)', {})
    map('x', ']5', '<Plug>(matchup-]%)', {})
    map('o', ']5', '<Plug>(matchup-]%)', {})
    map('x', 'a5', '<Plug>(matchup-a%)', {})
    map('o', 'a5', '<Plug>(matchup-a%)', {})
    map('x', 'i5', '<Plug>(matchup-i%)', {})
    map('o', 'i5', '<Plug>(matchup-i%)', {})

I'm full of this feature.

Chaitanyabsprip commented 1 year ago

@monkoose I'm looking for this feature as well. Could you please direct me towards a solution?

monkoose commented 1 year ago

@Chaitanyabsprip it's open issue. So there is no solution. It would require some internal changes, and I haven't time/motivation to think about decent implementation.

There are some other plugins you can try, if you really need this feature: vim-matchup (but at the time i tested it feels slow sometimes) and sentiment.nvim (it has what you want, but it doesn't care about syntax, so if you have unmatched brackets in a string or comment, it would highlight wrong brackets).