Some improvements
* More graceful degradation for 700, 701 * Simplify insertcache() * Correct SetWorkingPath()'s behavior * Reserve Open-Multiple-Files for built-ins
This commit is contained in:
parent
9dcef3db12
commit
ae6f1592b4
@ -2,7 +2,7 @@
|
||||
" File: autoload/ctrlp.vim
|
||||
" Description: Full path fuzzy file, buffer and MRU file finder for Vim
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" Version: 1.5.7
|
||||
" Version: 1.5.8
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{
|
||||
@ -26,7 +26,7 @@ fu! s:opts()
|
||||
\ 'g:ctrlp_root_markers': ['s:rmarkers', []],
|
||||
\ 'g:ctrlp_split_window': ['s:splitwin', 0],
|
||||
\ 'g:ctrlp_use_caching': ['s:caching', 1],
|
||||
\ 'g:ctrlp_working_path_mode': ['s:pathmode', 1],
|
||||
\ 'g:ctrlp_working_path_mode': ['s:pathmode', 2],
|
||||
\ }
|
||||
for key in keys(opts)
|
||||
let def = string(exists(key) ? eval(key) : opts[key][1])
|
||||
@ -70,7 +70,7 @@ fu! s:Open()
|
||||
let s:hstry = empty(hst) || !s:maxhst ? [''] : hst
|
||||
en
|
||||
for key in keys(s:glbs)
|
||||
exe 'let s:glb_'.key.' = &'.key.' | let &'.key.' = '.string(s:glbs[key])
|
||||
sil! exe 'let s:glb_'.key.' = &'.key.' | let &'.key.' = '.string(s:glbs[key])
|
||||
endfo
|
||||
if s:opmul && has('signs')
|
||||
sign define ctrlpmark text=+> texthl=Search
|
||||
@ -82,7 +82,7 @@ fu! s:Close()
|
||||
try | bun! | cat | clo! | endt
|
||||
cal s:unmarksigns()
|
||||
for key in keys(s:glbs)
|
||||
exe 'let &'.key.' = s:glb_'.key
|
||||
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] = [[], []]
|
||||
@ -103,9 +103,9 @@ endf
|
||||
fu! ctrlp#clearallcaches()
|
||||
let cache_dir = ctrlp#utils#cachedir()
|
||||
if isdirectory(cache_dir) && match(cache_dir, '.ctrlp_cache') >= 0
|
||||
let cache_files = split(globpath(cache_dir, '*.txt', 1), '\n')
|
||||
let cache_files = split(globpath(cache_dir, '*.txt'), '\n')
|
||||
cal filter(cache_files, '!isdirectory(v:val)')
|
||||
for each in cache_files | sil! cal delete(each) | endfo
|
||||
sil! cal map(cache_files, 'delete(v:val)')
|
||||
en
|
||||
cal ctrlp#clearcache()
|
||||
endf
|
||||
@ -118,7 +118,7 @@ fu! ctrlp#reset()
|
||||
unl! s:cline
|
||||
endf
|
||||
"}}}
|
||||
" * ListAllFiles {{{
|
||||
" * Files() {{{
|
||||
fu! s:GlobPath(dirs, allfiles, depth)
|
||||
let entries = split(globpath(a:dirs, s:glob), '\n')
|
||||
let entries = filter(entries, 'getftype(v:val) != "link"')
|
||||
@ -149,7 +149,7 @@ fu! s:UserCommand(path, lscmd)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:ListAllFiles(path)
|
||||
fu! s:Files(path)
|
||||
let cache_file = ctrlp#utils#cachefile()
|
||||
if g:ctrlp_newcache || !filereadable(cache_file) || !s:caching
|
||||
let lscmd = s:lscommand()
|
||||
@ -172,16 +172,11 @@ fu! s:ListAllFiles(path)
|
||||
if len(g:ctrlp_allfiles) <= s:compare_lim
|
||||
cal sort(g:ctrlp_allfiles, 's:complen')
|
||||
en
|
||||
" Write cache
|
||||
if !read_cache && ( ( g:ctrlp_newcache || !filereadable(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
|
||||
cal s:writecache(read_cache, cache_file)
|
||||
retu g:ctrlp_allfiles
|
||||
endf
|
||||
"}}}
|
||||
fu! s:ListAllBuffers() "{{{
|
||||
fu! s:Buffers() "{{{
|
||||
let allbufs = []
|
||||
for each in range(1, bufnr('$'))
|
||||
if getbufvar(each, '&bl')
|
||||
@ -193,7 +188,7 @@ fu! s:ListAllBuffers() "{{{
|
||||
endfo
|
||||
retu allbufs
|
||||
endf "}}}
|
||||
" * GetMatchedItems {{{
|
||||
" * MatchedItems() {{{
|
||||
fu! s:MatchIt(items, pat, limit)
|
||||
let [items, pat, limit, newitems] = [a:items, a:pat, a:limit, []]
|
||||
let mfunc = s:byfname ? 's:matchsubstr' : 'match'
|
||||
@ -204,7 +199,7 @@ fu! s:MatchIt(items, pat, limit)
|
||||
retu newitems
|
||||
endf
|
||||
|
||||
fu! s:GetMatchedItems(items, pats, limit)
|
||||
fu! s:MatchedItems(items, pats, limit)
|
||||
let [items, pats, limit] = [a:items, a:pats, a:limit]
|
||||
" If items is longer than s:mltipats_lim, use only the last pattern
|
||||
if len(items) >= s:mltipats_lim | let pats = [pats[-1]] | en
|
||||
@ -265,8 +260,8 @@ fu! s:SplitPattern(str,...) "{{{
|
||||
en
|
||||
retu newpats
|
||||
endf "}}}
|
||||
" * BuildPrompt {{{
|
||||
fu! s:Renderer(lines, pat)
|
||||
" * BuildPrompt() {{{
|
||||
fu! s:Render(lines, pat)
|
||||
let lines = a:lines
|
||||
" Setup the match window
|
||||
sil! exe '%d _ | res' min([len(lines), s:mxheight])
|
||||
@ -290,7 +285,7 @@ fu! s:Renderer(lines, pat)
|
||||
exe 'keepj norm!' s:mwreverse ? 'G' : 'gg'
|
||||
keepj norm! 1|
|
||||
cal s:unmarksigns()
|
||||
cal s:remarksigns(s:matched)
|
||||
cal s:remarksigns()
|
||||
en
|
||||
if exists('s:cline') | cal cursor(s:cline, 1) | en
|
||||
" Highlighting
|
||||
@ -301,7 +296,7 @@ fu! s:Renderer(lines, pat)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:UpdateMatches(pat,...)
|
||||
fu! s:Update(pat,...)
|
||||
let pat = a:pat
|
||||
" Get the previous string if existed
|
||||
let oldstr = exists('s:savestr') ? s:savestr : ''
|
||||
@ -312,9 +307,9 @@ fu! s:UpdateMatches(pat,...)
|
||||
if notail == oldstr && !empty(notail) && !exists('a:1') && !exists('s:force')
|
||||
retu
|
||||
en
|
||||
let lines = s:GetMatchedItems(g:ctrlp_lines, pats, s:mxheight)
|
||||
let lines = s:MatchedItems(g:ctrlp_lines, pats, s:mxheight)
|
||||
let pat = pats[-1]
|
||||
cal s:Renderer(lines, pat)
|
||||
cal s:Render(lines, pat)
|
||||
endf
|
||||
|
||||
fu! s:BuildPrompt(upd,...)
|
||||
@ -323,7 +318,7 @@ fu! s:BuildPrompt(upd,...)
|
||||
cal map(prt, 'escape(v:val, estr)')
|
||||
let str = join(prt, '')
|
||||
if a:upd && ( s:matches || s:regexp || match(str, '[*|]') >= 0 )
|
||||
sil! cal call('s:UpdateMatches', exists('a:2') ? [str, a:2] : [str])
|
||||
sil! cal call('s:Update', exists('a:2') ? [str, a:2] : [str])
|
||||
en
|
||||
sil! cal s:statusline()
|
||||
" Toggling
|
||||
@ -482,7 +477,7 @@ fu! s:PrtHistory(...)
|
||||
endf
|
||||
"}}}
|
||||
"}}}
|
||||
" * MapKeys {{{
|
||||
" * MapKeys() {{{
|
||||
fu! s:MapKeys(...)
|
||||
" Normal keys
|
||||
let pfunc = exists('a:1') && !a:1 ? 'PrtSelectJump' : 'PrtAdd'
|
||||
@ -599,33 +594,31 @@ fu! s:PrtSwitcher()
|
||||
endf
|
||||
"}}}
|
||||
fu! ctrlp#SetWorkingPath(...) "{{{
|
||||
let [l:pathmode, s:cwd] = [2, getcwd()]
|
||||
let [pathmode, s:cwd] = [s:pathmode, getcwd()]
|
||||
if exists('a:1') && len(a:1) == 1 && !type(a:1)
|
||||
let l:pathmode = a:1
|
||||
let pathmode = a:1
|
||||
elsei exists('a:1') && len(a:1) > 1 && type(a:1)
|
||||
sil! exe 'chd!' a:1
|
||||
retu
|
||||
en
|
||||
if match(expand('%:p', 1), '^\<.\+\>://.*') >= 0 || !s:pathmode || !l:pathmode
|
||||
if match(expand('%:p', 1), '^\<.\+\>://.*') >= 0 || !pathmode
|
||||
retu
|
||||
en
|
||||
if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en
|
||||
let path = expand('%:p:h', 1)
|
||||
let path = exists('*fnameescape') ? fnameescape(path) : escape(path, '%#')
|
||||
if s:pathmode == 1 || l:pathmode == 1
|
||||
sil! exe 'chd!' path
|
||||
retu
|
||||
en
|
||||
sil! exe 'chd!' path
|
||||
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
|
||||
let found = s:findroot(path, marker, 0, 0)
|
||||
let found = s:findroot(getcwd(), marker, 0, 0)
|
||||
if getcwd() != expand('%:p:h', 1) || found | brea | en
|
||||
endfo
|
||||
endf "}}}
|
||||
" * AcceptSelection {{{
|
||||
" * AcceptSelection() {{{
|
||||
fu! ctrlp#acceptfile(mode, matchstr)
|
||||
let [md, matchstr] = [a:mode, a:matchstr]
|
||||
" Get the full path
|
||||
@ -728,13 +721,12 @@ fu! s:CreateNewFile() "{{{
|
||||
cal s:insertcache(str)
|
||||
cal s:PrtExit()
|
||||
if s:newfop == 1 | tabnew | en
|
||||
let opcmd = cmd.' '.escape(getcwd().s:lash.optyp, '%#')
|
||||
cal s:openfile(opcmd)
|
||||
cal s:openfile(cmd.' '.escape(getcwd().s:lash.optyp, '%#'))
|
||||
en
|
||||
endf "}}}
|
||||
" * OpenMulti {{{
|
||||
" * OpenMulti() {{{
|
||||
fu! s:MarkToOpen()
|
||||
if s:bufnr <= 0 || !s:opmul | retu | en
|
||||
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
|
||||
@ -924,7 +916,7 @@ endf
|
||||
|
||||
fu! s:listdirs(path,parent)
|
||||
let str = ''
|
||||
for entry in filter(split(globpath(a:path, '*', 1), '\n'), 'isdirectory(v:val)')
|
||||
for entry in filter(split(globpath(a:path, '*'), '\n'), 'isdirectory(v:val)')
|
||||
let str .= a:parent . split(entry, '[\/]')[-1] . "\n"
|
||||
endfo
|
||||
retu str
|
||||
@ -938,9 +930,14 @@ fu! ctrlp#compl(A,L,P)
|
||||
endf
|
||||
|
||||
fu! s:findroot(curr, mark, depth, type)
|
||||
let [depth, notfound] = [a:depth + 1, empty(globpath(a:curr, a:mark, 1))]
|
||||
let [depth, notfound] = [a:depth + 1, empty(globpath(a:curr, a:mark))]
|
||||
if !notfound || depth > s:maxdepth
|
||||
if notfound | retu 0 | en
|
||||
if notfound
|
||||
if exists('s:cwd')
|
||||
sil! exe 'chd!' s:cwd
|
||||
en
|
||||
retu 0
|
||||
en
|
||||
if a:type
|
||||
let s:vcsroot = depth <= s:maxdepth ? a:curr : ''
|
||||
el
|
||||
@ -1002,9 +999,9 @@ fu! s:unmarksigns()
|
||||
endfo
|
||||
endf
|
||||
|
||||
fu! s:remarksigns(nls)
|
||||
fu! s:remarksigns()
|
||||
if !s:dosigns() | retu | en
|
||||
let nls = a:nls
|
||||
let nls = s:matched
|
||||
for ic in range(1, len(nls))
|
||||
let filpath = s:itemtype ? nls[ic - 1] : getcwd().s:lash.nls[ic - 1]
|
||||
let key = s:dictindex(s:marked, filpath)
|
||||
@ -1082,6 +1079,14 @@ fu! s:checkbuf()
|
||||
endf
|
||||
"}}}
|
||||
" Misc {{{
|
||||
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! s:regexfilter(str)
|
||||
let str = a:str
|
||||
let pats = {
|
||||
@ -1104,7 +1109,9 @@ fu! s:openfile(cmd)
|
||||
try
|
||||
exe a:cmd
|
||||
cat
|
||||
echoe 'CtrlP: Operation can''t be completed. Make sure filename is valid.'
|
||||
echoh Identifier
|
||||
echon "CtrlP: Operation can't be completed. Make sure filename is valid."
|
||||
echoh None
|
||||
endt
|
||||
endf
|
||||
|
||||
@ -1121,29 +1128,21 @@ fu! s:maxfiles(len)
|
||||
endf
|
||||
|
||||
fu! s:insertcache(str)
|
||||
let cache_file = ctrlp#utils#cachefile()
|
||||
if filereadable(cache_file)
|
||||
let data = readfile(cache_file)
|
||||
if index(data, a:str) >= 0 | retu | en
|
||||
if strlen(a:str) <= strlen(data[0])
|
||||
let pos = 0
|
||||
elsei strlen(a:str) >= strlen(data[-1])
|
||||
let pos = len(data) - 1
|
||||
el
|
||||
" Boost the value
|
||||
let strlen = abs((strlen(a:str) - strlen(data[0])) * 100000)
|
||||
let fullen = abs(strlen(data[-1]) - strlen(data[0]))
|
||||
let posi = string(len(data) * strlen / fullen)
|
||||
" Find and move the floating point back
|
||||
let floatpos = stridx(posi, '.')
|
||||
let posi = substitute(posi, '\.', '', 'g')
|
||||
let posi = join(insert(split(posi, '\zs'), '.', floatpos - 5), '')
|
||||
" Get the approximate integer
|
||||
let pos = float2nr(round(str2float(posi)))
|
||||
en
|
||||
cal insert(data, a:str, pos)
|
||||
cal ctrlp#utils#writecache(data)
|
||||
if match(a:str, '|\|?\|:\|"\|\*\|<\|>') >= 0 | retu | en
|
||||
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
|
||||
|
||||
fu! s:lscommand()
|
||||
@ -1170,8 +1169,8 @@ endf
|
||||
fu! s:SetLines(type)
|
||||
let s:itemtype = a:type
|
||||
let types = [
|
||||
\ 's:ListAllFiles(getcwd())',
|
||||
\ 's:ListAllBuffers()',
|
||||
\ 's:Files(getcwd())',
|
||||
\ 's:Buffers()',
|
||||
\ 'ctrlp#mrufiles#list(-1)',
|
||||
\ ]
|
||||
if !s:mru | cal remove(types, 2) | en
|
||||
|
@ -50,7 +50,7 @@ fu! ctrlp#mrufiles#list(bufnr,...) "{{{
|
||||
endf "}}}
|
||||
fu! s:rmdeleted(mrufs, cadir, cafile) "{{{
|
||||
for each in range(len(a:mrufs) - 1, 0, -1)
|
||||
if empty(glob(a:mrufs[each], 1))
|
||||
if empty(glob(a:mrufs[each]))
|
||||
cal remove(a:mrufs, each)
|
||||
en
|
||||
endfo
|
||||
|
110
doc/ctrlp.txt
110
doc/ctrlp.txt
@ -1,4 +1,4 @@
|
||||
*ctrlp.txt* Full path fuzzy file, buffer and MRU file finder. v1.5.7
|
||||
*ctrlp.txt* Full path fuzzy file, buffer and MRU file finder. v1.5.8
|
||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||
===============================================================================
|
||||
# #
|
||||
@ -19,18 +19,13 @@ CONTENTS *ctrlp-contents*
|
||||
4. Mappings.....................................|ctrlp-mappings|
|
||||
5. Input Formats................................|ctrlp-input-formats|
|
||||
|
||||
6. Credits......................................|ctrlp-credits|
|
||||
7. Thanks.......................................|ctrlp-thanks|
|
||||
8. Extending ctrlp..............................|ctrlp-extensions|
|
||||
9. Changelog....................................|ctrlp-changelog|
|
||||
|
||||
===============================================================================
|
||||
1. Intro *ctrlp-intro*
|
||||
|
||||
Full path fuzzy file, buffer and MRU file 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 monitoring, project’s root
|
||||
finder, custom extensions, and more.
|
||||
finder, and more.
|
||||
|
||||
===============================================================================
|
||||
2. Options *ctrlp-options*
|
||||
@ -73,16 +68,6 @@ Set the maximum height of the match window: >
|
||||
let g:ctrlp_max_height = 10
|
||||
<
|
||||
|
||||
*'g:ctrlp_split_window'*
|
||||
Use this option to specify how the file is to be opened when pressing <cr>:
|
||||
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_split_window = 0
|
||||
<
|
||||
|
||||
*'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: >
|
||||
@ -91,7 +76,7 @@ tab if the selected buffer’s opened in another tab: >
|
||||
|
||||
*'g:ctrlp_working_path_mode'*
|
||||
*SetWorkingPath()*
|
||||
When starting up the prompt, automatically set the working directory (i.e. the
|
||||
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:
|
||||
@ -103,7 +88,7 @@ When starting up the prompt, automatically set the working directory (i.e. the
|
||||
.vimprojects
|
||||
0 - don’t manage working directory.
|
||||
>
|
||||
let g:ctrlp_working_path_mode = 1
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
<
|
||||
You can use this functionality outside of |CtrlP| by adding the following line
|
||||
to your |.vimrc|; the parameter is the same (1, 2 or 0): >
|
||||
@ -124,8 +109,7 @@ be enabled for directories that have more than 4000 files: >
|
||||
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 (not deleting the caches upon
|
||||
exiting Vim): >
|
||||
Set this to 0 to enable cross-sessions caching: >
|
||||
let g:ctrlp_clear_cache_on_exit = 1
|
||||
<
|
||||
|
||||
@ -277,8 +261,8 @@ If non-zero this will enable opening multiple files with <c-z> and <c-o>: >
|
||||
let g:ctrlp_open_multi = 1
|
||||
<
|
||||
If bigger than 1, it’ll be used as the maximum number of windows to create when
|
||||
opening the files (the rest will be hidden buffers). If is 1, it’ll open all
|
||||
files, each in a vertical split.
|
||||
opening the files (the rest will be hidden buffers). If is 1, <c-o> will open
|
||||
all files, each in a vertical split.
|
||||
|
||||
===============================================================================
|
||||
3. Commands *ctrlp-commands*
|
||||
@ -315,17 +299,20 @@ The following commands ignore the value of |g:ctrlp_working_path_mode|:
|
||||
|
||||
*:CtrlPCurWD*
|
||||
:CtrlPCurWD
|
||||
Find files in the |current-directory| (without changing it).
|
||||
This acts like |:CtrlP| with |path_mode| = 0
|
||||
Find files in the |current-directory|.
|
||||
|
||||
*:CtrlPCurFile*
|
||||
:CtrlPCurFile
|
||||
Find files in the same directory as the current file, regardless of what the
|
||||
|current-directory| is.
|
||||
This acts like |:CtrlP| with |path_mode| = 1
|
||||
Find files in the same directory as the active buffer, regardless of what
|
||||
the |current-directory| is.
|
||||
|
||||
*:CtrlPRoot*
|
||||
:CtrlPRoot
|
||||
Same as |:CtrlPCurFile| but start from the project’s root.
|
||||
Check |g:ctrlp_working_path_mode| to see how |CtrlP| finds a root.
|
||||
This acts like |:CtrlP| with |path_mode| = 2
|
||||
Find files in the project’s root directory.
|
||||
Check |working_path_mode| to see how |CtrlP| finds a root.
|
||||
|
||||
===============================================================================
|
||||
4. Mappings *ctrlp-mappings*
|
||||
@ -348,14 +335,12 @@ Once inside the prompt:
|
||||
|
||||
<c-f>, 'forward'
|
||||
<c-up>
|
||||
Toggle between searching files and searching buffers. Or switch to the
|
||||
'next' search type in the sequence; currently files, buffers and most
|
||||
recently used files (MRU Files) are available.
|
||||
Scroll to the 'next' search type in the sequence. Currently file, buffer
|
||||
and most recently used file (MRU) are available.
|
||||
|
||||
<c-b>, 'backward'
|
||||
<c-down>
|
||||
Toggle between searching files and searching buffers. Or switch to the
|
||||
'previous' search type in the sequence.
|
||||
Scroll to the 'previous' search type in the sequence.
|
||||
|
||||
<tab>
|
||||
Toggle the focus between the match window and the prompt.
|
||||
@ -449,7 +434,7 @@ 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| and |g:ctrlp_regexp_search|.
|
||||
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,
|
||||
@ -473,35 +458,11 @@ e) Type the name of a non-existent file and press <c-y> to create it.
|
||||
f) Submit ? to open this help file.
|
||||
|
||||
===============================================================================
|
||||
6. Credits *ctrlp-credits*
|
||||
EXTENDING *ctrlp-extending*
|
||||
|
||||
Developed by Kien Nguyen (github.com/kien), primarily 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, added
|
||||
on top are a few additions of my own.
|
||||
|
||||
The basic part of 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
|
||||
|
||||
===============================================================================
|
||||
7. Thanks *ctrlp-thanks*
|
||||
|
||||
Thanks to everyone that has submitted ideas, bug reports, helped debugging or
|
||||
came up with solutions on gibhub, bitbucket, and through email.
|
||||
|
||||
===============================================================================
|
||||
8. Extending ctrlp *ctrlp-extensions*
|
||||
|
||||
Extending |CtrlP| is incredibly simple. Just create a .vim file following a
|
||||
guidelines, place it in the right spot, add a line to your .vimrc, and you have
|
||||
an extension.
|
||||
Extending |CtrlP| is made to be incredibly simple. Just create a .vim file
|
||||
following a short guidelines, place the file in the right spot and add a line
|
||||
to your .vimrc.
|
||||
|
||||
To see how it all works, get the sample.vim from the 'extensions' branch on the
|
||||
git repository (https://github.com/kien/ctrlp.vim/tree/extensions), and place
|
||||
@ -514,7 +475,30 @@ A 4th search type will show up the next time you open |CtrlP|.
|
||||
For more details, check out the comments inside sample.vim.
|
||||
|
||||
===============================================================================
|
||||
9. Changelog *ctrlp-changelog*
|
||||
CREDITS *ctrlp-credits*
|
||||
|
||||
Developed by Kien Nguyen (github.com/kien), primarily 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.
|
||||
|
||||
The 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, helped debugging or
|
||||
came up with solutions on gibhub, bitbucket, and through email.
|
||||
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
Before 2011/10/30
|
||||
|
||||
|
@ -10,7 +10,8 @@ Full path fuzzy __file__, __buffer__ and __MRU__ file finder for Vim.
|
||||
![ctrlp][1]
|
||||
|
||||
## Basic Usage
|
||||
* Press `<c-p>` or run `:CtrlP` to invoke CtrlP.
|
||||
* Press `<c-p>` or run `:CtrlP` to invoke CtrlP in find file mode.
|
||||
* Use `:CtrlPBuffer` and `:CtrlPMRU` for buffer and MRU mode.
|
||||
|
||||
Once CtrlP is open:
|
||||
|
||||
@ -34,7 +35,7 @@ e.g. `abc:45` will open the file matched the pattern and jump to line 45.
|
||||
* When CtrlP is invoked, it automatically sets the working directory according to this variable:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_working_path_mode = 1
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
```
|
||||
|
||||
0 - don’t manage working directory.
|
||||
@ -63,7 +64,7 @@ The parameter is the same (0, 1 or 2):
|
||||
```
|
||||
|
||||
* If you want to exclude directories or files from the search, you can use the Vim’s option `wildignore`.
|
||||
e.g. Just have something like this in your vimrc:
|
||||
Examples:
|
||||
|
||||
```vim
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " for Linux/MacOSX
|
||||
|
Loading…
Reference in New Issue
Block a user