About     Projects     GitHub     Now     Else

Configuring Vim for Use in the Terminal

GVim is great for a local machine, but sometimes it isn’t possible to use when working on a remote server. Never fear, with the right configuration, Vim can look just as great even when it is running in terminal mode.

candy_man

Configuration

When I’m using GVim, I prefer to use the solarized theme, but that colorscheme really does not work well in terminal mode. In order to get the right colorscheme, we need to set the configuration so that a different theme appears when Vim is not running in GUI mode.

Here is the snipit from my .vimrc that does what we want:

if has('gui_running')
    " GUI colors

    set background=dark 
    colorscheme solarized
else
    " Non-GUI (terminal) colors

    set t_Co=256
    colorscheme spacegray 
endif

The colorscheme that I really wanted to use in terminal mode was candyman, but I found its terminal colorscheme lacking. I ended up creating a custom theme to resemble candyman based on the spacegray terminal theme.