vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

Support for optional closing element in group

Open grr opened this issue 5 years ago • 3 comments

If b:matchwords has '\<if\>:\<elsif\>:\<else\>' it works when there is if/elsif/else or if/else. But I often use and encounter just if/elsif without a closing else, so matchit/matchup doesn't work on that syntax. Another example is '\<try\>:\<catch\>:\<finally\>'. It doesn't work when there is only try/catch. Is there any way to support this?

grr avatar Jan 27 '21 02:01 grr

Is this request intended for python or some other languages?

andymass avatar Feb 23 '21 05:02 andymass

perl

grr avatar Feb 24 '21 19:02 grr

The main problem is match-up needs to know where to stop looking for more clauses. And unfortunately, perl is much too difficult to parse using regex.

It would be possible with treesitter, but there is not yet a perl parser for https://github.com/nvim-treesitter/nvim-treesitter.

So it might be a while before this can be supported, unless there is a simple way to determine where the end of the if/else block is.

andymass avatar Feb 25 '21 00:02 andymass