Option to use an initial input string

Close #169
This commit is contained in:
Kien N 2012-03-30 14:40:57 +07:00
parent 43e469ce1b
commit 2e45d6cc5e
2 changed files with 23 additions and 6 deletions

View File

@ -14,6 +14,7 @@ fu! s:opts()
\ 'g:ctrlp_by_filename': ['s:byfname', 0], \ 'g:ctrlp_by_filename': ['s:byfname', 0],
\ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1], \ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1],
\ 'g:ctrlp_custom_ignore': ['s:usrign', ''], \ 'g:ctrlp_custom_ignore': ['s:usrign', ''],
\ 'g:ctrlp_default_input': ['s:deftxt', 0],
\ 'g:ctrlp_dont_split': ['s:nosplit', 'netrw'], \ 'g:ctrlp_dont_split': ['s:nosplit', 'netrw'],
\ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1],
\ 'g:ctrlp_extensions': ['s:extensions', []], \ 'g:ctrlp_extensions': ['s:extensions', []],
@ -464,6 +465,16 @@ fu! s:BuildPrompt(upd, ...)
exe 'echoh' hibase '| echon "_" | echoh None' exe 'echoh' hibase '| echon "_" | echoh None'
en en
endf endf
" - SetDefTxt() {{{1
fu! s:SetDefTxt()
if s:deftxt == '0' || s:pathmode == 1 | retu | en
let txt = s:deftxt
if !type(txt)
let txt = txt ? ctrlp#rmbasedir([s:crfpath])[0] : ''
let txt = txt != '' ? txt.s:lash(s:crfpath) : ''
en
let s:prompt[0] = txt
endf
" ** Prt Actions {{{1 " ** Prt Actions {{{1
" Editing {{{2 " Editing {{{2
fu! s:PrtClear() fu! s:PrtClear()
@ -1560,6 +1571,7 @@ fu! ctrlp#init(type, ...)
let [s:matches, s:init] = [1, 1] let [s:matches, s:init] = [1, 1]
cal s:Open() cal s:Open()
cal s:SetWD(a:0 ? a:1 : '') cal s:SetWD(a:0 ? a:1 : '')
cal s:SetDefTxt()
cal s:MapKeys() cal s:MapKeys()
if has('syntax') && exists('g:syntax_on') if has('syntax') && exists('g:syntax_on')
cal ctrlp#syntax() cal ctrlp#syntax()

View File

@ -111,12 +111,10 @@ Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
per buffer basis. per buffer basis.
*'g:ctrlp_root_markers'* *'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones. Your Use this to set your own root markers in addition to the default ones (.git/,
markers will take precedence: > .hg/, .svn/, .bzr/, and _darcs/). Your markers will take precedence: >
let g:ctrlp_root_markers = [''] let g:ctrlp_root_markers = ['']
< <
These markers (builtins and yours) will serve as identifiers for the '/' and
'\' special inputs (|ctrlp-input-formats| (e)).
*'g:ctrlp_use_caching'* *'g:ctrlp_use_caching'*
Set this to 0 to disable per-session caching. When disabled, caching will still Set this to 0 to disable per-session caching. When disabled, caching will still
@ -369,6 +367,12 @@ after typings been stopped for a certain amount of time: >
If is 1, update after 250ms. If bigger than 1, the number will be used as the If is 1, update after 250ms. If bigger than 1, the number will be used as the
delay time in milliseconds. delay time in milliseconds.
*'g:ctrlp_default_input'*
Set this to 1 to enable seeding the prompt with the current files relative
path: >
let g:ctrlp_default_input = 0
<
*'g:ctrlp_use_migemo'* *'g:ctrlp_use_migemo'*
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only 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: > works in |regexp| mode. To split the pattern, separate words with space: >
@ -881,9 +885,10 @@ Special thanks:~
=============================================================================== ===============================================================================
CHANGELOG *ctrlp-changelog* CHANGELOG *ctrlp-changelog*
Before 2012/03/28~ Before 2012/03/31~
+ New option: |g:ctrlp_match_func|, allow using a custom fuzzy matcher. + New option: |g:ctrlp_default_input|, default input when entering |CtrlP|.
|g:ctrlp_match_func|, allow using a custom fuzzy matcher.
+ Rename: + Rename:
*ClearCtrlPCache* -> |CtrlPClearCache| *ClearCtrlPCache* -> |CtrlPClearCache|
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches| *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|