V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
nocturnal
V2EX  ›  Linux

关于 fedora20 vi 的配色设置

  •  
  •   nocturnal · 2015-03-08 19:23:17 +08:00 · 2743 次点击
    这是一个创建于 3578 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    5 条回复    2015-03-15 23:15:40 +08:00
    joyeblue
        1
    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
        2
    joyeblue  
       2015-03-08 21:01:24 +08:00
    查看当前配色的方式为:
    :echo g:colors_name
    nocturnal
        3
    nocturnal  
    OP
       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 <[email protected]>
    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
        4
    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
        5
    nocturnal  
    OP
       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.
    暂时只发现自己自定义颜色的方法,没有发现导出配置的方法,好麻烦,还不如照着配色自己改一个。。。。。此贴终结
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5923 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 02:15 · PVG 10:15 · LAX 18:15 · JFK 21:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.