mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 03:50:30 +01:00
Update of plugins (vimwiki, ctrlp, syntastic, tagbar, gundo and mark),
added draft syntax file for kickassembler
This commit is contained in:
File diff suppressed because it is too large
Load Diff
140
bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim
Normal file
140
bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim
Normal file
@@ -0,0 +1,140 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/bookmarkdir.vim
|
||||
" Description: Bookmarked directories extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_bookmarkdir = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#bookmarkdir#init()',
|
||||
\ 'accept': 'ctrlp#bookmarkdir#accept',
|
||||
\ 'lname': 'bookmarked dirs',
|
||||
\ 'sname': 'bkd',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opmul': 1,
|
||||
\ 'nolim': 1,
|
||||
\ 'wipe': 'ctrlp#bookmarkdir#remove',
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:getinput(str, ...)
|
||||
echoh Identifier
|
||||
cal inputsave()
|
||||
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
|
||||
cal inputrestore()
|
||||
echoh None
|
||||
retu input
|
||||
endf
|
||||
|
||||
fu! s:cachefile()
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
retu s:cafile
|
||||
endf
|
||||
|
||||
fu! s:writecache(lines)
|
||||
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
|
||||
endf
|
||||
|
||||
fu! s:getbookmarks()
|
||||
retu ctrlp#utils#readfile(s:cachefile())
|
||||
endf
|
||||
|
||||
fu! s:savebookmark(name, cwd)
|
||||
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
|
||||
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
|
||||
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
||||
endf
|
||||
|
||||
fu! s:setentries()
|
||||
let time = getftime(s:cachefile())
|
||||
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
|
||||
let s:bookmarks = [time, s:getbookmarks()]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:parts(str)
|
||||
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
|
||||
retu mlist != [] ? mlist[1:2] : ['', '']
|
||||
endf
|
||||
|
||||
fu! s:process(entries, type)
|
||||
retu map(a:entries, 's:modify(v:val, a:type)')
|
||||
endf
|
||||
|
||||
fu! s:modify(entry, type)
|
||||
let [name, dir] = s:parts(a:entry)
|
||||
let dir = fnamemodify(dir, a:type)
|
||||
retu name.' '.( dir == '' ? '.' : dir )
|
||||
endf
|
||||
|
||||
fu! s:msg(name, cwd)
|
||||
redr
|
||||
echoh Identifier | echon 'Bookmarked ' | echoh Constant
|
||||
echon a:name.' ' | echoh Directory | echon a:cwd
|
||||
echoh None
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#bookmarkdir#init()
|
||||
cal s:setentries()
|
||||
cal s:syntax()
|
||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#accept(mode, str)
|
||||
let parts = s:parts(s:modify(a:str, ':p'))
|
||||
cal call('s:savebookmark', parts)
|
||||
if a:mode =~ 't\|v\|h'
|
||||
cal ctrlp#exit()
|
||||
en
|
||||
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
||||
if a:mode == 'e'
|
||||
cal ctrlp#switchtype(0)
|
||||
cal ctrlp#recordhist()
|
||||
cal ctrlp#prtclear()
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#add(dir)
|
||||
let str = 'Directory to bookmark: '
|
||||
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
|
||||
if cwd == '' | retu | en
|
||||
let cwd = fnamemodify(cwd, ':p')
|
||||
let name = s:getinput('Bookmark as: ', cwd)
|
||||
if name == '' | retu | en
|
||||
let name = tr(name, ' ', ' ')
|
||||
cal s:savebookmark(name, cwd)
|
||||
cal s:msg(name, cwd)
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#remove(entries)
|
||||
cal s:process(a:entries, ':p')
|
||||
cal s:writecache(a:entries == [] ? [] :
|
||||
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
|
||||
cal s:setentries()
|
||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
@@ -13,7 +13,7 @@ if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
||||
en
|
||||
let g:loaded_ctrlp_buftag = 1
|
||||
|
||||
let s:buftag_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
||||
\ 'accept': 'ctrlp#buffertag#accept',
|
||||
\ 'lname': 'buffer tags',
|
||||
@@ -21,48 +21,27 @@ let s:buftag_var = {
|
||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opts': 'ctrlp#buffertag#opts()',
|
||||
\ }
|
||||
|
||||
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! ctrlp#buffertag#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 ctrlp#buffertag#opts()
|
||||
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
|
||||
\ 'systemenc': ['s:enc', &enc],
|
||||
\ 'ctags_bin': ['s:bin', ''],
|
||||
\ 'types': ['s:usr_types', {}],
|
||||
\ }]
|
||||
|
||||
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()
|
||||
let s:bins = [
|
||||
\ 'ctags-exuberant',
|
||||
\ 'exuberant-ctags',
|
||||
\ 'exctags',
|
||||
\ '/usr/local/bin/ctags',
|
||||
\ '/opt/local/bin/ctags',
|
||||
\ 'ctags',
|
||||
\ 'ctags.exe',
|
||||
\ 'tags',
|
||||
\ ]
|
||||
|
||||
" s:types {{{2
|
||||
let s:types = {
|
||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
||||
@@ -109,9 +88,22 @@ if executable('jsctags')
|
||||
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
||||
en
|
||||
|
||||
if type(s:usr_types) == 4
|
||||
fu! ctrlp#buffertag#opts()
|
||||
for [ke, va] in items(s:opts)
|
||||
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
|
||||
endfo
|
||||
" Ctags bin
|
||||
if empty(s:bin)
|
||||
for bin in s:bins | if executable(bin)
|
||||
let s:bin = bin
|
||||
brea
|
||||
en | endfo
|
||||
el
|
||||
let s:bin = expand(s:bin, 1)
|
||||
en
|
||||
" Types
|
||||
cal extend(s:types, s:usr_types)
|
||||
en
|
||||
endf
|
||||
" Utilities {{{1
|
||||
fu! s:validfile(fname, ftype)
|
||||
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
||||
@@ -193,24 +185,20 @@ 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
|
||||
if 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
|
||||
|
||||
fu! s:syntax()
|
||||
if !hlexists('CtrlPTagKind')
|
||||
hi link CtrlPTagKind Title
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||
en
|
||||
if !hlexists('CtrlPBufName')
|
||||
hi link CtrlPBufName Directory
|
||||
en
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#buffertag#init(fname)
|
||||
@@ -223,14 +211,13 @@ fu! ctrlp#buffertag#init(fname)
|
||||
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
|
||||
cal extend(lines, s:process(bname, tftype))
|
||||
endfo
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#accept(mode, str)
|
||||
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
|
||||
if vals == [] | retu | en
|
||||
let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]]
|
||||
cal ctrlp#acceptfile(a:mode, bufnm, linenr)
|
||||
endf
|
||||
|
||||
@@ -10,18 +10,16 @@ if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
||||
en
|
||||
let g:loaded_ctrlp_changes = 1
|
||||
|
||||
let s:changes_var = {
|
||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crfile)',
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',
|
||||
\ 'accept': 'ctrlp#changes#accept',
|
||||
\ 'lname': 'changes',
|
||||
\ 'sname': 'chs',
|
||||
\ 'exit': 'ctrlp#changes#exit()',
|
||||
\ 'type': 'tabe',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:changes_var) : [s:changes_var]
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@@ -46,41 +44,34 @@ fu! s:process(clines, ...)
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !hlexists('CtrlPBufName')
|
||||
hi link CtrlPBufName Directory
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#changes#init(original_bufnr, fname)
|
||||
let fname = exists('s:bufname') ? s:bufname : a:fname
|
||||
let bufs = exists('s:clmode') && s:clmode
|
||||
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)') : [fname]
|
||||
fu! ctrlp#changes#init(original_bufnr, bufnr)
|
||||
let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr
|
||||
let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]
|
||||
cal filter(bufs, 'v:val > 0')
|
||||
let [swb, &swb] = [&swb, '']
|
||||
let lines = []
|
||||
for each in bufs
|
||||
let [bname, fnamet] = [fnamemodify(each, ':p'), fnamemodify(each, ':t')]
|
||||
let bufnr = bufnr('^'.bname.'$')
|
||||
if bufnr > 0
|
||||
cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet))
|
||||
en
|
||||
let fnamet = fnamemodify(bufname(each), ':t')
|
||||
cal extend(lines, s:process(s:changelist(each), each, fnamet))
|
||||
endfo
|
||||
sil! exe 'noa hid b' a:original_bufnr
|
||||
let &swb = swb
|
||||
let g:ctrlp_nolimit = 1
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal ctrlp#syntax()
|
||||
cal s:syntax()
|
||||
en
|
||||
cal ctrlp#syntax()
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#changes#accept(mode, str)
|
||||
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
|
||||
if info == [] | retu | en
|
||||
let bufnr = str2nr(get(info, 1))
|
||||
if bufnr
|
||||
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'))
|
||||
@@ -92,13 +83,13 @@ endf
|
||||
fu! ctrlp#changes#cmd(mode, ...)
|
||||
let s:clmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufname = fnamemodify(a:1, ':p')
|
||||
let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#changes#exit()
|
||||
unl! s:clmode s:bufname
|
||||
unl! s:clmode s:bufnr
|
||||
endf
|
||||
"}}}
|
||||
|
||||
|
||||
@@ -17,16 +17,14 @@ let s:ars = [
|
||||
\ 's:glob',
|
||||
\ ]
|
||||
|
||||
let s:dir_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ '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]
|
||||
\ 'specinput': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@@ -34,9 +32,9 @@ 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))
|
||||
let nr = len(g:ctrlp_alldirs)
|
||||
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
|
||||
sil! cal ctrlp#progress(nr)
|
||||
cal s:globdirs(join(dirs, ','), depth)
|
||||
en
|
||||
endf
|
||||
@@ -48,25 +46,24 @@ endf
|
||||
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)))
|
||||
let {s:ars[each]} = 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'])
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
|
||||
if g:ctrlp_newdir || !filereadable(cafile)
|
||||
let g:ctrlp_alldirs = []
|
||||
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
|
||||
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
|
||||
el
|
||||
if !( exists('s:initcwd') && s:initcwd == s:cwd )
|
||||
let s:initcwd = s:cwd
|
||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
||||
en
|
||||
en
|
||||
retu g:ctrlp_alldirs
|
||||
endf
|
||||
|
||||
@@ -10,52 +10,45 @@ if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||
en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
let s:line_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ '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)
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if !hlexists('CtrlPBufName')
|
||||
hi link CtrlPBufName Directory
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#line#init()
|
||||
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
|
||||
for each in bufs
|
||||
let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)]
|
||||
let bname = fnamemodify(each, ':p')
|
||||
cal map(from_file, 'tr(v:val, '' '', '' '')')
|
||||
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.bname.'$')]
|
||||
wh id <= len_ff
|
||||
let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
||||
let id += 1
|
||||
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
||||
for bufnr in bufs
|
||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
||||
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
|
||||
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
||||
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
|
||||
wh linenr <= len_lfb
|
||||
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
||||
let linenr += 1
|
||||
endw
|
||||
cal filter(from_file, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''')
|
||||
cal extend(lines, from_file)
|
||||
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
||||
endfo
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#accept(mode, str)
|
||||
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
||||
if info == [] | retu | en
|
||||
let [bufnr, linenr] = [str2nr(get(info, 1)), get(info, 2)]
|
||||
if bufnr > 0
|
||||
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr)
|
||||
|
||||
83
bundle/git_ctrlp/autoload/ctrlp/mixed.vim
Normal file
83
bundle/git_ctrlp/autoload/ctrlp/mixed.vim
Normal file
@@ -0,0 +1,83 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/mixed.vim
|
||||
" Description: Mixing Files + MRU + Buffers
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'fil + mru + buf',
|
||||
\ 'sname': 'mix',
|
||||
\ 'type': 'path',
|
||||
\ 'opmul': 1,
|
||||
\ 'specinput': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:newcache(cwd)
|
||||
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
||||
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
||||
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
|
||||
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
|
||||
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())
|
||||
endf
|
||||
|
||||
fu! s:getnewmix(cwd, clim)
|
||||
if g:ctrlp_newmix
|
||||
cal ctrlp#mrufiles#refresh('raw')
|
||||
let g:ctrlp_newcache = 1
|
||||
en
|
||||
let g:ctrlp_lines = copy(ctrlp#files())
|
||||
cal ctrlp#progress('Mixing...')
|
||||
let mrufs = copy(ctrlp#mrufiles#list('raw'))
|
||||
if exists('+ssl') && &ssl
|
||||
cal map(mrufs, 'tr(v:val, "\\", "/")')
|
||||
en
|
||||
let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")')
|
||||
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
|
||||
if len(mrufs) > len(g:ctrlp_lines)
|
||||
cal filter(mrufs, 'stridx(v:val, a:cwd)')
|
||||
el
|
||||
let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')
|
||||
let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)
|
||||
for each in cwd_mrufs
|
||||
let id = index(g:ctrlp_lines, each)
|
||||
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
|
||||
endfo
|
||||
en
|
||||
cal map(mrufs, 'fnamemodify(v:val, ":.")')
|
||||
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
|
||||
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines
|
||||
if len(g:ctrlp_lines) <= a:clim
|
||||
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
||||
en
|
||||
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
|
||||
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
|
||||
\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#mixed#init(clim)
|
||||
let cwd = getcwd()
|
||||
if s:newcache(cwd)
|
||||
cal s:getnewmix(cwd, a:clim)
|
||||
el
|
||||
let g:ctrlp_lines = g:ctrlp_allmixes['data']
|
||||
en
|
||||
let g:ctrlp_newmix = 0
|
||||
retu g:ctrlp_lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#mixed#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
@@ -5,120 +5,114 @@
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
let [s:mrbs, s:mrufs] = [[], []]
|
||||
|
||||
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],
|
||||
\ }
|
||||
let [pref, opts] = ['g:ctrlp_mruf_', {
|
||||
\ 'max': ['s:max', 250],
|
||||
\ 'include': ['s:in', ''],
|
||||
\ 'exclude': ['s:ex', ''],
|
||||
\ 'case_sensitive': ['s:cseno', 1],
|
||||
\ 'relative': ['s:re', 0],
|
||||
\ }]
|
||||
for [ke, va] in items(opts)
|
||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
|
||||
endfo
|
||||
let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []]
|
||||
if exists('s:locked')
|
||||
cal ctrlp#mrufiles#init()
|
||||
en
|
||||
endf
|
||||
cal ctrlp#mrufiles#opts()
|
||||
" Utilities {{{1
|
||||
fu! s:excl(fn)
|
||||
retu !empty(s:ex) && a:fn =~# s:ex
|
||||
retu !empty({s:ex}) && a:fn =~# {s:ex}
|
||||
endf
|
||||
|
||||
fu! s:readcache()
|
||||
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
|
||||
retu ctrlp#utils#readfile(s:cafile)
|
||||
fu! s:mergelists()
|
||||
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
|
||||
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
||||
let mrufs = s:mrufs + diskmrufs
|
||||
retu s:chop(mrufs)
|
||||
endf
|
||||
|
||||
fu! s:chop(mrufs)
|
||||
if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en
|
||||
retu a:mrufs
|
||||
endf
|
||||
|
||||
fu! s:reformat(mrufs)
|
||||
if s:re
|
||||
if {s:re}
|
||||
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
||||
cal filter(a:mrufs, '!stridx(v:val, cwd)')
|
||||
en
|
||||
retu map(a:mrufs, 'fnamemodify(v:val, '':.'')')
|
||||
retu map(a:mrufs, 'fnamemodify(v:val, ":.")')
|
||||
endf
|
||||
|
||||
fu! s:record(bufnr, ...)
|
||||
fu! s:record(bufnr)
|
||||
if s:locked | retu | en
|
||||
let bufnr = a:bufnr + 0
|
||||
if bufnr <= 0 | retu | en
|
||||
let fn = fnamemodify(bufname(bufnr), ':p')
|
||||
let bufname = bufname(bufnr)
|
||||
if empty(bufname) | retu | en
|
||||
let fn = fnamemodify(bufname, ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
cal filter(s:mrbs, 'v:val !='.s:csen.' fn')
|
||||
cal insert(s:mrbs, fn)
|
||||
if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in )
|
||||
\ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn)
|
||||
\ || ( a:0 && a:1 == 1 )
|
||||
retu
|
||||
cal filter(s:mrbs, 'v:val != bufnr')
|
||||
cal insert(s:mrbs, bufnr)
|
||||
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
|
||||
\ || !empty(&bt) || !filereadable(fn) | retu
|
||||
en
|
||||
let mrufs = s:readcache()
|
||||
cal filter(mrufs, 'v:val !='.s:csen.' fn')
|
||||
cal insert(mrufs, fn)
|
||||
if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
|
||||
cal insert(s:mrufs, fn)
|
||||
endf
|
||||
|
||||
fu! s:savetofile(mrufs)
|
||||
cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#mrufiles#refresh()
|
||||
let mrufs = s:readcache()
|
||||
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
||||
fu! ctrlp#mrufiles#refresh(...)
|
||||
let s:mrufs = s:mergelists()
|
||||
cal filter(s: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')
|
||||
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
|
||||
cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1')
|
||||
en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
retu s:reformat(mrufs)
|
||||
cal s:savetofile(s:mrufs)
|
||||
retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#remove(files)
|
||||
let mrufs = []
|
||||
let s:mrufs = []
|
||||
if a:files != []
|
||||
let mrufs = s:readcache()
|
||||
cal filter(mrufs, 'index(a:files, v:val) < 0')
|
||||
let s:mrufs = s:mergelists()
|
||||
cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0')
|
||||
en
|
||||
cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile)
|
||||
retu map(mrufs, 'fnamemodify(v:val, '':.'')')
|
||||
cal s:savetofile(s:mrufs)
|
||||
retu s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#list(...)
|
||||
if a:0 | cal s:record(a:1) | retu | en
|
||||
retu s:reformat(s:readcache())
|
||||
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#bufs()
|
||||
retu s:mrbs
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#cachefile()
|
||||
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
|
||||
retu s:cafile
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#init()
|
||||
if !has('autocmd') | retu | en
|
||||
let s:locked = 0
|
||||
aug CtrlPMRUF
|
||||
au!
|
||||
au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('<abuf>', 1))
|
||||
au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('<abuf>', 1))
|
||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
||||
au VimLeavePre * cal s:savetofile(s:mergelists())
|
||||
aug END
|
||||
aug CtrlPMREB
|
||||
au!
|
||||
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1), 1)
|
||||
aug END
|
||||
if exists('#CtrlPMREF')
|
||||
au! CtrlPMREF
|
||||
en
|
||||
if s:mre
|
||||
aug CtrlPMREF
|
||||
au!
|
||||
au BufEnter,BufUnload * cal s:record(expand('<abuf>', 1))
|
||||
aug END
|
||||
if exists('#CtrlPMREB')
|
||||
au! CtrlPMREB
|
||||
en
|
||||
en
|
||||
endf
|
||||
"}}}
|
||||
|
||||
|
||||
@@ -10,17 +10,15 @@ if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
||||
en
|
||||
let g:loaded_ctrlp_quickfix = 1
|
||||
|
||||
let s:var_qf = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#quickfix#init()',
|
||||
\ 'accept': 'ctrlp#quickfix#accept',
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
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]
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
@@ -28,20 +26,22 @@ 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 has('syntax') && exists('g:syntax_on')
|
||||
if !hlexists('CtrlPqfLineCol')
|
||||
hi link CtrlPqfLineCol Search
|
||||
en
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
|
||||
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#quickfix#init()
|
||||
cal s:syntax()
|
||||
retu map(getqflist(), 's:lineout(v:val)')
|
||||
endf
|
||||
|
||||
fu! ctrlp#quickfix#accept(mode, str)
|
||||
let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
|
||||
if items == [] | retu | en
|
||||
let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
|
||||
if empty(filpath) | retu | en
|
||||
cal ctrlp#exit()
|
||||
|
||||
@@ -10,16 +10,14 @@ if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
||||
en
|
||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
||||
|
||||
let s:rtscript_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ '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]
|
||||
\ 'opmul': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Public {{{1
|
||||
|
||||
@@ -10,17 +10,14 @@ if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
||||
en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
let s:tag_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#tag#init()',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'enter': 'ctrlp#tag#enter()',
|
||||
\ '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
|
||||
@@ -43,19 +40,27 @@ fu! s:findcount(str)
|
||||
endf
|
||||
|
||||
fu! s:filter(tags)
|
||||
let [nr, alltags] = [0, a:tags]
|
||||
let nr = 0
|
||||
wh 0 < 1
|
||||
if alltags[nr] =~ '^!' && alltags[nr] !~ '^!_TAG_'
|
||||
if a:tags == [] | brea | en
|
||||
if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_'
|
||||
let nr += 1
|
||||
con
|
||||
en
|
||||
if alltags[nr] =~ '^!_TAG_' && len(alltags) > nr
|
||||
cal remove(alltags, nr)
|
||||
if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr
|
||||
cal remove(a:tags, nr)
|
||||
el
|
||||
brea
|
||||
en
|
||||
endw
|
||||
retu alltags
|
||||
retu a:tags
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#tag#init()
|
||||
@@ -66,12 +71,7 @@ fu! ctrlp#tag#init()
|
||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
||||
cal extend(g:ctrlp_alltags, alltags)
|
||||
endfo
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
if !hlexists('CtrlPTabExtra')
|
||||
hi link CtrlPTabExtra Comment
|
||||
en
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
cal s:syntax()
|
||||
retu g:ctrlp_alltags
|
||||
endf
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||
en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
let s:undo_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#undo#init()',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
@@ -19,10 +19,8 @@ let s:undo_var = {
|
||||
\ 'exit': 'ctrlp#undo#exit()',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
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]
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
@@ -82,11 +80,10 @@ fu! s:elapsed(nr)
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if ctrlp#nosy() | retu | en
|
||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
|
||||
\ 'Sv': 'Comment', 'Po': 'Title'})
|
||||
if !hlexists('CtrlPUndo'.ke)
|
||||
exe 'hi link CtrlPUndo'.ke va
|
||||
en
|
||||
cal ctrlp#hicheck('CtrlPUndo'.ke, va)
|
||||
endfo
|
||||
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
|
||||
sy match CtrlPUndoBr '\[\|\]'
|
||||
@@ -115,16 +112,13 @@ endf
|
||||
fu! s:formatul(...)
|
||||
let parts = matchlist(a:1,
|
||||
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
|
||||
retu parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||
retu parts == [] ? '----'
|
||||
\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#undo#init()
|
||||
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
|
||||
if empty(entries) | retu [] | en
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
let g:ctrlp_nolimit = 1
|
||||
if !exists('s:lines')
|
||||
if s:undos[0]
|
||||
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
|
||||
@@ -133,6 +127,7 @@ fu! ctrlp#undo#init()
|
||||
let s:lines = map(reverse(entries), 's:formatul(v:val)')
|
||||
en
|
||||
en
|
||||
cal s:syntax()
|
||||
retu s:lines
|
||||
endf
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ endf
|
||||
let s:lash = ctrlp#utils#lash()
|
||||
|
||||
fu! s:lash(...)
|
||||
retu match(a:0 ? a:1 : getcwd(), '[\/]$') < 0 ? s:lash : ''
|
||||
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#opts()
|
||||
@@ -33,9 +33,9 @@ fu! ctrlp#utils#cachedir()
|
||||
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
|
||||
let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]
|
||||
let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
||||
retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#readfile(file)
|
||||
@@ -60,9 +60,6 @@ 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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.4
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.7.7
|
||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||
===============================================================================
|
||||
# #
|
||||
@@ -23,17 +23,63 @@ CONTENTS *ctrlp-contents*
|
||||
===============================================================================
|
||||
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.
|
||||
Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface.
|
||||
Written in pure Vimscript for MacVim, gVim 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|.
|
||||
|
||||
===============================================================================
|
||||
OPTIONS *ctrlp-options*
|
||||
|
||||
Below are the available options and their default values:~
|
||||
Overview:~
|
||||
|
||||
|loaded_ctrlp| Disable the plugin.
|
||||
|ctrlp_map| Default mapping.
|
||||
|ctrlp_cmd| Default command used for the default mapping.
|
||||
|ctrlp_by_filename| Default to filename mode or not.
|
||||
|ctrlp_regexp| Default to regexp mode or not.
|
||||
|ctrlp_match_window_bottom| Where to show the match window.
|
||||
|ctrlp_match_window_reversed| Sort order in the match window.
|
||||
|ctrlp_max_height| Max height of the match window.
|
||||
|ctrlp_switch_buffer| Jump to an open buffer if already opened.
|
||||
|ctrlp_reuse_window| Reuse special windows (help, quickfix, etc).
|
||||
|ctrlp_working_path_mode| How to set CtrlP's local working directory.
|
||||
|ctrlp_root_markers| Additional, high priority root markers.
|
||||
|ctrlp_use_caching| Use per-session caching or not.
|
||||
|ctrlp_clear_cache_on_exit| Keep cache after exiting Vim or not.
|
||||
|ctrlp_cache_dir| Location of the cache directory.
|
||||
|ctrlp_dotfiles| Ignore dotfiles and dotdirs or not.
|
||||
|ctrlp_custom_ignore| Hide stuff when using |globpath()|.
|
||||
|ctrlp_max_files| Number of files to scan initially.
|
||||
|ctrlp_max_depth| Directory depth to recurse into when scanning.
|
||||
|ctrlp_user_command| Use an external scanner.
|
||||
|ctrlp_max_history| Number of entries saved in the prompt history.
|
||||
|ctrlp_open_new_file| How to open a file created by <c-y>.
|
||||
|ctrlp_open_multiple_files| How to open files selected by <c-z>.
|
||||
|ctrlp_arg_map| Intercept <c-y> and <c-o> or not.
|
||||
|ctrlp_follow_symlinks| Follow symbolic links or not.
|
||||
|ctrlp_lazy_update| Only update when typing has stopped.
|
||||
|ctrlp_default_input| Seed the prompt with an initial string.
|
||||
|ctrlp_use_migemo| Use Migemo patterns for Japanese filenames.
|
||||
|ctrlp_prompt_mappings| Change the mappings in the prompt.
|
||||
|
||||
MRU mode:
|
||||
|ctrlp_mruf_max| Max MRU entries to remember.
|
||||
|ctrlp_mruf_exclude| Files that shouldn't be remembered.
|
||||
|ctrlp_mruf_include| Files to be remembered.
|
||||
|ctrlp_mruf_relative| Show only MRU files in the working directory.
|
||||
|ctrlp_mruf_default_order| Disable sorting.
|
||||
|ctrlp_mruf_case_sensitive| MRU files are case sensitive or not.
|
||||
|
||||
Advanced options:
|
||||
|ctrlp_status_func| Change CtrlP's two statuslines.
|
||||
|ctrlp_buffer_func| Call custom functions in the CtrlP buffer.
|
||||
|ctrlp_match_func| Replace the built-in matching algorithm.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Detailed descriptions and default values:~
|
||||
|
||||
*'g:ctrlp_map'*
|
||||
Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
|
||||
@@ -58,7 +104,7 @@ default: >
|
||||
Can be toggled on/off by pressing <c-d> inside the prompt.
|
||||
|
||||
*'g:ctrlp_regexp'*
|
||||
Set this to 1 to set |regexp| search as the default: >
|
||||
Set this to 1 to set regexp search as the default: >
|
||||
let g:ctrlp_regexp = 0
|
||||
<
|
||||
Can be toggled on/off by pressing <c-r> inside the prompt.
|
||||
@@ -80,12 +126,12 @@ Set the maximum height of the match window: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_switch_buffer'*
|
||||
When opening a file with <cr> or <c-t>, if the file’s already opened somewhere
|
||||
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_switch_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.
|
||||
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_reuse_window'*
|
||||
@@ -94,7 +140,7 @@ plugins, help and quickfix. Use this to setup some exceptions: >
|
||||
let g:ctrlp_reuse_window = 'netrw'
|
||||
<
|
||||
Acceptable values are partial name, filetype or buftype of the special buffers.
|
||||
Use |regexp| to specify the pattern.
|
||||
Use regexp to specify the pattern.
|
||||
Example: >
|
||||
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
|
||||
<
|
||||
@@ -104,16 +150,16 @@ 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.
|
||||
1 - the directory of the current file.
|
||||
2 - the nearest ancestor that contains one of these directories or files:
|
||||
.git/ .hg/ .svn/ .bzr/ _darcs/
|
||||
0 - don’t manage working directory.
|
||||
.git .hg .svn .bzr _darcs
|
||||
0 - don't manage working directory.
|
||||
Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
|
||||
per buffer basis.
|
||||
|
||||
*'g:ctrlp_root_markers'*
|
||||
Use this to set your own root markers in addition to the default ones (.git/,
|
||||
.hg/, .svn/, .bzr/, and _darcs/). Your markers will take precedence: >
|
||||
Use this to set your own root markers in addition to the default ones (.git,
|
||||
.hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
|
||||
let g:ctrlp_root_markers = ['']
|
||||
<
|
||||
|
||||
@@ -135,91 +181,8 @@ 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> (|keycodes|). So if pressing <bs> moves the cursor to the left instead of
|
||||
deleting a char for you, add this to your |.vimrc| to disable the plugin’s
|
||||
default <c-h> mapping: >
|
||||
let g:ctrlp_prompt_mappings = { '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 scan for dotfiles and dotdirs: >
|
||||
Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
|
||||
let g:ctrlp_dotfiles = 1
|
||||
<
|
||||
You can use |'wildignore'| to exclude anything from the search.
|
||||
@@ -237,7 +200,7 @@ 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: >
|
||||
CtrlP to not show. Use regexp to specify the patterns: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
Examples: >
|
||||
@@ -262,7 +225,7 @@ The maximum depth of a directory tree to recurse into: >
|
||||
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
|
||||
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 = ''
|
||||
<
|
||||
@@ -302,10 +265,10 @@ 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: >
|
||||
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>.
|
||||
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
|
||||
@@ -323,16 +286,18 @@ If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
|
||||
let g:ctrlp_open_multiple_files = 'v'
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_open_multiple_files = '2vr'
|
||||
let g:ctrlp_open_multiple_files = '2vjr'
|
||||
<
|
||||
For the number:
|
||||
- If given, it’ll be used as the maximum number of windows or tabs to create
|
||||
- If given, it'll be used as the maximum number of windows or tabs to create
|
||||
when opening the files (the rest will be opened as hidden buffers).
|
||||
- If not given, <c-o> will open all files, each in a new window or new tab.
|
||||
For the letters:
|
||||
t - each file in a new tab.
|
||||
h - each file in a new horizontal split.
|
||||
v - each file in a new vertical split.
|
||||
i - all files as hidden buffers.
|
||||
j - after opening, jump to the first opened tab or window.
|
||||
Reuse the current window:
|
||||
tr,
|
||||
hr,
|
||||
@@ -348,37 +313,132 @@ 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
|
||||
i - open as hidden buffers (for <c-o> only)
|
||||
c - clear the marked files (for <c-o> only)
|
||||
r - open in the current window (for <c-y> only)
|
||||
<esc>, <c-c>, <c-u> - cancel and go back to the prompt.
|
||||
<cr> - use the default behavior specified with |g:ctrlp_open_new_file| and
|
||||
|g:ctrlp_open_multiple_files|.
|
||||
|
||||
*'g:ctrlp_follow_symlinks'*
|
||||
Set this to 1 to follow symbolic links when listing files: >
|
||||
If non-zero, CtrlP will follow symbolic links when listing files: >
|
||||
let g:ctrlp_follow_symlinks = 0
|
||||
<
|
||||
When enabled, looped internal symlinks will be ignored to avoid duplicates.
|
||||
0 - don't follow symbolic links.
|
||||
1 - follow but ignore looped internal symlinks to avoid duplicates.
|
||||
2 - follow all symlinks indiscriminately.
|
||||
|
||||
*'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: >
|
||||
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_default_input'*
|
||||
Set this to 1 to enable seeding the prompt with the current file’s relative
|
||||
Set this to 1 to enable seeding the prompt with the current file's relative
|
||||
path: >
|
||||
let g:ctrlp_default_input = 0
|
||||
<
|
||||
|
||||
*'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: >
|
||||
works in regexp mode. To split the pattern, separate words with space: >
|
||||
let g:ctrlp_use_migemo = 0
|
||||
<
|
||||
|
||||
*'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>'],
|
||||
\ 'PrtSelectMove("t")': ['<Home>', '<kHome>'],
|
||||
\ 'PrtSelectMove("b")': ['<End>', '<kEnd>'],
|
||||
\ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'],
|
||||
\ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'],
|
||||
\ '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>'],
|
||||
\ '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("c")': ['<MiddleMouse>', '<insert>'],
|
||||
\ 'PrtInsert()': ['<c-\>'],
|
||||
\ 'PrtCurStart()': ['<c-a>'],
|
||||
\ 'PrtCurEnd()': ['<c-e>'],
|
||||
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
|
||||
\ 'PrtCurRight()': ['<c-l>', '<right>'],
|
||||
\ 'PrtClearCache()': ['<F5>'],
|
||||
\ 'PrtDeleteEnt()': ['<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> (|keycodes|). So if pressing <bs> moves the cursor to the left instead of
|
||||
deleting a char for you, add this to your |.vimrc| to disable the plugin's
|
||||
default <c-h> mapping: >
|
||||
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
|
||||
<
|
||||
|
||||
----------------------------------------
|
||||
MRU mode options:~
|
||||
|
||||
*'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_default_order'*
|
||||
Set this to 1 to disable sorting when searching in MRU mode: >
|
||||
let g:ctrlp_mruf_default_order = 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
|
||||
<
|
||||
|
||||
----------------------------------------
|
||||
Advanced options:~
|
||||
|
||||
*'g:ctrlp_status_func'*
|
||||
Use this to customize the statuslines for the CtrlP window: >
|
||||
let g:ctrlp_status_func = {}
|
||||
@@ -407,7 +467,7 @@ Structure of the functions: >
|
||||
" +- a:next : The next search mode.
|
||||
" |
|
||||
" +- a:marked : The number of marked files, or a comma separated list of
|
||||
" the filenames.
|
||||
" the marked filenames.
|
||||
|
||||
return full_statusline
|
||||
endfunction
|
||||
@@ -422,6 +482,18 @@ Structure of the functions: >
|
||||
<
|
||||
See https://gist.github.com/1610859 for a working example.
|
||||
|
||||
*'g:ctrlp_buffer_func'*
|
||||
Specify the functions that will be called after entering and before exiting the
|
||||
CtrlP buffer: >
|
||||
let g:ctrlp_buffer_func = {}
|
||||
<
|
||||
Example: >
|
||||
let g:ctrlp_buffer_func = {
|
||||
\ 'enter': 'Function_Name_1',
|
||||
\ 'exit': 'Function_Name_2',
|
||||
\ }
|
||||
<
|
||||
|
||||
*'g:ctrlp_match_func'*
|
||||
Set an external fuzzy matching function for CtrlP to use: >
|
||||
let g:ctrlp_match_func = {}
|
||||
@@ -446,8 +518,8 @@ Structure of the function: >
|
||||
" | + "first-non-tab": match until the first tab char.
|
||||
" | + "until-last-tab": match until the last tab char.
|
||||
" |
|
||||
" +- a:ispath : Is 1 when searching in file, buffer, mru, dir, and rtscript
|
||||
" | modes. Is 0 otherwise.
|
||||
" +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and
|
||||
" | rtscript modes. Is 0 otherwise.
|
||||
" |
|
||||
" +- a:crfile : The file in the current window. Should be excluded from the
|
||||
" | results when a:ispath == 1.
|
||||
@@ -467,6 +539,7 @@ COMMANDS *ctrlp-commands*
|
||||
|
||||
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*
|
||||
@@ -477,31 +550,27 @@ COMMANDS *ctrlp-commands*
|
||||
:CtrlPMRU
|
||||
Open CtrlP in find Most-Recently-Used file mode.
|
||||
|
||||
*:CtrlPLastMode*
|
||||
:CtrlPLastMode
|
||||
Open CtrlP in the last mode used.
|
||||
|
||||
*:CtrlPRoot*
|
||||
:CtrlPRoot
|
||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the
|
||||
variable's current value).
|
||||
|
||||
*:CtrlPClearCache*
|
||||
:CtrlPClearCache
|
||||
Flush the cache for the current working directory. The same as pressing <F5>
|
||||
inside CtrlP.
|
||||
You can enable/disable caching with the |g:ctrlp_use_caching| option.
|
||||
To enable or disable caching, use the |g:ctrlp_use_caching| option.
|
||||
|
||||
*:CtrlPClearAllCaches*
|
||||
:CtrlPClearAllCaches
|
||||
Delete all the cache files saved in |g:ctrlp_cache_dir|.
|
||||
|
||||
*:CtrlPReload*
|
||||
:CtrlPReload
|
||||
Load new values for the option variables.
|
||||
Delete all the cache files saved in |g:ctrlp_cache_dir| location.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
For commands provided by bundled extensions, see |ctrlp-extensions|.
|
||||
|
||||
===============================================================================
|
||||
MAPPINGS *ctrlp-mappings*
|
||||
@@ -510,17 +579,18 @@ MAPPINGS *ctrlp-mappings*
|
||||
<c-p>
|
||||
Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
|
||||
|
||||
----------------------------------------
|
||||
Once inside the prompt:~
|
||||
|
||||
<c-d>
|
||||
Toggle between full-path search and filename only search.
|
||||
Note: in filename mode, the prompt’s base is '>d>' instead of '>>>'
|
||||
Note: in filename mode, the prompt's base is '>d>' instead of '>>>'
|
||||
|
||||
<c-r> *'ctrlp-fullregexp'*
|
||||
Toggle between the string mode and full |regexp| mode.
|
||||
Note: in full |regexp| mode, the prompt’s base is 'r>>' instead of '>>>'
|
||||
Toggle between the string mode 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).
|
||||
See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
|
||||
|
||||
<c-f>, 'forward'
|
||||
<c-up>
|
||||
@@ -530,13 +600,19 @@ Once inside the prompt:~
|
||||
<c-down>
|
||||
Scroll to the 'previous' search mode in the sequence.
|
||||
|
||||
<tab>
|
||||
<tab> *'ctrlp-autocompletion'*
|
||||
Auto-complete directory names under the current working directory inside
|
||||
the prompt.
|
||||
|
||||
<s-tab>
|
||||
Toggle the focus between the match window and the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>
|
||||
Exit CtrlP.
|
||||
|
||||
Moving:~
|
||||
|
||||
<c-j>,
|
||||
<down>
|
||||
Move selection down.
|
||||
@@ -560,6 +636,8 @@ Once inside the prompt:~
|
||||
<right>
|
||||
Move the cursor one character to the 'right'.
|
||||
|
||||
Editing:~
|
||||
|
||||
<c-]>,
|
||||
<bs>
|
||||
Delete the preceding character.
|
||||
@@ -573,55 +651,66 @@ Once inside the prompt:~
|
||||
<c-u>
|
||||
Clear the input field.
|
||||
|
||||
Browsing input history:~
|
||||
|
||||
<c-n>
|
||||
Next string in the prompt's history.
|
||||
|
||||
<c-p>
|
||||
Previous string in the prompt's history.
|
||||
|
||||
Opening/Creating a file:~
|
||||
|
||||
<cr>
|
||||
Open selected file in the active window if possible.
|
||||
Open the selected file in the 'current' window if possible.
|
||||
|
||||
<c-t>
|
||||
Open selected file in a new 'tab' after the last tabpage.
|
||||
Open the selected file in a new 'tab' after the last tabpage.
|
||||
|
||||
<c-v>
|
||||
Open selected file in a 'vertical' split.
|
||||
Open the selected file in a 'vertical' split.
|
||||
|
||||
<c-x>,
|
||||
<c-cr>,
|
||||
<c-s>
|
||||
Open selected file in a 'horizontal' split.
|
||||
Open the 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.
|
||||
Opening multiple files:~
|
||||
|
||||
<c-z>
|
||||
- Mark/unmark a file to be opened with <c-o>.
|
||||
- Or mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
- Mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
|
||||
<c-o>
|
||||
Open files marked by <c-z>.
|
||||
|
||||
Function keys:~
|
||||
|
||||
<F5>
|
||||
- Refresh the match window and purge the cache for the current directory.
|
||||
- Or remove deleted files from the MRU list.
|
||||
- Remove deleted files from the MRU list.
|
||||
|
||||
<F7>
|
||||
- Wipe the MRU list.
|
||||
- Or delete MRU entries marked by <c-z>.
|
||||
- Delete MRU entries marked by <c-z>.
|
||||
|
||||
<insert>
|
||||
Insert the word under the cursor (in the current buffer) into the prompt.
|
||||
Pasting:~
|
||||
|
||||
<esc>,
|
||||
<c-c>,
|
||||
<c-g>
|
||||
Exit CtrlP.
|
||||
Note: <c-c> can also be used to stop the scan if it’s taking too long.
|
||||
<Insert>, *'ctrlp-pasting'*
|
||||
<MiddleMouse>
|
||||
Paste the clipboard content into the prompt.
|
||||
|
||||
<c-\>
|
||||
Open a text dialog to paste <cword>, <cfile>, the content of the search
|
||||
register, the last visual selection, the clipboard or any register into the
|
||||
prompt.
|
||||
|
||||
Choose your own mappings with |g:ctrlp_prompt_mappings|.
|
||||
|
||||
----------------------------------------
|
||||
When inside the match window (press <s-tab> to switch):~
|
||||
|
||||
a-z
|
||||
@@ -639,61 +728,78 @@ 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.
|
||||
b) When in regexp mode, the input string's 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).
|
||||
See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for
|
||||
how to enable regexp mode.
|
||||
|
||||
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.
|
||||
E.g. Use ':45' to jump to line 45.
|
||||
|
||||
'abc:/any\:string' will open the selected file and jump to the first
|
||||
instance of 'any:string'.
|
||||
Use ':/any\:string' to jump to the first instance of 'any:string'.
|
||||
|
||||
'abc:+setf\ myfiletype|50' will open the selected file and set its
|
||||
filetype to 'myfiletype', then jump to line 50.
|
||||
Use ':+setf\ myfiletype|50' to set the filetype to 'myfiletype', then
|
||||
jump to line 50.
|
||||
|
||||
'abc:diffthis' will open the selected files and run |:diffthis| on the
|
||||
first 4 files (if marked).
|
||||
Use ':diffthis' when opening multiple files to run |:diffthis| on the
|
||||
first 4 files.
|
||||
|
||||
See also Vim’s |++opt| and |+cmd|.
|
||||
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.
|
||||
d) Submit two dots '..' to go upward the directory tree by 1 level. To go up
|
||||
multiple levels, use one extra dot for each extra level:
|
||||
>
|
||||
Raw input Interpreted as
|
||||
.. ../
|
||||
... ../../
|
||||
.... ../../../
|
||||
<
|
||||
Note: if the parent directories are large and uncached, this can 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).
|
||||
You can also use '@cd path/' to change CtrlP's local working directory.
|
||||
Use '@cd %:h' to change to the directory of the current file.
|
||||
|
||||
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).
|
||||
|
||||
Note: d) and e) only work in file, directory and mixed modes.
|
||||
|
||||
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'.
|
||||
E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as
|
||||
well as a file named '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'.
|
||||
If an entry 'some/old/dirs/oldfile.txt' is marked with <c-z>, then
|
||||
'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The
|
||||
final path will then be 'some/old/dirs/newdir/newfile.txt'.
|
||||
|
||||
Use '\' in place of '/' on Windows (if |'ssl'| is not set).
|
||||
Note: use '\' in place of '/' on Windows (if |'shellslash'| is not set).
|
||||
|
||||
g) Submit ? to open this help file.
|
||||
g) In filename mode (toggle with <c-d>), you can use one primary pattern and
|
||||
one refining pattern separated by a semicolon. Both patterns work like (a),
|
||||
or (b) when in regexp mode.
|
||||
|
||||
h) Submit ? to open this help file.
|
||||
|
||||
===============================================================================
|
||||
EXTENSIONS *g:ctrlp-extensions*
|
||||
EXTENSIONS *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',
|
||||
\ 'undo', 'line', 'changes']
|
||||
\ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
|
||||
<
|
||||
The order of the items will be the order they appear on the statusline and when
|
||||
using <c-f>, <c-b>.
|
||||
@@ -705,7 +811,7 @@ Available extensions:~
|
||||
- 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
|
||||
definition. Use the Vim's option |'tags'| to specify the names and the
|
||||
locations of the tags file(s).
|
||||
E.g. set tags+=doc/tags
|
||||
|
||||
@@ -713,7 +819,7 @@ Available extensions:~
|
||||
*:CtrlPBufTagAll*
|
||||
* Buffer Tag mode:~
|
||||
- Name: 'buffertag'
|
||||
- Commands: ':CtrlPBufTag [buffer-name]',
|
||||
- Commands: ':CtrlPBufTag [buffer]',
|
||||
':CtrlPBufTagAll'.
|
||||
- Search for a tag within the current buffer or all listed buffers and jump
|
||||
to the definition. Requires |exuberant_ctags| or compatible programs.
|
||||
@@ -733,7 +839,7 @@ Available extensions:~
|
||||
+ <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
|
||||
+ <c-x> change the global working directory to CtrlP's current local
|
||||
working directory (exit).
|
||||
|
||||
*:CtrlPRTS*
|
||||
@@ -758,21 +864,43 @@ Available extensions:~
|
||||
*:CtrlPChangeAll*
|
||||
* Change list mode:~
|
||||
- Name: 'changes'
|
||||
- Commands: ':CtrlPChange [buffer-name]',
|
||||
- Commands: ':CtrlPChange [buffer]',
|
||||
':CtrlPChangeAll'.
|
||||
- Search for and jump to a recent change in the current buffer or in all
|
||||
listed buffers.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*:CtrlPMixed*
|
||||
* Mixed mode:~
|
||||
- Name: 'mixed'
|
||||
- Command: ':CtrlPMixed'
|
||||
- Search in files, buffers and MRU files at the same time.
|
||||
|
||||
*:CtrlPBookmarkDir*
|
||||
*:CtrlPBookmarkDirAdd*
|
||||
* BookmarkDir mode:~
|
||||
- Name: 'bookmarkdir'
|
||||
- Commands: ':CtrlPBookmarkDir',
|
||||
':CtrlPBookmarkDirAdd [directory]'.
|
||||
- Search for a bookmarked directory and change the working directory to it.
|
||||
- Mappings:
|
||||
+ <cr> change the local working directory for CtrlP, keep it open and
|
||||
switch to find file mode.
|
||||
+ <c-x> change the global working directory (exit).
|
||||
+ <c-v> change the local working directory for the current window (exit).
|
||||
+ <F7>
|
||||
- Wipe bookmark list.
|
||||
- Delete entries marked by <c-z>.
|
||||
|
||||
----------------------------------------
|
||||
Buffer Tag mode options:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
If ctags isn’t in your $PATH, use this to set its location: >
|
||||
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
|
||||
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
|
||||
<
|
||||
@@ -799,12 +927,12 @@ Highlighting:~
|
||||
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)
|
||||
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)
|
||||
CtrlPTabExtra : the part of each line that's not matched against (Comment)
|
||||
CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|)
|
||||
CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|)
|
||||
CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment)
|
||||
@@ -813,6 +941,7 @@ Highlighting:~
|
||||
CtrlPUndoNr : the undo number inside [] in undo mode (String)
|
||||
CtrlPUndoSv : the point where the file was saved (Comment)
|
||||
CtrlPUndoPo : the current position in the undo tree (|hl-Title|)
|
||||
CtrlPBookmark : the name of the bookmark (Identifier)
|
||||
|
||||
Statuslines:~
|
||||
* Highlight groups:
|
||||
@@ -825,7 +954,7 @@ Statuslines:~
|
||||
===============================================================================
|
||||
MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
||||
|
||||
* Use |wildignore| for |g:ctrlp_user_command|:
|
||||
* Using |wildignore| for |g:ctrlp_user_command|:
|
||||
>
|
||||
function! s:wig2cmd()
|
||||
" Change wildignore into space or | separated groups
|
||||
@@ -847,12 +976,12 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
||||
<
|
||||
(submitted by Rich Alesi <github.com/ralesi>)
|
||||
|
||||
* A standalone function to set the working directory to the project’s root, or
|
||||
to the parent directory of the current file if a root can’t be found:
|
||||
* A standalone function to set the working directory to the project's root, or
|
||||
to the parent directory of the current file if a root can't be found:
|
||||
>
|
||||
function! s:setcwd()
|
||||
let cph = expand('%:p:h', 1)
|
||||
if match(cph, '\v^<.+>://') >= 0 | retu | en
|
||||
if cph =~ '^.\+://' | retu | en
|
||||
for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']
|
||||
let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])
|
||||
if wd != '' | let &acd = 0 | brea | en
|
||||
@@ -864,12 +993,17 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
||||
<
|
||||
(requires Vim 7.1.299+)
|
||||
|
||||
* Using a |count| to invoke different commands using the same mapping:
|
||||
>
|
||||
let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)'
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
CREDITS *ctrlp-credits*
|
||||
|
||||
Developed by Kien Nguyen <github.com/kien>.
|
||||
|
||||
Project’s homepage: http://kien.github.com/ctrlp.vim
|
||||
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
|
||||
|
||||
@@ -891,14 +1025,38 @@ Special thanks:~
|
||||
* Kent Sibilev <github.com/datanoise>
|
||||
* Tacahiroy <github.com/tacahiroy>
|
||||
* Luca Pette <github.com/lucapette>
|
||||
* Seth Fowler <github.com/sfowler>
|
||||
* Lowe Thiderman <github.com/daethorian>
|
||||
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
Before 2012/06/15~
|
||||
|
||||
+ New value for |g:ctrlp_follow_symlinks|: 2.
|
||||
+ New value for |g:ctrlp_open_multiple_files|: 'j'.
|
||||
+ Allow using <c-t>, <c-x>, <c-v> to open files marked by <c-z>.
|
||||
+ Extend '..' (|ctrlp-input-formats| (d))
|
||||
+ New input format: '@cd' (|ctrlp-input-formats| (d))
|
||||
|
||||
Before 2012/04/30~
|
||||
|
||||
+ New option: |g:ctrlp_mruf_default_order|
|
||||
+ New feature: Bookmarked directories extension.
|
||||
+ New commands: |:CtrlPBookmarkDir|
|
||||
|:CtrlPBookmarkDirAdd|
|
||||
|
||||
Before 2012/04/15~
|
||||
|
||||
+ New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer.
|
||||
+ Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode.
|
||||
+ New commands: |:CtrlPLastMode|, open CtrlP in the last mode used.
|
||||
|:CtrlPMixed|, search in files, buffers and MRU files.
|
||||
|
||||
Before 2012/03/31~
|
||||
|
||||
+ New option: |g:ctrlp_default_input|, default input when entering CtrlP.
|
||||
|g:ctrlp_match_func|, allow using a custom fuzzy matcher.
|
||||
+ New options: |g:ctrlp_default_input|, default input when entering CtrlP.
|
||||
|g:ctrlp_match_func|, allow using a custom fuzzy matcher.
|
||||
+ Rename:
|
||||
*ClearCtrlPCache* -> |CtrlPClearCache|
|
||||
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
|
||||
@@ -959,7 +1117,7 @@ Before 2011/10/30~
|
||||
Before 2011/10/12~
|
||||
|
||||
+ New features: Open multiple files.
|
||||
Pass Vim’s |++opt| and |+cmd| to the opening file
|
||||
Pass Vim's |++opt| and |+cmd| to the opening file
|
||||
(|ctrlp-input-formats| (c))
|
||||
Auto-complete each dir for |:CtrlP| [starting-directory]
|
||||
+ New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" =============================================================================
|
||||
" File: plugin/ctrlp.vim
|
||||
" Description: Fuzzy file, buffer, mru and tag finder.
|
||||
" Description: Fuzzy file, buffer, mru, tag, etc finder.
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
|
||||
@@ -11,7 +11,8 @@ en
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_buftags, g:ctrlp_builtins] = [[], [], [], [], {}, 2]
|
||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
||||
\ = [[], [], [], [], {}, {}, [], 2]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
@@ -21,6 +22,8 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
|
||||
com! CtrlPBuffer cal ctrlp#init(1)
|
||||
com! CtrlPMRUFiles cal ctrlp#init(2)
|
||||
|
||||
com! CtrlPLastMode cal ctrlp#init(-1)
|
||||
|
||||
com! CtrlPClearCache cal ctrlp#clr()
|
||||
com! CtrlPClearAllCaches cal ctrlp#clra()
|
||||
com! CtrlPReload cal ctrlp#reset()
|
||||
@@ -39,22 +42,20 @@ en
|
||||
|
||||
cal ctrlp#mrufiles#init()
|
||||
|
||||
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
|
||||
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
|
||||
com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), <q-args>)
|
||||
|
||||
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
com! -n=? -com=dir CtrlPDir
|
||||
\ cal ctrlp#init(ctrlp#dir#id(), <q-args>)
|
||||
com! -n=? -com=buffer CtrlPBufTag
|
||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
||||
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
|
||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
|
||||
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
|
||||
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
|
||||
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
com! -n=? -com=buffer CtrlPChange
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||
com! CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
||||
com! CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
|
||||
com! -n=? -com=dir CtrlPBookmarkDirAdd
|
||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
|
||||
|
||||
@@ -1,56 +1,69 @@
|
||||
# ctrlp.vim
|
||||
Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim.
|
||||
Fuzzy __file__, __buffer__, __mru__, __tag__, ... finder for Vim.
|
||||
|
||||
* Written in pure Vimscript for MacVim and Vim 7.0+.
|
||||
* Full support for Vim’s regexp as search pattern.
|
||||
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
|
||||
* Full support for Vim's regexp as search patterns.
|
||||
* Built-in Most Recently Used (MRU) files monitoring.
|
||||
* Built-in project’s root finder.
|
||||
* Open Multiple Files.
|
||||
* [Extensible][3].
|
||||
* Built-in project's root finder.
|
||||
* Open multiple files at once.
|
||||
* Create new files and directories.
|
||||
* [Extensible][2].
|
||||
|
||||
![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.
|
||||
## Installation
|
||||
1. Clone the plugin into a separate directory:
|
||||
|
||||
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>'
|
||||
```
|
||||
$ cd ~/.vim
|
||||
$ git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim
|
||||
```
|
||||
|
||||
* When CtrlP is invoked, it automatically sets its local working directory
|
||||
according to this variable:
|
||||
2. Add to your `~/.vimrc`:
|
||||
|
||||
```vim
|
||||
set runtimepath^=~/.vim/bundle/ctrlp.vim
|
||||
```
|
||||
|
||||
3. Run at Vim's command line:
|
||||
|
||||
```
|
||||
:helptags ~/.vim/bundle/ctrlp.vim/doc
|
||||
```
|
||||
|
||||
4. Restart Vim and start reading `:help ctrlp.txt` for usage and configuration details.
|
||||
|
||||
On Windows, use the `$HOME/vimfiles` or the `$VIM/vimfiles` directory instead of the `~/.vim` directory.
|
||||
|
||||
## Usage
|
||||
1. See `:help ctrlp-commands` and `:help ctrlp-extensions`.
|
||||
2. Once the prompt's open:
|
||||
* Press `<c-f>` and `<c-b>` to cycle between 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.
|
||||
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
|
||||
* Use `<c-n>`, `<c-p>` to go to the next/previous string in the prompt's history.
|
||||
* Use `<c-y>` to create a new file and its parent dirs.
|
||||
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
|
||||
* End the input string with a colon `:` followed by a command to execute it on the opening file(s).
|
||||
|
||||
More at `:help ctrlp-mappings`.
|
||||
|
||||
## Configuration
|
||||
* Unless a starting directory is specified, the local working directory will be set 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.
|
||||
0 - don't manage working directory.
|
||||
1 - the directory of the current file.
|
||||
2 - the nearest ancestor that contains one of these directories or files:
|
||||
`.git/` `.hg/` `.svn/` `.bzr/` `_darcs/`
|
||||
`.git` `.hg` `.svn` `.bzr` `_darcs`
|
||||
|
||||
* If you want to exclude directories or files from the search, use the Vim’s
|
||||
option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples:
|
||||
Define additional root markers with the `g:ctrlp_root_markers` option.
|
||||
|
||||
* Exclude files and directories:
|
||||
|
||||
```vim
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
||||
@@ -64,15 +77,14 @@ option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples:
|
||||
\ }
|
||||
```
|
||||
|
||||
* Use a custom file listing command with:
|
||||
* Use a custom file listing command:
|
||||
|
||||
```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._
|
||||
More at `:help ctrlp-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
|
||||
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
|
||||
|
||||
Reference in New Issue
Block a user