Mercurial > public > dotfiles
changeset 5:eef1de191580
Removing ctrlp in preparation for installing pathogen.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 29 Apr 2012 16:08:44 -0500 |
parents | 6bb800967ce5 |
children | ff60fbc930de |
files | vim/vimfiles/autoload/ctrlp.vim vim/vimfiles/autoload/ctrlp/buffertag.vim vim/vimfiles/autoload/ctrlp/dir.vim vim/vimfiles/autoload/ctrlp/line.vim vim/vimfiles/autoload/ctrlp/mrufiles.vim vim/vimfiles/autoload/ctrlp/quickfix.vim vim/vimfiles/autoload/ctrlp/tag.vim vim/vimfiles/autoload/ctrlp/utils.vim vim/vimfiles/doc/ctrlp.txt vim/vimfiles/plugin/ctrlp.vim |
diffstat | 10 files changed, 0 insertions(+), 2784 deletions(-) [+] |
line wrap: on
line diff
--- a/vim/vimfiles/autoload/ctrlp.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1347 +0,0 @@ -" ============================================================================= -" File: autoload/ctrlp.vim -" Description: Fuzzy file, buffer, mru and tag finder. -" Author: Kien Nguyen <github.com/kien> -" Version: 1.6.5 -" ============================================================================= - -" Static variables {{{1 -fu! s:opts() - let hst = exists('+hi') ? &hi : 20 - let opts = { - \ 'g:ctrlp_by_filename': ['s:byfname', 0], - \ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1], - \ 'g:ctrlp_custom_ignore': ['s:usrign', ''], - \ 'g:ctrlp_dont_split': ['s:nosplit', ''], - \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], - \ 'g:ctrlp_extensions': ['s:extensions', []], - \ 'g:ctrlp_follow_symlinks': ['s:folsym', 0], - \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'Identifier']], - \ 'g:ctrlp_lazy_update': ['s:lazy', 0], - \ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2], - \ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1], - \ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1], - \ 'g:ctrlp_max_depth': ['s:maxdepth', 40], - \ 'g:ctrlp_max_files': ['s:maxfiles', 20000], - \ 'g:ctrlp_max_height': ['s:mxheight', 10], - \ 'g:ctrlp_max_history': ['s:maxhst', hst], - \ 'g:ctrlp_open_multi': ['s:opmul', '1v'], - \ 'g:ctrlp_open_new_file': ['s:newfop', 3], - \ 'g:ctrlp_prompt_mappings': ['s:urprtmaps', 0], - \ 'g:ctrlp_regexp_search': ['s:regexp', 0], - \ 'g:ctrlp_root_markers': ['s:rmarkers', []], - \ 'g:ctrlp_split_window': ['s:splitwin', 0], - \ 'g:ctrlp_use_caching': ['s:caching', 1], - \ 'g:ctrlp_use_migemo': ['s:migemo', 0], - \ 'g:ctrlp_user_command': ['s:usrcmd', ''], - \ 'g:ctrlp_working_path_mode': ['s:pathmode', 2], - \ } - for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) - endfo - if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en - let s:glob = s:dotfiles ? '.*\|*' : '*' - let s:maxdepth = min([s:maxdepth, 100]) - let g:ctrlp_builtins = 2 - if !empty(s:extensions) | for each in s:extensions - exe 'ru autoload/ctrlp/'.each.'.vim' - endfo | en -endf -cal s:opts() - -let s:lash = ctrlp#utils#lash() - -" Global options -let s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0, - \ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'mouse': 'n', - \ 'gcr': 'a:blinkon0' } - -if s:lazy - cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) -en - -" Limiters -let [s:compare_lim, s:nocache_lim, s:mltipats_lim] = [3000, 4000, 2000] -" * Open & Close {{{1 -fu! s:Open() - if exists('g:ctrlp_log') && g:ctrlp_log - sil! exe 'redi >>' ctrlp#utils#cachedir().s:lash.'ctrlp.log' - en - let [s:cwd, s:winres] = [getcwd(), winrestcmd()] - let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)] - let [s:crword, s:crline] = [expand('<cword>'), getline('.')] - let [s:tagfiles, s:crcursor] = [s:tagfiles(), getpos('.')] - let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] - let s:currwin = s:mwbottom ? winnr() : winnr() + has('autocmd') - sil! exe s:mwbottom ? 'bo' : 'to' '1new ControlP' - let [s:bufnr, s:prompt] = [bufnr('%'), ['', '', '']] - abc <buffer> - if !exists('s:hstry') - let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : [''] - let s:hstry = empty(hst) || !s:maxhst ? [''] : hst - en - for [ke, va] in items(s:glbs) - sil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va) - endfo - if s:opmul && has('signs') - sign define ctrlpmark text=+> texthl=Search - en - cal s:setupblank() -endf - -fu! s:Close() - try | bun! | cat | clo! | endt - cal s:unmarksigns() - for key in keys(s:glbs) - sil! exe 'let &'.key.' = s:glb_'.key - endfo - if exists('s:glb_acd') | let &acd = s:glb_acd | en - let [g:ctrlp_lines, g:ctrlp_allfiles] = [[], []] - exe s:winres - unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr - \ g:ctrlp_nolimit - cal ctrlp#recordhist() - if exists('g:ctrlp_log') && g:ctrlp_log - sil! redi END - en - ec -endf -" * Clear caches {{{1 -fu! ctrlp#clr(...) - exe 'let g:ctrlp_new'.( exists('a:1') ? a:1 : 'cache' ).' = 1' -endf - -fu! ctrlp#clra(...) - if !exists('a:1') && ( has('dialog_gui') || has('dialog_con') ) && - \ confirm("Delete all cache files?", "&OK\n&Cancel") != 1 | retu | en - let cache_dir = ctrlp#utils#cachedir() - if isdirectory(cache_dir) - let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n") - cal filter(cache_files, '!isdirectory(v:val) && v:val !~ ''\<cache\.txt$''') - sil! cal map(cache_files, 'delete(v:val)') - en - cal ctrlp#clr() -endf - -fu! ctrlp#reset() - if ( has('dialog_gui') || has('dialog_con') ) && - \ confirm("Reset and apply new options?", "&OK\n&Cancel") != 1 | retu | en - cal s:opts() - cal ctrlp#utils#opts() - cal ctrlp#mrufiles#opts() - unl! s:cline -endf -" * Files() {{{1 -fu! s:Files() - let [cwd, cafile, g:ctrlp_allfiles] = [getcwd(), ctrlp#utils#cachefile(), []] - if g:ctrlp_newcache || !filereadable(cafile) || !s:caching - let lscmd = s:lsCmd() - " Get the list of files - if empty(lscmd) - cal s:GlobPath(cwd, 0) - el - sil! cal ctrlp#progress('Indexing...') - try | cal s:UserCmd(cwd, lscmd) | cat | retu [] | endt - en - " Remove base directory - cal ctrlp#rmbasedir(g:ctrlp_allfiles) - let read_cache = 0 - el - let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) - let read_cache = 1 - en - if len(g:ctrlp_allfiles) <= s:compare_lim - cal sort(g:ctrlp_allfiles, 'ctrlp#complen') - en - cal s:writecache(read_cache, cafile) - retu g:ctrlp_allfiles -endf - -fu! s:GlobPath(dirs, depth) - let entries = split(globpath(a:dirs, s:glob), "\n") - if s:usrign != '' - cal filter(entries, 'v:val !~ s:usrign') - en - let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] - cal extend(g:ctrlp_allfiles, dnf[1]) - if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth - sil! cal ctrlp#progress(len(g:ctrlp_allfiles)) - cal s:GlobPath(join(dnf[0], ','), depth) - en -endf - -fu! s:UserCmd(path, lscmd) - let path = a:path - if exists('+ssl') && &ssl - let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] - en - let path = exists('*shellescape') ? shellescape(path) : path - let g:ctrlp_allfiles = split(system(printf(a:lscmd, path)), "\n") - if exists('+ssl') && exists('ssl') - let &ssl = ssl - cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")') - en - if exists('s:vcscmd') && s:vcscmd - cal map(g:ctrlp_allfiles, 'tr(v:val, "/", "\\")') - en -endf - -fu! s:lsCmd() - let cmd = s:usrcmd - if type(cmd) == 1 - retu cmd - elsei type(cmd) == 3 && len(cmd) >= 2 && !empty(cmd[0]) && !empty(cmd[1]) - let rmarker = cmd[0] - " Find a repo root - cal s:findroot(getcwd(), rmarker, 0, 1) - if !exists('s:vcsroot') || ( exists('s:vcsroot') && empty(s:vcsroot) ) - " Try the secondary_command - retu len(cmd) == 3 ? cmd[2] : '' - en - let s:vcscmd = s:lash == '\' ? 1 : 0 - retu cmd[1] - en -endf -fu! s:Buffers() "{{{1 - let allbufs = [] - for each in range(1, bufnr('$')) - if getbufvar(each, '&bl') && each != s:crbufnr - let bufname = bufname(each) - if strlen(bufname) && getbufvar(each, '&ma') && bufname != 'ControlP' - cal add(allbufs, fnamemodify(bufname, ':p')) - en - en - endfo - retu allbufs -endf -" * MatchedItems() {{{1 -fu! s:MatchIt(items, pat, limit, ispathitem, mfunc) - let newitems = [] - for item in a:items - if call(a:mfunc, [item, a:pat]) >= 0 | cal add(newitems, item) | en - if a:limit > 0 && len(newitems) >= a:limit | brea | en - endfo - retu newitems -endf - -fu! s:MatchedItems(items, pats, limit) - let [items, pats, limit, ipt] = [a:items, a:pats, a:limit, s:ispathitem()] - " If items is longer than s:mltipats_lim, use only the last pattern - if len(items) >= s:mltipats_lim | let pats = [pats[-1]] | en - cal map(pats, 'substitute(v:val, "\\\~", "\\\\\\~", "g")') - if !s:regexp | cal map(pats, 'escape(v:val, ".")') | en - let mfunc = s:byfname && ipt ? 's:matchfname' - \ : s:itemtype > 2 && len(items) < 30000 && !ipt ? 's:matchtab' - \ : 'match' - " Loop through the patterns - for pat in pats - " If newitems is small, set it as items to search in - if exists('newitems') && len(newitems) < limit - let items = copy(newitems) - en - if empty(items) " End here - retu exists('newitems') ? newitems : [] - el " Start here, go back up if have 2 or more in pats - " Loop through the items - let newitems = s:MatchIt(items, pat, limit, ipt, mfunc) - en - endfo - let s:matches = len(newitems) - retu newitems -endf -fu! s:SplitPattern(str, ...) "{{{1 - let str = s:sanstail(a:str) - if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo') - let dict = s:glbpath(&rtp, printf("dict/%s/migemo-dict", &encoding), 1) - if !len(dict) - let dict = s:glbpath(&rtp, "dict/migemo-dict", 1) - en - if len(dict) - let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s'] - for token in tokens - let rtn = system(printf(cmd, shellescape(token), shellescape(dict))) - let str .= !v:shell_error && len(rtn) > 0 ? '.*'.rtn : token - endfo - en - en - let s:savestr = str - if s:regexp || match(str, '\\\(zs\|ze\|<\|>\)\|[*|]') >= 0 - let array = [s:regexfilter(str)] - el - let array = split(str, '\zs') - if exists('+ssl') && !&ssl - cal map(array, 'substitute(v:val, "\\", "\\\\\\", "g")') - en - " Literal ^ and $ - for each in ['^', '$'] - cal map(array, 'substitute(v:val, "\\\'.each.'", "\\\\\\'.each.'", "g")') - endfo - en - " Build the new pattern - let nitem = !empty(array) ? array[0] : '' - let newpats = [nitem] - if len(array) > 1 - for item in range(1, len(array) - 1) - " Separator - let sep = a:0 ? a:1 : '[^'.array[item-1].']\{-}' - let nitem .= sep.array[item] - cal add(newpats, nitem) - endfo - en - retu newpats -endf -" * BuildPrompt() {{{1 -fu! s:Render(lines, pat) - let lines = a:lines - " Setup the match window - let s:height = min([len(lines), s:mxheight]) - sil! exe '%d _ | res' s:height - " Print the new items - if empty(lines) - setl nocul - cal setline(1, ' == NO ENTRIES ==') - cal s:unmarksigns() - if s:dohighlight() | cal clearmatches() | en - retu - en - setl cul - " Sort if not MRU - if ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') ) - \ || !empty(join(s:prompt, '')) - let s:compat = a:pat - cal sort(lines, 's:mixedsort') - unl s:compat - en - if s:mwreverse | cal reverse(lines) | en - let s:matched = copy(lines) - cal map(lines, '"> ".v:val') - cal setline(1, lines) - exe 'keepj norm!' s:mwreverse ? 'G' : 'gg' - keepj norm! 1| - cal s:unmarksigns() - cal s:remarksigns() - if exists('s:cline') | cal cursor(s:cline, 1) | en - " Highlighting - if s:dohighlight() - cal s:highlight(a:pat, empty(s:mathi[1]) ? 'Identifier' : s:mathi[1]) - en -endf - -fu! s:Update(str) - " Get the previous string if existed - let oldstr = exists('s:savestr') ? s:savestr : '' - let pats = s:SplitPattern(a:str) - " Get the new string sans tail - let notail = substitute(a:str, '\\\\', '\', 'g') - let notail = substitute(notail, '\\\@<!:\([^:]\|\\:\)*$', '', '') - let notail = substitute(notail, '\\\ze:', '', 'g') - " Stop if the string's unchanged - if notail == oldstr && !empty(notail) && !exists('s:force') - retu - en - let lines = exists('g:ctrlp_nolimit') && empty(notail) ? copy(g:ctrlp_lines) - \ : s:MatchedItems(g:ctrlp_lines, copy(pats), s:mxheight) - cal s:Render(lines, pats[-1]) -endf - -fu! s:ForceUpdate() - let [estr, prt] = ['"\', copy(s:prompt)] - cal map(prt, 'escape(v:val, estr)') - cal s:Update(join(prt, '')) -endf - -fu! s:BuildPrompt(upd, ...) - let base = ( s:regexp ? 'r' : '>' ).( s:byfname ? 'd' : '>' ).'> ' - let [estr, prt] = ['"\', copy(s:prompt)] - cal map(prt, 'escape(v:val, estr)') - let str = join(prt, '') - let lazy = empty(str) || exists('s:force') || !has('autocmd') ? 0 : s:lazy - if a:upd && !lazy && ( s:matches || s:regexp - \ || match(str, '[*|]') >= 0 || match(str, '\\\:\([^:]\|\\:\)*$') >= 0 ) - sil! cal s:Update(str) - en - sil! cal ctrlp#statusline() - " Toggling - let [hiactive, hicursor, base] = exists('a:1') && !a:1 - \ ? ['Comment', 'Comment', tr(base, '>', '-')] - \ : ['Normal', 'Constant', base] - let hibase = 'Comment' - " Build it - redr - exe 'echoh' hibase '| echon "'.base.'" - \ | echoh' hiactive '| echon "'.prt[0].'" - \ | echoh' hicursor '| echon "'.prt[1].'" - \ | echoh' hiactive '| echon "'.prt[2].'" | echoh None' - " Append the cursor at the end - if empty(prt[1]) && ( !exists('a:1') || ( exists('a:1') && a:1 ) ) - exe 'echoh' hibase '| echon "_" | echoh None' - en -endf -" ** Prt Actions {{{1 -" Editing {{{2 -fu! s:PrtClear() - unl! s:hstgot - let [s:prompt, s:matches] = [['', '', ''], 1] - cal s:BuildPrompt(1) -endf - -fu! s:PrtAdd(char) - unl! s:hstgot - let s:prompt[0] = s:prompt[0] . a:char - cal s:BuildPrompt(1) -endf - -fu! s:PrtBS() - unl! s:hstgot - let [prt, s:matches] = [s:prompt, 1] - let prt[0] = strpart(prt[0], -1, strlen(prt[0])) - cal s:BuildPrompt(1) -endf - -fu! s:PrtDelete() - unl! s:hstgot - let [prt, s:matches] = [s:prompt, 1] - let prt[1] = strpart(prt[2], 0, 1) - let prt[2] = strpart(prt[2], 1) - cal s:BuildPrompt(1) -endf - -fu! s:PrtDeleteWord() - unl! s:hstgot - let [str, s:matches] = [s:prompt[0], 1] - let str = match(str, '\W\w\+$') >= 0 ? matchstr(str, '^.\+\W\ze\w\+$') - \ : match(str, '\w\W\+$') >= 0 ? matchstr(str, '^.\+\w\ze\W\+$') - \ : match(str, '\s\+$') >= 0 ? matchstr(str, '^.*[^ \t]\+\ze\s\+$') - \ : match(str, ' ') <= 0 ? '' : str - let s:prompt[0] = str - cal s:BuildPrompt(1) -endf - -fu! s:PrtInsert(type) - unl! s:hstgot - " Insert current word, search register, last visual and clipboard - let s:prompt[0] .= a:type == 'w' ? s:crword - \ : a:type == 's' ? getreg('/') - \ : a:type == 'v' ? s:crvisual - \ : a:type == '+' ? substitute(getreg('+'), '\n', '\\n', 'g') : s:prompt[0] - cal s:BuildPrompt(1) -endf -" Movement {{{2 -fu! s:PrtCurLeft() - if !empty(s:prompt[0]) - let prt = s:prompt - let prt[2] = prt[1] . prt[2] - let prt[1] = strpart(prt[0], strlen(prt[0]) - 1) - let prt[0] = strpart(prt[0], -1, strlen(prt[0])) - en - cal s:BuildPrompt(0) -endf - -fu! s:PrtCurRight() - let prt = s:prompt - let prt[0] = prt[0] . prt[1] - let prt[1] = strpart(prt[2], 0, 1) - let prt[2] = strpart(prt[2], 1) - cal s:BuildPrompt(0) -endf - -fu! s:PrtCurStart() - let prt = s:prompt - let str = join(prt, '') - let [prt[0], prt[1], prt[2]] = ['', strpart(str, 0, 1), strpart(str, 1)] - cal s:BuildPrompt(0) -endf - -fu! s:PrtCurEnd() - let prt = s:prompt - let [prt[0], prt[1], prt[2]] = [join(prt, ''), '', ''] - cal s:BuildPrompt(0) -endf - -fu! s:PrtSelectMove(dir) - exe 'norm!' a:dir - let s:cline = line('.') - if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en -endf - -fu! s:PrtSelectJump(char, ...) - let lines = copy(s:matched) - if exists('a:1') - cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]') - en - " Cycle through matches, use s:jmpchr to store last jump - let chr = escape(a:char, '.~') - if match(lines, '\c^'.chr) >= 0 - " If not exists or does but not for the same char - let pos = match(lines, '\c^'.chr) - if !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr ) - let [jmpln, s:jmpchr] = [pos, [chr, pos]] - elsei exists('s:jmpchr') && s:jmpchr[0] == chr - " Start of lines - if s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en - let npos = match(lines, '\c^'.chr, s:jmpchr[1] + 1) - let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] - en - keepj exe jmpln + 1 - let s:cline = line('.') - if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en - en -endf -" Misc {{{2 -fu! s:PrtClearCache() - if s:itemtype == 1 | retu | en - if s:itemtype == 0 - cal ctrlp#clr() - elsei s:itemtype > 2 - cal ctrlp#clr(s:statypes[s:itemtype][1]) - en - if s:itemtype == 2 - let g:ctrlp_lines = ctrlp#mrufiles#list(-1, 1) - el - cal s:SetLines(s:itemtype) - en - let s:force = 1 - cal s:BuildPrompt(1) - unl s:force -endf - -fu! s:PrtDeleteMRU() - if s:itemtype == 2 - let s:force = 1 - let g:ctrlp_lines = ctrlp#mrufiles#list(-1, 2) - cal s:BuildPrompt(1) - unl s:force - en -endf - -fu! s:PrtExit() - if !has('autocmd') | cal s:Close() | en - exe s:currwin.'winc w' -endf - -fu! s:PrtHistory(...) - if !s:maxhst | retu | en - let [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1] - " Save to history if not saved before - let [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)] - let idx = exists('s:hisidx') ? s:hisidx + a:1 : a:1 - " Limit idx within 0 and hslen - let idx = idx < 0 ? 0 : idx >= hslen ? hslen > 1 ? hslen - 1 : 0 : idx - let s:prompt = [hst[idx], '', ''] - let [s:hisidx, s:hstgot, s:force] = [idx, 1, 1] - cal s:BuildPrompt(1) - unl s:force -endf -"}}}1 -" * MapKeys() {{{1 -fu! s:MapKeys(...) - " Normal keys - let pfunc = exists('a:1') && !a:1 ? 'PrtSelectJump' : 'PrtAdd' - let dojmp = s:byfname && pfunc == 'PrtSelectJump' ? ', 1' : '' - for each in range(32, 126) - let cmd = "nn \<buffer> \<silent> \<char-%d> :\<c-u>cal \<SID>%s(\"%s\"%s)\<cr>" - exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp) - endfo - if exists('a:2') | retu | en - " Special keys - cal call('s:MapSpecs', exists('a:1') && !a:1 ? [1] : []) -endf - -fu! s:MapSpecs(...) - let [lcmap, prtmaps] = ['nn <buffer> <silent>', { - \ 'PrtBS()': ['<bs>'], - \ '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>', '<c-q>', '<RightMouse>'], - \ 'ToggleFocus()': ['<tab>'], - \ 'ToggleRegex()': ['<c-r>'], - \ 'ToggleByFname()': ['<c-d>'], - \ 'ToggleType(1)': ['<c-f>', '<c-up>'], - \ 'ToggleType(-1)': ['<c-b>', '<c-down>'], - \ 'PrtInsert("w")': ['<F2>'], - \ 'PrtInsert("s")': ['<F3>'], - \ 'PrtInsert("v")': ['<F4>'], - \ 'PrtInsert("+")': ['<F6>'], - \ 'PrtCurStart()': ['<c-a>'], - \ 'PrtCurEnd()': ['<c-e>'], - \ 'PrtCurLeft()': ['<c-h>', '<left>'], - \ 'PrtCurRight()': ['<c-l>', '<right>'], - \ 'PrtClearCache()': ['<F5>'], - \ 'PrtDeleteMRU()': ['<F7>'], - \ 'CreateNewFile()': ['<c-y>'], - \ 'MarkToOpen()': ['<c-z>'], - \ 'OpenMulti()': ['<c-o>'], - \ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'], - \ }] - if type(s:urprtmaps) == 4 - cal extend(prtmaps, s:urprtmaps) - en - " Correct arrow keys in terminal - if ( has('termresponse') && !empty(v:termresponse) ) - \ || &term =~? 'xterm\|\<k\?vt\|gnome\|screen\|linux' - for each in ['\A <up>','\B <down>','\C <right>','\D <left>'] - exe lcmap.' <esc>['.each - endfo - en - if exists('a:1') - let prtunmaps = [ - \ 'PrtBS()', - \ 'PrtDelete()', - \ 'PrtDeleteWord()', - \ 'PrtClear()', - \ 'PrtCurStart()', - \ 'PrtCurEnd()', - \ 'PrtCurLeft()', - \ 'PrtCurRight()', - \ 'PrtHistory(-1)', - \ 'PrtHistory(1)', - \ 'PrtInsert("w")', - \ 'PrtInsert("s")', - \ 'PrtInsert("v")', - \ 'PrtInsert("+")', - \ ] - for ke in prtunmaps | for kp in prtmaps[ke] - exe lcmap kp '<Nop>' - endfo | endfo - el - for [ke, va] in items(prtmaps) | for kp in va - exe lcmap kp ':<c-u>cal <SID>'.ke.'<cr>' - endfo | endfo - en -endf -" * Toggling {{{1 -fu! s:Focus() - retu !exists('s:focus') ? 1 : s:focus -endf - -fu! s:ToggleFocus() - let s:focus = !exists('s:focus') || s:focus ? 0 : 1 - cal s:MapKeys(s:focus) - cal s:BuildPrompt(0, s:focus) -endf - -fu! s:ToggleRegex() - let s:regexp = s:regexp ? 0 : 1 - cal s:PrtSwitcher() -endf - -fu! s:ToggleByFname() - if s:ispathitem() - let s:byfname = s:byfname ? 0 : 1 - cal s:MapKeys(s:Focus(), 1) - cal s:PrtSwitcher() - en -endf - -fu! s:ToggleType(dir) - let ext = exists('g:ctrlp_ext_vars') ? len(g:ctrlp_ext_vars) : 0 - let s:itemtype = s:walker(g:ctrlp_builtins + ext, s:itemtype, a:dir) - let s:extid = s:itemtype - ( g:ctrlp_builtins + 1 ) - unl! g:ctrlp_nolimit - cal s:SetLines(s:itemtype) - cal s:PrtSwitcher() - if s:itemtype > 2 - if exists('g:ctrlp_ext_vars['.s:extid.'][4][0]') - let g:ctrlp_nolimit = g:ctrlp_ext_vars[s:extid][4][0] - en - el - cal s:syntax() - en -endf - -fu! s:PrtSwitcher() - let [s:force, s:matches] = [1, 1] - cal s:BuildPrompt(1, s:Focus()) - unl s:force -endf -fu! s:SetWD(...) "{{{1 - let pathmode = s:pathmode - if exists('a:1') && len(a:1) | if type(a:1) - cal ctrlp#setdir(a:1) | retu - el - let pathmode = a:1 - en | en - if !exists('a:2') - if match(s:crfile, '^\<.\+\>://.*') >= 0 || !pathmode | retu | en - if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en - cal ctrlp#setdir(s:crfpath) - en - if pathmode == 1 | retu | en - let markers = ['root.dir','.git/','.hg/','.vimprojects','_darcs/','.bzr/'] - if type(s:rmarkers) == 3 && !empty(s:rmarkers) - cal extend(markers, s:rmarkers, 0) - en - for marker in markers - cal s:findroot(getcwd(), marker, 0, 0) - if exists('s:foundroot') | brea | en - endfo - unl! s:foundroot -endf -" * AcceptSelection() {{{1 -fu! ctrlp#acceptfile(mode, matchstr, ...) - let [md, matchstr] = [a:mode, a:matchstr] - " Get the full path - let filpath = s:itemtype ? matchstr : getcwd().s:lash.matchstr - cal s:PrtExit() - let bufnum = bufnr(filpath) - if s:jmptobuf && bufnum > 0 && md =~ 'e\|t' - let [jmpb, bufwinnr] = [1, bufwinnr(bufnum)] - let buftab = s:jmptobuf > 1 ? s:buftab(bufnum, md) : [0, 0] - let j2l = a:0 ? a:1 : str2nr(matchstr(s:tail(), '^ +\zs\d\+$')) - en - " Switch to existing buffer or open new one - if exists('jmpb') && bufwinnr > 0 && md != 't' - exe bufwinnr.'winc w' - if j2l | cal ctrlp#j2l(j2l) | en - elsei exists('jmpb') && buftab[0] - exe 'tabn' buftab[0] - exe buftab[1].'winc w' - if j2l | cal ctrlp#j2l(j2l) | en - el - " Determine the command to use - let cmd = md == 't' || s:splitwin == 1 ? 'tabe' - \ : md == 'h' || s:splitwin == 2 ? 'new' - \ : md == 'v' || s:splitwin == 3 ? 'vne' : ctrlp#normcmd('e') - " Open new window/buffer - cal call('s:openfile', a:0 ? [cmd, filpath, ' +'.a:1] : [cmd, filpath]) - en -endf - -fu! s:SpecInputs() - let str = join(s:prompt, '') - let type = s:itemtype > 2 ? - \ g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )][3] : s:itemtype - if str == '..' && type =~ '0\|dir' - cal s:parentdir(getcwd()) - cal s:SetLines(s:itemtype) - cal s:PrtClear() - retu 1 - elsei ( str == '/' || str == '\' ) && type =~ '0\|dir' - cal s:SetWD(2, 0) - cal s:SetLines(s:itemtype) - cal s:PrtClear() - retu 1 - elsei str == '?' - cal s:PrtExit() - let hlpwin = &columns > 159 ? '| vert res 80' : '' - sil! exe 'bo vert h ctrlp-mappings' hlpwin '| norm! 0' - retu 1 - en - retu 0 -endf - -fu! s:AcceptSelection(mode) - if a:mode == 'e' | if s:SpecInputs() | retu | en | en - " Get the selected line - let matchstr = matchstr(getline('.'), '^> \zs.\+\ze\t*$') - if empty(matchstr) | retu | en - " Do something with it - let actfunc = s:itemtype =~ '0\|1\|2' ? 'ctrlp#acceptfile' - \ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )][1] - cal call(actfunc, [a:mode, matchstr]) -endf -fu! s:CreateNewFile() "{{{1 - let str = join(s:prompt, '') - if empty(str) | retu | en - let str = s:sanstail(str) - let arr = split(str, '[\/]') - let fname = remove(arr, -1) - if len(arr) | if isdirectory(s:createparentdirs(arr)) - let optyp = str - en | el - let optyp = fname - en - if exists('optyp') - let filpath = getcwd().s:lash.optyp - cal s:insertcache(str) - cal s:PrtExit() - let cmd = s:newfop == 1 ? 'tabe' - \ : s:newfop == 2 ? 'new' - \ : s:newfop == 3 ? 'vne' : ctrlp#normcmd('e') - cal s:openfile(cmd, filpath) - en -endf -" * OpenMulti() {{{1 -fu! s:MarkToOpen() - if s:bufnr <= 0 || !s:opmul || s:itemtype > g:ctrlp_builtins | retu | en - let matchstr = matchstr(getline('.'), '^> \zs.\+\ze\t*$') - if empty(matchstr) | retu | en - let filpath = s:itemtype ? matchstr : getcwd().s:lash.matchstr - if exists('s:marked') && s:dictindex(s:marked, filpath) > 0 - " Unmark and remove the file from s:marked - let key = s:dictindex(s:marked, filpath) - cal remove(s:marked, key) - if empty(s:marked) | unl! s:marked | en - if has('signs') - exe 'sign unplace' key 'buffer='.s:bufnr - en - el - " Add to s:marked and place a new sign - if exists('s:marked') - let vac = s:vacantdict(s:marked) - let key = empty(vac) ? len(s:marked) + 1 : vac[0] - let s:marked = extend(s:marked, { key : filpath }) - el - let [key, s:marked] = [1, { 1 : filpath }] - en - if has('signs') - exe 'sign place' key 'line='.line('.').' name=ctrlpmark buffer='.s:bufnr - en - en - sil! cal ctrlp#statusline() -endf - -fu! s:OpenMulti() - if !exists('s:marked') || !s:opmul - cal s:AcceptSelection('e') - retu - en - let mkd = s:marked - cal s:PrtExit() - " Try not to open a new tab - let [ntab, norwins] = [0, s:normbuf()] - if empty(norwins) | let ntab = 1 | el - for each in norwins - let bufnr = winbufnr(each) - if !empty(bufname(bufnr)) && !empty(getbufvar(bufnr, '&ft')) - \ && bufname(bufnr) != 'ControlP' - let ntab = 1 - en - endfo - if !ntab | let wnr = min(norwins) | en - en - if ntab | tabnew | en - let [ic, wnr] = [1, exists('wnr') ? wnr : 1] - let cmds = { 'v': 'vne', 'h': 'new', 't': 'tabe' } - let spt = len(s:opmul) > 1 ? cmds[matchstr(s:opmul, '\w$')] : 'vne' - let nr = matchstr(s:opmul, '^\d\+') - exe wnr.'winc w' - for va in values(mkd) - let cmd = ic == 1 ? 'e' : spt - cal s:openfile(cmd, va) - if nr > 1 && nr < ic | clo! | el | let ic += 1 | en - endfo -endf -" ** Helper functions {{{1 -" Sorting {{{2 -fu! ctrlp#complen(s1, s2) - " By length - let [len1, len2] = [strlen(a:s1), strlen(a:s2)] - retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 -endf - -fu! s:compmatlen(s1, s2) - " By match length - let mln1 = s:shortest(s:matchlens(a:s1, s:compat)) - let mln2 = s:shortest(s:matchlens(a:s2, s:compat)) - retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1 -endf - -fu! s:comptime(s1, s2) - " By last modified time - let [time1, time2] = [getftime(a:s1), getftime(a:s2)] - retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1 -endf - -fu! s:comparent(s1, s2) - " By same parent dir - if match(s:crfpath, escape(getcwd(), '.^$*\')) >= 0 - let [as1, as2] = [getcwd().s:lash.a:s1, getcwd().s:lash.a:s2] - let [loc1, loc2] = [s:getparent(as1), s:getparent(as2)] - if loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en - if loc2 == s:crfpath && loc1 != s:crfpath | retu 1 | en - retu 0 - en - retu 0 -endf - -fu! s:matchlens(str, pat, ...) - if empty(a:pat) || index(['^','$'], a:pat) >= 0 | retu {} | en - let st = exists('a:1') ? a:1 : 0 - let lens = exists('a:2') ? a:2 : {} - let nr = exists('a:3') ? a:3 : 0 - if match(a:str, a:pat, st) != -1 - let [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)] - let lens = extend(lens, { nr : [len(mst), mst] }) - let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1) - en - retu lens -endf - -fu! s:shortest(lens) - retu min(map(values(a:lens), 'v:val[0]')) -endf - -fu! s:mixedsort(s1, s2) - let [cml, cln] = [s:compmatlen(a:s1, a:s2), ctrlp#complen(a:s1, a:s2)] - if s:itemtype < 3 && s:height < 51 - let par = s:comparent(a:s1, a:s2) - if s:height < 21 - retu 6 * cml + 3 * par + 2 * s:comptime(a:s1, a:s2) + cln - en - retu 3 * cml + 2 * par + cln - en - retu 2 * cml + cln -endf -" Statusline {{{2 -fu! ctrlp#statusline(...) - if !exists('s:statypes') - let s:statypes = [ - \ ['files', 'fil'], - \ ['buffers', 'buf'], - \ ['mru files', 'mru'], - \ ] - if exists('g:ctrlp_ext_vars') - cal map(copy(g:ctrlp_ext_vars), 'add(s:statypes, [ v:val[2], v:val[3] ])') - en - en - let tps = s:statypes - let max = len(tps) - 1 - let nxt = tps[s:walker(max, s:itemtype, 1)][1] - let prv = tps[s:walker(max, s:itemtype, -1)][1] - let item = tps[s:itemtype][0] - let focus = s:Focus() ? 'prt' : 'win' - let byfname = s:byfname ? 'file' : 'path' - let regex = s:regexp ? '%#LineNr# regex %*' : '' - let focus = '%#LineNr# '.focus.' %*' - let byfname = '%#Character# '.byfname.' %*' - let item = '%#Character# '.item.' %*' - let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' - let dir = ' %=%<%#LineNr# '.getcwd().' %*' - let marked = s:opmul ? exists('s:marked') ? ' <'.s:dismrk().'>' : ' <+>' : '' - let &l:stl = focus.byfname.regex.slider.marked.dir -endf - -fu! s:dismrk() - retu has('signs') ? '+'.len(s:marked) : - \ '%<'.join(values(map(copy(s:marked), 'split(v:val, "[\\/]")[-1]')), ', ') -endf - -fu! ctrlp#progress(len) - if has('macunix') || has('mac') | sl 1m | en - let &l:stl = '%#Function# '.a:len.' %* %=%<%#LineNr# '.getcwd().' %*' - redr -endf -" Paths {{{2 -fu! s:ispathitem() - let ext = s:itemtype - ( g:ctrlp_builtins + 1 ) - retu s:itemtype < 3 || ( s:itemtype > 2 && g:ctrlp_ext_vars[ext][3] == 'dir' ) -endf - -fu! ctrlp#dirnfile(entries) - let [items, cwd] = [[[], []], getcwd().s:lash] - for each in a:entries - let etype = getftype(each) - if etype == 'dir' - if s:dotfiles | if match(each, '[\/]\.\{,2}$') < 0 - cal add(items[0], each) - en | el - cal add(items[0], each) - en - elsei etype == 'link' - if s:folsym - let isfile = !isdirectory(each) - if !s:samerootsyml(each, isfile, cwd) - cal add(items[isfile], each) - en - en - elsei etype == 'file' - cal add(items[1], each) - en - endfo - retu items -endf - -fu! s:samerootsyml(each, isfile, cwd) - let resolve = resolve(a:each) - let resolve = ( a:isfile ? fnamemodify(resolve, ':p:h') : resolve ).s:lash - retu !( stridx(resolve, a:cwd) && ( stridx(a:cwd, resolve) || a:isfile ) ) -endf - -fu! ctrlp#rmbasedir(items) - let idx = strlen(getcwd()) + 1 - retu map(a:items, 'strpart(v:val, idx)') -endf - -fu! s:parentdir(curr) - let parent = s:getparent(a:curr) - if parent != a:curr | cal ctrlp#setdir(parent) | en -endf - -fu! s:getparent(item) - retu split(a:item, '[\/]\ze[^\/]\+[\/:]\?$')[0] -endf - -fu! s:getgrand(item) - retu split(a:item, '[\/]\ze[^\/]\+[\/][^\/]\+[\/:]\?$')[0] -endf - -fu! s:createparentdirs(arr) - for each in a:arr - let curr = exists('curr') ? curr.s:lash.each : each - cal ctrlp#utils#mkdir(curr) - endfo - retu curr -endf - -fu! s:listdirs(path, parent) - let [str, dirs] = ['', split(s:glbpath(a:path, '*', 1), "\n")] - for entry in filter(dirs, 'isdirectory(v:val)') - let str .= a:parent . split(entry, '[\/]')[-1] . "\n" - endfo - retu str -endf - -fu! ctrlp#cpl(A, L, P) - let haslash = match(a:A, '[\/]') - let parent = substitute(a:A, '[^\/]*$', '', 'g') - let path = !haslash ? parent : haslash > 0 ? getcwd().s:lash.parent : getcwd() - retu s:listdirs(path, parent) -endf - -fu! s:findroot(curr, mark, depth, type) - let [depth, notfound] = [a:depth + 1, empty(s:glbpath(a:curr, a:mark, 1))] - if !notfound || depth > s:maxdepth - if notfound | cal ctrlp#setdir(s:cwd) | en - if a:type - let s:vcsroot = depth <= s:maxdepth ? a:curr : '' - el - cal ctrlp#setdir(a:curr) - let s:foundroot = 1 - en - el - let parent = s:getparent(a:curr) - if parent != a:curr | cal s:findroot(parent, a:mark, depth, a:type) | en - en -endf - -fu! s:glbpath(...) - retu call('globpath', v:version > 701 ? a:000 : a:000[:1]) -endf - -fu! ctrlp#fnesc(path) - retu exists('*fnameescape') ? fnameescape(a:path) : escape(a:path, " %#*?|<\"\n") -endf - -fu! ctrlp#setdir(path, ...) - let cmd = exists('a:1') ? a:1 : 'lc!' - try - exe cmd.' '.ctrlp#fnesc(a:path) - cat - cal ctrlp#msg("Can't change working dir. Directory not exists.") - endt -endf -" Highlighting {{{2 -fu! s:syntax() - sy match CtrlPNoEntries '^ == NO ENTRIES ==$' - sy match CtrlPLineMarker '^>' - hi link CtrlPNoEntries Error - hi CtrlPLineMarker guifg=bg -endf - -fu! s:highlight(pat, grp) - cal clearmatches() - if !empty(a:pat) && s:itemtype < 3 - let pat = substitute(a:pat, '\~', '\\~', 'g') - if !s:regexp | let pat = escape(pat, '.') | en - " Match only filename - if s:byfname - let pat = substitute(pat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') - let pat = substitute(pat, '$', '\\ze[^\\/]*$', 'g') - en - cal matchadd(a:grp, '\c'.pat) - cal matchadd('CtrlPLineMarker', '^>') - en -endf - -fu! s:dohighlight() - retu type(s:mathi) == 3 && len(s:mathi) > 1 && s:mathi[0] - \ && exists('*clearmatches') -endf -" Prompt history {{{2 -fu! s:gethistloc() - let cache_dir = ctrlp#utils#cachedir().s:lash.'hist' - retu [cache_dir, cache_dir.s:lash.'cache.txt'] -endf - -fu! s:gethistdata() - retu ctrlp#utils#readfile(s:gethistloc()[1]) -endf - -fu! ctrlp#recordhist() - let str = join(s:prompt, '') - if empty(str) || !s:maxhst | retu | en - let hst = s:hstry - if len(hst) > 1 && hst[1] == str | retu | en - cal extend(hst, [str], 1) - if len(hst) > s:maxhst | cal remove(hst, s:maxhst, -1) | en -endf -" Signs {{{2 -fu! s:unmarksigns() - if !s:dosigns() | retu | en - for key in keys(s:marked) - exe 'sign unplace' key 'buffer='.s:bufnr - endfo -endf - -fu! s:remarksigns() - if !s:dosigns() | retu | en - let [nls, head] = [s:matched, s:itemtype ? '' : getcwd().s:lash] - for ic in range(1, len(nls)) - let filpath = head.nls[ic - 1] - let key = s:dictindex(s:marked, filpath) - if key > 0 - exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr - en - endfo -endf - -fu! s:dosigns() - retu exists('s:marked') && s:bufnr > 0 && s:opmul && has('signs') -endf -" Dictionaries {{{2 -fu! s:dictindex(dict, expr) - for key in keys(a:dict) - if a:dict[key] == a:expr | retu key | en - endfo - retu -1 -endf - -fu! s:vacantdict(dict) - retu filter(range(1, max(keys(a:dict))), '!has_key(a:dict, v:val)') -endf -" Buffers {{{2 -fu! s:buftab(bufnum, md) - for tabnr in range(1, tabpagenr('$')) - if tabpagenr() == tabnr && a:md == 't' | con | en - let buflist = tabpagebuflist(tabnr) - if index(buflist, a:bufnum) >= 0 - for winnr in range(1, tabpagewinnr(tabnr, '$')) - if buflist[winnr - 1] == a:bufnum - retu [tabnr, winnr] - en - endfo - en - endfo - retu [0, 0] -endf - -fu! s:normbuf() - let winnrs = [] - for each in range(1, winnr('$')) - let bufnr = winbufnr(each) - if getbufvar(bufnr, '&bl') && empty(getbufvar(bufnr, '&bt')) - \ && getbufvar(bufnr, '&ma') - cal add(winnrs, each) - en - endfo - retu winnrs -endf - -fu! ctrlp#normcmd(cmd) - if !empty(s:nosplit) && match([bufname('%'), &l:ft], s:nosplit) >= 0 - retu a:cmd - en - " Find a regular buffer - let norwins = s:normbuf() - let norwin = empty(norwins) ? 0 : norwins[0] - if norwin - if index(norwins, winnr()) < 0 - exe norwin.'winc w' - en - retu a:cmd - en - retu 'bo vne' -endf - -fu! s:setupblank() - setl noswf nobl nonu nowrap nolist nospell nocuc wfh - setl fdc=0 fdl=99 tw=0 bt=nofile bh=unload - if v:version > 702 - setl nornu noudf cc=0 - en -endf - -fu! s:leavepre() - if s:clrex && ( !has('clientserver') || - \ ( has('clientserver') && len(split(serverlist(), "\n")) == 1 ) ) - cal ctrlp#clra(1) - en - cal ctrlp#utils#writecache(s:hstry, s:gethistloc()[0], s:gethistloc()[1]) -endf - -fu! s:checkbuf() - if exists('s:init') | retu | en - if exists('s:bufnr') && s:bufnr > 0 - exe s:bufnr.'bw!' - en -endf -" Arguments {{{2 -fu! s:tail() - if exists('s:optail') && !empty('s:optail') - let tailpref = match(s:optail, '^\s*+') < 0 ? ' +' : ' ' - retu tailpref.s:optail - en - retu '' -endf - -fu! s:sanstail(str) - let [str, pat] = [substitute(a:str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] - unl! s:optail - if match(str, '\\\@<!:'.pat) >= 0 - let s:optail = matchstr(str, '\\\@<!:\zs'.pat) - let str = substitute(str, '\\\@<!:'.pat, '', '') - en - retu substitute(str, '\\\ze:', '', 'g') -endf -" Misc {{{2 -fu! s:lastvisual() - let cview = winsaveview() - let [ovreg, ovtype] = [getreg('v'), getregtype('v')] - let [oureg, outype] = [getreg('"'), getregtype('"')] - sil! norm! gv"vy - let selected = substitute(getreg('v'), '\n', '\\n', 'g') - cal setreg('v', ovreg, ovtype) - cal setreg('"', oureg, outype) - cal winrestview(cview) - retu selected -endf - -fu! ctrlp#msg(msg) - redr | echoh Identifier | echon "CtrlP: ".a:msg | echoh None -endf - -fu! s:openfile(cmd, filpath, ...) - let cmd = a:cmd == 'e' && &modified ? 'hid e' : a:cmd - let tail = a:0 ? a:1 : s:tail() - try - exe cmd.tail.' '.ctrlp#fnesc(a:filpath) - cat - fina - if !empty(tail) - sil! norm! zvzz - en - endt -endf - -fu! s:writecache(read_cache, cache_file) - if !a:read_cache && ( ( g:ctrlp_newcache || !filereadable(a:cache_file) ) - \ && s:caching || len(g:ctrlp_allfiles) > s:nocache_lim ) - if len(g:ctrlp_allfiles) > s:nocache_lim | let s:caching = 1 | en - cal ctrlp#utils#writecache(g:ctrlp_allfiles) - en -endf - -fu! ctrlp#j2l(nr) - exe a:nr - sil! norm! zvzz -endf - -fu! s:regexfilter(str) - let str = a:str - let pats = { - \ '^\(\\|\)\|\(\\|\)$': '\\|', - \ '^\\\(zs\|ze\|<\|>\)': '^\\\(zs\|ze\|<\|>\)', - \ '^\S\*$': '\*', - \ '^\S\\?$': '\\?', - \ } - for key in keys(pats) | if match(str, key) >= 0 - let str = substitute(str, pats[key], '', 'g') - en | endfo - retu str -endf - -fu! s:walker(max, pos, dir) - retu a:dir > 0 ? a:pos < a:max ? a:pos + 1 : 0 : a:pos > 0 ? a:pos - 1 : a:max -endf - -fu! s:matchfname(item, pat) - retu match(split(a:item, '[\/]\ze[^\/]\+$')[-1], a:pat) -endf - -fu! s:matchtab(item, pat) - retu match(split(a:item, '\t\+[^\t]\+$')[0], a:pat) -endf - -fu! s:maxf(len) - retu s:maxfiles && a:len > s:maxfiles ? 1 : 0 -endf - -fu! s:insertcache(str) - let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str] - if strlen(str) <= strlen(data[0]) - let pos = 0 - elsei strlen(str) >= strlen(data[-1]) - let pos = len(data) - 1 - el - let pos = 0 - for each in data - if strlen(each) > strlen(str) | brea | en - let pos += 1 - endfo - en - cal insert(data, str, pos) - cal s:writecache(0, ctrlp#utils#cachefile()) -endf -" Extensions {{{2 -fu! s:tagfiles() - retu filter(map(tagfiles(), 'fnamemodify(v:val, ":p")'), 'filereadable(v:val)') -endf - -fu! ctrlp#exit() - cal s:PrtExit() -endf - -fu! ctrlp#prtclear() - cal s:PrtClear() -endf - -fu! ctrlp#setlines(type) - cal s:SetLines(a:type) -endf -"}}}1 -" * Initialization {{{1 -fu! s:SetLines(type) - let s:itemtype = a:type - let types = [ - \ 's:Files()', - \ 's:Buffers()', - \ 'ctrlp#mrufiles#list(-1)', - \ ] - if exists('g:ctrlp_ext_vars') - cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val[0])') - en - let g:ctrlp_lines = eval(types[a:type]) -endf - -fu! ctrlp#init(type, ...) - if exists('s:init') | retu | en - let [s:matches, s:init] = [1, 1] - cal s:Open() - cal s:SetWD(a:0 ? a:1 : '') - cal s:MapKeys() - cal s:SetLines(a:type) - cal s:BuildPrompt(1) - if has('syntax') && exists('g:syntax_on') | cal s:syntax() | en -endf -if has('autocmd') "{{{1 - aug CtrlPAug - au! - au BufEnter ControlP cal s:checkbuf() - au BufLeave ControlP cal s:Close() - au VimLeavePre * cal s:leavepre() - if s:lazy - au CursorHold ControlP cal s:ForceUpdate() - en - aug END -en "}}} - -" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
--- a/vim/vimfiles/autoload/ctrlp/buffertag.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -" ============================================================================= -" File: autoload/ctrlp/buffertag.vim -" Description: Buffer Tag extension -" Maintainer: Kien Nguyen <github.com/kien> -" ============================================================================= - -" Init {{{1 -if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag - fini -en -let g:loaded_ctrlp_buftag = 1 - -let s:buftag_var = ['ctrlp#buffertag#init(s:crfile, s:crbufnr)', - \ 'ctrlp#buffertag#accept', 'buffer tags', 'bft'] - -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 - if empty(cmd) - cal ctrlp#msg("Encoding conversion failed!") - 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 data = g:ctrlp_buftags[a:fname]['data'] - el - let data = s:exectagsonfile(a:fname, a:ftype) - let cache = { a:fname : { 'time': ftime, 'data': data } } - cal extend(g:ctrlp_buftags, cache) - en - let [raw, lines] = [split(data, '\n\+'), []] - for line in raw | if len(split(line, ';"')) == 2 - cal add(lines, s:parseline(line)) - en | endfo - 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 - retu vals[1].' '.vals[4].'|'.vals[6].'| '.vals[3] -endf -" Public {{{1 -fu! ctrlp#buffertag#init(fname, bufnr) - sy match CtrlPTabExtra '\zs\t.*\ze$' - hi link CtrlPTabExtra Comment - retu s:process(a:fname, get(split(getbufvar(a:bufnr, '&ft'), '\.'), 0, '')) -endf - -fu! ctrlp#buffertag#accept(mode, str) - cal ctrlp#exit() - if a:mode == 't' - tab sp - elsei a:mode == 'h' - sp - elsei a:mode == 'v' - vs - en - cal ctrlp#j2l(matchstr(a:str, '^[^\t]\+\t\+[^\t|]\+|\zs\d\+\ze|')) -endf - -fu! ctrlp#buffertag#id() - retu s:id -endf -"}}} - -" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
--- a/vim/vimfiles/autoload/ctrlp/dir.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -" ============================================================================= -" 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', - \ 's:usrign', - \ ] - -let s:dir_var = ['ctrlp#dir#init('.join(s:ars, ', ').')', 'ctrlp#dir#accept', - \ 'dirs', 'dir'] - -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") - if s:usrign != '' - cal filter(entries, 'v:val !~ s:usrign') - en - 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[3] - let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var[3]) - 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 - el - let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile) - let read_cache = 1 - en - if len(g:ctrlp_alldirs) <= s:compare_lim - cal sort(g:ctrlp_alldirs, 'ctrlp#complen') - 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
--- a/vim/vimfiles/autoload/ctrlp/line.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -" ============================================================================= -" File: autoload/ctrlp/line.vim -" Description: Line extension - find a line in any buffer. -" Author: Kien Nguyen <github.com/kien> -" ============================================================================= - -" Init {{{1 -if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line - fini -en -let g:loaded_ctrlp_line = 1 - -let s:line_var = ['ctrlp#line#init()', 'ctrlp#line#accept', 'lines', 'lns'] - -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] = [[], []] - for each in range(1, bufnr('$')) - if getbufvar(each, '&bl') - let bufname = bufname(each) - if strlen(bufname) && bufname != 'ControlP' - cal add(bufs, fnamemodify(bufname, ':p')) - en - en - endfo - cal filter(bufs, 'filereadable(v:val)') - 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 - sy match CtrlPTabExtra '\zs\t.*\ze$' - hi link CtrlPTabExtra Comment - 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
--- a/vim/vimfiles/autoload/ctrlp/mrufiles.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -" ============================================================================= -" 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:include', ''], - \ 'g:ctrlp_mruf_exclude': ['s:exclude', ''], - \ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1], - \ } - for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) - endfo -endf -cal ctrlp#mrufiles#opts() -fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 - if s:locked | retu | en - " Get the list - let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' - let cafile = cadir.ctrlp#utils#lash().'cache.txt' - let mrufs = ctrlp#utils#readfile(cafile) - " Remove non-existent files - if exists('a:1') && a:1 == 1 - let mrufs = s:rmdeleted(mrufs, cadir, cafile) - elsei exists('a:1') && a:1 == 2 - cal ctrlp#utils#writecache([], cadir, cafile) - retu [] - en - " Return the list - if a:bufnr == -1 | retu mrufs | en - " Filter it - let filename = fnamemodify(bufname(a:bufnr + 0), ':p') - if empty(filename) || !empty(&bt) - \ || ( !empty(s:include) && filename !~# s:include ) - \ || ( !empty(s:exclude) && filename =~# s:exclude ) - \ || ( index(mrufs, filename) == -1 && !filereadable(filename) ) - retu - en - " Remove old matched entry - cal filter(mrufs, 'v:val !='.( s:csen ? "#" : "?" ).' filename') - " Insert new one - cal insert(mrufs, filename) - " Remove oldest entry - if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en - cal ctrlp#utils#writecache(mrufs, cadir, cafile) -endf "}}} -fu! s:rmdeleted(mrufs, cadir, cafile) "{{{ - cal filter(a:mrufs, '!empty(ctrlp#utils#glob(v:val, 1))') - cal ctrlp#utils#writecache(a:mrufs, a:cadir, a:cafile) - retu a:mrufs -endf -fu! ctrlp#mrufiles#init() "{{{1 - let s:locked = 0 - aug CtrlPMRUF - au! - au BufReadPost,BufNewFile,BufWritePost * - \ cal ctrlp#mrufiles#list(expand('<abuf>', 1)) - 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
--- a/vim/vimfiles/autoload/ctrlp/quickfix.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -" ============================================================================= -" 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 = ['ctrlp#quickfix#init()', 'ctrlp#quickfix#accept', 'quickfix', - \ 'qfx', [1]] - -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 - sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' - hi def link CtrlPqfLineCol Search - 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 - try - exe cmd.' '.ctrlp#fnesc(filpath) - cat - cal ctrlp#msg("Invalid command or argument.") - fina - cal cursor(items[2], items[3]) | sil! norm! zvzz - endt -endf - -fu! ctrlp#quickfix#id() - retu s:id -endf -"}}} - -" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
--- a/vim/vimfiles/autoload/ctrlp/tag.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -" ============================================================================= -" 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 = ['ctrlp#tag#init(s:tagfiles)', 'ctrlp#tag#accept', - \ 'tags', 'tag'] - -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 [&l:tags, fname] = [s:ltags, expand(fname, 1)] - let tgs = 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 = sort(s:nodup(a:tagfiles)) - let s:ltags = join(tagfiles, ',') - let g:ctrlp_alltags = [] - for each in tagfiles - let alltags = s:filter(ctrlp#utils#readfile(each)) - cal extend(g:ctrlp_alltags, alltags) - endfo - sy match CtrlPTabExtra '\zs\t.*\ze$' - hi link CtrlPTabExtra Comment - 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': ['tabe', 'tab stj'], - \ 'h': ['new', 'stj'], - \ 'v': ['vne', 'vert stj'], - \ 'e': ['ene', 'tj'], - \ } - let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1] - let cmd = cmd =~ 'tj\|ene' && &modified ? 'hid '.cmd : cmd - try - if fnd[0] == 1 - exe cmd - let &l:tags = s:ltags - exe fnd[1].'ta' tg - el - exe cmd.' '.tg - en - cat - cal ctrlp#msg("Tag not found.") - endt -endf - -fu! ctrlp#tag#id() - retu s:id -endf -"}}} - -" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
--- a/vim/vimfiles/autoload/ctrlp/utils.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -" ============================================================================= -" 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! ctrlp#utils#opts() - let s:cache_dir = $HOME.s:lash.'.ctrlp_cache' - if exists('g:ctrlp_cache_dir') - let s:cache_dir = expand(g:ctrlp_cache_dir, 1) - if isdirectory(s:cache_dir.s:lash.'.ctrlp_cache') - let s:cache_dir = s:cache_dir.s:lash.'.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 = exists('a:1') ? '.'.a:1 : '' - let cache_file = substitute(getcwd(), '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt' - retu exists('a:1') ? cache_file : s:cache_dir.s:lash.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) - en -endf - -fu! ctrlp#utils#writecache(lines, ...) - let cache_dir = exists('a:1') ? a:1 : s:cache_dir - cal ctrlp#utils#mkdir(cache_dir) - if isdirectory(cache_dir) - sil! cal writefile(a:lines, exists('a:2') ? a:2 : ctrlp#utils#cachefile()) - if !exists('a:1') - let g:ctrlp_newcache = 0 - en - en -endf - -fu! ctrlp#utils#glob(...) - retu call('glob', v:version > 701 ? a:000 : [a:1]) -endf -"}}} - -" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
--- a/vim/vimfiles/doc/ctrlp.txt Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,719 +0,0 @@ -*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.6.5 -*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, quickfix, dir...), 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'* -Reverse the sort order of the matched files in the match window. The default -setting 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'* -Set this to 0 to disable the jump-to-open-buffer feature. -Set to 2 to also jump tab if the selected buffer’s opened in another tab. -Set to 1 to only jump to it if it’s opened in the current tab: > - let g:ctrlp_jump_to_buffer = 2 -< - - *'g:ctrlp_working_path_mode'* -When starting up the prompt, temporarily set the working directory (i.e. the -|current-directory|) to: - 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 - .vimprojects - 0 - don’t manage working directory. -> - let g:ctrlp_working_path_mode = 2 -< - - *'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-sessions caching: > - 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.'/.ctrlp_cache' -< - - *'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>'], - \ '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>', '<c-q>', '<RightMouse>'], - \ 'ToggleFocus()': ['<tab>'], - \ 'ToggleRegex()': ['<c-r>'], - \ 'ToggleByFname()': ['<c-d>'], - \ 'ToggleType(1)': ['<c-f>', '<c-up>'], - \ 'ToggleType(-1)': ['<c-b>', '<c-down>'], - \ 'PrtCurStart()': ['<c-a>'], - \ 'PrtCurEnd()': ['<c-e>'], - \ 'PrtCurLeft()': ['<c-h>', '<left>'], - \ 'PrtCurRight()': ['<c-l>', '<right>'], - \ 'PrtClearCache()': ['<F5>'], - \ 'PrtDeleteMRU()': ['<F7>'], - \ 'CreateNewFile()': ['<c-y>'], - \ 'MarkToOpen()': ['<c-z>'], - \ 'OpenMulti()': ['<c-o>'], - \ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'], - \ } -< -If you have problem with <bs> moving left instead of deleting a char, add this -to your |vimrc|: > - let g:ctrlp_prompt_mappings = { - \ 'PrtBS()': ['<c-h>'], - \ 'PrtCurLeft()': ['<left>'], - \ } -< - - *'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_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_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. -e.g. exclude version control directories: > - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX - set wildignore+=.git\*,.hg\*,.svn\* " Windows -< -Note: the `*/` in front of each glob is required. - -Other note: |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 pattern: > - let g:ctrlp_custom_ignore = '' -< - - *'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 = 20000 -< - - *'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 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 a lot -faster when working with large projects: > - let g:ctrlp_user_command = [repo_marker, vcs_ls_command, fallback_command] -< -If the fallback_command is empty or not defined, globpath() will then be used -when searching outside a repo. -Examples: > - let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files'] - let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate --fullpath -I .'] -< - - *'g:ctrlp_open_new_file'* -Use this option to specify how the newly created file is to be opened when -pressing <c-y>: - 1 - in a new tab - 2 - in a new horizontal split - 3 - in a new vertical split - 0 - in the current window -> - let g:ctrlp_open_new_file = 3 -< - - *'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. - - *'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. -For the letter: - t - each in a tab - h - each in a horizontal split - v - each in a vertical split - - *'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 = '' -< -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' -< - - *'g:ctrlp_follow_symlinks'* -Set this to 1 to follow symbolic links when listing files: > - let g:ctrlp_follow_symlinks = 0 -< - - *'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 -< - -=============================================================================== -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|. - - *:ClearAllCtrlPCaches* -:ClearAllCtrlPCaches - Delete all the cache files saved in |ctrlp_cache_dir|. - - *:ResetCtrlP* -:ResetCtrlP - Reset all options, take in new values of the option variables in section 2. - -------------------------------------------------------------------------------- -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| and |g:ctrlp_regexp_search|. - - <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> - 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> - Move the cursor one character to the 'left' - - <c-l>, - <right> - Move the cursor one character to the 'right' - - <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' - - <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>. - - <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. - - <esc>, - <c-c>, - <c-g> - Exit |CtrlP|. <c-c> can also be used to stop the file scan. - -Choose your own mappings with |g:ctrlp_prompt_mappings|. - -When inside the match window (press <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| (key map) 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 ':' in the command, - escape it with a backslash: '\:'. - e.g. 'abc:45' will open the selected file and jump to line 45. - 'abc:/my\:function' 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. - - 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. - e.g. 'parentdir/file.txt' will create a directory named 'parentdir' as well - as 'file.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'] -< -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* - * Buffer Tag mode:~ - - Name: 'buffertag' - - Command: ':CtrlPBufTag' - - Search for a tag within the current buffer and jump to the definition. - Requires |exuberant_ctags|. - - *: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' - - 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). - -------------------------------------------------------------------------------- -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 -', - \ }, - \ } -< - -=============================================================================== -EXTENDING *ctrlp-extending* - -Extending |CtrlP| is very simple. Simply create a vim file following a short -guidelines, place it in autoload/ctrlp/ and add its name to your .vimrc. - -To see how it works, get the sample.vim from the extensions branch on the main -git repository (https://github.com/kien/ctrlp.vim/tree/extensions), and place -it along with the parent directories somewhere in your runtimepath. Then put -this into your .vimrc: > - let g:ctrlp_extensions = ['sample'] -< -A new search type will show up the next time you open |CtrlP|. - -For more details, check out the comments inside sample.vim.~ - -=============================================================================== -CREDITS *ctrlp-credits* - -Developed by Kien Nguyen <github.com/kien>, initially based on the Command-T -and the LustyExplorer plugins. No code was taken from these plugins, but I did -clone the majority of their (awesome) interfaces and the way they work. - -This was originally written as a module for a would-be larger plugin called -AutoDoc.vim which I’ve stopped developing because of lost of interest. I really -liked the way Command-T and LustyExplorer deal with user’s input, so I wrote a -pure Vimscript version of their prompt window, intended to use it for the -aforementioned plugin. - -Homepage: http://kien.github.com/ctrlp.vim -Git repository: https://github.com/kien/ctrlp.vim -Mercurial repository: https://bitbucket.org/kien/ctrlp.vim - -=============================================================================== -THANKS *ctrlp-thanks* - -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 language. - -=============================================================================== -CHANGELOG *ctrlp-changelog* - - + New feature: Buffer Tag extension. - + New command: |:CtrlPBufTag|. - + 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
--- a/vim/vimfiles/plugin/ctrlp.vim Thu Jan 05 20:05:42 2012 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -" ============================================================================= -" 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=custom,ctrlp#cpl 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) - -exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>' - -cal ctrlp#mrufiles#init() - -if !exists('g:ctrlp_extensions') | fini | en - -if index(g:ctrlp_extensions, 'tag') >= 0 - let g:ctrlp_alltags = [] | com! CtrlPTag cal ctrlp#init(ctrlp#tag#id()) -en - -if index(g:ctrlp_extensions, 'quickfix') >= 0 - com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id()) -en - -if index(g:ctrlp_extensions, 'dir') >= 0 - let g:ctrlp_alldirs = [] - com! -n=? -com=custom,ctrlp#cpl CtrlPDir - \ cal ctrlp#init(ctrlp#dir#id(), <q-args>) -en - -if index(g:ctrlp_extensions, 'buffertag') >= 0 - let g:ctrlp_buftags = {} - com! CtrlPBufTag cal ctrlp#init(ctrlp#buffertag#id()) -en