mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 03:50:30 +01:00
Removed bundle_consider, and plugins: buffergator and fuzzyfinder (+l9). Give
a try to ctrlp plugin.
This commit is contained in:
8
bundle/git_ctrlp/.gitignore
vendored
Normal file
8
bundle/git_ctrlp/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
.hgignore
|
||||
*.markdown
|
||||
*.zip
|
||||
wiki.md
|
||||
note.txt
|
||||
tags
|
||||
.hg/*
|
||||
tmp/*
|
||||
1519
bundle/git_ctrlp/autoload/ctrlp.vim
Normal file
1519
bundle/git_ctrlp/autoload/ctrlp.vim
Normal file
File diff suppressed because it is too large
Load Diff
234
bundle/git_ctrlp/autoload/ctrlp/buffertag.vim
Normal file
234
bundle/git_ctrlp/autoload/ctrlp/buffertag.vim
Normal file
@@ -0,0 +1,234 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/buffertag.vim
|
||||
" Description: Buffer Tag extension
|
||||
" Maintainer: Kien Nguyen <github.com/kien>
|
||||
" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus
|
||||
" a few lines from taglist.vim by Yegappan Lakshmanan and from
|
||||
" buffertag.vim by Takeshi Nishida.
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_buftag = 1
|
||||
|
||||
let s:buftag_var = {
|
||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
||||
\ 'accept': 'ctrlp#buffertag#accept',
|
||||
\ 'lname': 'buffer tags',
|
||||
\ 'sname': 'bft',
|
||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:buftag_var) : [s:buftag_var]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
fu! s:opts()
|
||||
let opts = {
|
||||
\ 'g:ctrlp_buftag_systemenc': ['s:enc', &enc],
|
||||
\ 'g:ctrlp_buftag_ctags_bin': ['s:bin', ''],
|
||||
\ 'g:ctrlp_buftag_types': ['s:usr_types', ''],
|
||||
\ }
|
||||
for [ke, va] in items(opts)
|
||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||
endfo
|
||||
endf
|
||||
cal s:opts()
|
||||
|
||||
fu! s:bins()
|
||||
let bins = [
|
||||
\ 'ctags-exuberant',
|
||||
\ 'exuberant-ctags',
|
||||
\ 'exctags',
|
||||
\ '/usr/local/bin/ctags',
|
||||
\ '/opt/local/bin/ctags',
|
||||
\ 'ctags',
|
||||
\ 'ctags.exe',
|
||||
\ 'tags',
|
||||
\ ]
|
||||
if empty(s:bin)
|
||||
for bin in bins | if executable(bin)
|
||||
let s:bin = bin
|
||||
brea
|
||||
en | endfo
|
||||
el
|
||||
let s:bin = expand(s:bin, 1)
|
||||
en
|
||||
endf
|
||||
cal s:bins()
|
||||
|
||||
" s:types {{{2
|
||||
let s:types = {
|
||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
||||
\ 'aspvbs' : '%sasp%sasp%sfsv',
|
||||
\ 'awk' : '%sawk%sawk%sf',
|
||||
\ 'beta' : '%sbeta%sbeta%sfsv',
|
||||
\ 'c' : '%sc%sc%sdgsutvf',
|
||||
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
|
||||
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
|
||||
\ 'cobol' : '%scobol%scobol%sdfgpPs',
|
||||
\ 'eiffel' : '%seiffel%seiffel%scf',
|
||||
\ 'erlang' : '%serlang%serlang%sdrmf',
|
||||
\ 'expect' : '%stcl%stcl%scfp',
|
||||
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
|
||||
\ 'html' : '%shtml%shtml%saf',
|
||||
\ 'java' : '%sjava%sjava%spcifm',
|
||||
\ 'javascript': '%sjavascript%sjavascript%sf',
|
||||
\ 'lisp' : '%slisp%slisp%sf',
|
||||
\ 'lua' : '%slua%slua%sf',
|
||||
\ 'make' : '%smake%smake%sm',
|
||||
\ 'pascal' : '%spascal%spascal%sfp',
|
||||
\ 'perl' : '%sperl%sperl%sclps',
|
||||
\ 'php' : '%sphp%sphp%scdvf',
|
||||
\ 'python' : '%spython%spython%scmf',
|
||||
\ 'rexx' : '%srexx%srexx%ss',
|
||||
\ 'ruby' : '%sruby%sruby%scfFm',
|
||||
\ 'scheme' : '%sscheme%sscheme%ssf',
|
||||
\ 'sh' : '%ssh%ssh%sf',
|
||||
\ 'csh' : '%ssh%ssh%sf',
|
||||
\ 'zsh' : '%ssh%ssh%sf',
|
||||
\ 'slang' : '%sslang%sslang%snf',
|
||||
\ 'sml' : '%ssml%ssml%secsrtvf',
|
||||
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
|
||||
\ 'tcl' : '%stcl%stcl%scfmp',
|
||||
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
|
||||
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
|
||||
\ 'vim' : '%svim%svim%savf',
|
||||
\ 'yacc' : '%syacc%syacc%sl',
|
||||
\ }
|
||||
|
||||
cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")')
|
||||
|
||||
if executable('jsctags')
|
||||
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
||||
en
|
||||
|
||||
if type(s:usr_types) == 4
|
||||
cal extend(s:types, s:usr_types)
|
||||
en
|
||||
" Utilities {{{1
|
||||
fu! s:validfile(fname, ftype)
|
||||
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
||||
\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en
|
||||
retu 0
|
||||
endf
|
||||
|
||||
fu! s:exectags(cmd)
|
||||
if exists('+ssl')
|
||||
let [ssl, &ssl] = [&ssl, 0]
|
||||
en
|
||||
if &sh =~ 'cmd\.exe'
|
||||
let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c']
|
||||
en
|
||||
let output = system(a:cmd)
|
||||
if &sh =~ 'cmd\.exe'
|
||||
let [&sxq, &shcf] = [sxq, shcf]
|
||||
en
|
||||
if exists('+ssl')
|
||||
let &ssl = ssl
|
||||
en
|
||||
retu output
|
||||
endf
|
||||
|
||||
fu! s:exectagsonfile(fname, ftype)
|
||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]
|
||||
if type(s:types[ft]) == 1
|
||||
let ags .= s:types[ft]
|
||||
let bin = s:bin
|
||||
elsei type(s:types[ft]) == 4
|
||||
let ags = s:types[ft]['args']
|
||||
let bin = expand(s:types[ft]['bin'], 1)
|
||||
en
|
||||
if empty(bin) | retu '' | en
|
||||
let cmd = s:esctagscmd(bin, ags, a:fname)
|
||||
if empty(cmd) | retu '' | en
|
||||
let output = s:exectags(cmd)
|
||||
if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en
|
||||
retu output
|
||||
endf
|
||||
|
||||
fu! s:esctagscmd(bin, args, ...)
|
||||
if exists('+ssl')
|
||||
let [ssl, &ssl] = [&ssl, 0]
|
||||
en
|
||||
let fname = a:0 == 1 ? shellescape(a:1) : ''
|
||||
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
||||
if exists('+ssl')
|
||||
let &ssl = ssl
|
||||
en
|
||||
if has('iconv')
|
||||
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
|
||||
let cmd = iconv(cmd, &enc, last)
|
||||
en
|
||||
retu cmd
|
||||
endf
|
||||
|
||||
fu! s:process(fname, ftype)
|
||||
if !s:validfile(a:fname, a:ftype) | retu [] | endif
|
||||
let ftime = getftime(a:fname)
|
||||
if has_key(g:ctrlp_buftags, a:fname)
|
||||
\ && g:ctrlp_buftags[a:fname]['time'] >= ftime
|
||||
let lines = g:ctrlp_buftags[a:fname]['lines']
|
||||
el
|
||||
let data = s:exectagsonfile(a:fname, a:ftype)
|
||||
let [raw, lines] = [split(data, '\n\+'), []]
|
||||
for line in raw | if len(split(line, ';"')) == 2
|
||||
let parsed_line = s:parseline(line)
|
||||
if parsed_line != ''
|
||||
cal add(lines, parsed_line)
|
||||
en
|
||||
en | endfo
|
||||
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
|
||||
cal extend(g:ctrlp_buftags, cache)
|
||||
en
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! s:parseline(line)
|
||||
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
|
||||
let vals = matchlist(a:line, eval)
|
||||
if empty(vals) | retu '' | en
|
||||
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
||||
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#buffertag#init(fname)
|
||||
let fname = exists('s:bufname') ? s:bufname : a:fname
|
||||
let bufs = exists('s:btmode') && s:btmode ? ctrlp#allbufs() : [fname]
|
||||
let lines = []
|
||||
for each in bufs
|
||||
let tftype = get(split(getbufvar(each, '&ft'), '\.'), 0, '')
|
||||
cal extend(lines, s:process(each, tftype))
|
||||
endfo
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#accept(mode, str)
|
||||
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
|
||||
let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]]
|
||||
cal ctrlp#acceptfile(a:mode, bufnm, linenr)
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#cmd(mode, ...)
|
||||
let s:btmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufname = fnamemodify(a:1, ':p')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#exit()
|
||||
unl! s:btmode s:bufname
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
93
bundle/git_ctrlp/autoload/ctrlp/dir.vim
Normal file
93
bundle/git_ctrlp/autoload/ctrlp/dir.vim
Normal file
@@ -0,0 +1,93 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/dir.vim
|
||||
" Description: Directory extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]
|
||||
|
||||
let s:ars = [
|
||||
\ 's:maxdepth',
|
||||
\ 's:maxfiles',
|
||||
\ 's:compare_lim',
|
||||
\ 's:glob',
|
||||
\ ]
|
||||
|
||||
let s:dir_var = {
|
||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
||||
\ 'accept': 'ctrlp#dir#accept',
|
||||
\ 'lname': 'dirs',
|
||||
\ 'sname': 'dir',
|
||||
\ 'type': 'path',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:dir_var) : [s:dir_var]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:globdirs(dirs, depth)
|
||||
let entries = split(globpath(a:dirs, s:glob), "\n")
|
||||
let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]
|
||||
cal extend(g:ctrlp_alldirs, dirs)
|
||||
if !empty(dirs) && !s:max(len(g:ctrlp_alldirs), s:maxfiles)
|
||||
\ && depth <= s:maxdepth
|
||||
sil! cal ctrlp#progress(len(g:ctrlp_alldirs))
|
||||
cal s:globdirs(join(dirs, ','), depth)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:max(len, max)
|
||||
retu a:max && a:len > a:max ? 1 : 0
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#dir#init(...)
|
||||
let s:cwd = getcwd()
|
||||
for each in range(len(s:ars))
|
||||
exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1)))
|
||||
endfo
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var['sname']
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var['sname'])
|
||||
if g:ctrlp_newdir || !filereadable(cafile)
|
||||
let g:ctrlp_alldirs = []
|
||||
cal s:globdirs(s:cwd, 0)
|
||||
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
|
||||
let read_cache = 0
|
||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
||||
en
|
||||
el
|
||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
||||
let read_cache = 1
|
||||
en
|
||||
if !read_cache
|
||||
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
|
||||
let g:ctrlp_newdir = 0
|
||||
en
|
||||
retu g:ctrlp_alldirs
|
||||
endf
|
||||
|
||||
fu! ctrlp#dir#accept(mode, str)
|
||||
let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#utils#lash().a:str
|
||||
if a:mode =~ 't\|v\|h'
|
||||
cal ctrlp#exit()
|
||||
en
|
||||
cal ctrlp#setdir(path, a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
||||
if a:mode == 'e'
|
||||
sil! cal ctrlp#statusline()
|
||||
cal ctrlp#setlines(s:id)
|
||||
cal ctrlp#recordhist()
|
||||
cal ctrlp#prtclear()
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#dir#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
67
bundle/git_ctrlp/autoload/ctrlp/line.vim
Normal file
67
bundle/git_ctrlp/autoload/ctrlp/line.vim
Normal file
@@ -0,0 +1,67 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/line.vim
|
||||
" Description: Line extension - Find a line in any buffer
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" User Configuration {{{1
|
||||
" Enable:
|
||||
" let g:ctrlp_extensions += ['line']
|
||||
" Create A Command:
|
||||
" com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
"}}}
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
let s:line_var = {
|
||||
\ 'init': 'ctrlp#line#init()',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
\ 'type': 'tabe',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Public {{{1
|
||||
fu! ctrlp#line#init()
|
||||
let [bufs, lines] = [ctrlp#allbufs(), []]
|
||||
for each in bufs
|
||||
let from_file = readfile(each)
|
||||
cal map(from_file, 'tr(v:val, '' '', '' '')')
|
||||
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.each.'$')]
|
||||
wh id <= len_ff
|
||||
let from_file[id-1] .= ' #:'.bufnr.':'.id
|
||||
let id += 1
|
||||
endw
|
||||
cal filter(from_file, 'v:val !~ ''^\s*\t#:\d\+:\d\+$''')
|
||||
cal extend(lines, from_file)
|
||||
endfo
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#accept(mode, str)
|
||||
let info = get(split(a:str, '\t#:\ze\d\+:\d\+$'), 1, 0)
|
||||
let bufnr = str2nr(get(split(info, ':'), 0, 0))
|
||||
let linenr = get(split(info, ':'), 1, 0)
|
||||
if bufnr
|
||||
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
92
bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim
Normal file
92
bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim
Normal file
@@ -0,0 +1,92 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/mrufiles.vim
|
||||
" Description: Most Recently Used Files extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
fu! ctrlp#mrufiles#opts()
|
||||
let opts = {
|
||||
\ 'g:ctrlp_mruf_max': ['s:max', 250],
|
||||
\ 'g:ctrlp_mruf_include': ['s:in', ''],
|
||||
\ 'g:ctrlp_mruf_exclude': ['s:ex', ''],
|
||||
\ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1],
|
||||
\ 'g:ctrlp_mruf_relative': ['s:re', 0],
|
||||
\ 'g:ctrlp_mruf_last_entered': ['s:mre', 0],
|
||||
\ }
|
||||
for [ke, va] in items(opts)
|
||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||
endfo
|
||||
let s:csen = s:csen ? '#' : '?'
|
||||
endf
|
||||
cal ctrlp#mrufiles#opts()
|
||||
fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1
|
||||
if s:locked | retu | en
|
||||
let bufnr = a:bufnr + 0
|
||||
if bufnr > 0
|
||||
let fn = fnamemodify(bufname(bufnr), ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in )
|
||||
\ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn)
|
||||
retu
|
||||
en
|
||||
en
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
if a:0 && a:1 == 2
|
||||
cal ctrlp#utils#writecache([], s:cadir, s:cafile)
|
||||
retu []
|
||||
en
|
||||
" Get the list
|
||||
let mrufs = ctrlp#utils#readfile(s:cafile)
|
||||
" Remove non-existent files
|
||||
if a:0 && a:1 == 1
|
||||
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
||||
if exists('+ssl')
|
||||
cal map(mrufs, 'tr(v:val, ''/'', ''\'')')
|
||||
cal filter(mrufs, 'count(mrufs, v:val) == 1')
|
||||
en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
en
|
||||
" Return the list with the active buffer removed
|
||||
if bufnr == -1
|
||||
let crf = fnamemodify(bufname(winbufnr(winnr('#'))), ':p')
|
||||
let crf = exists('+ssl') ? tr(crf, '/', '\') : crf
|
||||
let mrufs = empty(crf) ? mrufs : filter(mrufs, 'v:val !='.s:csen.' crf')
|
||||
if s:re
|
||||
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
||||
cal filter(mrufs, '!stridx(v:val, cwd)')
|
||||
en
|
||||
cal map(mrufs, 'fnamemodify(v:val, '':.'')')
|
||||
retu mrufs
|
||||
en
|
||||
" Remove old entry
|
||||
cal filter(mrufs, 'v:val !='.s:csen.' fn')
|
||||
" Insert new one
|
||||
cal insert(mrufs, fn)
|
||||
" Remove oldest entry or entries
|
||||
if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
endf "}}}
|
||||
fu! s:excl(fn) "{{{
|
||||
retu !empty(s:ex) && a:fn =~# s:ex
|
||||
endf "}}}
|
||||
fu! ctrlp#mrufiles#init() "{{{1
|
||||
let s:locked = 0
|
||||
aug CtrlPMRUF
|
||||
au!
|
||||
au BufReadPost,BufNewFile,BufWritePost *
|
||||
\ cal ctrlp#mrufiles#list(expand('<abuf>', 1))
|
||||
if s:mre
|
||||
au BufEnter,BufUnload *
|
||||
\ cal ctrlp#mrufiles#list(expand('<abuf>', 1))
|
||||
en
|
||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
||||
aug END
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
58
bundle/git_ctrlp/autoload/ctrlp/quickfix.vim
Normal file
58
bundle/git_ctrlp/autoload/ctrlp/quickfix.vim
Normal file
@@ -0,0 +1,58 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/quickfix.vim
|
||||
" Description: Quickfix extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_quickfix = 1
|
||||
|
||||
let s:var_qf = {
|
||||
\ 'init': 'ctrlp#quickfix#init()',
|
||||
\ 'accept': 'ctrlp#quickfix#accept',
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:var_qf) : [s:var_qf]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
fu! s:lineout(dict)
|
||||
retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
|
||||
\ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#quickfix#init()
|
||||
let g:ctrlp_nolimit = 1
|
||||
if !hlexists('CtrlPqfLineCol')
|
||||
hi link CtrlPqfLineCol Search
|
||||
en
|
||||
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
|
||||
retu map(getqflist(), 's:lineout(v:val)')
|
||||
endf
|
||||
|
||||
fu! ctrlp#quickfix#accept(mode, str)
|
||||
let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
|
||||
let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
|
||||
if empty(filpath) | retu | en
|
||||
cal ctrlp#exit()
|
||||
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
|
||||
\ : ctrlp#normcmd('e')
|
||||
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
|
||||
exe cmd ctrlp#fnesc(filpath)
|
||||
cal cursor(items[2], items[3])
|
||||
sil! norm! zvzz
|
||||
endf
|
||||
|
||||
fu! ctrlp#quickfix#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
51
bundle/git_ctrlp/autoload/ctrlp/rtscript.vim
Normal file
51
bundle/git_ctrlp/autoload/ctrlp/rtscript.vim
Normal file
@@ -0,0 +1,51 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/rtscript.vim
|
||||
" Description: Runtime scripts extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
||||
|
||||
let s:rtscript_var = {
|
||||
\ 'init': 'ctrlp#rtscript#init()',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'runtime scripts',
|
||||
\ 'sname': 'rts',
|
||||
\ 'type': 'path',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:rtscript_var) : [s:rtscript_var]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Public {{{1
|
||||
fu! ctrlp#rtscript#init()
|
||||
if g:ctrlp_newrts
|
||||
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
|
||||
sil! cal ctrlp#progress('Indexing...')
|
||||
let entries = split(globpath(&rtp, '**/*.*'), "\n")
|
||||
cal filter(entries, 'count(entries, v:val) == 1')
|
||||
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
|
||||
el
|
||||
let [entries, results] = g:ctrlp_rtscache[2:3]
|
||||
en
|
||||
let cwd = getcwd()
|
||||
if g:ctrlp_newrts
|
||||
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, cwd] )
|
||||
if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
|
||||
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
|
||||
en
|
||||
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, cwd, entries, results], 0]
|
||||
retu results
|
||||
endf
|
||||
|
||||
fu! ctrlp#rtscript#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
111
bundle/git_ctrlp/autoload/ctrlp/tag.vim
Normal file
111
bundle/git_ctrlp/autoload/ctrlp/tag.vim
Normal file
@@ -0,0 +1,111 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/tag.vim
|
||||
" Description: Tag file extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
let s:tag_var = {
|
||||
\ 'init': 'ctrlp#tag#init(s:tagfiles)',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:tag_var) : [s:tag_var]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:nodup(items)
|
||||
let dict = {}
|
||||
for each in a:items
|
||||
cal extend(dict, { each : 0 })
|
||||
endfo
|
||||
retu keys(dict)
|
||||
endf
|
||||
|
||||
fu! s:findcount(str)
|
||||
let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$')
|
||||
let [fname, tgs] = [expand(fname, 1), taglist('^'.tg.'$')]
|
||||
if empty(tgs) | retu [1, 1] | en
|
||||
let [fnd, ct, pos] = [0, 0, 0]
|
||||
for each in tgs
|
||||
let ct += 1
|
||||
let fulname = fnamemodify(each["filename"], ':p')
|
||||
if stridx(fulname, fname) >= 0
|
||||
\ && strlen(fname) + stridx(fulname, fname) == strlen(fulname)
|
||||
let fnd += 1
|
||||
let pos = ct
|
||||
en
|
||||
if fnd > 1 | brea | en
|
||||
endfo
|
||||
retu [fnd, pos]
|
||||
endf
|
||||
|
||||
fu! s:filter(tags)
|
||||
let [nr, alltags] = [0, a:tags]
|
||||
wh 0 < 1
|
||||
if alltags[nr] =~ '^!' && alltags[nr] !~ '^!_TAG_'
|
||||
let nr += 1
|
||||
con
|
||||
en
|
||||
if alltags[nr] =~ '^!_TAG_' && len(alltags) > nr
|
||||
cal remove(alltags, nr)
|
||||
el
|
||||
brea
|
||||
en
|
||||
endw
|
||||
retu alltags
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#tag#init(tagfiles)
|
||||
if empty(a:tagfiles) | retu [] | en
|
||||
let [tagfiles, g:ctrlp_alltags] = [sort(s:nodup(a:tagfiles)), []]
|
||||
for each in tagfiles
|
||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
||||
cal extend(g:ctrlp_alltags, alltags)
|
||||
endfo
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
retu g:ctrlp_alltags
|
||||
endf
|
||||
|
||||
fu! ctrlp#tag#accept(mode, str)
|
||||
cal ctrlp#exit()
|
||||
let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t')
|
||||
let [md, tg] = [a:mode, split(str, '^[^\t]\+\zs\t')[0]]
|
||||
let fnd = s:findcount(str)
|
||||
let cmds = {
|
||||
\ 't': ['tab sp', 'tab stj'],
|
||||
\ 'h': ['sp', 'stj'],
|
||||
\ 'v': ['vs', 'vert stj'],
|
||||
\ 'e': ['', 'tj'],
|
||||
\ }
|
||||
let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1]
|
||||
let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd
|
||||
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
|
||||
if fnd[0] == 1
|
||||
if cmd != ''
|
||||
exe cmd
|
||||
en
|
||||
exe fnd[1].'ta' tg
|
||||
el
|
||||
exe cmd tg
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#tag#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
123
bundle/git_ctrlp/autoload/ctrlp/undo.vim
Normal file
123
bundle/git_ctrlp/autoload/ctrlp/undo.vim
Normal file
@@ -0,0 +1,123 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/undo.vim
|
||||
" Description: Undo extension - Browse undo history (requires Vim 7.3.005+)
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" User Configuration {{{1
|
||||
" Enable:
|
||||
" let g:ctrlp_extensions += ['undo']
|
||||
" Create A Command:
|
||||
" com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
"}}}
|
||||
|
||||
" Init {{{1
|
||||
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||
\ || !( v:version > 702 && has('patch005') )
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
let s:undo_var = {
|
||||
\ 'init': 'ctrlp#undo#init(s:undotree)',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
\ 'sname': 'udo',
|
||||
\ 'type': 'line',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var]
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:flatten(tree)
|
||||
let flatdict = {}
|
||||
for each in a:tree
|
||||
cal extend(flatdict, { each['seq'] : each['time'] })
|
||||
if has_key(each, 'alt')
|
||||
cal extend(flatdict, s:flatten(each['alt']))
|
||||
en
|
||||
endfo
|
||||
retu flatdict
|
||||
endf
|
||||
|
||||
fu! s:humantime(nr)
|
||||
let elapsed = localtime() - a:nr
|
||||
let mins = elapsed / 60
|
||||
let hrs = elapsed / 3600
|
||||
let days = elapsed / 86400
|
||||
let wks = elapsed / 604800
|
||||
let mons = elapsed / 2592000
|
||||
let yrs = elapsed / 31536000
|
||||
let text = [
|
||||
\ ' second ago',
|
||||
\ ' seconds ago',
|
||||
\ ' minutes ago',
|
||||
\ ' hours ago',
|
||||
\ ' days ago',
|
||||
\ ' weeks ago',
|
||||
\ ' months ago',
|
||||
\ ' years ago',
|
||||
\ ]
|
||||
if yrs > 1
|
||||
retu yrs.text[7]
|
||||
elsei mons > 1
|
||||
retu mons.text[6]
|
||||
elsei wks > 1
|
||||
retu wks.text[5]
|
||||
elsei days > 1
|
||||
retu days.text[4]
|
||||
elsei hrs > 1
|
||||
retu hrs.text[3]
|
||||
elsei mins > 1
|
||||
retu mins.text[2]
|
||||
elsei elapsed == 1
|
||||
retu elapsed.text[0]
|
||||
elsei elapsed < 120
|
||||
retu elapsed.text[1]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String'})
|
||||
if !hlexists('CtrlPUndo'.ke)
|
||||
exe 'hi link CtrlPUndo'.ke va
|
||||
en
|
||||
endfo
|
||||
sy match CtrlPUndoT '\d\+ \zs[^ ]\+\ze'
|
||||
sy match CtrlPUndoBr '\[\|\]'
|
||||
sy match CtrlPUndoNr '\[\d\+\]$' contains=CtrlPUndoBr
|
||||
endf
|
||||
|
||||
fu! s:dict2list(dict)
|
||||
let dict = map(a:dict, 's:humantime(v:val)')
|
||||
retu map(keys(dict), 'eval(''[v:val, dict[v:val]]'')')
|
||||
endf
|
||||
|
||||
fu! s:compval(...)
|
||||
retu a:2[0] - a:1[0]
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#undo#init(undo)
|
||||
let entries = a:undo['entries']
|
||||
if empty(entries) | retu [] | en
|
||||
cal s:syntax()
|
||||
let g:ctrlp_nolimit = 1
|
||||
let entries = sort(s:dict2list(s:flatten(entries)), 's:compval')
|
||||
retu map(entries, 'v:val[1]." [".v:val[0]."]"')
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#accept(mode, str)
|
||||
let undon = matchstr(a:str, '\[\zs\d\+\ze\]')
|
||||
if empty(undon) | retu | en
|
||||
cal ctrlp#exit()
|
||||
exe 'u' undon
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
75
bundle/git_ctrlp/autoload/ctrlp/utils.vim
Normal file
75
bundle/git_ctrlp/autoload/ctrlp/utils.vim
Normal file
@@ -0,0 +1,75 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/utils.vim
|
||||
" Description: Utilities
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
fu! ctrlp#utils#lash()
|
||||
retu &ssl || !exists('+ssl') ? '/' : '\'
|
||||
endf
|
||||
let s:lash = ctrlp#utils#lash()
|
||||
|
||||
fu! s:lash(...)
|
||||
retu match(a:0 ? a:1 : getcwd(), '[\/]$') < 0 ? s:lash : ''
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#opts()
|
||||
let usrhome = $HOME.s:lash($HOME)
|
||||
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
|
||||
let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
|
||||
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
|
||||
if exists('g:ctrlp_cache_dir')
|
||||
let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
|
||||
if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
|
||||
let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache'
|
||||
en
|
||||
en
|
||||
endf
|
||||
cal ctrlp#utils#opts()
|
||||
" Files and Directories {{{1
|
||||
fu! ctrlp#utils#cachedir()
|
||||
retu s:cache_dir
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#cachefile(...)
|
||||
let tail = a:0 ? '.'.a:1 : ''
|
||||
let cache_file = substitute(getcwd(), '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
||||
retu a:0 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#readfile(file)
|
||||
if filereadable(a:file)
|
||||
let data = readfile(a:file)
|
||||
if empty(data) || type(data) != 3
|
||||
unl data
|
||||
let data = []
|
||||
en
|
||||
retu data
|
||||
en
|
||||
retu []
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#mkdir(dir)
|
||||
if exists('*mkdir') && !isdirectory(a:dir)
|
||||
sil! cal mkdir(a:dir, 'p')
|
||||
en
|
||||
retu a:dir
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#writecache(lines, ...)
|
||||
if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))
|
||||
sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())
|
||||
if !a:0
|
||||
let g:ctrlp_newcache = 0
|
||||
en
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#glob(...)
|
||||
let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
|
||||
retu call('glob', cond ? a:000 : [a:1])
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
860
bundle/git_ctrlp/doc/ctrlp.txt
Normal file
860
bundle/git_ctrlp/doc/ctrlp.txt
Normal file
@@ -0,0 +1,860 @@
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.1
|
||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||
===============================================================================
|
||||
# #
|
||||
# :::::::: ::::::::::: ::::::::: ::: ::::::::: #
|
||||
# :+: :+: :+: :+: :+: :+: :+: :+: #
|
||||
# +:+ +:+ +:+ +:+ +:+ +:+ +:+ #
|
||||
# +#+ +#+ +#++:++#: +#+ +#++:++#+ #
|
||||
# +#+ +#+ +#+ +#+ +#+ +#+ #
|
||||
# #+# #+# #+# #+# #+# #+# #+# #
|
||||
# ######## ### ### ### ########## ### #
|
||||
# #
|
||||
===============================================================================
|
||||
CONTENTS *ctrlp-contents*
|
||||
|
||||
1. Intro........................................|ctrlp-intro|
|
||||
2. Options......................................|ctrlp-options|
|
||||
3. Commands.....................................|ctrlp-commands|
|
||||
4. Mappings.....................................|ctrlp-mappings|
|
||||
5. Input Formats................................|ctrlp-input-formats|
|
||||
6. Extensions...................................|ctrlp-extensions|
|
||||
|
||||
===============================================================================
|
||||
1. Intro *ctrlp-intro*
|
||||
|
||||
Full path fuzzy file, buffer, mru and tag finder with an intuitive interface.
|
||||
Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for
|
||||
Vim’s |regexp| as search pattern, built-in MRU files monitoring, project’s root
|
||||
finder, and more.
|
||||
|
||||
To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.
|
||||
|
||||
===============================================================================
|
||||
2. Options *ctrlp-options*
|
||||
|
||||
Below are the available options and their default values:~
|
||||
|
||||
*'g:ctrlp_map'*
|
||||
Use this option to change the mapping to invoke |CtrlP| in |Normal| mode: >
|
||||
let g:ctrlp_map = '<c-p>'
|
||||
<
|
||||
|
||||
*'g:ctrlp_cmd'*
|
||||
Set the default opening command to use when pressing the above mapping: >
|
||||
let g:ctrlp_cmd = 'CtrlP'
|
||||
<
|
||||
|
||||
*'g:loaded_ctrlp'*
|
||||
Use this to disable the plugin completely: >
|
||||
let g:loaded_ctrlp = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_by_filename'*
|
||||
Set this to 1 to set search by filename (not full path) as the default: >
|
||||
let g:ctrlp_by_filename = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_regexp_search'*
|
||||
Set this to 1 to set |regexp| search as the default: >
|
||||
let g:ctrlp_regexp_search = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_match_window_bottom'*
|
||||
Set this to 0 to show the match window at the top of the screen: >
|
||||
let g:ctrlp_match_window_bottom = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_match_window_reversed'*
|
||||
Change the listing order of the matched files in the match window. The default
|
||||
setting (1) is from bottom to top: >
|
||||
let g:ctrlp_match_window_reversed = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_max_height'*
|
||||
Set the maximum height of the match window: >
|
||||
let g:ctrlp_max_height = 10
|
||||
<
|
||||
|
||||
*'g:ctrlp_jump_to_buffer'*
|
||||
When opening a file with <cr> or <c-t>, if the file's already opened somewhere
|
||||
|CtrlP| will try to jump to it instead of opening a new instance: >
|
||||
let g:ctrlp_jump_to_buffer = 2
|
||||
<
|
||||
1 - only jump to the buffer if it’s opened in the current tab.
|
||||
2 - jump tab as well if the buffer's opened in another tab.
|
||||
0 - disable this feature.
|
||||
|
||||
*'g:ctrlp_working_path_mode'*
|
||||
When starting up, |CtrlP| sets its local working directory according to this
|
||||
variable: >
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
<
|
||||
1 - the parent directory of the current file.
|
||||
2 - the nearest ancestor that contains one of these directories/files:
|
||||
.git/
|
||||
.hg/
|
||||
.bzr/
|
||||
_darcs/
|
||||
root.dir
|
||||
0 - don’t manage working directory.
|
||||
|
||||
*'g:ctrlp_root_markers'*
|
||||
Use this to set your own root markers in addition to the default ones. Your
|
||||
markers will take precedence: >
|
||||
let g:ctrlp_root_markers = ['']
|
||||
<
|
||||
These markers (builtins and yours) will serve as identifiers for the '/' and
|
||||
'\' special inputs (section 5.e).
|
||||
|
||||
*'g:ctrlp_use_caching'*
|
||||
Set this to 0 to disable per-session caching. When disabled, caching will still
|
||||
be enabled for directories that have more than 4000 files: >
|
||||
let g:ctrlp_use_caching = 1
|
||||
<
|
||||
Note: you can quickly purge the cache by pressing <F5> while inside |CtrlP|.
|
||||
|
||||
*'g:ctrlp_clear_cache_on_exit'*
|
||||
Set this to 0 to enable cross-session caching by not deleting the cache files
|
||||
upon exiting Vim: >
|
||||
let g:ctrlp_clear_cache_on_exit = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_cache_dir'*
|
||||
Set the directory to store the cache files: >
|
||||
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
|
||||
<
|
||||
|
||||
*'g:ctrlp_prompt_mappings'*
|
||||
Use this to customize the mappings inside |CtrlP|’s prompt to your liking. You
|
||||
only need to keep the lines that you’ve changed the values (inside []): >
|
||||
let g:ctrlp_prompt_mappings = {
|
||||
\ 'PrtBS()': ['<bs>', '<c-]>'],
|
||||
\ 'PrtDelete()': ['<del>'],
|
||||
\ 'PrtDeleteWord()': ['<c-w>'],
|
||||
\ 'PrtClear()': ['<c-u>'],
|
||||
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
|
||||
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
|
||||
\ 'PrtHistory(-1)': ['<c-n>'],
|
||||
\ 'PrtHistory(1)': ['<c-p>'],
|
||||
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
|
||||
\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
|
||||
\ 'AcceptSelection("t")': ['<c-t>', '<MiddleMouse>'],
|
||||
\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
|
||||
\ 'ToggleFocus()': ['<s-tab>'],
|
||||
\ 'ToggleRegex()': ['<c-r>'],
|
||||
\ 'ToggleByFname()': ['<c-d>'],
|
||||
\ 'ToggleType(1)': ['<c-f>', '<c-up>'],
|
||||
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
|
||||
\ 'PrtExpandDir()': ['<tab>'],
|
||||
\ 'PrtInsert("w")': ['<F2>', '<insert>'],
|
||||
\ 'PrtInsert("s")': ['<F3>'],
|
||||
\ 'PrtInsert("v")': ['<F4>'],
|
||||
\ 'PrtInsert("+")': ['<F6>'],
|
||||
\ 'PrtCurStart()': ['<c-a>'],
|
||||
\ 'PrtCurEnd()': ['<c-e>'],
|
||||
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
|
||||
\ 'PrtCurRight()': ['<c-l>', '<right>'],
|
||||
\ 'PrtClearCache()': ['<F5>'],
|
||||
\ 'PrtDeleteMRU()': ['<F7>'],
|
||||
\ 'CreateNewFile()': ['<c-y>'],
|
||||
\ 'MarkToOpen()': ['<c-z>'],
|
||||
\ 'OpenMulti()': ['<c-o>'],
|
||||
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
|
||||
\ }
|
||||
<
|
||||
Note: In some terminals, it’s not possible to remap <c-h> without also changing
|
||||
<bs> (|key-codes|). So if pressing <bs> moves the cursor to the left instead of
|
||||
deleting a char for you, add this to your |vimrc| to change the default <c-h>
|
||||
mapping: >
|
||||
let g:ctrlp_prompt_mappings = {
|
||||
\ 'PrtBS()': ['<bs>', '<c-]>', '<c-h>'],
|
||||
\ 'PrtCurLeft()': ['<left>', '<c-^>'],
|
||||
\ }
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_max'*
|
||||
Specify the number of recently opened files you want |CtrlP| to remember: >
|
||||
let g:ctrlp_mruf_max = 250
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_exclude'*
|
||||
Files you don’t want |CtrlP| to remember. Use |regexp| to specify the patterns:
|
||||
>
|
||||
let g:ctrlp_mruf_exclude = ''
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
|
||||
let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_include'*
|
||||
And if you want |CtrlP| to only remember some files, specify them here: >
|
||||
let g:ctrlp_mruf_include = ''
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_mruf_include = '\.py$\|\.rb$'
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_relative'*
|
||||
Set this to 1 to show only MRU files in the current working directory: >
|
||||
let g:ctrlp_mruf_relative = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_case_sensitive'*
|
||||
Match this with your file system case-sensitivity setting to avoid duplicate
|
||||
MRU entries: >
|
||||
let g:ctrlp_mruf_case_sensitive = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_last_entered'*
|
||||
Set to 1 to sort the MRU file list to most-recently-entered-buffer order: >
|
||||
let g:ctrlp_mruf_last_entered = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_dotfiles'*
|
||||
Set this to 0 if you don’t want |CtrlP| to search for dotfiles and dotdirs: >
|
||||
let g:ctrlp_dotfiles = 1
|
||||
<
|
||||
You can use |'wildignore'| to exclude anything from the search.
|
||||
Examples: >
|
||||
" Excluding version control directories
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
|
||||
set wildignore+=.git\*,.hg\*,.svn\* " Windows
|
||||
<
|
||||
Note #1: the `*/` in front of each directory glob is required.
|
||||
|
||||
Note #2: |wildignore| influences the result of |expand()|, |globpath()| and
|
||||
|glob()| which many plugins use to find stuff on the system (e.g. fugitive.vim
|
||||
looks for .git/, some other plugins look for external .exe tools on Windows).
|
||||
So be a little mindful of what you put in your |wildignore|.
|
||||
|
||||
*'g:ctrlp_custom_ignore'*
|
||||
In addition to |'wildignore'|, use this for files and directories you want only
|
||||
|CtrlP| to not show. Use |regexp| to specify the patterns: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\.git$\|\.hg$\|\.svn$',
|
||||
\ 'file': '\.exe$\|\.so$\|\.dll$',
|
||||
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
||||
\ }
|
||||
<
|
||||
|
||||
*'g:ctrlp_highlight_match'*
|
||||
Use this to enable/disable highlighting of the matched patterns and to specify
|
||||
the highlight group that’ll be used: >
|
||||
let g:ctrlp_highlight_match = [1, 'Identifier']
|
||||
<
|
||||
|
||||
*'g:ctrlp_max_files'*
|
||||
The maximum number of files to scan, set to 0 for no limit: >
|
||||
let g:ctrlp_max_files = 10000
|
||||
<
|
||||
|
||||
*'g:ctrlp_max_depth'*
|
||||
The maximum depth of a directory tree to recurse into: >
|
||||
let g:ctrlp_max_depth = 40
|
||||
<
|
||||
Note: the larger these values, the more memory Vim uses.
|
||||
|
||||
*'g:ctrlp_user_command'*
|
||||
Specify an external tool to use for listing files instead of using Vim’s
|
||||
|globpath()|. Use %s in place of the target directory: >
|
||||
let g:ctrlp_user_command = ''
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
||||
<
|
||||
You can also use 'grep', 'findstr' or something else to filter the results.
|
||||
Examples: >
|
||||
let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)'
|
||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$'
|
||||
<
|
||||
Use a version control listing command when inside a repository, this is faster
|
||||
when scanning large projects: >
|
||||
let g:ctrlp_user_command = [root_marker, listing_command, fallback_command]
|
||||
let g:ctrlp_user_command = {
|
||||
\ 'types': {
|
||||
\ 1: [root_marker_1, listing_command_1],
|
||||
\ n: [root_marker_n, listing_command_n],
|
||||
\ },
|
||||
\ 'fallback': fallback_command
|
||||
\ }
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files']
|
||||
let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate -I .']
|
||||
let g:ctrlp_user_command = {
|
||||
\ 'types': {
|
||||
\ 1: ['.git/', 'cd %s && git ls-files'],
|
||||
\ 2: ['.hg/', 'hg --cwd %s locate -I .'],
|
||||
\ },
|
||||
\ 'fallback': 'find %s -type f'
|
||||
\ }
|
||||
<
|
||||
If the fallback_command is empty or not defined, |globpath()| will then be used
|
||||
when searching outside a repo.
|
||||
|
||||
*'g:ctrlp_max_history'*
|
||||
The maximum number of input strings you want |CtrlP| to remember. The default
|
||||
value mirrors Vim’s global |'history'| option: >
|
||||
let g:ctrlp_max_history = &history
|
||||
<
|
||||
Set to 0 to disable prompt’s history. Browse the history with <c-n> and <c-p>.
|
||||
|
||||
*'g:ctrlp_open_new_file'*
|
||||
Use this option to specify how the newly created file is to be opened when
|
||||
pressing <c-y>:
|
||||
t - in a new tab
|
||||
h - in a new horizontal split
|
||||
v - in a new vertical split
|
||||
r - in the current window
|
||||
>
|
||||
let g:ctrlp_open_new_file = 'v'
|
||||
<
|
||||
|
||||
*'g:ctrlp_open_multi'*
|
||||
If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
|
||||
let g:ctrlp_open_multi = '1v'
|
||||
<
|
||||
For the number:
|
||||
- If bigger than 1, it’ll be used as the maximum number of windows or tabs to
|
||||
create when opening the files (the rest will be hidden buffers).
|
||||
- If is 1, <c-o> will open all files, each in a new window or new tab.
|
||||
- If no number is given, only the first file will be opened in a window,
|
||||
either new window or reused, and the rest will be hidden buffers.
|
||||
For the letters:
|
||||
t - each in a new tab
|
||||
h - each in a new horizontal split
|
||||
v - each in a new vertical split
|
||||
Reuse the current window:
|
||||
tr,
|
||||
hr,
|
||||
vr - open the first file in the current window, then the remaining files in
|
||||
new splits or new tabs just like with t, h, v.
|
||||
|
||||
*'g:ctrlp_arg_map'*
|
||||
When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
|
||||
as an argument to override their default behavior: >
|
||||
let g:ctrlp_arg_map = 0
|
||||
<
|
||||
Pressing <c-o> or <c-y> will then prompt for a keypress. The key can be:
|
||||
t - open in tab(s)
|
||||
h - open in horizontal split(s)
|
||||
v - open in vertical split(s)
|
||||
r - open in current window (for <c-y> only)
|
||||
<esc>, <c-c> - cancel and go back to the prompt.
|
||||
Any other key - use the behavior specified with |g:ctrlp_open_new_file| and
|
||||
|g:ctrlp_open_multi|.
|
||||
|
||||
*'g:ctrlp_dont_split'*
|
||||
When opening a file with <cr>, |CtrlP| avoids opening it in windows created by
|
||||
plugins, help and quickfix. Use this to setup some exceptions: >
|
||||
let g:ctrlp_dont_split = 'netrw'
|
||||
<
|
||||
Acceptable values are partial names or filetypes of the special buffers. Use
|
||||
|regexp| to specify the pattern. Example: >
|
||||
let g:ctrlp_dont_split = 'netrw\|help\|quickfix'
|
||||
<
|
||||
|
||||
*'g:ctrlp_follow_symlinks'*
|
||||
Set this to 1 to follow symbolic links when listing files: >
|
||||
let g:ctrlp_follow_symlinks = 0
|
||||
<
|
||||
When enabled, looped internal symlinks will be ignored to avoid duplicates.
|
||||
|
||||
*'g:ctrlp_lazy_update'*
|
||||
Set this to 1 to enable the lazy-update feature: only update the match window
|
||||
after typing’s been stopped for a certain amount of time: >
|
||||
let g:ctrlp_lazy_update = 0
|
||||
<
|
||||
If is 1, update after 250ms. If bigger than 1, the number will be used as the
|
||||
delay time in milliseconds.
|
||||
|
||||
*'g:ctrlp_use_migemo'*
|
||||
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
|
||||
works in |regexp| mode. To split the pattern, separate words with space: >
|
||||
let g:ctrlp_use_migemo = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_status_func'*
|
||||
Use this to customize the statuslines for the |CtrlP| window: >
|
||||
let g:ctrlp_status_func = {}
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_status_func = {
|
||||
\ 'main': 'Function_Name_1',
|
||||
\ 'prog': 'Function_Name_2',
|
||||
\ }
|
||||
<
|
||||
See https://gist.github.com/1610859 for a working example.
|
||||
|
||||
===============================================================================
|
||||
3. Commands *ctrlp-commands*
|
||||
|
||||
*:CtrlP*
|
||||
:CtrlP [starting-directory]
|
||||
Open |CtrlP| in find file mode.
|
||||
|
||||
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
|
||||
used to determine the starting directory.
|
||||
You can use <tab> to auto-complete the [starting-directory] when typing it.
|
||||
|
||||
*:CtrlPBuffer*
|
||||
:CtrlPBuffer
|
||||
Open |CtrlP| in find buffer mode.
|
||||
|
||||
*:CtrlPMRU*
|
||||
:CtrlPMRU
|
||||
Open |CtrlP| in find Most-Recently-Used file mode.
|
||||
|
||||
*:ClearCtrlPCache*
|
||||
:ClearCtrlPCache
|
||||
Flush the cache for the current working directory. The same as pressing <F5>
|
||||
inside |CtrlP|.
|
||||
You can also enable/disable caching with the option |g:ctrlp_use_caching|.
|
||||
|
||||
*:ClearAllCtrlPCaches*
|
||||
:ClearAllCtrlPCaches
|
||||
Delete all the cache files saved in |g:ctrlp_cache_dir|.
|
||||
|
||||
*:ResetCtrlP*
|
||||
:ResetCtrlP
|
||||
Reset all options and take in new values of the option variables.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The following commands ignore the current value of |g:ctrlp_working_path_mode|:
|
||||
|
||||
:CtrlPCurWD *:CtrlPCurWD*
|
||||
This acts like |:CtrlP| with |path_mode| = 0
|
||||
|
||||
:CtrlPCurFile *:CtrlPCurFile*
|
||||
This acts like |:CtrlP| with |path_mode| = 1
|
||||
|
||||
:CtrlPRoot *:CtrlPRoot*
|
||||
This acts like |:CtrlP| with |path_mode| = 2
|
||||
|
||||
===============================================================================
|
||||
4. Mappings *ctrlp-mappings*
|
||||
|
||||
*'ctrlp-<c-p>'*
|
||||
<c-p>
|
||||
Default |Normal| mode mapping to open the |CtrlP| prompt in find file mode.
|
||||
|
||||
Once inside the prompt:~
|
||||
|
||||
<c-r> *'ctrlp-fullregexp'*
|
||||
Toggle between the string mode (section 5.a & b) and full |regexp| mode.
|
||||
(note: in full |regexp| mode, the prompt’s base is 'r>>' instead of '>>>')
|
||||
|
||||
See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
|
||||
|
||||
<c-d>
|
||||
Toggle between full-path search and filename only search.
|
||||
(note: in filename mode, the prompt’s base is '>d>' instead of '>>>')
|
||||
|
||||
<c-f>, 'forward'
|
||||
<c-up>
|
||||
Scroll to the 'next' search mode in the sequence.
|
||||
|
||||
<c-b>, 'backward'
|
||||
<c-down>
|
||||
Scroll to the 'previous' search mode in the sequence.
|
||||
|
||||
<tab>
|
||||
Auto-complete directory names under the current working directory inside
|
||||
the prompt.
|
||||
|
||||
<s-tab>
|
||||
Toggle the focus between the match window and the prompt.
|
||||
|
||||
<c-j>,
|
||||
<down>
|
||||
Move selection down.
|
||||
|
||||
<c-k>,
|
||||
<up>
|
||||
Move selection up.
|
||||
|
||||
<c-a>
|
||||
Move the cursor to the 'start' of the prompt.
|
||||
|
||||
<c-e>
|
||||
Move the cursor to the 'end' of the prompt.
|
||||
|
||||
<c-h>,
|
||||
<left>,
|
||||
<c-^>
|
||||
Move the cursor one character to the 'left'.
|
||||
|
||||
<c-l>,
|
||||
<right>
|
||||
Move the cursor one character to the 'right'.
|
||||
|
||||
<c-]>,
|
||||
<bs>
|
||||
Delete the preceding character.
|
||||
|
||||
<del>
|
||||
Delete the current character.
|
||||
|
||||
<c-w>
|
||||
Delete a preceding inner word.
|
||||
|
||||
<c-u>
|
||||
Clear the input field.
|
||||
|
||||
<cr>
|
||||
Open selected file in the active window if possible.
|
||||
|
||||
<c-t>
|
||||
Open selected file in a new 'tab' after the last tabpage.
|
||||
|
||||
<c-v>
|
||||
Open selected file in a 'vertical' split.
|
||||
|
||||
<c-cr>,
|
||||
<c-s>,
|
||||
<c-x>
|
||||
Open selected file in a 'horizontal' split.
|
||||
|
||||
<c-y>
|
||||
Create a new file and its parent directories.
|
||||
|
||||
<c-n>
|
||||
Next string in the prompt’s history.
|
||||
|
||||
<c-p>
|
||||
Previous string in the prompt’s history.
|
||||
|
||||
<c-z>
|
||||
- Mark/unmark a file to be opened with <c-o>.
|
||||
- Mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
|
||||
<c-o>
|
||||
Open files marked by <c-z>.
|
||||
|
||||
<F5>
|
||||
- Refresh the match window and purge the cache for the current directory.
|
||||
- Remove deleted files from MRU list.
|
||||
|
||||
<F7>
|
||||
Clear MRU list.
|
||||
|
||||
<insert>
|
||||
Insert the word under the cursor (in the active buffer) into the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>,
|
||||
<c-g>
|
||||
Exit |CtrlP|.
|
||||
<c-c> can also be used to stop the scan if it’s taking too long.
|
||||
|
||||
Choose your own mappings with |g:ctrlp_prompt_mappings|.
|
||||
|
||||
When inside the match window (press <s-tab> to switch):~
|
||||
|
||||
a-z
|
||||
0-9
|
||||
~^-=;`',.+!@#$%&_(){}[]
|
||||
Cycle through the lines with the first letter (of paths or filenames) that
|
||||
matches that key.
|
||||
|
||||
===============================================================================
|
||||
5. Input Formats *ctrlp-input-formats*
|
||||
|
||||
Formats for inputting in the prompt:~
|
||||
|
||||
a) Simple string.
|
||||
e.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
|
||||
|
||||
b) Vim |regexp|. If the input string contains '*' or '|', it’ll be treated as
|
||||
a Vim’s |regexp| |pattern| without any modification.
|
||||
e.g. 'abc\d*efg' will be read as 'abc\d*efg'.
|
||||
|
||||
See also |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option).
|
||||
|
||||
c) End the string with a colon ':' followed by a Vim command to execute that
|
||||
command after opening the file. If you need to use ':' literally, escape it
|
||||
with a backslash: '\:'. When opening multiple files, the command will be
|
||||
executed on each opening file.
|
||||
e.g. 'abc:45' will open the selected file and jump to line 45.
|
||||
'abc:/my\:string' will open the selected file and jump to the first
|
||||
instance of 'my:function'.
|
||||
'abc:+setf\ myfiletype|50' will open the selected file and set its
|
||||
filetype to 'myfiletype', then jump to line 50.
|
||||
'abc:diffthis' will open the selected file and run |:diffthis| on the
|
||||
first 4 files.
|
||||
|
||||
See also Vim’s |++opt| and |+cmd|.
|
||||
|
||||
d) Type exactly two dots '..' at the start of the prompt and press enter to go
|
||||
backward in the directory tree by 1 level. If the parent directory is
|
||||
large, this might be slow.
|
||||
|
||||
e) Similarly, submit '/' or '\' to find and go to the project’s root. If the
|
||||
project is large, using a VCS listing command to look for files might help
|
||||
speeding up the intial scan (see |g:ctrlp_user_command| for more details).
|
||||
|
||||
f) Type the name of a non-existent file and press <c-y> to create it. Mark a
|
||||
file with <c-z> to create the new file in the same directory as the marked
|
||||
file.
|
||||
e.g. 'parentdir/newfile.txt' will create a directory named 'parentdir' as
|
||||
well as 'newfile.txt'.
|
||||
If 'some/old/dirs/oldfile.txt' is marked with <c-z>, then 'parentdir'
|
||||
and 'newfile.txt' will be created in 'some/old/dirs'. The final path
|
||||
will then be 'some/old/dirs/parentdir/newfile.txt'.
|
||||
Use '\' in place of '/' on Windows (if |'ssl'| is not set).
|
||||
|
||||
g) Submit ? to open this help file.
|
||||
|
||||
===============================================================================
|
||||
6. Extensions *g:ctrlp-extensions*
|
||||
|
||||
Extensions are optional. To enable an extension, add its name to the variable
|
||||
g:ctrlp_extensions: >
|
||||
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript']
|
||||
<
|
||||
The order of the items will be the order they appear on the statusline and when
|
||||
using <c-f>, <c-b>.
|
||||
|
||||
Available extensions:~
|
||||
|
||||
*:CtrlPTag*
|
||||
* Tag mode:~
|
||||
- Name: 'tag'
|
||||
- Command: ':CtrlPTag'
|
||||
- Search for a tag within a generated central tags file, and jump to the
|
||||
definition. Use the Vim’s option |'tags'| to specify the names and the
|
||||
locations of the tags file(s). Example: `set tags+=tags/help,doc/tags`
|
||||
|
||||
*:CtrlPBufTag*
|
||||
*:CtrlPBufTagAll*
|
||||
* Buffer Tag mode:~
|
||||
- Name: 'buffertag'
|
||||
- Commands: ':CtrlPBufTag [buffer-name]',
|
||||
':CtrlPBufTagAll'.
|
||||
- Search for a tag within the current buffer or all buffers and jump to the
|
||||
definition. Requires |exuberant_ctags| or compatible programs.
|
||||
|
||||
*:CtrlPQuickfix*
|
||||
* Quickfix mode:~
|
||||
- Name: 'quickfix'
|
||||
- Command: ':CtrlPQuickfix'
|
||||
- Search for an entry in the current quickfix errors and jump to it.
|
||||
|
||||
*:CtrlPDir*
|
||||
* Directory mode:~
|
||||
- Name: 'dir'
|
||||
- Command: ':CtrlPDir [starting-directory]'
|
||||
- Search for a directory and change the working directory to it.
|
||||
- Mappings:
|
||||
+ <cr> change the local working directory for |CtrlP| and keep it open.
|
||||
+ <c-t> change the global working directory (exit).
|
||||
+ <c-v> change the local working directory for the current window (exit).
|
||||
+ <c-x> change the global working directory to |CtrlP|’s current local
|
||||
working directory (exit).
|
||||
|
||||
*:CtrlPRTS*
|
||||
* Runtime script mode:~
|
||||
- Name: 'rtscript'
|
||||
- Command: ':CtrlPRTS'
|
||||
- Search for files (vimscripts, docs, snippets...) in runtimepath.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Buffer Tag mode options:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
If ctags isn’t in your $PATH, use this to set its location: >
|
||||
let g:ctrlp_buftag_ctags_bin = ''
|
||||
<
|
||||
|
||||
*'g:ctrlp_buftag_systemenc'*
|
||||
Match this with your OS’s encoding (not Vim’s). The default value mirrors Vim’s
|
||||
global |'encoding'| option: >
|
||||
let g:ctrlp_buftag_systemenc = &encoding
|
||||
<
|
||||
|
||||
*'g:ctrlp_buftag_types'*
|
||||
Use this to set the arguments for ctags, jsctags... for a given filetype: >
|
||||
let g:ctrlp_buftag_types = ''
|
||||
<
|
||||
Examples: >
|
||||
let g:ctrlp_buftag_types = {
|
||||
\ 'erlang' : '--language-force=erlang --erlang-types=drmf',
|
||||
\ 'javascript' : {
|
||||
\ 'bin': 'jsctags',
|
||||
\ 'args': '-f -',
|
||||
\ },
|
||||
\ }
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
CUSTOMIZATION *ctrlp-customization*
|
||||
|
||||
Highlighting:~
|
||||
* For the |CtrlP| buffer:
|
||||
CtrlPNoEntries : the message when no match is found (Error)
|
||||
CtrlPMatch : the matched pattern (Identifier)
|
||||
CtrlPLinePre : the line prefix '>' in the match window
|
||||
CtrlPPrtBase : the prompt’s base (Comment)
|
||||
CtrlPPrtText : the prompt’s text (|hl-Normal|)
|
||||
CtrlPPrtCursor : the prompt’s cursor when moving over the text (Constant)
|
||||
|
||||
* In extensions:
|
||||
CtrlPTabExtra : the part of each line that’s not matched against (Comment)
|
||||
CtrlPqfLineCol : the line and column numbers in quickfix mode (|hl-Search|)
|
||||
CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|)
|
||||
CtrlPUndoBr : the square brackets [] in undo mode (Comment)
|
||||
CtrlPUndoNr : the undo number inside [] in undo mode (String)
|
||||
|
||||
Statuslines:~
|
||||
* Highlight groups:
|
||||
CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character)
|
||||
CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|)
|
||||
CtrlPStats : the scanning status (Function)
|
||||
|
||||
For rebuilding the statuslines, see |g:ctrlp_status_func|.
|
||||
|
||||
===============================================================================
|
||||
CREDITS *ctrlp-credits*
|
||||
|
||||
Developed by Kien Nguyen <github.com/kien>.
|
||||
|
||||
Project’s homepage: http://kien.github.com/ctrlp.vim
|
||||
Git repository: https://github.com/kien/ctrlp.vim
|
||||
Mercurial repository: https://bitbucket.org/kien/ctrlp.vim
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Thanks to everyone that has submitted ideas, bug reports or helped debugging on
|
||||
gibhub, bitbucket, and through email.
|
||||
|
||||
Special thanks:~
|
||||
|
||||
* Woojong Koh <github.com/wjkoh>
|
||||
Forked and suggested the support for VCS listing commands.
|
||||
|
||||
* Yasuhiro Matsumoto <github.com/mattn>
|
||||
Added option to use Migemo for Japanese filenames.
|
||||
|
||||
* Kyo Nagashima <github.com/hail2u>
|
||||
Made some enhancements to file opening mappings.
|
||||
|
||||
* Piet Delport <github.com/pjdelport>
|
||||
Changed the default cache directory to meet XDG spec.
|
||||
|
||||
* Kent Sibilev <github.com/datanoise>
|
||||
Debugged and made various patches.
|
||||
|
||||
* Simon Ruderich
|
||||
* Ken Earley <github.com/kenearley>
|
||||
* Zak Johnson <github.com/zakj>
|
||||
* Diego Viola <github.com/diegoviola>
|
||||
* Thibault Duplessis <github.com/ornicar>
|
||||
* Tacahiroy <github.com/tacahiroy>
|
||||
Bugfixes/Corrections.
|
||||
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
+ New option: |g:ctrlp_mruf_last_entered| change MRU to recently-entered.
|
||||
|
||||
Before 2012/01/15~
|
||||
|
||||
+ New mapping: Switch <tab> and <s-tab>. <tab> is now used for completion
|
||||
of directory names under the current working directory.
|
||||
+ New options: |g:ctrlp_arg_map| for <c-y>, <c-o> to accept an argument.
|
||||
|g:ctrlp_status_func| custom statusline.
|
||||
|g:ctrlp_mruf_relative| show only MRU files inside cwd.
|
||||
+ Extend |g:ctrlp_open_multi| with new optional values: tr, hr, vr.
|
||||
+ Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link.
|
||||
|
||||
Before 2012/01/05~
|
||||
|
||||
+ New feature: Buffer Tag extension.
|
||||
+ New commands: |:CtrlPBufTag|, |:CtrlPBufTagAll|.
|
||||
+ New options: |g:ctrlp_cmd|,
|
||||
|g:ctrlp_custom_ignore|
|
||||
|
||||
Before 2011/11/30~
|
||||
|
||||
+ New features: Tag, Quickfix and Directory extensions.
|
||||
+ New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|.
|
||||
+ New options: |g:ctrlp_use_migemo|,
|
||||
|g:ctrlp_lazy_update|,
|
||||
|g:ctrlp_follow_symlinks|
|
||||
|
||||
Before 2011/11/13~
|
||||
|
||||
+ New special input: '/' and '\' find root (section 5.e)
|
||||
+ Remove ctrlp#SetWorkingPath().
|
||||
+ Remove |g:ctrlp_mru_files|, make MRU permanent.
|
||||
+ Extend |g:ctrlp_open_multi|, add new ways to open files.
|
||||
+ New option: |g:ctrlp_dont_split|,
|
||||
|g:ctrlp_mruf_case_sensitive|
|
||||
|
||||
Before 2011/10/30~
|
||||
|
||||
+ New feature: Support for custom extensions.
|
||||
<F5> also removes non-existent files from MRU list.
|
||||
+ New option: |g:ctrlp_jump_to_buffer|
|
||||
|
||||
Before 2011/10/12~
|
||||
|
||||
+ New features: Open multiple files.
|
||||
Pass Vim’s |++opt| and |+cmd| to the opening file
|
||||
(section 5.c)
|
||||
Auto-complete each dir for |:CtrlP| [starting-directory]
|
||||
+ New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
|
||||
<c-o> open all marked files.
|
||||
+ New option: |g:ctrlp_open_multi|
|
||||
+ Remove |g:ctrlp_persistent_input|, |g:ctrlp_live_update| and <c-^>.
|
||||
|
||||
Before 2011/09/29~
|
||||
|
||||
+ New mappings: <c-n>, <c-p> next/prev string in the input history.
|
||||
<c-y> create a new file and its parent dirs.
|
||||
+ New options: |g:ctrlp_open_new_file|,
|
||||
|g:ctrlp_max_history|
|
||||
+ Added a new open-in-horizontal-split mapping: <c-x>
|
||||
|
||||
Before 2011/09/19~
|
||||
|
||||
+ New command: |ResetCtrlP|
|
||||
+ New options: |g:ctrlp_max_files|,
|
||||
|g:ctrlp_max_depth|,
|
||||
|g:ctrlp_live_update|
|
||||
+ New mapping: <c-^>
|
||||
|
||||
Before 2011/09/12~
|
||||
|
||||
+ Ability to cycle through matched lines in the match window.
|
||||
+ Extend the behavior of |g:ctrlp_persistent_input|
|
||||
+ Extend the behavior of |:CtrlP|
|
||||
+ New options: |g:ctrlp_dotfiles|,
|
||||
|g:ctrlp_clear_cache_on_exit|,
|
||||
|g:ctrlp_highlight_match|,
|
||||
|g:ctrlp_user_command|
|
||||
+ New special input: '..' (section 5.d)
|
||||
+ New mapping: <F5>.
|
||||
+ New commands: |:CtrlPCurWD|,
|
||||
|:CtrlPCurFile|,
|
||||
|:CtrlPRoot|
|
||||
|
||||
+ New feature: Search in most recently used (MRU) files
|
||||
+ New mapping: <c-b>.
|
||||
+ Extended the behavior of <c-f>.
|
||||
+ New options: |g:ctrlp_mru_files|,
|
||||
|g:ctrlp_mruf_max|,
|
||||
|g:ctrlp_mruf_exclude|,
|
||||
|g:ctrlp_mruf_include|
|
||||
+ New command: |:CtrlPMRUFiles|
|
||||
|
||||
First public release: 2011/09/06~
|
||||
|
||||
===============================================================================
|
||||
vim:ft=help:et:ts=2:sw=2:sts=2:norl
|
||||
64
bundle/git_ctrlp/plugin/ctrlp.vim
Normal file
64
bundle/git_ctrlp/plugin/ctrlp.vim
Normal file
@@ -0,0 +1,64 @@
|
||||
" =============================================================================
|
||||
" File: plugin/ctrlp.vim
|
||||
" Description: Fuzzy file, buffer, mru and tag finder.
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
|
||||
|
||||
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp, g:ctrlp_lines, g:ctrlp_allfiles] = [1, [], []]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
|
||||
com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
|
||||
|
||||
com! CtrlPBuffer cal ctrlp#init(1)
|
||||
com! CtrlPMRUFiles cal ctrlp#init(2)
|
||||
|
||||
com! ClearCtrlPCache cal ctrlp#clr()
|
||||
com! ClearAllCtrlPCaches cal ctrlp#clra()
|
||||
com! ResetCtrlP cal ctrlp#reset()
|
||||
|
||||
com! CtrlPCurWD cal ctrlp#init(0, 0)
|
||||
com! CtrlPCurFile cal ctrlp#init(0, 1)
|
||||
com! CtrlPRoot cal ctrlp#init(0, 2)
|
||||
|
||||
if g:ctrlp_map != ''
|
||||
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
|
||||
en
|
||||
|
||||
cal ctrlp#mrufiles#init()
|
||||
|
||||
if !exists('g:ctrlp_extensions') | fini | en
|
||||
|
||||
let s:ext = g:ctrlp_extensions
|
||||
|
||||
if index(s:ext, 'tag') >= 0
|
||||
let g:ctrlp_alltags = []
|
||||
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
en
|
||||
|
||||
if index(s:ext, 'quickfix') >= 0
|
||||
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
en
|
||||
|
||||
if index(s:ext, 'dir') >= 0
|
||||
let g:ctrlp_alldirs = []
|
||||
com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), <q-args>)
|
||||
en
|
||||
|
||||
if index(s:ext, 'buffertag') >= 0
|
||||
let g:ctrlp_buftags = {}
|
||||
com! -n=? -com=buffer CtrlPBufTag
|
||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
||||
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
en
|
||||
|
||||
if index(s:ext, 'rtscript') >= 0
|
||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
en
|
||||
|
||||
unl s:ext
|
||||
79
bundle/git_ctrlp/readme.md
Normal file
79
bundle/git_ctrlp/readme.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# ctrlp.vim
|
||||
Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim.
|
||||
|
||||
* Written in pure Vimscript for MacVim and Vim 7.0+.
|
||||
* Full support for Vim’s regexp as search pattern.
|
||||
* Built-in Most Recently Used (MRU) files monitoring.
|
||||
* Built-in project’s root finder.
|
||||
* Open Multiple Files.
|
||||
* [Extensible][3].
|
||||
|
||||
![ctrlp][1]
|
||||
|
||||
## Basic Usage
|
||||
* Press `<c-p>` or run `:CtrlP` to invoke CtrlP in find file mode.
|
||||
* Or run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in buffer or MRU mode.
|
||||
|
||||
Once CtrlP is open:
|
||||
|
||||
* Press `<c-f>` and `<c-b>` to switch between find file, buffer, and MRU file modes.
|
||||
* Press `<c-d>` to switch to filename only search instead of full path.
|
||||
* Press `<F5>` to purge the cache for the current directory and get new files.
|
||||
* Use `*` or `|` in the prompt to submit the string as a Vim’s regexp pattern.
|
||||
* Or press `<c-r>` to switch to regexp mode.
|
||||
* End the input string with a colon `:` followed by a command to execute after opening the file.
|
||||
e.g. `abc:45` will open the file matched the pattern and jump to line 45.
|
||||
* Submit two dots `..` as the input string to go backward the directory tree by 1 level.
|
||||
* Use `<c-y>` to create a new file and its parent dirs.
|
||||
* Use `<c-z>` to mark/unmark files and `<c-o>` to open them.
|
||||
|
||||
## Basic Options
|
||||
* Change the mapping to invoke CtrlP:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_map = '<c-p>'
|
||||
```
|
||||
|
||||
* When CtrlP is invoked, it automatically sets the working directory according to this variable:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
```
|
||||
|
||||
0 - don’t manage working directory.
|
||||
1 - the parent directory of the current file.
|
||||
2 - the nearest ancestor that contains one of these directories or files:
|
||||
|
||||
.git/
|
||||
.hg/
|
||||
.bzr/
|
||||
_darcs/
|
||||
root.dir
|
||||
|
||||
* If you want to exclude directories or files from the search, you can use the Vim’s option `wildignore`
|
||||
and/or the option `g:ctrlp_custom_ignore`. Examples:
|
||||
|
||||
```vim
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " for Linux/MacOSX
|
||||
set wildignore+=.git\*,.hg\*,.svn\* " for Windows
|
||||
|
||||
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\.git$\|\.hg$\|\.svn$',
|
||||
\ 'file': '\.exe$\|\.so$\|\.dll$',
|
||||
\ 'link': 'some_bad_symbolic_links',
|
||||
\ }
|
||||
```
|
||||
|
||||
* Use a custom file listing command with:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
||||
```
|
||||
|
||||
_Check [the docs][2] for more mappings, commands and options._
|
||||
|
||||
[1]: http://i.imgur.com/yIynr.png
|
||||
[2]: https://github.com/kien/ctrlp.vim/blob/master/doc/ctrlp.txt
|
||||
[3]: https://github.com/kien/ctrlp.vim/tree/extensions
|
||||
Reference in New Issue
Block a user