Ⅰ. 插件描述
if_ruby helperⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'junegunn/vim-ruby-x'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'junegunn/vim-ruby-x'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'junegunn/vim-ruby-x'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/junegunn/vim-ruby-x
Ⅳ. 文档说明
vim-ruby-x
:RubyX command extends Ruby interface of Vim, making it (marginally) easier to use.
Installation
Use your favorite plugin manager.
- Add
Plug 'junegunn/vim-ruby-x'to .vimrc - Run
:PlugInstall
- Add
Features
Easier variable access
VIM[]VIM[]=VIM.exists?(varname)VIM.fetch(varname, default)VIM.unlet(*varnames)
var1 = VIM['g:var1']
var2 = VIM['g:var2'] || 0
VIM['g:vars'] = { :vars => [var1, var2], :sum => var1 + var2 }
VIM.unlet 'g:var1', 'g:var2'Shortcuts to VIM::command and VIM::evaluate
String#vim!String#vim?
'redraw!'.vim!
count = 'len(g:array)'.vim?Executing normal mode commands
VIM.normal 'gqip'
VIM.normal! 'gg=G'Vimscript representation of Ruby values
Object#to_v
'hello world'.to_v
# "hello world"
[1, 2, 3, %w[hello world], { 'hello' => { 'world' => '!' } }].to_v
# [1, 2, 3, ["hello", "world"], {"hello": {"world": "!"}}]Calling Vim functions
VIM.call(name, *args)
VIM.call(:feedkeys, "\C-c")Making Ruby code interruptible with CTRL-C
VIM.interruptible do
begin
sleep
rescue Interrupt
puts 'Interrupted!'
end
endMessages
VIM.echo 'Welcome'
VIM.echo 'Apples', :Identifier, ' are ', :Structure, 'red', :Error
VIM.error 'Oops, try again'
VIM.message 'This one is builtin'