Skip to content

Instantly share code, notes, and snippets.

@mike-clark-8192
Created September 13, 2024 17:12
Show Gist options
  • Save mike-clark-8192/bb9c56062c453fd13227a4fae711e951 to your computer and use it in GitHub Desktop.
Save mike-clark-8192/bb9c56062c453fd13227a4fae711e951 to your computer and use it in GitHub Desktop.
Cycle through Gvim color schemes and display current scheme's name
let g:colors = getcompletion('', 'color')
func! NextColors()
let idx = index(g:colors, g:colors_name)
return (idx + 1 >= len(g:colors) ? g:colors[0] : g:colors[idx + 1])
endfunc
func! PrevColors()
let idx = index(g:colors, g:colors_name)
return (idx - 1 < 0 ? g:colors[-1] : g:colors[idx - 1])
endfunc
nnoremap <silent> <s-a-n> :exe "colo " .. NextColors() \| redraw \| colorsch <CR>
nnoremap <silent> <s-a-p> :exe "colo " .. PrevColors() \| redraw \| colorsch <CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment