Some commands, for example :syn and :scriptnames show a "--more-- screen" which is confusing to navigate. Contrary to what man more says, pressing / doesn't seem to work to search for text. Instead pressing it shows -- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit at bottom, which is different from the behaviour in more (which also doesn't seem to work properly in my system, which i never noticed since i always used less). This is very awkward and confusing, how to navigate in these windows?
- 121
- 1
1 Answers
To see the commands available from that prompt go to :h pager. Here's the bulk of the content:
Type effect
<CR> or <NL> or j or <Down> one more line
d down a page (half a screen)
<Space> or f or <PageDown> down a screen
G down all the way, until the hit-enter
prompt
<BS> or k or <Up> one line back
u up a page (half a screen)
b or <PageUp> back a screen
g back to the start
q, <Esc> or CTRL-C stop the listing
: stop the listing and enter a
command-line
<C-Y> yank (copy) a modeless selection to
the clipboard ("* and "+ registers)
{menu-entry} what the menu is defined to in
Cmdline-mode.
<LeftMouse> next page (*)
Any other key causes the meaning of the keys to be displayed.
Then there's the somewhat obscure g< command...
The |g<| command can be used to see the last page of previous command output.
This is especially useful if you accidentally typed <Space> at the hit-enter prompt.
I know I often accidentally exit out of the last page of output so g< is a nice little command to get back there without having to think much about it.
Ah, but you asked about searching. As you can see / is not available. Your best bet is probably to use the :filter command...
:filter /pattern/ :scriptnames
...for example. Unfortunately, :filter doesn't work with all commands. Your other example, :syn, to name one. At this point we're left with only ad hoc solutions. If you want to use / then it'll be quite crude...
:redir @x | silent :syn | redir END
That'll put the :syn command's output into register x. (:silent ensure the full output is dumped without pause/prompting.) Now go paste the register contents in an empty buffer and search it. Like I said, crude.
Update:
A more fully realized and robust take on the :redir approach can be found here: Redirect the output of a Vim or external command into a scratch buffer
Conveniently, it's encapsulated in a single user command named :Redir.
- 19,834
- 2
- 30
- 57
-
:filter /pattern/ :synseems to have always same output as:syn. Help page on:filtersays only some commands support filtering and:syndoesn't seem to be one of those.. – Carla is my name Apr 07 '21 at 10:10 -
Ah, I think I tested
:scriptnamesand then mixed them up in my head. I'm pretty sure there's no straightforward way to do it for commands that don't work with:filter. I have a couple ad hoc methods that you can use which I'll post when I get a minute. – B Layer Apr 07 '21 at 10:41 -
1
-
Yes, there are all kinds of ways to do it. All but the way that makes the most sense (i.e. search in pager.) :P – B Layer Apr 07 '21 at 14:04
moreutility but is in fact internal to vim. That is why its behaviour is discordant with what you might expect when readingman more. – Andrew Ho-Lee Apr 06 '21 at 22:27