martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.21k stars 258 forks source link

Highlight search as it is typed #942

Open dead10ck opened 3 years ago

dead10ck commented 3 years ago

Apologies if this has been discussed before, I was unable to find an existing issue, and I didn't see anything about it in the docs.

I was just trying vis for the first time, and I noticed that while you are doing an x/... search, it does not highlight the selections in the buffer as you are typing. It would be nice if it did, as this would greatly increase the immediate visual feedback that you are finding the right thing, or that you didn't make a typo somewhere along the way. Vim and Kakoune both do this.

ninewise commented 3 years ago

This may be harder than you expect: the x// loop is a command which can be used inside other commands, sometimes when there's already a visual selection. Do you also highlight then? Do you make exceptions for just a pure :x// command?

It'd make more sense to me to add this to the / search (which is how it's used in vim, not with the s/// command?).

dead10ck commented 3 years ago

I think it would make sense to make an exception for pure x/ commands. It's also different from a / command because it does multiselection.

Another idea that may be radical and not work: why not execute the whole command on the buffer on every key press, so the user can see the result as it's being typed? But if they hit esc, or backspace, the state gets rewound to what it was. In other words, it doesn't get "committed" to the history until the user hits the return key.