Can we trigger some .vimrc editing frenzy? Chapter (n): ruby-run-and-vsplit.
A quick & dirty run-and-show-output-in-vsplit-window script for vim. Definitely not as refined as the xmp decorator, and it cannot expand test assertions automagically, but I'll give it a try in my .vimrc.
Some minor details to make it more palatable:
- works in insert, normal, visual mode, and DWIM
- doesn't overwrite the original file, doesn't use fixed tempfiles
- preserves the cursor position, and you're placed back in the source file
- most importantly: killing the new window is as easy as creating it in the first place (F7 to open, S-F7 to close), and it won't break the minibufexpl (which you should be using)
(hmm some aggregators can't show the following animation)
cat >> ~/.vimrc
function! Ruby_eval_vsplit() range let src = tempname() let dst = tempname() execute ": " . a:firstline . "," . a:lastline . "w " . src execute ":silent ! ruby " . src . " > " . dst . " 2>&1 " execute ":redraw!" execute ":vsplit" execute "normal \<C-W>l" execute ":e! " . dst execute "normal \<C-W>h" endfunction vmap <silent> <F7> :call Ruby_eval_vsplit()<cr> nmap <silent> <F7> mzggVG<F7>`z imap <silent> <F7> <ESC><F7>a map <silent> <S-F7> <C-W>l:bw<cr> imap <silent> <S-F7> <ESC><S-F7>a
.vimrc snippets are always ugly; this is indeed no exception.
- 45 http://www.artima.com/forums/flat.jsp?forum=123&thread=158160
- 12 http://anarchaia.org
- 12 http://planetruby.0x42.net
- 10 http://www.artima.com/buzz/community.jsp?forum=123
- 5 http://www.anarchaia.org
- 4 http://anarchaia.org/archive/2006/04/29.html
- 3 http://www.artima.com/buzz/community.jsp?forum=123&start=15&thRange=15
- 2 http://ruby-and-rails.toptensources.com/TopTenSources/Default.aspx
- 2 http://del.icio.us/tag/vim
- 2 http://newsdancer.com/23