Skip to content

Instantly share code, notes, and snippets.

@brianjp93
Last active July 8, 2020 21:33
Show Gist options
  • Save brianjp93/bb2fff399b37c3c9272bb10d64df7beb to your computer and use it in GitHub Desktop.
Save brianjp93/bb2fff399b37c3c9272bb10d64df7beb to your computer and use it in GitHub Desktop.
cycle through colorschemes in vim and switch to light theme for specific themes. Bound alt-c to cycle.
let s:mycolors = ['deus', 'gruvbox', 'onedark'] " colorscheme names that we use to set color
function! NextColor()
call s:NextColor()
endfunction
function! s:NextColor()
let current = index(s:mycolors, g:colors_name)
let go_next = 1
if index(['gruvbox'], g:colors_name) >= 0
if &background == 'dark'
let go_next = 0
execute 'set bg=light'
endif
endif
if go_next
execute 'set bg=dark'
execute 'colorscheme ' .s:mycolors[(current+1) % len(s:mycolors)]
endif
endfunction
nnoremap <a-c> :call NextColor()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment