chrisbra / matchit

The matchit plugin from Vim
61 stars 9 forks source link

Making `v_a%` repeatable #2

Closed lacygoill closed 5 years ago

lacygoill commented 6 years ago

Hello,

as discussed on this question on stackexchange, a user could like the ability to select increasingly large regions of text by pressing the visual mapping v_a% several times consecutively.

Currently, the mapping is defined on line 69:

vmap a% <Esc>[%v]%

If o is added in front of the {rhs} of the mapping (to move the cursor on the opposite corner of the selection):

vmap a% o<Esc>[%v]%

And if the issue involving ]% is fixed, v_a% could probably be used repeatedly.

I'm not sure if ]% is really needed at the end. It seems that % would be enough, since [% has already found the previous unmatched token, but maybe I'm missing something. If % is used, instead of ]%, then this issue does not depend on the other one anymore. They become separate.

Also, if the mapping is not needed in select mode (I don't see why it would, but I may have missed something), xmap could replace vmap:

xmap a% o<esc>[%v% 
k-takata commented 6 years ago

The behavior of v_a% was changed by #8 and #9, but the behavior might be still unexpected for multiple patterns like #if-#else-#endif.

chrisbra commented 5 years ago

closing. If there is a specific error, please create a new issue