Ⅰ. 插件描述
Converts and unconverts hashrocket notationⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'danchoi/ruby-bashrockets-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'danchoi/ruby-bashrockets-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'danchoi/ruby-bashrockets-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/danchoi/ruby_bashrockets.vim
Ⅳ. 文档说明
# ruby_bashrockets.vim
This gives you Vim commands to convert Ruby hashes from the older hashrocket
notation to the newer key-value notation, and back.
Synopsis
:Bashrockets {:foo => 'bar', :boston => 'rocks'} ==> {foo: 'bar', boston: 'rocks'}
:Hashrockets {foo: 'bar', boston: 'rocks'} ==> {:foo => 'bar', :boston => 'rocks'}
You can select a range before entering these commands. They will apply the
conversion to all the text in the range. Otherwise, the command is applied to the current line.
You can also type the first few characters of either command and try to let
Vim tab-autocomplete it.
Install
Copy ftplugin/ruby_bashrockets.vim to ~/.vim/ftplugin/
Quick install:
curl -L https://raw.github.com/danchoi/ruby_bashrockets.vim/master/ftplugin/ruby_bashrockets.vim > ~/.vim/ftplugin/ruby_bashrockets.vim
Make sure your .vimrc has these lines:
filetype on
filetype plugin on
Also, there should already be a ruby.vim file in your ~/.vim/ftdetect/
- If not, you can grab this one from Tim Pope's vim-ruby
- or just install vim-ruby.
Author
Daniel Choi http://github.com/danchoi