matchparen.nvim icon indicating copy to clipboard operation
matchparen.nvim copied to clipboard

Support `matchup_matchparen_hi_surround_always` option

Open kevinhwang91 opened this issue 3 years ago • 6 comments

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

kevinhwang91 avatar Dec 13 '21 05:12 kevinhwang91

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.

monkoose avatar Dec 13 '21 09:12 monkoose

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 :)

kevinhwang91 avatar Dec 13 '21 09:12 kevinhwang91

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

monkoose avatar Dec 13 '21 09:12 monkoose

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.

kevinhwang91 avatar Dec 13 '21 09:12 kevinhwang91

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

Chaitanyabsprip avatar Aug 01 '23 17:08 Chaitanyabsprip

@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).

monkoose avatar Aug 01 '23 19:08 monkoose