Muffinresearch Labs by Stuart Colville

Vim: Setting the colorscheme Doesn’t Work | Comments (5)

Posted in Linux/Unix on 28th April 2009, 9:29 pm by Stuart

If you’ve found a fancy colorscheme for vim and you want to try it out, once you’ve saved the colorscheme file to ~/.vim/colors you can enable the theme with the following in a vim session’s command mode:

:colorscheme fruity

If you want the colorscheme to be permanent then you can set the name of the theme in your ~/.vimrc file with:

colorscheme fruity

However if this doesn’t work then it’s probably that your terminal doesn’t support enough colors. Fixing the amount of colors the terminal can display is fairly easy by simply exporting the TERM environment variable to use the 256 color xterm. (Sadly this is not possible on OSX’s leopard terminal as it only supports 16 colors though apparently iTerm does have 256 color support)

export TERM=xterm-256color

An alternative to this is to start vim with the terminal switch set to xterm-256color e.g:

vim -T xterm-256color

Once this is done the colorschemes should work just fine.

Simplying the colors used by gvim themes

Another issue that you can hit is when trying to use a gvim (gui version) theme in vim it may specify colors that don’t fit within the range your terminal is capable of displaying. CSApprox is a plugin which converts the colors in gvim themes to the closest color that will work with your term see http://www.vim.org/scripts/script.php?script_id=2390 for more info.

Post Tools

Comments: Add yours

1. On April 29th, 2009 at 11:51 am Bradley Wright said:

You can also fork the display logic in your .vimrc like so:

if has('gui_running')
colorscheme ir_black
else
colorscheme desert
end

2. On April 29th, 2009 at 11:56 am Stuart Colville said:

@Bradley Wright: nice tip

3. On April 29th, 2009 at 1:27 pm Bradley Wright said:

To be clear, “gui_running” is set by GVim, so that clause will never be true in the CLI version.

4. On April 30th, 2009 at 2:47 am Jim Klo said:

Actually, Bradley – gvim is just vim with gui extensions compiled in … the gui_running flag is honored AFAIK for all versions of VIM regardless

5. On May 7th, 2009 at 8:28 am Stuart Colville said:

If you’re finding you don’t have xterm-256color on your machine I found that installation of the ncurses-term package provided it on Hardy for example.







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Using Loggerhead with mod_wsgi|(0)

Here’s a post I wrote over on the Project Fondue Blog about our use of Loggerhead with mod_wsgi under Apache. Loggerhead is the rather nice branch viewer for bazaar branches as used on Launchpad.net.

If you’re not already subscribed to the Project Fondue blog feed then I can recommend it, as there should be some interesting posts coming out of there in the coming months (yes I’m unashamedly biased!).

Ubuntu: Turn off changing workspace with mouse wheel|(1)

I found the changing with the workspace with the mouse wheel really annoying. To disable it go to System => Preferences => CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck “Viewport Switcher” which is under the “Desktop” heading.

Photos on Flickr

© Copyright 2004-10 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.608s.