Skip to main content
vsplit and split would change the document you are currently on. I suggest a non intrusive alternative.
Source Link

For completeness, I want to present this awesome functions that I collected (stole) from romainl

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vsplitvnew or splitnew etc.

(new and vnew are alternatives to split and vsplit as the output would otherwise be printed in your current file)

For completeness, I want to present this awesome functions that I collected (stole) from romainl

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vsplit or split etc.

For completeness, I want to present this awesome functions that I collected (stole) from romainl

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vnew or new etc.

(new and vnew are alternatives to split and vsplit as the output would otherwise be printed in your current file)

add links
Source Link
3N4N
  • 5.9k
  • 1
  • 21
  • 49

For completeness, I want to present this awesome functions that I collected (stole) from romainl.romainl

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vsplit or split etc.

For completeness, I want to present this awesome functions that I collected (stole) from romainl.

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vsplit or split etc.

For completeness, I want to present this awesome functions that I collected (stole) from romainl

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vsplit or split etc.

Source Link
3N4N
  • 5.9k
  • 1
  • 21
  • 49

For completeness, I want to present this awesome functions that I collected (stole) from romainl.

" redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd)
  if a:cmd =~ '^!'
    execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
  else
    redir => output
    execute a:cmd
    redir END
  endif
  tabnew
  setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
  call setline(1, split(output, "\n"))
  put! = a:cmd
  put = '----'
endfunction
command! -nargs=1 Redir silent call Redir(<f-args>)

This will take normal or system command output and put it in a new tab. Feel free to change the line tabnew to vsplit or split etc.