Created
September 15, 2011 04:47
-
-
Save ironcamel/1218566 to your computer and use it in GitHub Desktop.
vim script runner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmap <F5> :call Run('perl')<CR> | |
cabbrev pyx call Run('python') | |
cabbrev perlx call Run('perl') | |
cabbrev rubyx call Run('ruby') | |
fu! NewThrowawayBuffer() | |
new | |
setlocal noswapfile | |
setlocal buftype=nowrite | |
setlocal bufhidden=delete | |
endf | |
fu! Run(cmd) | |
only | |
%y | |
call NewThrowawayBuffer() | |
wincmd J | |
resize 15 | |
put | |
exe "%!" . a:cmd | |
0 read !date | |
append | |
---------------------------- | |
. | |
wincmd w | |
endf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This vim plugin lets you execute any script you are editing in vim and the output is displayed in a split window at the bottom. I have included mappings for perl, python and ruby. As you can see, it is easy to add your own mappings for other languages. With the mappings above, you could for example execute a perl script via the command :perlx or by hitting F5 in normal mode.
To install, just drop this file in your $HOME/.vim/plugin folder. Or you could append it to your .vimrc file.