A Vim plugin to copy output of vims terminal to a new buffer.
This plugin contains a shell implementation of a pager, that will take the input and send it to a vim plugin (in Unix-like OSes like Linux and MacOS; in Microsoft Windows, only opening files is supported yet). The Vim plugin processes the input and stores it in a new window.
See also the following screencast:
Use the plugin manager of your choice.
Also available at vim.org
It requires Python with the json
module to properly json encode the input.
This makes use of Vims built in terminal and the provided terminal API. You need at least Vim version 8.0.1647
Use the provided vpager
script and pipe input into it.
Its containing folder is added to your local $PATH
inside Vim.
(If not found, please ensure that vpager
's executable flag is set.)
The script supports the following options:
NAME
This script vpager can be used as pager from inside Vims built-in
terminal. The output will be copied to a new buffer in Vim.
SYNOPSIS
vpager [-enVQ -C option] [file]
vpager [-h|-v]
-v display version
-h display help
-C Pass options to Vim. Can be used to e.g. set the filetype for
correct syntax highlighting.
-e open the file in the instance of vim that is running the terminal
-n Clear the previous buffer in Vim
-V create a new vertical window in Vim
-Q parse the output back in the quickfix list
EXAMPLES
git diff | vpager -nC 'ft=diff'
Copies the output of git diff into a buffer inside Vim. Any previous
output in the buffer will be cleared and the filetype will be set
to "diff", for proper syntax highlighting.
grep -n <searchterm> files | vpager -Q
Parses the grep -n output, copies it back into the quickfix buffer
and opens the first result in a new window.
A command drop
is provided as alias for vpager -e
.
Inside a terminal in vim, vim-terminal-help opens a file in the vim instance that spawned that terminal.
© 2018 by Christian Brabandt. The Vim license (see :h license
) applies to the Vim plugin, the shell script is licensed under the BSD license.
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK