自定颜色

回忆上节课内容

这次我们研究了配色方案找到了 colors 的位置并应用了颜色方案制作了自己的配色方案下面我想修改配色方案的颜色是否能成功???

首先得有自己的颜色方案

红色系列色卡图片(色卡大全图片橙色)

找到colors的位置 cd usr/share/vim/vim81/colors 列出所有配色方案 ls 复制出自己的配色方案 sudo cp murphy.vim oeasy.vim 查看配色方案信息 sudo vi oeasy.vim

修改配色方案

红色系列色卡图片(色卡大全图片橙色)

前 5 行是注释第 7 行取消原来的配色第 8 行设置背景第 9-11 行重设语法高亮第 12 行命名此配色方案,可以修改为 oeasy第 14 行开始设置各种高亮组的颜色我们先修改个高亮组 NormalNormal的意思是一般文字这类的文字都属于这个高亮组与此类似的还有注释Comment常量Constant等

改变 Normal 高亮组颜色

首先把配色方案名称改为 oeasy找到 Normal 组把 Normal 组的背景色ctermbg 改为 blue把 Normal 组的前景色 ctermfg 改为 yellow:w 保存配色文件colorscheme oeasy 重新设定配色文件

红色系列色卡图片(色卡大全图片橙色)

查看配色

:hi Normal 可以查看 Normal 组的配色:hi 可以查看当前色彩方案所有的配色xxx 就是效果预览

红色系列色卡图片(色卡大全图片橙色)

配色细节

hi 是 highlight 的缩写:h hi 可以查询帮助

红色系列色卡图片(色卡大全图片橙色)

字体特征

:hi StatusLine:hi StatusLine cterm=bold:hi StatusLine cterm=bold,italic:hi StatusLine cterm=bold,italic:hi StatusLine cterm=bold,italic,underline:hi StatusLine

红色系列色卡图片(色卡大全图片橙色)

term意思是terminal效果之间可以加逗号对应黑白终端在此无效ctermbold 加粗underline 下划线italic 倾斜NONE 取消效果

设置颜色

hi StatusLinehi StatusLine ctermfg=red ctermbg=bluehi StatusLinectermfg意思是color terminal fore color前景色设置ctermfg=whitectermbg意思是color terminal back color被景色设置ctermfg=redgui相关的属性呢与gui相关当前终端中无效果颜色对应的色号是来自系统的ansi对应的颜色值

定义光标所在行的颜色效果

设置光标行高亮显示:set cursorline:h cursorline:hi CursorLine:hi CursorLine ctermbg=red ctermfg=white:hi CursorLine随着光标的运动,CursorLine 也会移动

定义光标所在列的颜色效果

设置光标行高亮显示:set cursorcolumn:h cursorcolumn:hi CursorColumn:hi CursorColumn ctermbg=red ctermfg=white:hi CursorColumn随着光标的运动,CursorColumn 也会移动如果有换行问题的话:set nowrap

红色系列色卡图片(色卡大全图片橙色)

自定义颜色名

定义 oeasy 组:hi oeasy ctermbg=white ctermfg=red查看 oeasy 组:hi oeasy应用 oeasy 组:set statusline=%oeasy%F%*

红色系列色卡图片(色卡大全图片橙色)

配置文件

set statusline=%-040.40(%F%m%)%-030.30([%l,%c]%)%p%%set laststatus=2set rulerset numberset showcmdset nocompatibleset showcmdset showmodeset history=100set t_Co=256colorscheme blueset cursorlinehi CursorLine ctermbg=red ctermfg=whiteset cursorcolumnhi CursorColumn ctermbg=red ctermfg=white

总结

我们这次深入了配色方案修改了方案中的具体配色建立了自己的配色应用了自己的配色配置里面还有什么好玩的吗?用来用去就是红绿蓝可以有更多颜色吗?下次再说