chrisbra / matchit

The matchit plugin from Vim
61 stars 9 forks source link

Make % error #31

Closed benknoble closed 2 years ago

benknoble commented 3 years ago

This may not be possible, but it would be really helpful if matchit's % retained the default behavior of (quietly) interrupting macros and mappings when there is no jump to be made.

cf. https://vi.stackexchange.com/a/33052/10604

chrisbra commented 3 years ago

Not sure this is possible. I tried explicitly adding norm! <esc>, but that does not help. Neither does using feedkeys("\e", 'tni'). So I don't think this is possible.

Best workaround would be to add an explicit f{ before invoking matchit, so that Vim will abort properly when it does not find the search char.

benknoble commented 3 years ago

Unfortunately when the line starts like { text { (and continues with closing braces), 0f{ leaves you on the second { rather than the first, which is what I needed. Of course if there is whitespace at the beginning of the line, it does not.

My workaround ended up being vaB instead, but even that I didn't test with whitespace at the front of the line.

What other ways to "cause an error" are there? throw is probably too much. What about normal! <some-non-existent-command>?