Ⅰ. 插件描述
Combinable completion functions for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'dirkwallenstein/localcomplete'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'dirkwallenstein/localcomplete'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'dirkwallenstein/localcomplete'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/dirkwallenstein/vim-localcomplete
Ⅳ. 文档说明
vim-localcomplete
Combinable completion functions for Vim.
This repository contains functions that can be used in combination with
a patched AutoComplPop to
combine the results of multiple completion sources into one PopUp Menu. One use
case is to augment RopeOmni from
python-mode with completions for a small
area around the current line or the whole current buffer. There is some example
code included for this use case.
To see how these two plugins can be connected take a look at this
blog post
There are two files of interest:
localcomplete.vim
Here you find three completion functions:
localcomplete#localMatches
It searches through the configured area of the current buffer only. All of the
configuration in the first section of the source file applies to it. Please
read through that section. There is no documentation file.
localcomplete#allBufferMatches
This function searches through all buffers. It respects the case and
keyword-char configuration.
localcomplete#dictMatches
Search the file configured in Vim's 'dictionary' setting for matches. It can
optionally search for matches case-insensitively. The dictionary has to be
utf-8 encoded.
All three functions can have individual minimum leading word lengths configured
after which they start to produce results. This makes only sense in
combination with ACP.
In addition, all three functions mimic Vim's 'infercase' behavior.
combinerEXP.vim
This is a pretty rough and hardcoded module for demonstration purposes. Please
read the mentioned blog post for more.
Testing
To test, execute nosetests from the root directory. For example:
$> nosetests pylibs.localcomplete_tests
It requires mock
Installation
On how to add this plug-in, I'd like to refer you to
Vundle or
Pathogen.