yangmillstheory / vim-snipe

MIT License
118 stars 8 forks source link

Only show the first character in a multi-character sequence by default #18

Closed ychin closed 6 years ago

ychin commented 6 years ago

When there are more options than the default number of tokens (26 of them), vim-snipe uses a multi-keystroke sequence. Right now it shows the full sequence, which has the issue of shifting the text around as it converts a single character into multiple ones. This makes it hard to use the plugin as the positioning of the character is the one thing the user has to remember which position to pick.

For example if the tokens are "asd" (for simplicity), and the line is 12 34 56 78, then doing (snipe-w) will show a2 s4 da6 ds8, which makes it hard to parse. Ideally it would be a2 s4 d6 d8 instead (then when you press 'd', it will show 12 34 a6 s8 for further filtering down).

Also, see #16 for examples.

I have a pull request incoming, but wanted to get some thoughts on this first. It will change the default to the new behavior but provide backward compatability. I could switch the default around as well.

yangmillstheory commented 6 years ago

What about when there's 9 words and 4 tokens? I think there are going to be multiple d's in that case, right?

In general this is a good idea, you should only have to see the first keystroke that you're going to press.

ychin commented 6 years ago

Yes, you will see multiple d's and f's (third and fourth token). The behavior for the plugin is the same, it's only the visualization that's different (only show first keystroke to avoid shifting column positions and confusing the user). After you press the 'd' or 'f' the UI will update to show the next keystroke.