ctrlp-generic


Ⅰ. 插件描述

A generic list selection extension to CtrlP for vim

Ⅱ. 基本信息

创建日期:  2013-01-09
使用用户:  2
Github星:  3
插件作者:  Chris Toomey

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'christoomey/ctrlp-generic'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'christoomey/ctrlp-generic'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'christoomey/ctrlp-generic'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/christoomey/ctrlp-generic

Ⅳ. 文档说明

# CtrlP Generic

[CtrlP][] is a file navigation plugin for Vim that supports fuzzy filename matching
similar to [Command-T][], but is written entirely in vimscript. This plugin,
[CtrlP Generic][], is an extension to CtrlP that provides a generic interface
to the CtrlP fuzzy matching window. Using this plugin you can support CtrlP
style fuzzy selection from any generic list.

Installation

The recommended installation for this plugin is via [Vundle][] using the
following steps:

  1. Add the bundle directive to your vimrc after the CtrlP directive as shown below:
  2. Source the vimrc file to read in the bundle directive :source $MYVIMRC
  3. Run the Vundle install command with :BundleInstall

This will git clone the plugin repository into ~/.vim/bundles, activate the
plugin, and run :helptags on it. From there you are all set to use it.

Note, since CtrlP-Generic is implemented as an extension to CtrlP, you must
also have CtrlP installed and it should appear before CtrlP-Generic in your
vimrc:

Sample vimrc:

Bundle "kien/ctrlp.vim"
Bundle "christoomey/ctrlp-generic"

Usage

Since CtrlP's match window is asynchronous, CtrlP-Generic requires the use of a
callback function. CtrlPGeneric provides a single function as its interface.
This function, aptly named CtrlPGeneric, takes two arguments:

  • Options - A Vim list containing the items to be selected from
  • Callback - The name of the function CtrlP will call with the selected
    value from the provided Options list.
call CtrlPGeneric(a_vim_list, 'MyGreatCallback')

function! MyGreatCallback(selected_value) range
    echo "You selected: " . a:selected_value
endfunction

Callback function notes - The callback function must be glabal and must be
defined to accept a range, as shown above.

添加新评论