Skip to content

Instantly share code, notes, and snippets.

@eagletmt
Forked from Shougo/.vimrc
Created April 27, 2010 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eagletmt/380620 to your computer and use it in GitHub Desktop.
Save eagletmt/380620 to your computer and use it in GitHub Desktop.
" Capture {{{
command!
\ -nargs=+
\ -complete=command
\ Capture
\ call s:cmd_capture([<f-args>])
function! s:capture(cmd)
redir => result
silent execute a:cmd
redir END
return result
endfunction
function! s:cmd_capture(args) "{{{
new
setlocal buftype=nofile bufhidden=hide noswapfile
call setline(1, split(s:capture(join(a:args)), '\n'))
endfunction "}}}
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment