Tip #341: switch color schemes
tip karma |
Rating 10/4, Viewed by 2854
|
created: |
|
October 11, 2002 12:46 |
|
complexity: |
|
intermediate |
author: |
|
andreas berg |
|
as of Vim: |
|
6.0 |
This function is similar to the vimtip #211. I did not recognize that s.o.
already wrote a function for that, but this one has one advantage:
It just takes all possible colorschemes in the given directorys and rotates
them. Just put the following code in your .vimrc file:
let SwitchSchemesFiles = globpath("$VIMRUNTIME,$HOME/.vim","colors/*.vim")
let SwitchSchemesIndex = 0
function! SwitchSchemes()
let sep="\n"
if g:SwitchSchemesIndex == -1
let g:SwitchSchemesIndex=0
endif
exe "source " . NextElement(g:SwitchSchemesFiles, sep, g:SwitchSchemesIndex)
let g:SwitchSchemesIndex = NextIndex(g:SwitchSchemesFiles, sep, g:SwitchSchemesIndex + 1)
endfunction
In addition you need the https://www.vim8.org/script.php?script_id=109
Put it in the plugin directory.
If you use e.g. a map to F12, you can easily switch between all
installed themes:
map <f12> :call SwitchSchemes()<CR>
<<Visual Select And Search |
Remap <ESC> >>
Additional Notes
|