Created
October 30, 2010 14:10
-
-
Save jugyo/655329 to your computer and use it in GitHub Desktop.
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
" Eval line | |
function! EvalLine() range | |
let str = "" | |
for i in range(a:firstline, a:lastline) | |
let str = str . getline(i) . "\n" | |
endfor | |
ruby << EOF | |
require 'stringio' | |
$stdout = StringIO.new | |
begin | |
result = eval(VIM.evaluate('str')).inspect | |
rescue Exception => e | |
result = e.class.name | |
end | |
unless $stdout.string.empty? | |
result = $stdout.string | |
end | |
result.split(/\n/).reverse_each do |line| | |
$curbuf.append VIM.evaluate('a:lastline').to_i, line | |
end | |
EOF | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment