forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.vim
40 lines (32 loc) · 789 Bytes
/
theme.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
" Theme
" -----
" Enable 256 color terminal
set t_Co=256
" Enable true color
if has('termguicolors')
set termguicolors
endif
if has('gui_running')
set background=light
set lines=40
set columns=150
endif
function! s:theme_reload(name)
let theme_path = $VIMPATH.'/themes/'.a:name.'.vim'
if filereadable(theme_path)
execute 'source' fnameescape(theme_path)
" Persist theme
call writefile([g:colors_name], s:cache)
endif
endfunction
" THEME NAME
let g:theme_name = 'rafi-2017'
autocmd MyAutoCmd ColorScheme * call s:theme_reload(g:theme_name)
" COLORSCHEME NAME
let s:cache = $VARPATH.'/theme.txt'
if ! exists('g:colors_name')
set background=light
execute 'colorscheme'
\ filereadable(s:cache) ? readfile(s:cache)[0] : 'hybrid'
endif
" vim: set ts=2 sw=2 tw=80 noet :