1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 02:29:06 -08:00

the night is on my mind

This commit is contained in:
Connor Olding 2015-03-10 14:42:26 -07:00
parent 6628195280
commit f47e46856a
3 changed files with 264 additions and 466 deletions

2
.gitignore vendored
View file

@ -3,6 +3,8 @@ ssh/*
!ssh/known_hosts
!ssh/crawl
vim/backup/*
vim/swp/*
vim/.*
vim/bundle/*
*.swp
*.swo

View file

@ -1,5 +1,6 @@
" vim:cc=79,39
" make vim unusable for anyone else
" from the get-go, we assume version >= 703
set nocompatible " screw vi
@ -180,6 +181,8 @@ Inn <c-up> <c-y>
Inn <c-down> <c-e>
Inn <silent> <c-s-up> :m-2<cr>
Inn <silent> <c-s-down> :m+1<cr>
Inn <silent> <c-s-PageUp> :tabm -1<cr>
Inn <silent> <c-s-PageDown> :tabm +1<cr>
" hide search highlighting
Inn <silent> <c-]> :nohls<enter>
@ -204,19 +207,22 @@ Inn <s-Del> X
nn <Leader>p "0p
nn <Leader>P "0P
nn <Leader>e :tabe
nn <silent> <Leader>d :cd %:p:h<cr>:pwd<cr>
nn <Leader>. @:
"nn <Leader>? :exec getline(".")
nn <Leader>, :Tab /,\zs<cr>
"nn <Leader>x :system('chmod +x %') | e
"
nn <Leader>, :Tab /,\zs<cr>
nn <Leader>s :call SyntaxAttr()<cr>
nn <Leader>1 :colo property<cr>
nn <Leader>2 :colo clearance<cr>
nn <Leader>3 :colo Tomorrow-Night<cr>
" misc {{{1
if v:version < 703 " even debian stable has 7.3, so...
set nomodeline
else
if &termencoding == "utf-8"
set list listchars=tab:»·,trail,extends:…,nbsp:‗
else
set list listchars=tab:>-,trail:.,extends:>,nbsp:_
endif
endif
" including this in case i'm on a _really_ bad terminal:
"set list listchars=tab:>-,trail:.,extends:>,nbsp:_
try | execute pathogen#infect() | catch /E117/ | endtry

View file

@ -1,7 +1,7 @@
" Tomorrow Night - Full Colour and 256 Colour
" http://chriskempson.com
"
" Hex colour conversion functions borrowed from the theme "Desert256""
" Hex colour conversion functions were stripped out in favor of csapprox
" Default GUI Colours
let s:foreground = "c5c8c6"
@ -31,212 +31,11 @@ syntax reset
let g:colors_name = "Tomorrow-Night"
if has("gui_running") || &t_Co == 88 || &t_Co == 256
" Returns an approximate grey index for the given grey level
fun <SID>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 <SID>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 <SID>grey_colour(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 colour index for the given colour level
fun <SID>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 colour level for the given colour index
fun <SID>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 colour indices
fun <SID>rgb_colour(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 colour levels
fun <SID>colour(r, g, b)
" Get the closest grey
let l:gx = <SID>grey_number(a:r)
let l:gy = <SID>grey_number(a:g)
let l:gz = <SID>grey_number(a:b)
" Get the closest colour
let l:x = <SID>rgb_number(a:r)
let l:y = <SID>rgb_number(a:g)
let l:z = <SID>rgb_number(a:b)
if l:gx == l:gy && l:gy == l:gz
" There are two possibilities
let l:dgr = <SID>grey_level(l:gx) - a:r
let l:dgg = <SID>grey_level(l:gy) - a:g
let l:dgb = <SID>grey_level(l:gz) - a:b
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
let l:dr = <SID>rgb_level(l:gx) - a:r
let l:dg = <SID>rgb_level(l:gy) - a:g
let l:db = <SID>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 <SID>grey_colour(l:gx)
else
" Use the colour
return <SID>rgb_colour(l:x, l:y, l:z)
endif
else
" Only one possibility
return <SID>rgb_colour(l:x, l:y, l:z)
endif
endfun
" Returns the palette index to approximate the 'rrggbb' hex string
fun <SID>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 <SID>colour(l:r, l:g, l:b)
endfun
" Sets the highlighting for the given group
fun <SID>X(group, fg, bg, attr)
if a:fg != ""
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
endif
if a:bg != ""
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
endif
if a:attr != ""
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
endif
if a:fg != "" | exec "hi " . a:group . " guifg=#" . a:fg | endif
if a:bg != "" | exec "hi " . a:group . " guibg=#" . a:bg | endif
if a:attr != "" | exec "hi " . a:group . " gui=" . a:attr | endif
endfun
" Vim Highlighting
@ -484,14 +283,5 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
" Delete Functions
delf <SID>X
delf <SID>rgb
delf <SID>colour
delf <SID>rgb_colour
delf <SID>rgb_level
delf <SID>rgb_number
delf <SID>grey_colour
delf <SID>grey_level
delf <SID>grey_number
endif
set background=dark