Skip to content

Instantly share code, notes, and snippets.

@dkuku
Last active March 17, 2019 09:48
Show Gist options
  • Save dkuku/d9e61e8363a5e4abcfcf45c359cb0267 to your computer and use it in GitHub Desktop.
Save dkuku/d9e61e8363a5e4abcfcf45c359cb0267 to your computer and use it in GitHub Desktop.
vim quick switch colorscheme
"install the colorschemes you want
call plug#begin('~/.vim/plugged')
Plug 'ErichDonGubler/vim-sublime-monokai' "colorscheme
Plug 'NLKNguyen/papercolor-theme'
call plug#end()
" set all the colorscheme options
let g:sublimemonokai_term_italic = 1
" set the default colorscheme
colorscheme sublimemonokai
" set the colorscheme you want - this can be moved to the function below - but for me this way is more flexible,
" I can change the colorscheme by calling :Dark/:light
" You may want to set the background variable - sublimemonokai sets it programmatically to dark
command DarkTheme colorscheme sublimemonokai
command LightTheme set background=light | colorscheme PaperColor
function ToggleColorTheme()
if &background == "dark"
LightTheme
else
DarkTheme
endif
endfunction
" call the function on button press
nnoremap <leader>c :call ToggleColorTheme()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment