parent
e927848400
commit
27e2375bc0
@ -248,7 +248,9 @@ endf
|
||||
fu! ctrlp#buffertag#cmd(mode, ...)
|
||||
let s:btmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufname = fnamemodify(a:1, ':p')
|
||||
let s:btmode = 0
|
||||
let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1
|
||||
let s:bufname = fnamemodify(bname, ':p')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
@ -83,7 +83,9 @@ endf
|
||||
fu! ctrlp#changes#cmd(mode, ...)
|
||||
let s:clmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$')
|
||||
let s:clmode = 0
|
||||
let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1
|
||||
let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
@ -11,7 +11,7 @@ en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#line#init()',
|
||||
\ 'init': 'ctrlp#line#init(s:crbufnr)',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
@ -29,8 +29,9 @@ fu! s:syntax()
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#line#init()
|
||||
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
||||
fu! ctrlp#line#init(bufnr)
|
||||
let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr]
|
||||
let bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr]
|
||||
for bufnr in bufs
|
||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
||||
if lfb == [] && bufn != ''
|
||||
@ -57,7 +58,13 @@ fu! ctrlp#line#accept(mode, str)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#id()
|
||||
fu! ctrlp#line#cmd(mode, ...)
|
||||
let s:lnmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:lnmode = 0
|
||||
let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1
|
||||
let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
@ -1106,8 +1106,8 @@ Available extensions:~
|
||||
*:CtrlPLine*
|
||||
* Line mode:~
|
||||
- Name: 'line'
|
||||
- Command: ":CtrlPLine"
|
||||
- Search for a line in all listed buffers.
|
||||
- Command: ":CtrlPLine [buffer]"
|
||||
- Search for a line in all listed buffers or in the specified [buffer].
|
||||
|
||||
*:CtrlPChange*
|
||||
*:CtrlPChangeAll*
|
||||
|
@ -51,7 +51,9 @@ com! -n=? -com=buffer CtrlPBufTag
|
||||
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
|
||||
com! -n=? -com=buffer CtrlPLine
|
||||
\ cal ctrlp#init(ctrlp#line#cmd(1, <q-args>))
|
||||
|
||||
com! -n=? -com=buffer CtrlPChange
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||
|
Loading…
Reference in New Issue
Block a user