Cycle easily through custom schemes ...

352 views
Skip to first unread message

Kiffin Gish

unread,
Apr 19, 2009, 2:00:01 PM4/19/09
to vim...@googlegroups.com
What's the quickest way to cycle through all the color schemes to help
me choose the one I like best?

-
Kiffin Gish <Kiffi...@planet.nl>
Gouda, The Netherlands

Dennis Benzinger

unread,
Apr 19, 2009, 2:14:44 PM4/19/09
to vim...@googlegroups.com
Am 19.04.2009 20:00, Kiffin Gish schrieb:
> What's the quickest way to cycle through all the color schemes to help
> me choose the one I like best?
> [...]

Execute the following line in every colorscheme directory (~/.vim/colors
and $VIMRUNTIME/colors). Replace xyz with the file you want to view.

for f in *.vim; do gview -c ":colorscheme `basename $f .vim`" xyz; done


HTH,
Dennis Benzinger

Kiffin Gish

unread,
Apr 19, 2009, 2:25:03 PM4/19/09
to vim...@googlegroups.com
Elegant scripting! However, I was hoping more for some kind of hot key
from within vim that I could hit in series viewing the color schemes
quickly.

-
Kiffin Gish <Kiffi...@planet.nl>
Gouda, The Netherlands



Kiffin Gish

unread,
Apr 19, 2009, 2:33:02 PM4/19/09
to vim...@googlegroups.com
Okay, say I've decided which one I like best how can I find out which
colorscheme that window is?
-
Kiffin Gish <Kiffi...@planet.nl>
Gouda, The Netherlands



On Sun, 2009-04-19 at 20:14 +0200, Dennis Benzinger wrote:

_sc_

unread,
Apr 19, 2009, 2:49:38 PM4/19/09
to vim...@googlegroups.com
On Sunday 19 April 2009 1:25 pm, Kiffin Gish wrote:
>
> Elegant scripting! However, I was hoping more for some kind of hot key
> from within vim that I could hit in series viewing the color schemes
> quickly.

i got this from this very list, and i *think* it is enshrined
somewhere as a tip:

nnoremap <Leader>n :call Step_color()<CR>
nnoremap <Leader>ns :source ~/.vim/colorstepper.vim<CR>
nnoremap <Leader>o :echo g:colors_name<CR>
nnoremap <Leader>p :call Step_color_back()<CR>

<colorstepper.vim>
" colorstepper changes colorscheme to the "next" color
" saves position in global variable
" re-obtains list of schemes every time, so new colors will
" be automatically added
"
" extra credit will be awarded to the student who can tell
" me why the echo of colors_name works sometimes and sometimes
" doesn't
"
" interestingly it now seems to have stopped working entirely
"
function! Step_color()
let mycolors = split(globpath(&rtp,"colors/*.vim"),"\n")
if exists("g:color_step")
let g:color_step += 1
if g:color_step > len(mycolors) - 1
let g:color_step = 0
endif
else
let g:color_step = 0
endif
silent exe 'so ' . mycolors[g:color_step]
echo g:colors_name "\n"
unlet mycolors
endfunction

function! Step_color_back()
let mycolors = split(globpath(&rtp,"colors/*.vim"),"\n")
if exists("g:color_step")
let g:color_step -= 1
if g:color_step < 0
let g:color_step = len(mycolors) - 1
endif
else
let g:color_step = 5
endif
silent exe 'so ' . mycolors[g:color_step]
echo g:colors_name
unlet mycolors
endfunction

"nmap <F6> :call Step_color()<CR> <Bar> :echo g:colors_name<CR>
"nmap <F7> :echo g:colors_name<CR>
"nmap <S-F6> :call Step_color_back()<CR> <Bar> :echo g:colors_name<CR>

</colorstepper.vim>

by adding a '\n' to the echo in Step_color i am able to see the
name, but that's a hack and causes me to have to hit enter before i
can see the new colorscheme in the whole window, so if you fix that
feel free to share

anyway, this is a fun script to play around with

enjoy

sc

Kiffin Gish

unread,
Apr 19, 2009, 3:09:00 PM4/19/09
to vim...@googlegroups.com
Great stuff! Thanks.
-
Kiffin Gish <Kiffi...@planet.nl>
Gouda, The Netherlands



Dennis Benzinger

unread,
Apr 19, 2009, 3:11:37 PM4/19/09
to vim...@googlegroups.com
Am 19.04.2009 20:33, Kiffin Gish schrieb:
> Okay, say I've decided which one I like best how can I find out which
> colorscheme that window is?
> [...]

Use :echo g:colors_name


Dennis Benzinger

John Beckett

unread,
Apr 19, 2009, 7:32:35 PM4/19/09
to vim...@googlegroups.com
Kiffin Gish wrote:
> What's the quickest way to cycle through all the color
> schemes to help me choose the one I like best?

Here is a good script:
http://vim.wikia.com/wiki/Switch_color_schemes

John

Tony Mechelynck

unread,
Apr 20, 2009, 3:07:53 AM4/20/09
to vim...@googlegroups.com
On 19/04/09 20:00, Kiffin Gish wrote:
>
> What's the quickest way to cycle through all the color schemes to help
> me choose the one I like best?

