Reputation: 7199
When I'm using the Vim plugin CtrlP I have a hard time seeing which file is being highlighted as the current file I might open. I want the highlight line to be bright and vivid.
I could change the color of my CursorLine setting but I don't want it to change everywhere. When I'm normally editing files I want my highlight cursor line to be a subtle background-ish color.
How can I change the color of only the highlight line in the CtrlP file selection buffer?
Upvotes: 4
Views: 1778
Reputation: 7199
I got a lead on a fix in this GitHub issue asking a similar question.
CtrlP offers a setting called ctrlp_buffer_func
that lets you set a function to call every time CtrlP is loaded and when it exits. In my .vimrc file, I just set the highlight color to a bright and vivid color on CtrlP load, and then set it back to my default when I exit CtrlP.
let g:ctrlp_buffer_func = { 'enter': 'BrightHighlightOn', 'exit': 'BrightHighlightOff', }
function BrightHighlightOn()
hi CursorLine guibg=darkred
endfunction
function BrightHighlightOff()
hi CursorLine guibg=#191919
endfunction
Upvotes: 8