1、打开vim,输入命令 scriptnames看看vim加载了哪些脚本 命令: scriptnames
确认所有和语法及颜色相关的脚本是否都已经加载了,如加载了就没有问题了,如未加载,往下看
2、查看.vimrc配置文件
约从第9行开始,如果用的是xterm,那就就进行下面的颜色设置,则正常,如果系统用的不是xterm则就会出现颜色问题,在shell终端输入命令: echo $TERM
3、结果: vt100+ 即确认不是xterm,所以没有颜色。
4、打开shell配置文件,.bash_profile或.bashrc加入下面一行
TERM=xterm
export TERM
5、重新敲一下bash,再次运行vim,颜色应该就回来了!
/etc/下面可以找到vim的配置文件,文件名是vimrc,打开它,这里面全是vim的初始配置,在最后加入color murphy或者是colorscheme murphy。保存
cd /usr/share/vim/vim72/colorsls 打开murphy 它就是colors目录下面其中的一个配置文件不包含.vim的文件名。
我们接着研究,其实这下面都是一些关于vim的不同颜色方案的组合。你可以打开这些文件看看里面的实际内容。也许试过了所有的颜色方案后,没有一个让你觉得满意的,那就改一个自己满意的, 怎么做呢?
首先找一个自己觉得还比较喜欢的颜色方案的配置文件,比如morning.vim, 复制一份。打开它。
我们修改其中的颜色,注意其中的几行:
hi normal ctermfg = black ctermbg=grey guifg=black guibg=grey98
hi commnet ...
hi statement ...
hi type...
hi number...
我们先说这里列出的第一行
hi 是高亮的意思,是light的缩写
normal这个段指的是什么样的文本,这是normal是指普通文本。
ctermfg是指vim以终端方式运行时前景的颜色
ctermfg是指vim以终端方式运行时背景景的颜色
guifg是指vim以gui方式运行时前景的颜色
guibg是指vim以gui方式运行时背景的颜色
因为我们这里讨论的是在终端启动vim所以我只关注第2,3段位,忽略4,5段位。
后面行和第一行的格式相似,多了一个term字段,我们暂且不去管它。其中我们要关注是第二字段所表示是什么,下面列出这些所代表的意义:
comment any comment
constantany constant
stringa string constant: "this is a string"
character a character constant: 'c', '/n'
numbera number constant: 234, 0xff
booleanabooleanconstant: true, false
floata floating point constant: 2.3e10
identifierany variable name
functionfunction name (also: methods for classes)
statementany statement
conditionalif, then, else, endif, switch, etc.
repeatfor,do, while, etc.
labelcase, default, etc.
operator"sizeof", "+", "*", etc.
keywordany other keyword
exception try, catch, throw
preprocgeneric preprocessor
includepreprocessor #include
definepreprocessor #define
macrosameasdefine
preconditpreprocessor #if, #else, #endif, etc.
typeint, long, char, etc.
storageclassstatic,register, volatile, etc.
structure struct, union, enum, etc.
typedefa typedef
specialany special symbol
specialcharspecial character in a constant
tagyou can usectrl-]on this
delimitercharacter that needs attention
specialcommentspecial things inside a comment
debugdebugging statements
underlinedtext that stands out, html links
ignoreleft blank, hidden
errorany erroneous construct
todoanything that needs extra attention; mostly the
keywords todo fixme and xxx
参照上面的内容就可以把配置文件改成我们想要的样子了,保存退出。
让我们在回到/etc/vimrc,打开它,比如我们刚才新改的配置文件我们取的名字是my_conf.vim,在最后行,加入如下内容:
color my_conf
让后保存退出。重新打开vim, 看看我们修改的成果。
Photoshop|
Dreamweaver|
SVG|
WebGL|
Visual Studio|
PowerDesigner|
Eclipse|
Git|
Apache Ant|
Atom|
Composer|
CodeSmith|
Flex|
Gradle|
Maven|
Sublime Text3|
SVN|
Tableau|
Vim|
Chrome开发者工具|
OpenGL|
Unity|
Direct3D|
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....