In gvim, use the "Edit => Color Scheme" menu, where every installed
colorscheme has a submenu.

In Console Vim, either use the other solutions proposed, or the
following (if compiled with +menu):

:set wildmenu
:runtime menu.vim
:emenu Edit.Color\ Scheme.<Tab>

Select by <Left> <Right>, accept by <Enter>, abort by <Cancel>.
You can enter part of the name and hit <Tab> again to go faster to a
given part of the menu.

To try a second, third, etc., colorscheme, repeat only the :emenu command.

You can also reach the submenu by command-line completion (in 'wildmenu'
mode, <Down> will descend into a submenu).

If you want to remap the emenu command to a key, see ":help 'wildcharm'".


Best regards,
Tony.
--
Impossible, adj.:
(1) I wouldn't like it and when it happens I won't approve;
(2) I can't be bothered; (3) God can't be bothered. Meaning (3) may
perhaps be valid but the others are 101% whaledreck.
-- Chad C. Mulligan, "The Hipcrime Vocab"

Yakov

unread,
Apr 30, 2009, 2:37:18 PM4/30/09
to vim_use
http://www.vim.org/scripts/script.php?script_id=1488
ScrollColors : Colorsheme Scroller, Chooser, and Browser

SHORT USAGE DESCRIPTION:
Drop ScrollColors.vim into your plugin directory.
Type :SCROLL
Use arrow keys to walk through colorschemes, ? for help, Esc to
exit.

DETAILED DESCRIPTION:
1. source ScrollColors.vim " or drop ScrollColors.vim into
" your ~/.vim/plugins directory
2. Type :SCROLL
Another synonym is :COLOR
3. Use arrows to scroll thgough colorschemes.
4. When done, press Esc to exit. You will be prompted
wether to

You can download 140 colorschemes pack from:
http://www.vim.org/scripts/script.php?script_id=625
Having 140 installed colorschemes is in no way prerequisite for
ScrollColors. But with ScrollColors you can preview 140 colorschemes
in couple of minutes. Have fun.

CUSTOM KEY MAPPINGS:
You can map two keys of your choice to NextColor and PrevColor
actions.
Choose pair of shortcut keys (for example <F2> and <f3>, or \n and
\p)
and map them as follows:
map <silent><F3> :NEXTCOLOR<cr>
map <silent><F2> :PREVCOLOR<cr>

Vera, Pedro L.

unread,
Apr 30, 2009, 6:10:38 PM4/30/09
to vim...@googlegroups.com

Thanks for the tip. The scroll plugin works really well. However, I'm having problem with the added schemes. I unzipped the files as the webpage suggested, but when I run vim I get the following error:

Error detected while processing /usr/share/vim/vim72/syntax/synload.vim:
line 19:
E185: Cannot find color scheme martin_krischik
Press ENTER or type command to continue


Only the original 17 schemes show up. Is this because I'm running vim in linux using a rox-term? I did set my vimrc to display 256 colors.

thanks for the help.

Pedro
________________________________________
From: vim...@googlegroups.com [vim...@googlegroups.com] On Behalf Of Yakov [ile...@gmail.com]
Sent: Thursday, April 30, 2009 2:37 PM
To: vim_use
Subject: Re: Cycle easily through custom schemes ...

Matt Wozniski

unread,
Apr 30, 2009, 6:47:52 PM4/30/09
to vim...@googlegroups.com
On Thu, Apr 30, 2009 at 6:10 PM, Vera, Pedro L. wrote:
>
>
> Thanks for the tip. The scroll plugin works really well. However, I'm
> having problem with the added schemes. I unzipped the files as the
> webpage suggested, but when I run vim I get the following error:
>
> Error detected while processing /usr/share/vim/vim72/syntax/synload.vim:
> line 19:
> E185: Cannot find color scheme martin_krischik
> Press ENTER or type command to continue

This is what would happen if you load a colorscheme that isn't named
"martin_krischik.vim", but that had the line

let g:colors_name = "martin_krischik.vim"

in it.

> Only the original 17 schemes show up. Is this because I'm running vim
> in linux using a rox-term? I did set my vimrc to display 256 colors.

Not sure about this problem, though.

> thanks for the help.
>
> Pedro

<snip bottom context>

> From: vim...@googlegroups.com [x...@xxx.xxx] On Behalf Of Yakov [x...@xxx.xxx]
> Sent: Thursday, April 30, 2009 2:37 PM
> To: vim_use
> Subject: Re: Cycle easily through custom schemes ...

In the future, please put your messages directly below the quotes that
you're referencing. Bottom posting is the established convention on
this mailing list.

~Matt

Vera, Pedro L.

unread,
Apr 30, 2009, 7:30:52 PM4/30/09
to vim...@googlegroups.com
Matt:

>> Only the original 17 schemes show up. Is this because I'm running vim
> >in linux using a rox-term? I did set my vimrc to display 256 colors.

>Not sure about this problem, though.

Thanks for your help. I fixed the problem by unzipping at a different level of the directory, rather than at individual subdirectories. The plugin works fine now and I can see all the schemes.

Pedro

Reply all
Reply to author
Forward
0 new messages