Syntax highlighting in VIM on a remote RaspberryPi


Categories: ,

To VIM or not to VIM. The decades old text editor inspires avid devotion or utter hatred. I fell into the latter camp.

However, now that I’m experimenting with the Raspberry Pi for some hardware projects, it’s obvious I need something with more features than the nano editor. VIM pretty universal, will run in a terminal, or a non-GUI linux, and is undeniably fast editing once the steep learning curve is overcome.

So here are some of notes on VIM - particularly,setting up syntax highlighting with a nice colour scheme - a first step in making VIM palatable to my GUI insticts.

Colour Schemes

If I’d spent half the time learning VIM as I’d spent trying to customise the colours, I’d be a VIM Jedi already.

Good Schemes

I particularly like solarized

On Windows (Putty)

If you want any chance of getting the genuine Solarized colors working in VIM through Putty, the colours in Putty must be changed.

The easiest way to do this is with this reg file which sets up some sensible defaults for Putty, including the solarized dark colours

You will need to recreate any existing sessions to get the new defaults

On The Raspberry Pi

Connect and login using Putty. Your shell session will already have the new colour scheme

sudo apt-get install vim
cd ~
mkdir .vim
cd .vim
mkdir colors
:e $HOME/.vimrc
i     (insert mode)
syntax enable
set background=dark
colorscheme solarized
:wq!      (save and close)

Now to add my VIM config to source control, we copy it to the .vim folder and symlink it first

cd ~
mv .vimrc .vim/.vimrc
ln -s .vim/.vimrc .vimrc
cd .vim
git init
ls -la         (shows hidden files)

Configure GIT
git config --global "your full name"
git config --local "your full name"
git config --global "your email id"
git config --local "your email id"
git config -l

still in the ~/.vim folder…

git add .
git commit -m "Initial commit of my vim configuration"
git remote add origin

//had to do a git pull first
git pull
git push origin master


My VIMconfiguration is now on github.

To install my Vim Config onto a new server…

cd ~
git clone .vim
ln -s .vim/.vimrc .vimrc