Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use different color schema between vim and gvim

Tags:

vim

colors

What should I write in my .vimrc file to test whether I am running vim or gvim.

Because the colorscheme I like very much is beautiful in vim, but is ugly in gvim. So I want it that when I am in vim, I use this aforementioned colorscheme, and when I am in gvim, use another colorscheme.

Is there any vimscript code can implement this function?

like image 888
Tanky Woo Avatar asked Mar 23 '12 08:03

Tanky Woo


People also ask

How do I change the color scheme in Gvim?

You can set your preferred color scheme in gvim for MS Windows by editing the file _vimrc in C:\Program Files\Vim or the location where you installed Vim. Save the file and start gvim you will see your color scheme.

How do I change the default theme in Gvim?

In Ubuntu make a file with the name . vimrc in your Home directory if it doesn't exist, add colorscheme pablo in it and save it. Now restart GVim. For Windows put this file with the name _gvimrc in C:/Documents and Settings/<your-username> .

Where do vim color schemes go?

View preinstalled color schemes Some color schemes are already installed on your system. You can find those color schemes in the /usr/share/vim/vim*/colors directory as . vim extension.

How do I change the background color in vim?

The ctermfg=white is used to set the foreground color to white in a terminal text editor. Finally, the ctermbg=black is used to set the background color to black in a terminal text editor.


1 Answers

These two pages have a lot of info on color schemes and how to switch them: http://vim.wikia.com/wiki/Switch_color_schemes http://www.indelible.org/ink/vim-colorschemes/

It also features the issue you have:

if has('gui_running')
    " GUI colors
    colorscheme foo
else
    " Non-GUI (terminal) colors
    colorscheme bar
endif
like image 56
j13r Avatar answered Jan 03 '23 16:01

j13r