关于 fedora20 vi 的配色设置

2015-03-08 19:23:17 +08:00
 nocturnal

请问fedora 20 vi 默认配色在哪里看的 能否导出

2570 次点击
所在节点    Linux
5 条回复
joyeblue
2015-03-08 20:58:23 +08:00
现行*nix发行版上的vi一般是软链接到vim上,这个可以通过type vi看下。

如果是软链接到vim上,执行vim,
然后:echo $VIM
这个会输出vim的RUNTIMEPATH,然后cd 到这个目录,
配色会在RUNTIMEPATH/vimfiles/colors 目录下。
joyeblue
2015-03-08 21:01:24 +08:00
查看当前配色的方式为:
:echo g:colors_name
nocturnal
2015-03-08 23:09:13 +08:00
@joyeblue
[victini@localhost ~]$ cd /usr/share/vim/
[victini@localhost vim]$ ll
总用量 8
drwxr-xr-x. 16 root root 4096 12月 6 16:57 vim74
drwxr-xr-x. 17 root root 4096 12月 6 16:57 vimfiles
[victini@localhost vim]$ cd vimfiles/
[victini@localhost vimfiles]$ cd colors/
[victini@localhost colors]$ ll
总用量 0

:echo g:colors_name
default
但是default文件的配色貌似是调用系统的配色的
这是default文件 没有具体的配置信息诶
" Vim color file
2 " Maintainer:>--Bram Moolenaar <Bram@vim.org>
3 " Last Change:>-2001 Jul 23
4
5 " This is the default color scheme. It doesn't define the Normal
6 " highlighting, it uses whatever the colors used to be.
7
8 " Set 'background' back to the default. The value can't always be estimated
9 " and is then guessed.
10 hi clear Normal
11 set bg&
12
13 " Remove all existing highlighting and set the defaults.
14 hi clear
15
16 " Load the syntax highlighting defaults, if it's enabled.
17 if exists("syntax_on")
18 syntax reset
19 endif
20
21 let colors_name = "default"
joyeblue
2015-03-08 23:39:59 +08:00
@nocturnal 那这就只得去源代码中找答案了。

分析的源代码版本为7.2
在src/syntax.c:6199中,以下就是默认的colorscheme

/*
* The default highlight groups. These are compiled-in for fast startup and
* they still work when the runtime files can't be found.
* When making changes here, also change runtime/colors/default.vim!
* The #ifdefs are needed to reduce the amount of static data. Helps to make
* the 16 bit DOS (museum) version compile.
*/
#ifdef FEAT_GUI
# define CENT(a, b) b
#else
# define CENT(a, b) a
#endif
static char *(highlight_init_both[]) =
{
CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White",
"ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"),
#ifdef FEAT_SEARCH_EXTRA
CENT("IncSearch term=reverse cterm=reverse",
"IncSearch term=reverse cterm=reverse gui=reverse"),
#endif
CENT("ModeMsg term=bold cterm=bold",
"ModeMsg term=bold cterm=bold gui=bold"),
CENT("NonText term=bold ctermfg=Blue",
"NonText term=bold ctermfg=Blue gui=bold guifg=Blue"),
CENT("StatusLine term=reverse,bold cterm=reverse,bold",
"StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"),
CENT("StatusLineNC term=reverse cterm=reverse",
"StatusLineNC term=reverse cterm=reverse gui=reverse"),
#ifdef FEAT_VERTSPLIT
CENT("VertSplit term=reverse cterm=reverse",
"VertSplit term=reverse cterm=reverse gui=reverse"),
#endif
#ifdef FEAT_CLIPBOARD
CENT("VisualNOS term=underline,bold cterm=underline,bold",
"VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold"),
#endif
#ifdef FEAT_DIFF
CENT("DiffText term=reverse cterm=bold ctermbg=Red",
"DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red"),
#endif
#ifdef FEAT_INS_EXPAND
CENT("PmenuThumb cterm=reverse",
"PmenuThumb cterm=reverse gui=reverse"),
CENT("PmenuSbar ctermbg=Grey",
"PmenuSbar ctermbg=Grey guibg=Grey"),
#endif
#ifdef FEAT_WINDOWS
CENT("TabLineSel term=bold cterm=bold",
"TabLineSel term=bold cterm=bold gui=bold"),
CENT("TabLineFill term=reverse cterm=reverse",
"TabLineFill term=reverse cterm=reverse gui=reverse"),
#endif
#ifdef FEAT_GUI
"Cursor guibg=fg guifg=bg",
"lCursor guibg=fg guifg=bg", /* should be different, but what? */
#endif
NULL
};

PS:要学会去从源代码中去查找答案,因为源代码里面包含你所需要的一切信息!
nocturnal
2015-03-15 23:15:40 +08:00
@joyeblue - -! 不好意思,上个星期事情太多,没啥时间看,不过上星期在公司电脑和自己家电脑终端看代码,发现同一个测试机,在不同终端的代码颜色显示是不一样的,所以在终端的help看到这个:
Color schemes
If you do not like the default Terminal theme, you may want to change the colors that are used for the text and background. You can use colors from your theme, select one of the presets or use a custom scheme.
暂时只发现自己自定义颜色的方法,没有发现导出配置的方法,好麻烦,还不如照着配色自己改一个。。。。。此贴终结

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/175358

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX