dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

redir.vim (458B)


      1 function! redir#Redir(cmd) abort
      2   for win in range(1, winnr('$'))
      3     if getwinvar(win, 'scratch')
      4       execute win . 'windo close'
      5     endif
      6   endfor
      7   if a:cmd =~ '^!'
      8     execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')"
      9   else
     10     redir => output
     11     execute a:cmd
     12     redir END
     13   endif
     14   vnew
     15   let w:scratch = 1
     16   setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile
     17   call setline(1, split(output, "\n"))
     18 endfunction