Skip to content

AndrewRadev/bufferize.vim

Repository files navigation

GitHub version

Usage

The plugin exposes the :Bufferize command, which runs the given command and shows its output in a temporary buffer. For example:

:Bufferize messages
:Bufferize digraphs
:Bufferize map
:Bufferize command

All of these are examples of useful commands, whose output you can now freely explore in a proper Vim buffer.

You can provide any command sequence, with arguments and all. For instance, if you run the following command in this file:

:Bufferize ilist Bufferize

you'll get a buffer with all lines that contain "Bufferize". A lot of other commands output to the Vim console, and you can just feed them to the :Bufferize command. If you run :Bufferize command Bufferize, you'll see that the command is hooked up to the bufferize#Run function. You can then

:Bufferize function bufferize#Run

To get a listing of the function in a buffer and explore its source code.

BufferizeTimer

If you have a recent enough Vim that has +timers and +lambda (Vim 8 will do, but you can even use 7.4 with any of the later patches), you can also run the :BufferizeTimer command, which will do the same thing, but will also auto-update the buffer with the contents in the provided time interval. For instance:

BufferizeTimer 500 messages

This will run the :messages command every 500ms and update its output in the bufferize buffer.

b:bufferize_source_command

If you'd like to customize something in the bufferize buffer, you can hook into the filetype bufferize.

The buffer will also hold the variable b:bufferize_source_command which is the source command that generated this output. For instance, you could define a command to regenerate the buffer like so:

autocmd FileType bufferize
      \ command! -buffer Rerun exe 'Bufferize '.b:bufferize_source_command

Contributing

Pull requests are welcome, but take a look at CONTRIBUTING.md first for some guidelines.

About

Execute a :command and show the output in a temporary buffer

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published