helix
helix copied to clipboard
Step to previous and next item from the last picker
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.
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.
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, 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.
This could actually be implemented with a macro. On #4709:
[keys.normal]
"]"."'" = "@<space>'<C-n><ret>"
"["."'" = "@<space>'<C-p><ret>"