认为这是我第一次遇到vimscript,我检查了插件代码.它有以下几行代码:
fu! ctrlp#init(type, ...) if exists('s:init') || s:iscmdwin() | retu | en let [s:ermsg, v:errmsg] = [v:errmsg, ''] let [s:matches, s:init] = [1, 1] cal s:Reset(a:0 ? a:1 : {}) noa cal s:Open() cal s:SetWD(a:0 ? a:1 : {}) gal s:MapNorms() cal s:MapSpecs() cal ctrlp#syntax() cal ctrlp#setlines(s:settype(a:type)) cal s:SetDefTxt() cal s:BuildPrompt(1) if s:keyloop | cal s:KeyLoop() | en endf
如果我colorscheme atom
在函数中放置或类似的东西,它会改变整个缓冲区的颜色方案,而不是只改变弹出窗口的颜色方案.有没有办法配置CtrlP使用单独的配色方案?当然,我并不打算将配置放到插件代码中,因此我也在寻找一种解决方案,使我可以将设置放入我的设置中.vimrc
,例如使用autocmd
.
+1
查看源代码并实际尝试一些东西.
-1
不看插件的文档:
Highlighting:~ * For the CtrlP buffer: CtrlPNoEntries : the message when no match is found (Error) CtrlPMatch : the matched pattern (Identifier) CtrlPLinePre : the line prefix '>' in the match window CtrlPPrtBase : the prompt's base (Comment) CtrlPPrtText : the prompt's text (|hl-Normal|) CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant) * In extensions: CtrlPTabExtra : the part of each line that's not matched against (Comment) CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|) CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|) CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment) CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|) CtrlPUndoBr : the square brackets [] in undo mode (Comment) CtrlPUndoNr : the undo number inside [] in undo mode (String) CtrlPUndoSv : the point where the file was saved (Comment) CtrlPUndoPo : the current position in the undo tree (|hl-Title|) CtrlPBookmark : the name of the bookmark (Identifier) Statuslines:~ * Highlight groups: CtrlPMode1 : 'file' or 'path' or 'line', and the current mode (Character) CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|) CtrlPStats : the scanning status (Function)
编辑
看看你最喜欢的colorscheme,如果写得很好,你应该找到一堆看起来像这样的线:
hi Whatever ctermbg=235 ctermfg=250 guibg=#262626 guifg=#bcbcbc cterm=NONE gui=NONE
你需要做的很简单:
复制其中一条线,
将突出显示组名称更改Whatever
为CtrlPNoEntries
,
调整颜色值以适合您的口味,
重复.
如果您希望您的colorscheme是独立的,您需要在一个单独的文件中定义所有这些CtrlP高亮,这些文件将像任何其他插件一样加载,但在启动过程的后期:
~/.vim/after/plugin/mycolorscheme.vim