Support standard parent dir syntax

This commit is contained in:
Kien N 2012-05-31 10:26:44 +07:00
parent 96bd4b37f4
commit 9b79b74c17

View File

@ -868,9 +868,10 @@ fu! ctrlp#acceptfile(mode, line, ...)
endf endf
fu! s:SpecInputs(str) fu! s:SpecInputs(str)
if a:str =~ '^\.\.\.*$' && s:spi if a:str =~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*)$' && s:spi
let cwd = s:dyncwd let cwd = s:dyncwd
cal ctrlp#setdir('../'.repeat('../', strlen(a:str) - 2)) cal ctrlp#setdir(a:str =~ '^\.\.\.*$' ?
\ '../'.repeat('../', strlen(a:str) - 2) : a:str)
if cwd != s:dyncwd | cal ctrlp#setlines() | en if cwd != s:dyncwd | cal ctrlp#setlines() | en
cal s:PrtClear() cal s:PrtClear()
retu 1 retu 1
@ -896,7 +897,7 @@ fu! s:AcceptSelection(mode)
" Get the selected line " Get the selected line
let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
if a:mode != 'e' && !s:itemtype && line == '' if a:mode != 'e' && !s:itemtype && line == ''
\ && str !~ '\v^(\.\.\.*|/|\\|\?|\@.+)$' \ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$'
cal s:CreateNewFile(a:mode) | retu cal s:CreateNewFile(a:mode) | retu
en en
if empty(line) | retu | en if empty(line) | retu | en
@ -1495,7 +1496,8 @@ fu! s:tail()
endf endf
fu! s:sanstail(str) fu! s:sanstail(str)
let str = s:spi ? substitute(a:str, '^\(@.*$\|\\\\\ze@\)', '', 'g') : a:str let str = s:spi ?
\ substitute(a:str, '^\(@.*$\|\\\\\ze@\|\.\.\zs[.\/]\+$\)', '', 'g') : a:str
let [str, pat] = [substitute(str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] let [str, pat] = [substitute(str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$']
unl! s:optail unl! s:optail
if match(str, '\\\@<!:'.pat) >= 0 if match(str, '\\\@<!:'.pat) >= 0