From 7e1408f5d15be59e8e0830f7eea48f8bcdf3d61e Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Sun, 2 Jun 2013 14:37:54 +0200 Subject: [PATCH] Vim extenstion --- install.sh | 7 + vim/colors/wombat256mod.vim | 96 +++++++++++ vim/colors/wombat256modv1.vim | 302 ++++++++++++++++++++++++++++++++++ vim/colors/wombat256modv2.vim | 64 +++++++ vimrc | 3 +- 5 files changed, 471 insertions(+), 1 deletion(-) create mode 100644 vim/colors/wombat256mod.vim create mode 100644 vim/colors/wombat256modv1.vim create mode 100644 vim/colors/wombat256modv2.vim diff --git a/install.sh b/install.sh index f89330f..9ac05b1 100755 --- a/install.sh +++ b/install.sh @@ -13,3 +13,10 @@ if [ ! -d "~/.ssh" ]; then mkdir .ssh/; fi; cd ~/.ssh ln -s $WAI/ssh/config ./ +if [ ! -d "~/.vim" ]; then mkdir ~/.vim/; fi; +cd ~/.vim + +if [ ! -d "./colors" ]; then mkdir colors; fi; +cd colors +ln -s $WAI/vim/colors/wombat256modv1.vim ./wombat256modv1.vim + diff --git a/vim/colors/wombat256mod.vim b/vim/colors/wombat256mod.vim new file mode 100644 index 0000000..1137eb8 --- /dev/null +++ b/vim/colors/wombat256mod.vim @@ -0,0 +1,96 @@ +" Vim color file +" Original Maintainer: Lars H. Nielsen (dengmao@gmail.com) +" Last Change: 2010-07-23 +" +" Modified version of wombat for 256-color terminals by +" David Liang (bmdavll@gmail.com) +" based on version by +" Danila Bespalov (danila.bespalov@gmail.com) + +set background=dark + +if version > 580 + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let colors_name = "wombat256mod" + + +" General colors +hi Normal ctermfg=252 ctermbg=234 cterm=none guifg=#e3e0d7 guibg=#242424 gui=none +hi Cursor ctermfg=234 ctermbg=228 cterm=none guifg=#242424 guibg=#eae788 gui=none +hi Visual ctermfg=251 ctermbg=239 cterm=none guifg=#c3c6ca guibg=#554d4b gui=none +hi VisualNOS ctermfg=251 ctermbg=236 cterm=none guifg=#c3c6ca guibg=#303030 gui=none +hi Search ctermfg=177 ctermbg=241 cterm=none guifg=#d787ff guibg=#636066 gui=none +hi Folded ctermfg=103 ctermbg=237 cterm=none guifg=#a0a8b0 guibg=#3a4046 gui=none +hi Title ctermfg=230 cterm=bold guifg=#ffffd7 gui=bold +hi StatusLine ctermfg=230 ctermbg=238 cterm=none guifg=#ffffd7 guibg=#444444 gui=italic +hi VertSplit ctermfg=238 ctermbg=238 cterm=none guifg=#444444 guibg=#444444 gui=none +hi StatusLineNC ctermfg=241 ctermbg=238 cterm=none guifg=#857b6f guibg=#444444 gui=none +hi LineNr ctermfg=241 ctermbg=232 cterm=none guifg=#857b6f guibg=#080808 gui=none +hi SpecialKey ctermfg=241 ctermbg=235 cterm=none guifg=#626262 guibg=#2b2b2b gui=none +hi WarningMsg ctermfg=203 guifg=#ff5f55 +hi ErrorMsg ctermfg=196 ctermbg=236 cterm=bold guifg=#ff2026 guibg=#3a3a3a gui=bold + +" Vim >= 7.0 specific colors +if version >= 700 +hi CursorLine ctermbg=236 cterm=none guibg=#32322f +hi MatchParen ctermfg=228 ctermbg=101 cterm=bold guifg=#eae788 guibg=#857b6f gui=bold +hi Pmenu ctermfg=230 ctermbg=238 guifg=#ffffd7 guibg=#444444 +hi PmenuSel ctermfg=232 ctermbg=192 guifg=#080808 guibg=#cae982 +endif + +" Diff highlighting +hi DiffAdd ctermbg=17 guibg=#2a0d6a +hi DiffDelete ctermfg=234 ctermbg=60 cterm=none guifg=#242424 guibg=#3e3969 gui=none +hi DiffText ctermbg=53 cterm=none guibg=#73186e gui=none +hi DiffChange ctermbg=237 guibg=#382a37 + +"hi CursorIM +"hi Directory +"hi IncSearch +"hi Menu +"hi ModeMsg +"hi MoreMsg +"hi PmenuSbar +"hi PmenuThumb +"hi Question +"hi Scrollbar +"hi SignColumn +"hi SpellBad +"hi SpellCap +"hi SpellLocal +"hi SpellRare +"hi TabLine +"hi TabLineFill +"hi TabLineSel +"hi Tooltip +"hi User1 +"hi User9 +"hi WildMenu + + +" Syntax highlighting +hi Keyword ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Statement ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Constant ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Number ctermfg=173 cterm=none guifg=#e5786d gui=none +hi PreProc ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Function ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Identifier ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Type ctermfg=186 cterm=none guifg=#d4d987 gui=none +hi Special ctermfg=229 cterm=none guifg=#eadead gui=none +hi String ctermfg=113 cterm=none guifg=#95e454 gui=italic +hi Comment ctermfg=246 cterm=none guifg=#9c998e gui=italic +hi Todo ctermfg=101 cterm=none guifg=#857b6f gui=italic + + +" Links +hi! link FoldColumn Folded +hi! link CursorColumn CursorLine +hi! link NonText LineNr + +" vim:set ts=4 sw=4 noet: diff --git a/vim/colors/wombat256modv1.vim b/vim/colors/wombat256modv1.vim new file mode 100644 index 0000000..73be6db --- /dev/null +++ b/vim/colors/wombat256modv1.vim @@ -0,0 +1,302 @@ +" Vim color file +" Maintainer: David Liang (bmdavll at gmail dot com) +" Last Change: November 28 2008 +" +" wombat256.vim - a modified version of Wombat by Lars Nielsen that also +" works on xterms with 88 or 256 colors. The algorithm for approximating the +" GUI colors with the xterm palette is from desert256.vim by Henry So Jr. + +set background=dark + +if version > 580 + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let g:colors_name = "wombat256" + +if !has("gui_running") && &t_Co != 88 && &t_Co != 256 + finish +endif + +" 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 != "" + if a:attr == 'italic' + exec "hi ".a:group." gui=".a:attr." cterm=none" + else + exec "hi ".a:group." gui=".a:attr." cterm=".a:attr + endif + endif +endfun +" }}} + +call X("Normal", "cccccc", "242424", "none") +call X("Cursor", "222222", "ecee90", "none") +call X("CursorLine", "", "32322e", "none") +call X("CursorColumn", "", "2d2d2d", "") + "CursorIM + "Question + "IncSearch +call X("Search", "444444", "af87d7", "") +call X("MatchParen", "ecee90", "857b6f", "bold") +call X("SpecialKey", "6c6c6c", "2d2d2d", "none") +call X("Visual", "ecee90", "597418", "none") +call X("LineNr", "857b6f", "121212", "none") +call X("Folded", "a0a8b0", "404048", "none") +call X("Title", "f6f3e8", "", "bold") +call X("VertSplit", "444444", "444444", "none") +call X("StatusLine", "f6f3e8", "444444", "italic") +call X("StatusLineNC", "857b6f", "444444", "none") + "Scrollbar + "Tooltip + "Menu + "WildMenu +call X("Pmenu", "f6f3e8", "444444", "") +call X("PmenuSel", "121212", "caeb82", "") +call X("WarningMsg", "ff0000", "", "") + "ErrorMsg + "ModeMsg + "MoreMsg + "Directory + "DiffAdd + "DiffChange + "DiffDelete + "DiffText + +" syntax highlighting +call X("Number", "e5786d", "", "none") +call X("Constant", "e5786d", "", "none") +call X("String", "95e454", "", "italic") +call X("Comment", "c0bc6c", "", "italic") +call X("Identifier", "caeb82", "", "none") +call X("Keyword", "87afff", "", "none") +call X("Statement", "87afff", "", "none") +call X("Function", "caeb82", "", "none") +call X("PreProc", "e5786d", "", "none") +call X("Type", "caeb82", "", "none") +call X("Special", "ffdead", "", "none") +call X("Todo", "857b6f", "", "italic") + "Underlined + "Error + "Ignore + +hi! link VisualNOS Visual +hi! link NonText LineNr +hi! link FoldColumn Folded + +" 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 +" }}} + +" vim:set ts=4 sw=4 noet fdm=marker: diff --git a/vim/colors/wombat256modv2.vim b/vim/colors/wombat256modv2.vim new file mode 100644 index 0000000..b22e5ba --- /dev/null +++ b/vim/colors/wombat256modv2.vim @@ -0,0 +1,64 @@ +" Vim color file +" Original Maintainer: Lars H. Nielsen (dengmao@gmail.com) +" Last Change: 2010-07-23 +" +" Converting for 256-color terminals by +" Danila Bespalov (danila.bespalov@gmail.com) +" with great help of tool by Wolfgang Frisch (xororand@frexx.de) +" inspired by David Liang's version (bmdavll@gmail.com) + +set background=dark + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "wombat256" + + +" General colors +hi Normal ctermfg=254 ctermbg=234 cterm=none guifg=#f6f3e8 guibg=#242424 gui=none +hi Cursor ctermfg=none ctermbg=241 cterm=none guifg=NONE guibg=#656565 gui=none +hi Visual ctermfg=7 ctermbg=238 cterm=none guifg=#f6f3e8 guibg=#444444 gui=none +" hi VisualNOS +" hi Search +hi Folded ctermfg=103 ctermbg=238 cterm=none guifg=#a0a8b0 guibg=#384048 gui=none +hi Title ctermfg=7 ctermbg=none cterm=bold guifg=#f6f3e8 guibg=NONE gui=bold +hi StatusLine ctermfg=7 ctermbg=238 cterm=none guifg=#f6f3e8 guibg=#444444 gui=italic +hi VertSplit ctermfg=238 ctermbg=238 cterm=none guifg=#444444 guibg=#444444 gui=none +hi StatusLineNC ctermfg=243 ctermbg=238 cterm=none guifg=#857b6f guibg=#444444 gui=none +hi LineNr ctermfg=243 ctermbg=0 cterm=none guifg=#857b6f guibg=#000000 gui=none +hi SpecialKey ctermfg=244 ctermbg=236 cterm=none guifg=#808080 guibg=#343434 gui=none +hi NonText ctermfg=244 ctermbg=236 cterm=none guifg=#808080 guibg=#303030 gui=none + +" Vim >= 7.0 specific colors +if version >= 700 +hi CursorLine ctermbg=236 cterm=none guibg=#2d2d2d +hi MatchParen ctermfg=7 ctermbg=243 cterm=bold guifg=#f6f3e8 guibg=#857b6f gui=bold +hi Pmenu ctermfg=7 ctermbg=238 guifg=#f6f3e8 guibg=#444444 +hi PmenuSel ctermfg=0 ctermbg=192 guifg=#000000 guibg=#cae682 +endif + + +" Syntax highlighting +hi Keyword ctermfg=111 cterm=none guifg=#8ac6f2 gui=none +hi Statement ctermfg=111 cterm=none guifg=#8ac6f2 gui=none +hi Constant ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Number ctermfg=173 cterm=none guifg=#e5786d gui=none +hi PreProc ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Function ctermfg=192 cterm=none guifg=#cae682 gui=none +hi Identifier ctermfg=192 cterm=none guifg=#cae682 gui=none +hi Type ctermfg=192 cterm=none guifg=#cae682 gui=none +hi Special ctermfg=194 cterm=none guifg=#e7f6da gui=none +hi String ctermfg=113 cterm=none guifg=#95e454 gui=italic +hi Comment ctermfg=246 cterm=none guifg=#99968b gui=italic +hi Todo ctermfg=245 cterm=none guifg=#8f8f8f gui=italic + + +" Links +hi! link FoldColumn Folded +hi! link CursorColumn CursorLine + +" vim:set ts=4 sw=4 noet: diff --git a/vimrc b/vimrc index 04e7f15..5f15bd5 100644 --- a/vimrc +++ b/vimrc @@ -23,7 +23,8 @@ set foldmethod=marker "set cul "souligner la ligne actuelle -color desert +"color desert +colorscheme wombat256modv1 "color darkblue set cursorline hi CursorLine term=bold cterm=bold guibg=Grey40