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.

  • 2
    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, 2015 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, 2015 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, 2015 at 8:43
  • 1
    very cool, both the Ctrl-d and the echo trick worked nicely, thanks! Dec 5, 2015 at 9:03

3 Answers 3


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.

  • oh very cool, thats a great command to know! thanks Dec 5, 2015 at 9:09
  • 10
    slightly simpler: :redir @b|sil let|redir end Dec 5, 2015 at 12:38
  • 3
    Even though it is not the more pager, I feel like there is room for a plugin to replace Vim's more pager with less
    – Max Coplan
    Mar 16, 2020 at 19:05
  • 3
    @MaxCoplan you could try this: gist.github.com/romainl/eae0a260ab9c135390c30cd370c20cd7 It's not exactly a pager but I've found it to be pretty useful.
    – romainl
    Mar 18, 2020 at 9:49
  • @romainl thanks
    – Max Coplan
    Mar 18, 2020 at 17:03

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, 2016 at 20:21
  • 1
    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, 2020 at 2:59

Here is working solution (that romainl mentioned in comment under the answer):

Redirect the output of a Vim or external command into a scratch buffer

Description of this script is in this answer for question:

Can listings in the awful 'more' be displayed, instead, in a vim window?

Described and used scratch buffer is similar to less command. Navigation and search function is available in it.

Checked in Vim with clipboard support:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 07 2023 15:42:49) Included patches: 1-213, 1840, 214-579, 1969, 580-1848, 4975, 5023, 2110, 1849-1854, 1857, 1855-1857, 1331, 1858, 1858-1859, 1873, 1860-1969, 1992, 1970-1992, 2010, 1993-2068, 2106, 2069-2106, 2108, 2107-2109, 2109-2111, 2111-2112, 2112-2269, 3612, 3625, 3669, 3741, 1847 under Ubuntu 20.04

sudo apt install vim
sudo apt install vim-gtk3

apt - How do I install vim-gnome on Ubuntu 19.10?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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