blogdaren 2014-11-17 3评论 1310人次

VIM 默认的注释代码颜色为深蓝色,在vi中看起来不明显, 所以想把它改成别的颜色,方法如下:

在 /path/to/.vimrc 末尾添加一句:
hi Comment  ctermfg = 6
如此一来,ctermfg原来默认为4,为深蓝色,看起来很吃力,改成 6 浅蓝色之后效果好多了!

cterm             // 设置为 bold 则会很亮
ctermfg         //   设置从1~8 种基本颜色


In gvim, after changing the default color scheme, the next time gvim is started, the default setting is restored.

To retain the color scheme add colorscheme <scheme_name> to vimrc.

For example:

colorscheme morning

MS Windows: Make sure HOME exists and is set to where your vimrc file is located. The $HOME environment variable can be set by going to your desktop, right click on "My Computer", click the "Advanced" tab, select "Environment Variables". If HOME is not in the list of variables, create a new variable named HOME and point it to the location of your vimrc.

On Unix/Linux/MacOSX this should be preset and can be seen by going to a command prompt/Terminal window and typing echo $HOME or in vim enter :echo $HOME.

Sometimes if colorscheme <colorscheme> is not loading properly on startup, edit your gvimrc file and comment out or remove the lines containing highlight aka hi.

Save your changes and start vim.

You can set your preferred color scheme in gvim for MS Windows by editing the file vimrc in C:\Program Files\Vim or the location where you installed Vim.

Edit vimrc and add a line like colors <your color scheme> as the last line.

For example:

colors koehler

Save the file and start gvim you Wwill see your color scheme.

MS Windows: (this particular example applies to any instance of gvim), :help gvimrc states that for MS Win32 if vimrc is not in $HOME, the _gvimrc in $VIM. You may display these by issuing, :echo $VIM, or :echo $VIM from within gvim.

版权声明:除非注明,本文由( blogdaren )原创,转载请保留文章出处。



2018-03-25 21:51
2018-03-23 19:36
2018-03-21 19:33