Ⅰ. 插件描述
User auto-completions based on regular expressions -- automate the boring parts of any programming language.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'stanangeloff/fizzy-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'stanangeloff/fizzy-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'stanangeloff/fizzy-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/stanangeloff/fizzy.vim
Ⅳ. 文档说明
fizzy.vim
User auto-completions based on regular expressions -- automate the boring parts of any programming language.
:tv: Screencast
WIP.
Installation
Install with Pathogen
If you don't have a preferred installation method, you should use pathogen.vim, and then run in a shell:
cd ~/.vim/bundle
git clone git://github.com/StanAngeloff/fizzy.vim.gitInstall with [Vundle]
Open ~/.vimrc in your favourite editor and append:
Bundle 'StanAngeloff/fizzy.vim'and then run in a shell:
vim -c 'silent! BundleInstall' -c 'qa!'Contributing
fizzy.vim has limited completions for a limited list of languages. You can contribute by creating plug-ins and completions for more languages.
See the autoload/fizzy/completions/php.vim and ftplugin/php/fizzy.vim for code.
Usage
To trigger a completion, use <C-X><C-U> at the end of a line in a supported file.
In PHP
There are a few completions currently supported in PHP.
<?php
# - Create a type-hinted private property -------------
private array $list;
⇣
/**
* @var array
*/
private $list;
# - Expand an isset(..) expression at the first '?' ---
$timezone?->getName()
$property->timezone?->getName()
⇣
(isset ($timezone) ? $timezone->getName() : null)
(isset ($property->timezone) ? $property->timezone->getName() : null)
# - Return a property and initialize it once ----------
return $this->eventDispatcher = new EventDispatcher();
⇣
if ($this->eventDispatcher === null) {
$this->eventDispatcher = new EventDispatcher();
}
return $this->eventDispatcher;
# - Check if one or more variables are set ------------
if isset $this->repository $this->eventDispatcher
⇣
if (isset ($this->repository) && isset ($this->eventDispatcher)) {
}Tips
You can set up Vim to auto-complete expressions using the <Tab> key.
The below script will not work if you have [Supertab] or similar installed, however.
" {{{ Tab completion
function! BestComplete()
" If fizzy.vim has results, use 'completefunc' to complete.
if exists('g:loaded_fizzy')
let fizzy_position = fizzy#Complete(1, '')
if fizzy_position != col('.')
let fizzy_completions = fizzy#Complete(0, getline('.')[fizzy_position : col('.')])
if len(fizzy_completions)
if len(fizzy_completions) > 1
return "\<C-X>\<C-U>\<C-N>"
else
return "\<C-X>\<C-U>\<C-N>\<C-Y>"
endif
endif
endif
endif
return "\<Tab>"
endfunction
inoremap <silent> <Tab> <C-R>=BestComplete()<CR>
" }}}Bug Reports
File a bug on GitHub Issues.