Skip to content

Instantly share code, notes, and snippets.

@wusuopu
Created July 3, 2014 13:00
Show Gist options
  • Save wusuopu/c1182efefa85d4f6839b to your computer and use it in GitHub Desktop.
Save wusuopu/c1182efefa85d4f6839b to your computer and use it in GitHub Desktop.
"=============================================================================
"
" FileName: demo.vim
"
" Author: LongChangjin
" Email: [email protected]
"
"=============================================================================
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