将不同的颜色方案应用于不同的窗口(Applying different colorschemes to different windows)

编程入门 行业动态 更新时间:2024-10-27 18:20:05
将不同的颜色方案应用于不同的窗口(Applying different colorschemes to different windows)

我想对不同的文件类型使用不同的colorschemes,我在.vimrc中添加了以下代码

function SetColorScheme () if &filetype != "vo_base" colorscheme desertEx endif endfunction au WinEnter * call SetColorScheme()

这适用于一个问题。

如果我打开.otl文件,说todo.otl(vo_base),然后打开另一个文件,比如example.xml,使用:sp colorscheme desertEx不会应用于第二个窗口(具有example.xml的窗口)。

如果我使用BufEnter而不是WinEnter而不是使用desertEx来应用于两个窗口。

有没有办法确保当我打开一个窗口时:sp上面的函数(a)运行,(b)只运行该特定窗口而不是当前会话中的所有窗口。

I want to used different colorschemes for different filetypes and I added the following code in my .vimrc

function SetColorScheme () if &filetype != "vo_base" colorscheme desertEx endif endfunction au WinEnter * call SetColorScheme()

This works fine with one issue.

If I open a .otl file, say todo.otl (vo_base), and then open another file, say example.xml, using :sp the colorscheme desertEx does not get applied to the second window (the one having example.xml).

If I use BufEnter instead of WinEnter than desertEx gets applied to both the windows.

Is there a way to make sure that when I open a window with :sp the above function (a) runs, and (b) runs only for that particular window and not all the windows in the current session.

最满意答案

不,没有办法做到这一点。 在vim中,同时只能有一个活动的colorscheme。

No there's no way to do that. There can be only one active colorscheme at the same time in vim.

更多推荐

本文发布于:2023-07-24 10:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1244915.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用于   颜色   窗口   方案   windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!