Ⅰ. 插件描述
Vim Completion for Objective-J and CappuccinoⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'nanki/vim-objj'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'nanki/vim-objj'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'nanki/vim-objj'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/nanki/vim-objj
Ⅳ. 文档说明
#Vim Objective-J plugin.
Install
$ git clone git://github.com/nanki/vim-objj
$ vi .vimrc
set runtimepath+=path/to/objjvim
Demo
Checkout Youtube movie that shows the plugin in action.
YouTube - Objective-J Completion in Vim
Requirements
- Vim compiled with Ruby.
- neocomplcache or AutoComplePop (optional)
Features
Smartbrackets
If you type unmatched ],
[CPButton alloc] ]
Smartbrackets will add [ before [ which matches the last ]
and move the cursor before ] which you typed. (indicated with ^ below)
[[CPButton alloc] ]
^
In another case, if you type ] after an Objective-J method,
[CPButton alloc] init]
Smartbrackets will add a bracket and move the cursor just after the letter you typed then.
[[CPButton alloc] init]
^
Omni-completion
By typing C-x C-o, you can use omni-completion anywhere you should input class names, methods and constants.
The plugin provides an Objective-J omni-completion according to precalculated class databases(*.jd files).
By default, the repository includes the databases for Foundation.framework and AppKit.framework
The plugin complete class name, class methods and instance methods at the positions indicated below.
var button = [CPB
^
var button = [CPButton al
^
var button = [CPButton alloc] in
^
var button = [[CPButton alloc] init];
Type estimation
When the receiver is not a class name, type estimation will be taking place.
var button = [CPButton alloc] in
vim : Um... [CPButton alloc] seems to return (id), maybe (CPButton).
Here are various types of estimation.
Arguments
- (void)setWindow:(CPWindow)window {
[window setFra
^
vim : Hmm... window should be an instance of CPWindow.
Variable Assignment
var button = [[CPButton alloc] init];
[button
^
vim : Mmm... button may be an instance of CPButton.
self and super
Estimates types from type declarations.
@implementation CPCustomWindow: CPWindow {
...
[self cont
^
vim : self should be an instance of CPCustomWindow...