I can easily see the output of a command in a split using vim's terminal
For example, I use :vertical terminal make re
a lot.
This example is also stated in the help (h :terminal
):
Or to run build command:
:term make myprogram
I even wrote a short function to easily launch shell commands in a vertical split:
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
function! s:RunShellCommand(cmdline) abort
exe 'vert terminal '. a:cmdline
endfunction
However, if the output is larger than the terminal width, new lines will be inserted. This makes the output inconsistent (it will depend on the current splits layout, window and screen size, and so on).
In this state, it's difficult to make use of vim's magic moves, copy, paste, diff, and so on.
Is there any way to get the command output without breaking lines?
I tried using set nowrap
, nolinebreak
, tw=0
with no luck.
Is there any way to get the command output without breaking lines?
Right in a Vim terminal buffer, and without a hack or patching Vim, I don't think so.If you want to grab the output from a command as it was sent to the terminal, you need to use another way.
(source)tee
if you want both to have it display in the terminal and preserve it for reuse inside Vim.set columns=0
? Well, it'll let more space for the output, but the same behavior will apply. @filbranden I've consideredtee
but would like to keep with builtins if possible.