Created
July 3, 2014 13:00
-
-
Save wusuopu/c1182efefa85d4f6839b 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
"============================================================================= | |
" | |
" 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