Permalink
Browse files

Improve <tab> completion

Refs #77
  • Loading branch information...
1 parent d1a6423 commit f1db1253ecbd8462d0c129b9a7c4ab4eaef2f56b @kien committed Jan 18, 2012
Showing with 16 additions and 21 deletions.
  1. +12 −18 autoload/ctrlp.vim
  2. +2 −2 autoload/ctrlp/utils.vim
  3. +2 −1 readme.md
View
@@ -497,13 +497,11 @@ fu! s:PrtExpandDir()
if prt[0] == '' | retu | en
let parts = split(prt[0], '[\/]\ze[^\/]\+[\/:]\?$')
if len(parts) == 1
- let seed = parts[0]
- let begin = ''
- elsei len(parts) > 1
- let seed = parts[1]
- let begin = parts[0].s:lash
+ let [base, seed] = ['', parts[0]]
+ elsei len(parts) == 2
+ let [base, seed] = parts
en
- let dirs = s:dircompl(begin, seed)
+ let dirs = s:dircompl(base, seed)
if len(dirs) == 1
let prt[0] = dirs[0]
elsei len(dirs) > 1
@@ -984,16 +982,12 @@ fu! ctrlp#progress(enum)
redr
endf
" Paths {{{2
-fu! s:dircompl(dir, seed)
- if a:seed == '' | retu [] | en
- let [dir, seed] = a:dir == ''
- \ ? [getcwd().s:lash, a:seed] : [a:dir, a:dir.a:seed]
- let dirs = ctrlp#rmbasedir(split(globpath(dir, '*/'), "\n"))
- if s:dotfiles
- let dirs += ctrlp#rmbasedir(split(globpath(dir, '.*/'), "\n"))
- en
- cal filter(dirs, '!match(v:val, escape(seed, ''''''~$.\'')) && ( !s:dotfiles'
- \ . ' || ( s:dotfiles && match(v:val, ''[\/]\.\{,2}[\/:]$'') < 0) )')
+fu! s:dircompl(be, sd)
+ if a:sd == '' | retu [] | en
+ let [be, sd] = a:be == '' ? [getcwd(), a:sd] : [a:be, a:be.s:lash.a:sd]
+ let dirs = ctrlp#rmbasedir(split(globpath(be, a:sd.'*/'), "\n"))
+ cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))'
+ \ . ' && match(v:val, ''\v(^|[\/])\.{1,2}[\/]$'') < 0')
retu dirs
endf
@@ -1023,7 +1017,7 @@ fu! ctrlp#dirnfile(entries)
let etype = getftype(each)
if s:igntype >= 0 && s:usrign(each, etype) | con | en
if etype == 'dir'
- if s:dotfiles | if match(each, '[\/]\.\{,2}$') < 0
+ if s:dotfiles | if match(each, '[\/]\.\{1,2}$') < 0
cal add(items[0], each)
en | el
cal add(items[0], each)
@@ -1100,7 +1094,7 @@ fu! s:findroot(curr, mark, depth, type)
endf
fu! s:glbpath(...)
- let cond = ( v:version == 702 && has('patch051') ) || v:version > 702
+ let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
retu call('globpath', cond ? a:000 : a:000[:1])
endf
View
@@ -61,8 +61,8 @@ fu! ctrlp#utils#writecache(lines, ...)
endf
fu! ctrlp#utils#glob(...)
- let cond = ( v:version == 702 && has('patch051') ) || v:version > 702
- retu call('glob', cond ? a:000 : [a:1])
+ let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
+ retu call('glob', cond ? a:000 : [a:1])
endf
"}}}
View
@@ -18,6 +18,7 @@ Once CtrlP is open:
* Press `<c-f>` and `<c-b>` to switch between find file, buffer, and MRU file modes.
* Press `<c-d>` to switch to filename only search instead of full path.
+* Press `<F5>` to purge the cache for the current directory and get new files.
* Use `*` or `|` in the prompt to submit the string as a Vim’s regexp pattern.
* Or press `<c-r>` to switch to regexp mode.
* End the input string with a colon `:` followed by a command to execute after opening the file.
@@ -61,7 +62,7 @@ Examples:
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
- \ 'link': 'bad_symbolic_link',
+ \ 'link': 'some_bad_symbolic_links',
\ }
```

0 comments on commit f1db125

Please sign in to comment.