如何在 Vim 拆分窗口中获得不同的配色方案? [英] How to get different colorschemes in Vim split window?
问题描述
我更喜欢为 python 使用不同的colorscheme
,而对于其余文件使用不同的colorscheme
.
I prefer having different colorscheme
for python and different for rest of the files.
所以,我所做的是在我的 vimrc
中添加以下两行:
So, what I did is added the below two lines in my vimrc
:
"for python file
autocmd! BufEnter,BufNewFile *.py colo badwolf
autocmd! BufLeave *.py colo badwolf
"for rest of the files
colo molokai
当我使用 vim test.py
在 vim 中打开 new/pre-exixting
文件时一切正常,但是当我使用 vim test.py
将我的 vim 窗口分成两个时出现问题code>:split .scripts/test.sh.
Everything works fine when I open a new/pre-exixting
file in vim using vim test.py
but problem occur when I split my vim window into two using :split .scripts/test.sh
.
当我的光标移动到新拆分的窗口(.sh)时拆分窗口后会发生什么,我的 python 文件得到 molokai
颜色方案,当我将光标移动到旧窗口时(.py) 我在 .sh 窗口
中得到了 badwolf
颜色方案.因此,正如您最终看到的,我的窗口中有相同的配色方案,具体取决于焦点是哪种文件类型.
What happens is after splitting the window when my cursor moves to the new-split window(.sh) I get molokai
colorscheme for my python file and when I shift my cursor to my old window(.py) I get badwolf
colorscheme in my .sh window
. So, as you can see eventually I have the same colorscheme in my windows depending upon which file-type is in focus.
在 Vim-Tab
的情况下,只要我打开一个包含预定义颜色方案的文件(通过 autocmd),所有选项卡都会应用该颜色方案.
In case of Vim-Tab
as soon as I open a file which has it's pre-defined colorscheme(via autocmd) all the tabs apply that colorscheme.
那么,有什么办法可以在 vim 拆分窗口和选项卡中使用不同的 colorschemes
.
So, is there any way I can have different colorschemes
in vim split windows and tabs.
推荐答案
我认为不可能可靠地同时激活不同的颜色方案.
I don't think that it's possible to reliably have different colorschemes active at the same time.
事实上,我非常惊讶您能够为不同的窗口加载不同的颜色方案.:colorscheme molokai
是一个适用于每个缓冲区的全局命令.
In fact, I'm very surprised that you are able to load different colorschemes for different windows. :colorscheme molokai
is a global command that works on every buffer.
这篇关于如何在 Vim 拆分窗口中获得不同的配色方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!