Skip to content

Instantly share code, notes, and snippets.

@gmarik
Created March 15, 2012 18:19
Show Gist options
  • Save gmarik/2045798 to your computer and use it in GitHub Desktop.
Save gmarik/2045798 to your computer and use it in GitHub Desktop.
" put this into your .vimrc
func! Run_current_line()
" get current line and run it as a system command
let content = system(getline('.'))
" open new window
silent pedit `=tempname()`
" change focus to the window
wincmd P
" append content
call append(0, split(content, '\n'))
endf
" mapping
nmap <leader>r :call Run_current_line()<CR>
" so if you uncomment below line and press <leader>r over it ( which is \r or ,r or " smth eslse depending on your config)
" ls
" you'll get window with content of the PWD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment