From c9d3f852e2686ae780ce27ae448d3337f6b32463 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 2 Jan 2012 17:07:19 +1300 Subject: New custom syntax color file. --- vim/colors/dessert.vim | 324 ------------------------------------------------- vim/colors/sahara.vim | 59 +++++++++ vim/vimrc | 32 +++-- 3 files changed, 74 insertions(+), 341 deletions(-) delete mode 100644 vim/colors/dessert.vim create mode 100644 vim/colors/sahara.vim diff --git a/vim/colors/dessert.vim b/vim/colors/dessert.vim deleted file mode 100644 index b810b974..00000000 --- a/vim/colors/dessert.vim +++ /dev/null @@ -1,324 +0,0 @@ -" -" dessert, tejr's modest fork of the desert256 colorscheme. -" -set background=dark -if version > 580 - " no guarantees for version 5.8 and below, but this makes it stop - " complaining - hi clear - if exists("syntax_on") - syntax reset - endif -endif -let g:colors_name="dessert" - -if has("gui_running") || &t_Co == 88 || &t_Co == 256 - " functions {{{ - " returns an approximate grey index for the given grey level - fun grey_number(x) - if &t_Co == 88 - if a:x < 23 - return 0 - elseif a:x < 69 - return 1 - elseif a:x < 103 - return 2 - elseif a:x < 127 - return 3 - elseif a:x < 150 - return 4 - elseif a:x < 173 - return 5 - elseif a:x < 196 - return 6 - elseif a:x < 219 - return 7 - elseif a:x < 243 - return 8 - else - return 9 - endif - else - if a:x < 14 - return 0 - else - let l:n = (a:x - 8) / 10 - let l:m = (a:x - 8) % 10 - if l:m < 5 - return l:n - else - return l:n + 1 - endif - endif - endif - endfun - - " returns the actual grey level represented by the grey index - fun grey_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 46 - elseif a:n == 2 - return 92 - elseif a:n == 3 - return 115 - elseif a:n == 4 - return 139 - elseif a:n == 5 - return 162 - elseif a:n == 6 - return 185 - elseif a:n == 7 - return 208 - elseif a:n == 8 - return 231 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 8 + (a:n * 10) - endif - endif - endfun - - " returns the palette index for the given grey index - fun grey_color(n) - if &t_Co == 88 - if a:n == 0 - return 16 - elseif a:n == 9 - return 79 - else - return 79 + a:n - endif - else - if a:n == 0 - return 16 - elseif a:n == 25 - return 231 - else - return 231 + a:n - endif - endif - endfun - - " returns an approximate color index for the given color level - fun rgb_number(x) - if &t_Co == 88 - if a:x < 69 - return 0 - elseif a:x < 172 - return 1 - elseif a:x < 230 - return 2 - else - return 3 - endif - else - if a:x < 75 - return 0 - else - let l:n = (a:x - 55) / 40 - let l:m = (a:x - 55) % 40 - if l:m < 20 - return l:n - else - return l:n + 1 - endif - endif - endif - endfun - - " returns the actual color level for the given color index - fun rgb_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 139 - elseif a:n == 2 - return 205 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 55 + (a:n * 40) - endif - endif - endfun - - " returns the palette index for the given R/G/B color indices - fun rgb_color(x, y, z) - if &t_Co == 88 - return 16 + (a:x * 16) + (a:y * 4) + a:z - else - return 16 + (a:x * 36) + (a:y * 6) + a:z - endif - endfun - - " returns the palette index to approximate the given R/G/B color levels - fun color(r, g, b) - " get the closest grey - let l:gx = grey_number(a:r) - let l:gy = grey_number(a:g) - let l:gz = grey_number(a:b) - - " get the closest color - let l:x = rgb_number(a:r) - let l:y = rgb_number(a:g) - let l:z = rgb_number(a:b) - - if l:gx == l:gy && l:gy == l:gz - " there are two possibilities - let l:dgr = grey_level(l:gx) - a:r - let l:dgg = grey_level(l:gy) - a:g - let l:dgb = grey_level(l:gz) - a:b - let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) - let l:dr = rgb_level(l:gx) - a:r - let l:dg = rgb_level(l:gy) - a:g - let l:db = rgb_level(l:gz) - a:b - let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) - if l:dgrey < l:drgb - " use the grey - return grey_color(l:gx) - else - " use the color - return rgb_color(l:x, l:y, l:z) - endif - else - " only one possibility - return rgb_color(l:x, l:y, l:z) - endif - endfun - - " returns the palette index to approximate the 'rrggbb' hex string - fun rgb(rgb) - let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 - let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 - let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 - - return color(l:r, l:g, l:b) - endfun - - " sets the highlighting for the given group - fun X(group, fg, bg, attr) - if a:fg != "" - exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) - endif - if a:bg != "" - exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) - endif - if a:attr != "" - exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr - endif - endfun - " }}} - - call X("Normal", "cccccc", "000000", "") - - " highlight groups - call X("Cursor", "708090", "f0e68c", "") - "CursorIM - "Directory - "DiffAdd - "DiffChange - "DiffDelete - "DiffText - "ErrorMsg - call X("VertSplit", "444444", "7f7f7f", "") - call X("Folded", "ffd700", "4d4d4d", "") - call X("FoldColumn", "d2b48c", "4d4d4d", "") - call X("IncSearch", "445599", "aabbff", "") - call X("LineNr", "444444", "", "") - call X("ModeMsg", "daa520", "", "") - call X("MoreMsg", "2e8b57", "", "") - call X("NonText", "444444", "000000", "") - call X("Question", "00ff7f", "", "") - call X("Search", "aabbff", "334499", "") - call X("SpecialKey", "9acd32", "", "") - call X("StatusLine", "444444", "ffffff", "") - call X("StatusLineNC", "444444", "000000", "") - call X("TabLine", "000000", "444444", "none") - call X("TabLineSel", "ffffff", "444444", "none") - call X("TabLineFill", "444444", "000000", "") - call X("Title", "888888", "", "") - call X("Visual", "6b8e23", "f0e68c", "reverse") - "VisualNOS - call X("WarningMsg", "fa8072", "", "") - "WildMenu - "Menu - "Scrollbar - "Tooltip - - " syntax highlighting groups - call X("Comment", "77bedb", "", "") - call X("Constant", "ffa0a0", "", "") - call X("Identifier", "98fb98", "", "none") - call X("Statement", "f0e68c", "", "") - call X("PreProc", "cd5c5c", "", "") - call X("Type", "bdb76b", "", "") - call X("Special", "ffdead", "", "") - "Underlined - call X("Ignore", "666666", "", "") - "Error - call X("Todo", "ff4500", "eeee00", "") - call X("Pmenu", "ffffff", "444444", "") - - " delete functions {{{ - delf X - delf rgb - delf color - delf rgb_color - delf rgb_level - delf rgb_number - delf grey_color - delf grey_level - delf grey_number - " }}} -else - " color terminal definitions - hi SpecialKey ctermfg=darkgreen - hi NonText cterm= ctermfg=8 - hi Directory ctermfg=darkcyan - hi ErrorMsg cterm= ctermfg=7 ctermbg=1 - hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green - hi Search cterm=NONE ctermfg=grey ctermbg=blue - hi MoreMsg ctermfg=darkgreen - hi ModeMsg cterm=NONE ctermfg=brown - hi LineNr ctermfg=8 - hi Question ctermfg=green - hi StatusLine cterm=,reverse - hi StatusLineNC cterm=reverse - hi VertSplit cterm=reverse - hi Title ctermfg=5 - hi Visual cterm=reverse - hi VisualNOS cterm=,underline - hi WarningMsg ctermfg=1 - hi WildMenu ctermfg=0 ctermbg=3 - hi Folded ctermfg=darkgrey ctermbg=NONE - hi FoldColumn ctermfg=darkgrey ctermbg=NONE - hi DiffAdd ctermbg=4 - hi DiffChange ctermbg=5 - hi DiffDelete cterm= ctermfg=4 ctermbg=6 - hi DiffText cterm= ctermbg=1 - hi Comment ctermfg=darkcyan - hi Constant ctermfg=brown - hi Special ctermfg=5 - hi Identifier ctermfg=6 - hi Statement ctermfg=3 - hi PreProc ctermfg=5 - hi Type ctermfg=2 - hi Underlined cterm=underline ctermfg=5 - hi Ignore ctermfg=darkgrey - hi Error cterm= ctermfg=7 ctermbg=1 - hi Pmenu ctermfg=0 ctermbg=8 -endif - diff --git a/vim/colors/sahara.vim b/vim/colors/sahara.vim new file mode 100644 index 00000000..8aa9032d --- /dev/null +++ b/vim/colors/sahara.vim @@ -0,0 +1,59 @@ +" +" sahara, a 256-color retake on desert256 with the color detection code +" removed for clarity. Written by Tom Ryder (tyrmored). +" +" http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim +" + +" +" Terminal setup. +" +set background=dark +if version > 580 + highlight clear + if exists("g:syntax_on") + syntax reset + endif +endif +let g:colors_name="dessert" + +" +" Highlighting definitions. +" +if has("gui_running") || &t_Co == 256 + highlight Comment cterm=NONE ctermfg=110 ctermbg=16 gui=NONE guifg=#87afd7 guibg=#000000 + highlight Constant cterm=NONE ctermfg=217 ctermbg=16 gui=NONE guifg=#ffafaf guibg=#000000 + highlight Cursor cterm=NONE ctermfg=66 ctermbg=222 gui=NONE guifg=#5f8787 guibg=#ffd787 + highlight FoldColumn cterm=NONE ctermfg=180 ctermbg=237 gui=NONE guifg=#d7af87 guibg=#3a3a3a + highlight Folded cterm=NONE ctermfg=220 ctermbg=237 gui=NONE guifg=#ffd700 guibg=#3a3a3a + highlight Identifier cterm=NONE ctermfg=120 ctermbg=16 gui=NONE guifg=#87ff87 guibg=#000000 + highlight Ignore cterm=NONE ctermfg=240 ctermbg=16 gui=NONE guifg=#585858 guibg=#000000 + highlight IncSearch cterm=NONE ctermfg=147 ctermbg=24 gui=NONE guifg=#afafff guibg=#005f87 + highlight ModeMsg cterm=NONE ctermfg=178 ctermbg=16 gui=NONE guifg=#d7af00 guibg=#000000 + highlight MoreMsg cterm=NONE ctermfg=29 ctermbg=16 gui=NONE guifg=#00875f guibg=#000000 + highlight NonText cterm=NONE ctermfg=237 ctermbg=16 gui=NONE guifg=#3a3a3a guibg=#000000 + highlight Normal cterm=NONE ctermfg=251 ctermbg=16 gui=NONE guifg=#c6c6c6 guibg=#000000 + highlight Pmenu cterm=NONE ctermfg=231 ctermbg=237 gui=NONE guifg=#ffffff guibg=#3a3a3a + highlight PreProc cterm=NONE ctermfg=167 ctermbg=16 gui=NONE guifg=#d75f5f guibg=#000000 + highlight Question cterm=NONE ctermfg=48 ctermbg=16 gui=NONE guifg=#00ff87 guibg=#000000 + highlight Search cterm=NONE ctermfg=147 ctermbg=17 gui=NONE guifg=#afafff guibg=#000087 + highlight Special cterm=NONE ctermfg=223 ctermbg=16 gui=NONE guifg=#ffd7af guibg=#000000 + highlight SpecialKey cterm=NONE ctermfg=112 ctermbg=16 gui=NONE guifg=#87d700 guibg=#000000 + highlight Statement cterm=NONE ctermfg=222 ctermbg=16 gui=NONE guifg=#ffd787 guibg=#000000 + highlight StatusLine cterm=NONE ctermfg=231 ctermbg=237 gui=NONE guifg=#ffffff guibg=#3a3a3a + highlight StatusLineNC cterm=NONE ctermfg=16 ctermbg=237 gui=NONE guifg=#000000 guibg=#3a3a3a + highlight Title cterm=NONE ctermfg=244 ctermbg=237 gui=NONE guifg=#808080 guibg=#3a3a3a + highlight Todo cterm=NONE ctermfg=196 ctermbg=226 gui=NONE guifg=#ff0000 guibg=#ffff00 + highlight Type cterm=NONE ctermfg=143 ctermbg=16 gui=NONE guifg=#afaf5f guibg=#000000 + highlight Underlined cterm=NONE ctermfg=81 ctermbg=16 gui=NONE guifg=#5fd7ff guibg=#000000 + highlight VertSplit cterm=NONE ctermfg=243 ctermbg=237 gui=NONE guifg=#767676 guibg=#3a3a3a + highlight Visual cterm=NONE ctermfg=222 ctermbg=64 gui=NONE guifg=#ffd787 guibg=#5f8700 + highlight WarningMsg cterm=NONE ctermfg=209 ctermbg=16 gui=NONE guifg=#ff875f guibg=#000000 + highlight! link LineNr NonText + highlight! link TabLine StatusLineNC + highlight! link TabLineFill StatusLineNC + highlight! link TabLineSel StatusLine + highlight! link VertSplit StatusLineNC + highlight! link VimHiGroup VimGroup +endif + diff --git a/vim/vimrc b/vim/vimrc index 926b3d02..989a7323 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -4,8 +4,8 @@ set nocompatible " Filetypes if has("autocmd") filetype on - filetype plugin on filetype indent on + filetype plugin on endif " Backups @@ -18,16 +18,14 @@ set hidden " Colors if has("syntax") syntax enable - try - colorscheme dessert - catch - endtry + silent! colorscheme sahara endif " Commands if has("cmdline_info") set ruler set showcmd + set showmode endif " Completion @@ -35,7 +33,7 @@ if has("wildmenu") set wildignore+=*.a,*.o set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png set wildignore+=.DS_Store,.git,.hg,.svn - set wildignore+=*~,*.sw,*.tmp + set wildignore+=*~,*.swp,*.tmp set wildmenu set wildmode=longest,list endif @@ -54,10 +52,10 @@ set shiftround set shiftwidth=4 set softtabstop=4 set tabstop=4 -set textwidth=78 +set textwidth=80 " History -set history=100 +set history=1000 " Leaders nnoremap h :set hlsearch! @@ -85,7 +83,7 @@ set sidescroll=1 " Search set hlsearch set incsearch -nnoremap :nohlsearch +nnoremap :nohlsearch " Spelling if has("spell") @@ -96,12 +94,13 @@ endif set noswapfile " Typos -command W w -command Wq wq -command WQ wq -command Q q -command QA qa -command Qa qa +cnoreabbrev E w +cnoreabbrev W w +cnoreabbrev Wq wq +cnoreabbrev WQ wq +cnoreabbrev Q q +cnoreabbrev QA qa +cnoreabbrev Qa qa " Windows if has("windows") @@ -109,10 +108,9 @@ if has("windows") set showtabline=1 set splitbelow if has("vertsplit") - set fillchars= + set fillchars="" set splitright endif - au VimResized * exe "normal! \=" endif " Wrapping -- cgit v1.2.3