Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
" 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'))
" 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