Skip to content

Instantly share code, notes, and snippets.

@wusuopu
Created Jul 3, 2014
Embed
What would you like to do?
"=============================================================================
"
" FileName: demo.vim
"
" Author: LongChangjin
" Email: admin@longchangjin.cn
"
"=============================================================================
if !has('ruby')
echo "Error: Required vim compiled with +ruby"
finish
endif
if exists('g:loaded_ruby_demo_plugin')
finish
endif
let g:loaded_ruby_demo_plugin = 1
function! DemoFun1()
ruby<<EOF
buf = VIM::Buffer.current
puts "current buffer name: #{buf.name} number: #{buf.number} length: #{buf.length}"
EOF
endfunction
function! DemoFun2(arg1)
ruby<< EOF
puts "you input: #{VIM.evaluate('a:arg1')}"
EOF
endfunction
command! -nargs=0 DemoFun1 call DemoFun1()
command! -nargs=1 -rang DemoFun2 call DemoFun2(<f-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment