Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Forked from Shougo/.vimrc
Created April 27, 2010 09:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hokaccha/380535 to your computer and use it in GitHub Desktop.
Save hokaccha/380535 to your computer and use it in GitHub Desktop.
" Capture {{{
command!
\ -nargs=1
\ -complete=command
\ Capture
\ call Capture(<f-args>)
function! Capture(cmd)
redir => result
silent execute a:cmd
redir END
let bufname = 'Capture: ' . a:cmd
new
setlocal bufhidden=unload
setlocal nobuflisted
setlocal buftype=nofile
setlocal noswapfile
silent file `=bufname`
silent put =result
1,2delete _
endfunction
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment