Some vim commands output quite a lot of text and it would be nice to get the output in a more readable format. This command lets you do that. Simply prefix any command-line invocation with :Bufferize
and you'll get the standard output in a Vim buffer.
Try these examples out:
:Bufferize digraphs
:Bufferize map
:Bufferize let g:
command! -nargs=* -complete=command Bufferize call s:Bufferize(<q-args>) function! s:Bufferize(cmd) let cmd = a:cmd redir => output silent exe cmd redir END new setlocal nonumber call setline(1, split(output, "\n")) set nomodified endfunction
Israel Chauca Fuentes 8 years ago
Also, you can use setline(1, split(output, "\n"))
to avoid the extra line at the end of the buffer.
Andrew Radev 8 years ago
Good points, thanks :).
Israel Chauca Fuentes 8 years ago
Use
<q-args>
instead to skipjoin()
.