Skip to content

Commit e953ee7

Browse files
authored
Merge pull request #488 from ezequielv/dev_ezequielv-fix-issue_upstream-0463-nosyntaxhl_when_opening-01_01-upstream_01
Split ctrlp#setlines() for ctrlp#init(). Fixes #463
2 parents 5e40e55 + 6d0a49d commit e953ee7

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

autoload/ctrlp.vim

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,9 +2567,13 @@ fu! ctrlp#getvar(var)
25672567
endf
25682568
"}}}1
25692569
" * Initialization {{{1
2570-
fu! ctrlp#setlines(...)
2570+
fu! s:setlines_pre(...)
25712571
if a:0 | let s:itemtype = a:1 | en
25722572
cal s:modevar()
2573+
let g:ctrlp_lines = []
2574+
endf
2575+
2576+
fu! s:setlines_post()
25732577
let inits = {'fil': 'ctrlp#files()', 'buf': 'ctrlp#buffers()', 'mru': 'ctrlp#mrufiles#list()'}
25742578
let types = map(copy(g:ctrlp_types), 'inits[v:val]')
25752579
if !empty(g:ctrlp_ext_vars)
@@ -2578,6 +2582,11 @@ fu! ctrlp#setlines(...)
25782582
let g:ctrlp_lines = eval(types[s:itemtype])
25792583
endf
25802584

2585+
fu! ctrlp#setlines(...)
2586+
cal call('s:setlines_pre', a:000)
2587+
cal s:setlines_post()
2588+
endf
2589+
25812590
" Returns [lname, sname]
25822591
fu! s:CurTypeName()
25832592
if s:itemtype < len(s:coretypes)
@@ -2632,8 +2641,16 @@ fu! ctrlp#init(type, ...)
26322641
retu
26332642
en
26342643
en
2635-
cal ctrlp#setlines(s:settype(type))
2644+
" Fixed issue ctrlpvim/ctrlp.vim#463 : Opening 'ctrlp' in certain modes
2645+
" (':CtrlPBufTag', ':CtrlPLine') seems to trigger a partially deffective
2646+
" intialisation (for example, syntax highlighting not working as expected).
2647+
" Fix: ctrlp#setlines() split in two, as the second part (now in
2648+
" s:setlines_post()) seems to need '&filetype', and s:DetectFileType() seems
2649+
" to need the first part of the old ctrlp#setlines() (now in
2650+
" s:setlines_pre()).
2651+
cal s:setlines_pre(s:settype(type))
26362652
let &filetype = s:DetectFileType(type, &filetype)
2653+
cal s:setlines_post()
26372654
cal ctrlp#syntax()
26382655
cal s:SetDefTxt()
26392656
let curName = s:CurTypeName()

0 commit comments

Comments
 (0)