Skip to content

christoomey/ctrlp-generic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

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.

About

A generic list selection extension to CtrlP for vim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published