how to set different color schemes for GVIM & console VIM

4,016 views
Skip to first unread message

Hua Yanghao

unread,
Nov 25, 2008, 3:08:01 AM11/25/08
to v...@vim.org
Hello,

The same color scheme for GUI vim & console vim looks quite different, and I found different color scheme best suited for each of them. Is it possible to set different color scheme for GUI and Console VIM?

--
Thanks & Best Regards,
Hua Yanghao

John Beckett

unread,
Nov 25, 2008, 4:19:54 AM11/25/08
to vim...@googlegroups.com
Hua Yanghao wrote:
> The same color scheme for GUI vim & console vim looks quite
> different, and I found different color scheme best suited for
> each of them. Is it possible to set different color scheme
> for GUI and Console VIM?

In your vimrc, you can put code like the following:

if has('gui_running')
set guioptions-=T " no toolbar
colorscheme elflord
hi Todo guifg=#40ffff guibg=#606060
set lines=50 columns=96 linespace=0
else
" something for console Vim
endif

John

A. S. Budden

unread,
Nov 25, 2008, 4:21:26 AM11/25/08
to vim...@googlegroups.com
2008/11/25 Hua Yanghao <huaya...@gmail.com>:

> Hello,
>
> The same color scheme for GUI vim & console vim looks quite different, and I
> found different color scheme best suited for each of them. Is it possible to
> set different color scheme for GUI and Console VIM?

Just put a different colorscheme line in .vimrc and .gvimrc.
Alternatively, you can do if has("gui_running") in .vimrc, but this
will cause problems if you are ever in console vim and enter :gui
(assuming your console vim has GUI support).

Al

Swaroop

unread,
Nov 25, 2008, 4:12:19 AM11/25/08
to vim_use
if has('gui_running')
colorscheme delek
else
colorscheme darkblue
endif

Regards,
Swaroop

Matt Wozniski

unread,
Nov 25, 2008, 2:04:10 PM11/25/08
to vim...@googlegroups.com
On Tue, Nov 25, 2008 at 4:21 AM, A. S. Budden wrote:
>
> 2008/11/25 Hua Yanghao:

Or check out CSApprox - it tries to make gvim-only colorschemes look
right in 88- and 256-color terminals.

http://www.vim.org/scripts/script.php?script_id=2390

~Matt

PS. If you want to try it but have any problems setting it up, feel
free to ask me about it. :)

Tony Mechelynck

unread,
Nov 26, 2008, 7:30:37 AM11/26/08
to vim...@googlegroups.com, v...@vim.org

Sure:
- set your console-mode colorscheme in your vimrc
- set your GUI-mode colorscheme in your gvimrc if you have one,
otherwise in an autocommand for the GUIEnter event. You may want to
bracket that autocommand with "if has('gui')" to avoid errors in
Console-only Vim versions (where the GUIEnter event isn't defined).

That way, the GUI-mode colorscheme will be set only when starting the
GUI, and after your vimrc has been read and is over and done with. IOW,
the console-mode colorscheme will be the only one set in console mode,
and the GUI-mode colorscheme will be the last one set in GUI mode.


Best regards,
Tony.
--
A language that doesn't have everything is actually easier to program
in than some that do.
-- Dennis M. Ritchie

Tony Mechelynck

unread,
Nov 26, 2008, 7:30:37 AM11/26/08
to vim...@googlegroups.com, v...@vim.org
On 25/11/08 09:08, Hua Yanghao wrote:

Sure:

Reply all
Reply to author
Forward
0 new messages