6

To take a look at the mappings in my current session I fired:

:map

to list all current mappings.

The output opens in some sort of read only awkward window. It's only possible to scroll. It's not even searchable.

  • Is it possible to get the output of :map and redirect it to a normal buffer? How?
  • What is this kind of window/buffer? (I'm curious about it)

2 Answers 2

9

That "window" is a simplistic built-in pager similar in spirit to more or less.

See :help pager.

Here is how you get the output of a command in a more usable form:

First, redirect the output of :map to an arbitrary register:

:redir @a<CR>
:map<CR>
:redir END

Then, put that register into a new buffer in a new window:

:vnew<CR>
"aP

See :help :redir.

1

The simply approach

:redir @" | silent map | redir END | new | put!
2
  • Welcome to this site! Your answer has been flagged has "low quality" because of its length. To make it more useful to future readers how could explain how it differs from the accepted answer, how the | characters works, why you choose the unamed register, etc... Adding some explanations with you code is always a good thing to help other people :)
    – statox
    Apr 7, 2019 at 17:04
  • For others, note that you can put this into a function definition (without ":"), and then use it more easily. You can also replace "map" with "let" in order to put all of the variable definitions into a buffer. This could be done with romainl's version, too, but this is simpler.
    – Mars
    Aug 13 at 18:13

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.