@@ -2567,9 +2567,13 @@ fu! ctrlp#getvar(var)
2567
2567
endf
2568
2568
" }}}1
2569
2569
" * Initialization {{{1
2570
- fu ! ctrlp#setlines (... )
2570
+ fu ! s: setlines_pre (... )
2571
2571
if a: 0 | let s: itemtype = a: 1 | en
2572
2572
cal s: modevar ()
2573
+ let g: ctrlp_lines = []
2574
+ endf
2575
+
2576
+ fu ! s: setlines_post ()
2573
2577
let inits = {' fil' : ' ctrlp#files()' , ' buf' : ' ctrlp#buffers()' , ' mru' : ' ctrlp#mrufiles#list()' }
2574
2578
let types = map (copy (g: ctrlp_types ), ' inits[v:val]' )
2575
2579
if ! empty (g: ctrlp_ext_vars )
@@ -2578,6 +2582,11 @@ fu! ctrlp#setlines(...)
2578
2582
let g: ctrlp_lines = eval (types[s: itemtype ])
2579
2583
endf
2580
2584
2585
+ fu ! ctrlp#setlines (... )
2586
+ cal call (' s:setlines_pre' , a: 000 )
2587
+ cal s: setlines_post ()
2588
+ endf
2589
+
2581
2590
" Returns [lname, sname]
2582
2591
fu ! s: CurTypeName ()
2583
2592
if s: itemtype < len (s: coretypes )
@@ -2632,8 +2641,16 @@ fu! ctrlp#init(type, ...)
2632
2641
retu
2633
2642
en
2634
2643
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 ))
2636
2652
let &filetype = s: DetectFileType (type , &filetype )
2653
+ cal s: setlines_post ()
2637
2654
cal ctrlp#syntax ()
2638
2655
cal s: SetDefTxt ()
2639
2656
let curName = s: CurTypeName ()
0 commit comments