Allow using F7 in extensions

This commit is contained in:
Kien N 2012-04-13 09:58:37 +07:00
parent 13cf37f106
commit e94a5e78e7
2 changed files with 34 additions and 14 deletions

View File

@ -96,7 +96,7 @@ fu! s:opts()
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'], \ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
\ 'PrtCurRight()': ['<c-l>', '<right>'], \ 'PrtCurRight()': ['<c-l>', '<right>'],
\ 'PrtClearCache()': ['<F5>'], \ 'PrtClearCache()': ['<F5>'],
\ 'PrtDeleteMRU()': ['<F7>'], \ 'PrtDeleteEnt()': ['<F7>'],
\ 'CreateNewFile()': ['<c-y>'], \ 'CreateNewFile()': ['<c-y>'],
\ 'MarkToOpen()': ['<c-z>'], \ 'MarkToOpen()': ['<c-z>'],
\ 'OpenMulti()': ['<c-o>'], \ 'OpenMulti()': ['<c-o>'],
@ -615,17 +615,18 @@ fu! s:PrtClearCache()
unl s:force unl s:force
endf endf
fu! s:PrtDeleteMRU() fu! s:PrtDeleteEnt()
if s:itemtype != 2 | retu | en if s:itemtype == 2
let [s:force, tbrem] = [1, []] cal s:PrtDeleteMRU()
if exists('s:marked') elsei type(s:getextvar('wipe')) == 1
let tbrem = values(s:marked) cal s:delent(s:getextvar('wipe'))
cal s:unmarksigns() en
unl s:marked endf
fu! s:PrtDeleteMRU()
if s:itemtype == 2
cal s:delent('ctrlp#mrufiles#remove')
en en
let g:ctrlp_lines = ctrlp#mrufiles#remove(tbrem)
cal s:BuildPrompt(1)
unl s:force
endf endf
fu! s:PrtExit() fu! s:PrtExit()
@ -860,7 +861,7 @@ fu! s:MarkToOpen()
en en
let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
if empty(line) | retu | en if empty(line) | retu | en
let filpath = fnamemodify(line, ':p') let filpath = s:ispath ? fnamemodify(line, ':p') : line
if exists('s:marked') && s:dictindex(s:marked, filpath) > 0 if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
" Unmark and remove the file from s:marked " Unmark and remove the file from s:marked
let key = s:dictindex(s:marked, filpath) let key = s:dictindex(s:marked, filpath)
@ -886,7 +887,7 @@ fu! s:MarkToOpen()
endf endf
fu! s:OpenMulti() fu! s:OpenMulti()
if !exists('s:marked') || s:opmul == '0' | retu | en if !exists('s:marked') || s:opmul == '0' || !s:ispath | retu | en
" Get the options " Get the options
let [nr, md, ucr] = matchlist(s:opmul, '\v^(\d+)=(\w)=(\w)=$')[1:3] let [nr, md, ucr] = matchlist(s:opmul, '\v^(\d+)=(\w)=(\w)=$')[1:3]
if s:argmap if s:argmap
@ -1460,6 +1461,25 @@ endf
fu! s:walker(m, p, d) fu! s:walker(m, p, d)
retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
endf endf
fu! s:delent(rfunc)
if a:rfunc == '' | retu | en
let [s:force, tbrem] = [1, []]
if exists('s:marked')
let tbrem = values(s:marked)
cal s:unmarksigns()
unl s:marked
en
if tbrem == [] && ( has('dialog_gui') || has('dialog_con') ) &&
\ confirm("Wipe all entries?", "&OK\n&Cancel") != 1
unl s:force
cal s:BuildPrompt(0)
retu
en
let g:ctrlp_lines = call(a:rfunc, [tbrem])
cal s:BuildPrompt(1)
unl s:force
endf
" Entering & Exiting {{{2 " Entering & Exiting {{{2
fu! s:getenv() fu! s:getenv()
let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]]

View File

@ -374,7 +374,7 @@ only need to keep the lines that youve changed the values (inside []): >
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'], \ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
\ 'PrtCurRight()': ['<c-l>', '<right>'], \ 'PrtCurRight()': ['<c-l>', '<right>'],
\ 'PrtClearCache()': ['<F5>'], \ 'PrtClearCache()': ['<F5>'],
\ 'PrtDeleteMRU()': ['<F7>'], \ 'PrtDeleteEnt()': ['<F7>'],
\ 'CreateNewFile()': ['<c-y>'], \ 'CreateNewFile()': ['<c-y>'],
\ 'MarkToOpen()': ['<c-z>'], \ 'MarkToOpen()': ['<c-z>'],
\ 'OpenMulti()': ['<c-o>'], \ 'OpenMulti()': ['<c-o>'],