Set up gvimrc to be more portable

* gvimrc can now work with locally installed color schemes
* This requires extending the g:colors list after sourcing it
* Also removed old commented block that would never be used again anyway
This commit is contained in:
Talia 2017-11-07 11:28:31 +01:00
parent a59faeb51b
commit 1e334ac9cb

40
gvimrc
View file

@ -1,33 +1,29 @@
set guioptions-=T
set guioptions-=m
augroup filecolors
autocmd!
" au BufLeave * :colorscheme slate
" au BufEnter *.rb :colorscheme desert
" au BufEnter *.txt :colorscheme morning
" au BufEnter *.vim,.vimrc,_vimrc :colorscheme morning
augroup end
let s:colors=['slate', 'desert', 'blue', 'ron', 'elflord', 'murphy', 'torte']
let g:colors=['slate', 'desert', 'blue', 'ron', 'elflord', 'murphy', 'torte']
function! Randomcolor()
let random = localtime() % len(s:colors)
execute "colorscheme ".s:colors[random]
let random = localtime() % len(g:colors)
execute "colorscheme ".g:colors[random]
endfunction
" Color list can be extended after including (sourcing) this file with
" :let g:colors = extend(['list', 'of', 'color', 'schemes'], g:colors)
" Color Stuff
nnoremap <C-F1> :colorscheme slate<CR>
nnoremap <C-F2> :colorscheme desert<CR>
nnoremap <C-F3> :colorscheme blue<CR>
nnoremap <C-F4> :colorscheme ron<CR>
nnoremap <C-F1> :exe "colorscheme ".g:colors[0 % len(g:colors)]<CR>
nnoremap <C-F2> :exe "colorscheme ".g:colors[1 % len(g:colors)]<CR>
nnoremap <C-F3> :exe "colorscheme ".g:colors[2 % len(g:colors)]<CR>
nnoremap <C-F4> :exe "colorscheme ".g:colors[3 % len(g:colors)]<CR>
nnoremap <C-F5> :colorscheme peachpuff<CR>
nnoremap <C-F6> :colorscheme morning<CR>
nnoremap <C-F7> :colorscheme delek<CR>
nnoremap <C-F8> :colorscheme shine<CR>
nnoremap <C-F5> :exe "colorscheme ".g:colors[4 % len(g:colors)]<CR>
nnoremap <C-F6> :exe "colorscheme ".g:colors[5 % len(g:colors)]<CR>
nnoremap <C-F7> :exe "colorscheme ".g:colors[6 % len(g:colors)]<CR>
nnoremap <C-F8> :exe "colorscheme ".g:colors[7 % len(g:colors)]<CR>
nnoremap <C-F9> :colorscheme elflord<CR>
nnoremap <C-F10> :colorscheme murphy<CR>
nnoremap <C-F11> :colorscheme torte<CR>
nnoremap <C-F9> :exe "colorscheme ".g:colors[8 % len(g:colors)]<CR>
nnoremap <C-F10> :exe "colorscheme ".g:colors[9 % len(g:colors)]<CR>
nnoremap <C-F11> :exe "colorscheme ".g:colors[10 % len(g:colors)]<CR>
nnoremap <C-F12> :call Randomcolor()<CR>
call Randomcolor()