Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make color settings look the same in vim as in gvim

Tags:

vim

When I put the following in .vimrc

colorscheme blue

It gives me a nice blue colorscheme in gvim. However, when I use vim, it is light blue instead. Is there a setting I can change so that gvim and vim look the same? If not, then is there a way I can set it up so that my gvim settings do not interfere with my vim settings?

like image 805
neuromancer Avatar asked Dec 05 '09 07:12

neuromancer


3 Answers

As well as John's suggestion of using .gvimrc, there are a couple of other interesting alternatives:

If your command-line vim is compiled with +gui (:echo has("gui"))* and you have a 256 colour capable terminal, you can use the CSApprox plugin to convert the GUI colour scheme into a matching command line one.

If your command-line vim doesn't have +gui, you could try (I haven't used this one) the guicolorscheme plugin. The guicolorscheme plugin parses the colour scheme file, so it isn't as robust as the CSApprox one (it almost certainly won't work with my colour scheme for example.

There's a lot more information on both of those methods here and here.


* Regarding has("gui"):

If you're not interested in +gui, stop reading now!

Personally, I'd recommend this as it simplifies things a bit - you get the opportunity to type :gui if you want to change from terminal to GUI and as you inevitably have +X11 and +xterm_clipboard as well, you can copy to the X clipboards from console vim. If your vim doesn't have +gui, the easiest way to fix it is to create a link in your personal bin directory to the GUI executable:

ln `which gvim` ~/bin/vim

GVim will quite happily work as a console vim if the executable name is vim. A "default" build from the vim source with GUI enabled will create one executable (vim) and lots of links to that executable like gvim, gview, view, vimdiff etc. Most Linux distributions seem to compile them separately though, in order to minimise requirements of the basic Vim (so you can use vim without installing X). As such, I tend to recompile and install in /usr/local with the features I want as I always have X installed (it doesn't have to be running, just installed).

like image 95
DrAl Avatar answered Nov 09 '22 05:11

DrAl


set your vim settings in the .vimrc file, and set the gvim settings in the .gvimrc settings file.

Just pick a different colorscheme in the .gvimrc...

like image 33
John Weldon Avatar answered Nov 09 '22 07:11

John Weldon


If you are using a modern terminal which support 88 or 256 colors(most of them do like gnome-terminal or roxterm(on linux) not sure about Mac or Windows) , you should check out this vim script CSApprox(http://www.vim.org/scripts/script.php?script_id=2390). This scripts make the color schemes made for gvim, work with terminal vim.

like image 27
Mir Nazim Avatar answered Nov 09 '22 07:11

Mir Nazim