helix icon indicating copy to clipboard operation
helix copied to clipboard

Step to previous and next item from the last picker

Open groves opened this issue 2 years ago • 3 comments

You can do this with space ' down ret, but this gets it down to ] '. Feels nicer to me when going through a big set of global search matches.

groves avatar Aug 08 '22 19:08 groves

I'm not necessarily against these commands/bindings but I don't really understand the use-case. Why not use the picker? The preview pane is there to view the code-context of a search-result/diagnostic/jump/etc so that you don't have to exit the picker.

With these commands you discard the context that the picker gives: you have no idea where you'll jump next or how many results are left in the picker.

the-mikedavis avatar Aug 08 '22 22:08 the-mikedavis

This would enable an ad-hoc quickfix list behaviour, carried over from vim. In vim a list of file locations can be sent to the quickfix list, and commands exist that take us to the next/previous item in the list (usually bound to ]q and [q). But notably a small window appears at the bottom with the list, and the list itself is editable (delete and reorder items).

Even without the quickfix window, the keybinds themselves are useful; imagine navigating between workspace diagnostics. I can open it once, close it and then jump between all the errors with ]' and ['. ]d would only navigate between diagnostics in the file, and navigation that way is possible only because there's a dedicated keybind for diagnostics navigation and can't be generalized.

sudormrfbin avatar Aug 09 '22 04:08 sudormrfbin

@sudormrfbin, thanks! That's a lot of the inspiration of this for me.

In particular I see my self using it with global search and goto references. With both of those, I'll find something that matches a smallish number of things I want to step through. I don't find the preview pane useful for that as I can't move in the source when I'm on a match and I often want to do that.

The context would be nice to keep like with Vim's quickfix window. I'm hoping to add the ability to put picker results in a split window in a later PR. Like @sudormrfbin says though, this is already useful.

groves avatar Aug 09 '22 09:08 groves

This could actually be implemented with a macro. On #4709:

[keys.normal]
"]"."'" = "@<space>'<C-n><ret>"
"["."'" = "@<space>'<C-p><ret>"

the-mikedavis avatar Nov 18 '22 20:11 the-mikedavis