Extend '..' input
This commit is contained in:
parent
a96f0b2204
commit
bfbbbafa86
@ -863,9 +863,10 @@ fu! ctrlp#acceptfile(mode, line, ...)
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:SpecInputs(str)
|
fu! s:SpecInputs(str)
|
||||||
if a:str == '..' && s:spi
|
if a:str =~ '^\.\.\.*$' && s:spi
|
||||||
cal s:parentdir(s:dyncwd)
|
let cwd = s:dyncwd
|
||||||
cal ctrlp#setlines()
|
cal ctrlp#setdir('../'.repeat('../', strlen(a:str) - 2))
|
||||||
|
if cwd != s:dyncwd | cal ctrlp#setlines() | en
|
||||||
cal s:PrtClear()
|
cal s:PrtClear()
|
||||||
retu 1
|
retu 1
|
||||||
elsei a:str == s:lash && s:spi
|
elsei a:str == s:lash && s:spi
|
||||||
@ -890,7 +891,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
|
||||||
@ -1248,11 +1249,6 @@ fu! ctrlp#rmbasedir(items)
|
|||||||
retu a:items
|
retu a:items
|
||||||
endf
|
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)
|
fu! s:getparent(item)
|
||||||
let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '')
|
let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '')
|
||||||
if parent == '' || match(parent, '[\/]') < 0
|
if parent == '' || match(parent, '[\/]') < 0
|
||||||
|
@ -746,8 +746,15 @@ c) End the string with a colon ':' followed by a Vim command to execute that
|
|||||||
|
|
||||||
See also: Vim's |++opt| and |+cmd|.
|
See also: Vim's |++opt| and |+cmd|.
|
||||||
|
|
||||||
d) Submit two dots '..' to go backward the directory tree by 1 level. If the
|
d) Submit two dots '..' to go backward the directory tree by 1 level. To go
|
||||||
parent directory is large and uncached, this can be slow.
|
backward multiple levels, use one extra dot for each extra level:
|
||||||
|
>
|
||||||
|
Raw input Interpreted as
|
||||||
|
.. ../
|
||||||
|
... ../../
|
||||||
|
.... ../../../
|
||||||
|
<
|
||||||
|
Note: if the parent directories are large and uncached, this can be slow.
|
||||||
|
|
||||||
You can also use '@cd path/' to change CtrlP's local working directory.
|
You can also use '@cd path/' to change CtrlP's local working directory.
|
||||||
Use '@cd %:h' to change to the directory of the current file.
|
Use '@cd %:h' to change to the directory of the current file.
|
||||||
@ -1011,6 +1018,9 @@ Special thanks:~
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
CHANGELOG *ctrlp-changelog*
|
CHANGELOG *ctrlp-changelog*
|
||||||
|
|
||||||
|
Before 2012/05/15~
|
||||||
|
|
||||||
|
+ Extend '..' (|ctrlp-input-formats| (d))
|
||||||
+ New input format: '@cd' (|ctrlp-input-formats| (d))
|
+ New input format: '@cd' (|ctrlp-input-formats| (d))
|
||||||
|
|
||||||
Before 2012/04/30~
|
Before 2012/04/30~
|
||||||
|
Loading…
Reference in New Issue
Block a user