Skip to content

Instantly share code, notes, and snippets.

@ur4ltz
Forked from gmarik/Run_current_line.vim
Created July 3, 2016 12:52
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 ur4ltz/cf4a58a49dd1692fc4cc59bfece763ea to your computer and use it in GitHub Desktop.
Save ur4ltz/cf4a58a49dd1692fc4cc59bfece763ea 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