I want to see the value of a variable, so I run the command


Vim displays the results of this command using the --more-- pager.
How can I search this for a phrase, e.g. html?
I've looked the man page for the more pager which says +/ is used for search but it doesn't seem to work, neither does / as per the less pager.

  • 1
    AFAIK, it's a Vim internal command - it looks like 'more', but the program is not called by Vim (proof: it works in Windows, too). You can still write the beginning of a variable name, than ask Vim to complete it (e.g. with Ctrl-d).
    – VanLaser
    Dec 5 '15 at 8:30
  • thanks, when I type the variable name - or in fact pretty much anything - vim wont accept it - it just prompts with -- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit in the commandline. Dec 5 '15 at 8:34
  • 1
    Write :let then don't hit Enter, but Tab or Ctrl-d - you'll have a list of existing variables, displayed in "more" style - now hit Esc, write a few letters, hit Tab or Ctrl-d again ... and so on until you find the variable you want. Actually, to see the value of a variable, perhaps you should use echo instead? (Or set variable-name? for options)
    – VanLaser
    Dec 5 '15 at 8:43
  • 1
    very cool, both the Ctrl-d and the echo trick worked nicely, thanks! Dec 5 '15 at 9:03

This is not the more pager, this is Vim's internal and minimalistic pager which doesn't have search capabilities.

But you can use the :redir command:

:redir @a    redirect output of following commands to register a
:let         list every current option and its value
G<CR>        go straight to the end of the listing and make it disappear
:redir END   stop redirection
:tabnew      open a new buffer in a new window in a new tab page
"ap          put from register a

… then use regular Vim commands.


Vim 8 has a execute() command the allows you to get the output of a command. To see it to the current buffer do:

:put =execute('let')

For Vim 7 you can use capture.vim. It is a plugin that wraps the commands from @romainl's answer and lets you use it as

:Capture let
  • thats good to know, thanks. I'll check it out when I upgrade. On vim 7 Im using steve losh's clam plugin to capture large amounts of output into a new buffer. it works well too Dec 1 '16 at 20:21
  • Both this answer and @romainl's are great for different uses. This one (:put =execute(…)) is what I will use when I want to run a command and get the output in the same buffer. If I want the output in a different buffer, I'll use :redir @a; :let; redir END. This is going to help me finally get my highlighting and syntax annoyances figured out after 20 years! Feb 2 '20 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.