]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - .vim/colors/ps_color.vim
.vimrc: Enable swap files; scrolloff and sidescroll; comment clean-up
[dotfiles.git] / .vim / colors / ps_color.vim
1 " Vim colour file --- PSC
2 " Maintainer: Pan, Shi Zhu <Go to the following URL for my email>
3 " URL: http://vim.sourceforge.net/scripts/script.php?script_id=760
4 " Last Change: 18 July 2006
5 " Version: 2.9
6 "
7 " Please prepend [VIM] in the title when writing e-mail to me, or it will
8 " be automatically treated as spam and removed.
9 "
10 " See the help document for all details, the help document will be
11 " installed after the script has been sourced once, do not open the
12 " script when you source it for the first time.
13 "
14
15 " Initializations: {{{1
16 "
17
18 " without user_commands, all these are not possible
19 if !has("user_commands")
20 finish
21 end
22
23 function! s:init_option(var, value)
24 if !exists("g:psc_".a:var)
25 execute "let s:".a:var." = ".a:value
26 else
27 let s:{a:var} = g:psc_{a:var}
28 endif
29 endfunction
30 command! -nargs=+ InitOpt call s:init_option(<f-args>)
31
32 function! s:multi_hi(setting, ...)
33 let l:idx = a:0
34 while l:idx > 0
35 let l:hlgroup = a:{l:idx}
36 execute "highlight ".l:hlgroup." ".a:setting
37 let l:idx = l:idx - 1
38 endwhile
39 endfunction
40 command! -nargs=+ MultiHi call s:multi_hi(<f-args>)
41
42 InitOpt style 'cool'
43 InitOpt inversed_todo 0
44 InitOpt use_default_for_cterm 0
45 InitOpt statement_different_from_type 0
46 if s:style == 'warm'
47 InitOpt fontface 'mixed'
48 else
49 InitOpt fontface 'plain'
50 endif
51
52 if !has("gui_running")
53 call s:init_option("cterm_style", "'".s:style."'")
54
55 " Forces 'cool' style when gui is not present Since the 'warm' style for
56 " terminal isn't available now, and probably never will be.
57 if s:cterm_style=='warm' | let s:cterm_style = 'cool'
58 endif
59 if s:use_default_for_cterm==1 | let s:cterm_style = 'default'
60 elseif s:use_default_for_cterm==2 | let s:cterm_style = 'defdark'
61 endif
62 endif
63
64
65 InitOpt other_style 0
66
67 if has("gui_running")
68 if s:style=='warm' || s:style=='default'
69 set background=light
70 elseif s:style=='cool' || s:style=='defdark'
71 set background=dark
72 else | let s:other_style = 1
73 endif
74 else
75 if s:cterm_style=='cool' || s:cterm_style=='defdark'
76 set background=dark
77 elseif s:cterm_style=='default'
78 set background=light
79 else | let s:other_style = 1
80 endif
81 endif
82
83
84 highlight clear
85
86 if exists("syntax_on")
87 syntax reset
88 endif
89
90 let s:color_name = expand("<sfile>:t:r")
91
92 if s:other_style==0 | let g:colors_name = s:color_name
93 " Go from console version to gui, the color scheme should be sourced again
94 execute "autocmd TermChanged * if g:colors_name == '".s:color_name."' | "
95 \."colo ".s:color_name." | endif"
96 else
97 execute "runtime colors/".s:style.".vim"
98 endif
99
100 " Command to go different schemes easier.
101 execute "command! -nargs=1 Colo if '".s:color_name."'!=\"<args>\" | "
102 \'let g:psc_style = "<args>"| endif | colo '.s:color_name
103
104 " Give control to 'reloaded' scheme if possible
105 if s:style == 'reloaded'
106 finish
107 endif
108
109 " }}}1
110
111 " Relevant Help:
112 " :h highlight-groups
113 " :h psc-cterm-color-table
114 " :ru syntax/hitest.vim
115 "
116 " Hardcoded Colors Comment:
117 " #aabbcc = Red aa, Green bb, Blue cc
118 " we must use hard-coded colours to get more 'tender' colours
119 "
120
121
122 " GUI:
123 "
124 " I don't want to abuse folding, but here folding is used to avoid confusion.
125 if s:style=='warm'
126 " Warm style for gui here {{{2
127 " LIGHT COLOR DEFINE START
128
129 highlight Normal guifg=#000000 guibg=#e0e0e0
130 highlight Search guifg=#902000 guibg=#f8f8f8
131 highlight Visual guifg=fg guibg=#a6caf0
132 highlight Cursor guifg=#f0f0f0 guibg=#008000
133 " The idea of CursorIM is pretty good, however, the feature is still buggy
134 " in the current version (Vim 7.0).
135 " The following line will be kept commented until the bug fixed.
136 "
137 " highlight CursorIM guifg=#f0f0f0 guibg=#800080
138 highlight Special guifg=#907000 guibg=bg
139 highlight Comment guifg=#606000 guibg=bg
140 highlight Number guifg=#907000 guibg=bg
141 highlight Constant guifg=#007068 guibg=bg
142 highlight StatusLine guifg=fg guibg=#a6caf0
143 highlight LineNr guifg=#686868 guibg=bg
144 highlight Question guifg=fg guibg=#d0d090
145 highlight PreProc guifg=#009030 guibg=bg
146 if s:statement_different_from_type==1
147 highlight Statement guifg=#4020a0 guibg=bg
148 else
149 highlight Statement guifg=#2060a8 guibg=bg
150 endif
151 highlight Type guifg=#0850a0 guibg=bg
152 if s:inversed_todo==1
153 highlight Todo guifg=#e0e090 guibg=#000080
154 else
155 highlight Todo guifg=#800000 guibg=#e0e090
156 endif
157 " NOTE THIS IS IN THE WARM SECTION
158 highlight Error guifg=#c03000 guibg=bg
159 highlight Identifier guifg=#a030a0 guibg=bg
160 highlight ModeMsg guifg=fg guibg=#b0b0e0
161 highlight VisualNOS guifg=fg guibg=#b0b0e0
162 highlight SpecialKey guifg=#1050a0 guibg=bg
163 highlight NonText guifg=#002090 guibg=#d0d0d0
164 highlight Directory guifg=#a030a0 guibg=bg
165 highlight ErrorMsg guifg=fg guibg=#f0b090
166 highlight MoreMsg guifg=#489000 guibg=bg
167 highlight Title guifg=#a030a0 guibg=bg
168 highlight WarningMsg guifg=#b02000 guibg=bg
169 highlight WildMenu guifg=fg guibg=#d0d090
170 highlight Folded guifg=fg guibg=#b0e0b0
171 highlight FoldColumn guifg=fg guibg=#90e090
172 highlight DiffAdd guifg=fg guibg=#b0b0e0
173 highlight DiffChange guifg=fg guibg=#e0b0e0
174 highlight DiffDelete guifg=#002090 guibg=#d0d0d0
175 highlight DiffText guifg=fg guibg=#c0e080
176 highlight SignColumn guifg=fg guibg=#90e090
177 highlight IncSearch guifg=#f0f0f0 guibg=#806060
178 highlight StatusLineNC guifg=fg guibg=#c0c0c0
179 highlight VertSplit guifg=fg guibg=#c0c0c0
180 highlight Underlined guifg=#6a5acd guibg=bg gui=underline
181 highlight Ignore guifg=bg guibg=bg
182 " NOTE THIS IS IN THE WARM SECTION
183 if v:version >= 700
184 highlight SpellBad guifg=NONE guibg=NONE guisp=#c03000
185 highlight SpellCap guifg=NONE guibg=NONE guisp=#2060a8
186 highlight SpellRare guifg=NONE guibg=NONE guisp=#a030a0
187 highlight SpellLocal guifg=NONE guibg=NONE guisp=#007068
188 highlight Pmenu guifg=fg guibg=#e0b0e0
189 highlight PmenuSel guifg=#f0f0f0 guibg=#806060
190 highlight PmenuSbar guifg=fg guibg=#c0c0c0
191 highlight PmenuThumb guifg=fg guibg=#c0e080
192 highlight TabLine guifg=fg guibg=#c0c0c0 gui=underline
193 highlight TabLineFill guifg=fg guibg=#c0c0c0 gui=underline
194 highlight TabLineSel guifg=fg guibg=bg
195 highlight CursorColumn guifg=NONE guibg=#f0b090
196 highlight CursorLine guifg=NONE guibg=NONE gui=underline
197 highlight MatchParen guifg=NONE guibg=#c0e080
198 endif
199
200 " LIGHT COLOR DEFINE END
201 " }}}2
202 elseif s:style=='cool'
203 " Cool style for gui here {{{2
204 " DARK COLOR DEFINE START
205
206 highlight Normal guifg=#d0d0d0 guibg=#202020
207 highlight Comment guifg=#d0d090 guibg=bg
208 highlight Constant guifg=#80c0e0 guibg=bg
209 highlight Number guifg=#e0c060 guibg=bg
210 highlight Identifier guifg=#f0c0f0 guibg=bg
211 if s:statement_different_from_type==1
212 highlight Statement guifg=#98a8f0 guibg=bg
213 else
214 highlight Statement guifg=#c0d8f8 guibg=bg
215 endif
216 highlight PreProc guifg=#60f080 guibg=bg
217 highlight Type guifg=#b0d0f0 guibg=bg
218 highlight Special guifg=#e0c060 guibg=bg
219 highlight Error guifg=#f08060 guibg=bg
220 if s:inversed_todo==1
221 highlight Todo guifg=#d0d090 guibg=#000080
222 else
223 highlight Todo guifg=#800000 guibg=#d0d090
224 endif
225 highlight Search guifg=#e0e0e0 guibg=#800000
226 highlight Visual guifg=#000000 guibg=#a6caf0
227 highlight Cursor guifg=#000000 guibg=#00f000
228 " NOTE THIS IS IN THE COOL SECTION
229 " highlight CursorIM guifg=#000000 guibg=#f000f0
230 highlight StatusLine guifg=#000000 guibg=#a6caf0
231 highlight LineNr guifg=#b0b0b0 guibg=bg
232 highlight Question guifg=#000000 guibg=#d0d090
233 highlight ModeMsg guifg=fg guibg=#000080
234 highlight VisualNOS guifg=fg guibg=#000080
235 highlight SpecialKey guifg=#b0d0f0 guibg=bg
236 highlight NonText guifg=#6080f0 guibg=#101010
237 highlight Directory guifg=#80c0e0 guibg=bg
238 highlight ErrorMsg guifg=#d0d090 guibg=#800000
239 highlight MoreMsg guifg=#c0e080 guibg=bg
240 highlight Title guifg=#f0c0f0 guibg=bg
241 highlight WarningMsg guifg=#f08060 guibg=bg
242 highlight WildMenu guifg=#000000 guibg=#d0d090
243 highlight Folded guifg=#d0d0d0 guibg=#004000
244 highlight FoldColumn guifg=#e0e0e0 guibg=#008000
245 highlight DiffAdd guifg=fg guibg=#000080
246 highlight DiffChange guifg=fg guibg=#800080
247 highlight DiffDelete guifg=#6080f0 guibg=#202020
248 highlight DiffText guifg=#000000 guibg=#c0e080
249 highlight SignColumn guifg=#e0e0e0 guibg=#008000
250 highlight IncSearch guifg=#000000 guibg=#d0d0d0
251 highlight StatusLineNC guifg=#000000 guibg=#c0c0c0
252 highlight VertSplit guifg=#000000 guibg=#c0c0c0
253 highlight Underlined guifg=#80a0ff guibg=bg gui=underline
254 highlight Ignore guifg=#000000 guibg=bg
255 " NOTE THIS IS IN THE COOL SECTION
256 if v:version >= 700
257 highlight SpellBad guifg=NONE guibg=NONE guisp=#f08060
258 highlight SpellCap guifg=NONE guibg=NONE guisp=#6080f0
259 highlight SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0
260 highlight SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8
261 highlight Pmenu guifg=fg guibg=#800080
262 highlight PmenuSel guifg=#000000 guibg=#d0d0d0
263 highlight PmenuSbar guifg=fg guibg=#000080
264 highlight PmenuThumb guifg=fg guibg=#008000
265 highlight TabLine guifg=fg guibg=#008000 gui=underline
266 highlight TabLineFill guifg=fg guibg=#008000 gui=underline
267 highlight TabLineSel guifg=fg guibg=bg
268 highlight CursorColumn guifg=NONE guibg=#800000
269 highlight CursorLine guifg=NONE guibg=NONE gui=underline
270 highlight MatchParen guifg=NONE guibg=#800080
271 endif
272
273 " DARK COLOR DEFINE END
274 " }}}2
275 elseif s:style=='defdark'
276 highlight Normal guifg=#f0f0f0 guibg=#000000
277 endif
278
279 " Take NT gui for example, If you want to use a console font such as
280 " Lucida_Console with font size larger than 14, the font looks already thick,
281 " and the bold font for that will be too thick, you may not want it be bolded.
282 " The following code does this.
283 "
284 " All of the bold font may be disabled, since continuously switching between
285 " bold and plain font hurts consistency and will inevitably fatigue your eye!
286
287 " Maximum 20 parameters for vim script function
288 "
289 MultiHi gui=NONE ModeMsg Search Cursor Special Comment Constant Number LineNr Question PreProc Statement Type Todo Error Identifier Normal
290
291 MultiHi gui=NONE VisualNOS SpecialKey NonText Directory ErrorMsg MoreMsg Title WarningMsg WildMenu Folded FoldColumn DiffAdd DiffChange DiffDelete DiffText SignColumn
292
293 " Vim 7 added stuffs
294 if v:version >= 700
295 MultiHi gui=NONE Ignore PmenuSel PmenuSel PmenuSbar PmenuThumb TabLine TabLineFill TabLineSel
296
297 " the gui=undercurl guisp could only support in Vim 7
298 MultiHi gui=undercurl SpellBad SpellCap SpellRare SpellLocal
299 if s:style=="cool" || s:style=="warm"
300 MultiHi gui=underline TabLine TabLineFill Underlined CursorLine
301 else
302 MultiHi gui=underline TabLine Underlined
303 endif
304 endif
305
306 " For reversed stuffs
307 MultiHi gui=NONE IncSearch StatusLine StatusLineNC VertSplit Visual
308
309 if s:style=="cool" || s:style=="warm"
310 if s:fontface=="mixed"
311 MultiHi gui=bold IncSearch StatusLine StatusLineNC VertSplit Visual
312 endif
313 else
314 if s:fontface=="mixed"
315 hi StatusLine gui=bold,reverse
316 else
317 hi StatusLine gui=reverse
318 endif
319 MultiHi gui=reverse IncSearch StatusLineNC VertSplit Visual
320 endif
321
322 " Enable the bold style
323 if s:fontface=="mixed"
324 MultiHi gui=bold Question DiffText Statement Type MoreMsg ModeMsg NonText Title VisualNOS DiffDelete TabLineSel
325 endif
326
327
328
329
330 " Color Term:
331
332 " It's not quite possible to support 'cool' and 'warm' simultaneously, since
333 " we cannot expect a terminal to have more than 16 color names.
334 "
335
336 " I assume Vim will never go to cterm mode when has("gui_running") returns 1,
337 " Please enlighten me if I am wrong.
338 "
339 if !has('gui_running')
340 " cterm settings {{{1
341 if s:cterm_style=='cool'
342
343 highlight Normal ctermfg=LightGrey ctermbg=Black
344 highlight Search ctermfg=White ctermbg=DarkRed
345 highlight Visual ctermfg=Black ctermbg=DarkCyan
346 highlight Cursor ctermfg=Black ctermbg=Green
347 highlight Special ctermfg=Yellow ctermbg=Black
348 highlight Comment ctermfg=DarkYellow ctermbg=Black
349 highlight Constant ctermfg=Blue ctermbg=Black
350 highlight Number ctermfg=Yellow ctermbg=Black
351 highlight StatusLine ctermfg=Black ctermbg=DarkCyan
352 highlight LineNr ctermfg=DarkGrey ctermbg=Black
353 highlight Question ctermfg=Black ctermbg=DarkYellow
354 highlight PreProc ctermfg=Green ctermbg=Black
355 highlight Statement ctermfg=Cyan ctermbg=Black
356 highlight Type ctermfg=Cyan ctermbg=Black
357 if s:inversed_todo==0
358 highlight Todo ctermfg=DarkRed ctermbg=DarkYellow
359 else
360 highlight Todo ctermfg=DarkYellow ctermbg=DarkBlue
361 endif
362 highlight Error ctermfg=Red ctermbg=Black
363 highlight Identifier ctermfg=Magenta ctermbg=Black
364 highlight Folded ctermfg=White ctermbg=DarkGreen
365 highlight ModeMsg ctermfg=Grey ctermbg=DarkBlue
366 highlight VisualNOS ctermfg=Grey ctermbg=DarkBlue
367 highlight SpecialKey ctermfg=Cyan ctermbg=Black
368 highlight NonText ctermfg=Blue ctermbg=Black
369 highlight Directory ctermfg=Blue ctermbg=Black
370 highlight ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed
371 highlight MoreMsg ctermfg=Green ctermbg=Black
372 highlight Title ctermfg=Magenta ctermbg=Black
373 highlight WarningMsg ctermfg=Red ctermbg=Black
374 highlight WildMenu ctermfg=Black ctermbg=DarkYellow
375 highlight FoldColumn ctermfg=White ctermbg=DarkGreen
376 highlight SignColumn ctermfg=White ctermbg=DarkGreen
377 highlight DiffText ctermfg=Black ctermbg=DarkYellow
378 highlight DiffDelete ctermfg=Blue ctermbg=Black
379
380 if v:version >= 700
381 highlight SpellBad ctermfg=NONE ctermbg=DarkRed
382 highlight SpellCap ctermfg=NONE ctermbg=DarkBlue
383 highlight SpellRare ctermfg=NONE ctermbg=DarkMagenta
384 highlight SpellLocal ctermfg=NONE ctermbg=DarkGreen
385 highlight Pmenu ctermfg=fg ctermbg=DarkMagenta
386 highlight PmenuSel ctermfg=bg ctermbg=fg
387 highlight PmenuSbar ctermfg=fg ctermbg=DarkBlue
388 highlight PmenuThumb ctermfg=fg ctermbg=DarkGreen
389 highlight TabLine ctermfg=fg ctermbg=DarkGreen cterm=underline
390 highlight TabLineFill ctermfg=fg ctermbg=DarkGreen cterm=underline
391 highlight TabLineSel ctermfg=fg ctermbg=bg
392 highlight CursorColumn ctermfg=NONE ctermbg=DarkRed
393 highlight CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
394 highlight MatchParen ctermfg=NONE ctermbg=DarkMagenta
395 endif
396 if &t_Co==8
397 " 8 colour terminal support, this assumes 16 colour is available through
398 " setting the 'bold' attribute, will get bright foreground colour.
399 " However, the bright background color is not available for 8-color terms.
400 "
401 " You can manually set t_Co=16 in your .vimrc to see if your terminal
402 " supports 16 colours,
403 MultiHi cterm=none DiffText Visual Cursor Comment Todo StatusLine Question DiffChange ModeMsg VisualNOS ErrorMsg WildMenu DiffAdd Folded DiffDelete Normal PmenuThumb
404 MultiHi cterm=bold Search Special Constant Number LineNr PreProc Statement Type Error Identifier SpecialKey NonText MoreMsg Title WarningMsg FoldColumn SignColumn Directory DiffDelete
405
406 else
407 " Background > 7 is only available with 16 or more colors
408
409 " Only use the s:fontface option when there is 16-colour(or more)
410 " terminal support
411
412 MultiHi cterm=none WarningMsg Search Visual Cursor Special Comment Constant Number LineNr PreProc Todo Error Identifier Folded SpecialKey Directory ErrorMsg Normal PmenuThumb
413 MultiHi cterm=none WildMenu FoldColumn SignColumn DiffAdd DiffChange Question StatusLine DiffText
414 MultiHi cterm=reverse IncSearch StatusLineNC VertSplit
415
416 " Well, well, bold font with color 0-7 is not possible.
417 " So, the Question, StatusLine, DiffText cannot act as expected.
418
419 call s:multi_hi("cterm=".((s:fontface=="plain") ? "none" : "bold"), "Statement", "Type", "MoreMsg", "ModeMsg", "NonText", "Title", "VisualNOS", "DiffDelete", "TabLineSel")
420
421 endif
422
423 elseif s:cterm_style=='defdark'
424 highlight Normal ctermfg=LightGrey ctermbg=Black
425 endif
426 " }}}1
427 endif
428
429
430 " Term:
431 " For console with only 4 colours (term, not cterm), we'll use the default.
432 " ...
433 " The default colorscheme is good enough for terms with no more than 4 colours
434 "
435
436
437 " Links:
438 "
439 if (s:style=='cool') || (s:style == 'warm')
440 " COLOR LINKS DEFINE START
441
442 highlight link String Constant
443 " Character must be different from strings because in many languages
444 " (especially C, C++) a 'char' variable is scalar while 'string' is pointer,
445 " mistaken a 'char' for a 'string' will cause disaster!
446 highlight link Character Number
447 highlight link SpecialChar LineNr
448 highlight link Tag Identifier
449 " The following are not standard hi links,
450 " these are used by DrChip
451 highlight link Warning MoreMsg
452 highlight link Notice Constant
453 " these are used by Calendar
454 highlight link CalToday PreProc
455 " these are used by TagList
456 highlight link MyTagListTagName IncSearch
457 highlight link MyTagListTagScope Constant
458
459 " COLOR LINKS DEFINE END
460 endif
461
462
463 " Clean:
464 "
465 delcommand InitOpt
466 delcommand MultiHi
467
468 " vim:et:nosta:sw=2:ts=8:
469 " vim600:fdm=marker:fdl=1: