vim配色文件

.vimrc文件如下

set t_Co=256
set tabstop=4
set shiftwidth=4
set hlsearch
syntax on
set nu
set autoindent
set cindent
set softtabstop=4
set smartindent
set fileencodings=ucs-bom,utf-8,gb2312,cp936,chinese
set guifont=YaHei\ Consolas\ Hybrid\ 14
colorscheme littley

littley.vim  放在/usr/share/vim/vim73/colors/目录下

" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file

set background=dark
hi clear
if exists("syntax_on")
  syntax reset
endif
let g:colors_name = "littley"
hi Normal							ctermfg=7
hi Comment							ctermfg=203
hi Constant							ctermfg=74
hi Special 							ctermfg=196
hi Identifier   cterm=bold			ctermfg=black
hi Statement	cterm=bold			ctermfg=112
hi PreProc		term=underline		ctermfg=208
hi Type			cterm=bold  term=underline		ctermfg=112
hi Function		cterm=bold  term=bold			ctermfg=112
hi Repeat		cterm=bold  term=underline		ctermfg=112
hi Operator		ctermfg=222	 
hi Ignore		ctermfg=Blue	 
hi Error		term=reverse		ctermfg=black  
hi Todo			term=standout	    ctermfg=Black

" Common groups that link to default highlighting.
" You can specify other highlighting easily.
hi link String		Special
hi link Character	Constant
hi link Number		Constant
hi link Boolean		Type
hi link Float		Number

hi link Conditional	Repeat
hi link Label		Statement
hi link Keyword		Statement
hi link Exception	Statement
hi link Include		PreProc
hi link Define		PreProc
hi link Macro		PreProc
hi link PreCondit	PreProc
hi link StorageClass	Type
hi link Structure		Type
hi link Typedef			Type
hi link Tag			Special
hi link SpecialChar	Special
hi link Delimiter	Special
hi link SpecialComment Special
hi link Debug		Constant

hi Normal	guifg=White guibg=grey20

" highlight groups
hi Cursor	guibg=khaki guifg=slategrey
"hi CursorIM
"hi Directory
"hi DiffAdd
"hi DiffChange
"hi DiffDelete
"hi DiffText
"hi ErrorMsg
hi VertSplit	guibg=#c2bfa5 guifg=grey50 gui=none
hi Folded	guibg=grey30 guifg=gold
hi FoldColumn	guibg=grey30 guifg=tan
hi IncSearch	guifg=slategrey guibg=khaki
"hi LineNr
hi ModeMsg	guifg=goldenrod
hi MoreMsg	guifg=SeaGreen
hi NonText	guifg=LightBlue guibg=grey30
hi Question	guifg=springgreen
hi Search	guibg=peru guifg=wheat
hi SpecialKey	guifg=yellowgreen
hi StatusLine	guibg=#c2bfa5 guifg=black gui=none
hi StatusLineNC	guibg=#c2bfa5 guifg=grey50 gui=none
hi Title	guifg=indianred
hi Visual	gui=none guifg=khaki guibg=olivedrab
"hi VisualNOS
hi WarningMsg	guifg=salmon
"hi WildMenu
"hi Menu
"hi Scrollbar
"hi Tooltip

" syntax highlighting groups
hi Comment	guifg=SkyBlue
hi Constant	guifg=#ffa0a0
hi Identifier	guifg=palegreen
hi Statement	guifg=khaki
hi PreProc	guifg=indianred
hi Type		guifg=darkkhaki
hi Special	guifg=navajowhite
"hi Underlined
hi Ignore	guifg=grey40
"hi Error
hi Todo		guifg=orangered guibg=yellow2


### 关于 Vim 配色方案的设置教程与主题推荐 #### 一、Vim 配色方案的基础概念 Vim配色方案通过 `.vimrc` 文件中的 `colorscheme` 命令来指定。用户可以从官方仓库或其他第三方资源获取各种配色方案,并将其放置在 `$HOME/.vim/colors/` 或 `/usr/share/vim/vimXX/colors/` 目录下,之后即可在 Vim 中加载这些配色方案。 如果遇到类似 “处理 /usr/share/vim/vim72/colors/rainbow...” 的错误提示,通常是因为配色文件语法有误或者未正确安装依赖项[^1]。解决方法包括检查配色文件是否有损坏以及确认当前环境是否支持该配色所需的特性(如 TrueColor 支持)。 --- #### 二、常见 Vim 配色方案及其特点 以下是几个流行的 Vim 配色方案简介: ##### 1. Solarized Solarized 是一种高对比度的颜色方案,适用于浅色和深色背景模式。其项目地址位于 [GitCode](https://gitcode.com/gh_mirrors/vi/vim-colors-solarized),目录结构清晰,便于集成到现有工作流中[^2]。 - **优点**: 提供精确的颜色定义,适合长时间编码。 - **缺点**: 对某些终端模拟器的支持可能有限。 ##### 2. Molokai Molokai 是基于 TextMate 的 Monokai 主题移植而来的一种深色配色方案。它具有经典的紫色调设计,默认背景为深灰色[^3]。 - **优点**: 经典美观,广泛兼容多种终端。 - **缺点**: 不完全支持浅色背景。 ##### 3. Everforest Everforest 是一款模仿森林色调的设计风格的主题,核心逻辑存储在 `autoload/everforest.vim` 文件中[^4]。此配色方案允许用户自定义多个参数,例如亮度级别和强调颜色。 - **优点**: 自然柔和的视觉效果,减少眼睛疲劳。 - **缺点**: 可能需要额外配置才能达到最佳体验。 ##### 4. Gruvbox Gruvbox 是一个复古风十足的配色方案,特别受到极简主义者喜爱。它的特点是暖冷两套色彩体系,适应不同用户的偏好[^5]。 - **优点**: 极具个性化的外观,适合作为日常开发工具。 - **缺点**: 初次使用者可能会觉得不够现代化。 --- #### 三、如何设置 Vim 配色方案? 假设已经下载了一个名为 `mytheme.vim` 的配色文件,则按照以下方式操作: 1. 将 `mytheme.vim` 移动至个人配置路径: ```bash mv mytheme.vim ~/.vim/colors/ ``` 2. 编辑 `.vimrc` 添加如下内容以激活新主题: ```vim syntax on set background=dark colorscheme mytheme ``` 注意:如果运行的是较旧版本 Vim (低于8.x),需确保启用了必要的功能模块;否则可能导致部分样式无法正常显示。 --- #### 四、代码示例——动态切换配色方案 下面展示一段脚本用于实现快捷键绑定,在两种预设之间来回转换: ```vim let g:current_colorscheme = 'molokai' function! ToggleColors() if g:current_colorscheme == 'molokai' let g:current_colorscheme = 'gruvbox' execute "colorscheme gruvbox" else let g:current_colorscheme = 'molokai' execute "colorscheme molokai" endif endfunction nnoremap <F5> :call ToggleColors()<CR> ``` 上述片段实现了按下 F5 键时交替使用 Molokai 和 Gruvbox 主题的功能。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值