Closed leahneukirchen closed 11 months ago
That's a great idea.
It is not that simple to implement though, because the TUI has no concept of line numbers of the matches. A simple implementation can take the line number shown on the screen if -n
is active. This is the only clue we can use. It won't work if -n
is not active, or if -l
or -c
are active.
If it only works with -n, that's good enough for me.
I've implemented this feature in my dev version. Some pagers do not support +linenum
such as moar
see #286 where I added a comment about this.
So we have two choices:
+linenum
regardless of the pager specified, but this may not start the pager if the pager like moar
returns an error.+linenum
when the pagers are more
or less
or vi
or vim
or emacs
I prefer 2 which is safe, so I'll include this in the next release.
More tools that do it: most, w3m, pico, nano, joe, zile, vile, mg, mcedit, vis, kak... :)
OK, ok... got it!
More tools that do it: most, w3m, pico, nano, joe, zile, vile, mg, mcedit, vis, kak... :)
Out of curiosity @leahneukirchen, how did you come up with that list?
My thinking of every editor I had here and trying. ;)
Notably, helix doesn't support it (but I'll file a bug).
Implemented in ugrep v4.2 (released).
From the interactive mode, ^Y opens the file in a pager or an editor, however you lose track of the search result.
Most Unix pagers and Editors (less, vim, emacs...) support being called like
program +NNN file
to jump to line NNN, this would simplify use a lot.