Bio photo

Dan Nixon

Code Monkey, Electronics Engineer, Mad Scientist.

Setting up Vim on Windows

By Dan Nixon on 2016-07-16

For a while now I've wanted to have Vim setup on Windows identical to how I have it under Linux, however I've never really got round to doing it since it has always proven to be more of a pain than it is worth. However since I'm starting to do more development on Windows now it has become more worthwhile.

So this is what ended up working for me, a lot of existing instructions don't seem to account for the fact that you may be using an existing configuration. This was derived from the following sources:


  1. Install Git and Curl as per the instructions here
  2. Install Vim
  3. Install ConEmu
  4. Symlink existing configurations to the home directory, typically this includes the .vim directory and _vimrc file
  5. Clone Vundle using the command git clone .vim/bundle/vundle.git
  6. Modify configs (see below)
  7. Install plugins using :BundleInstall

I'm using ConEmu as the terminal as it support 256 colours which is required for the theme I use.

Config modifications

There were a few small tweaks I had to do to get my existing config working correctly.

(the full set of modifications that I made to my configs is in this commit).

I had a line that set the default shell, as on Linux I typically use the Fish shell which has been known to give me problems in the past. This may not actually be the case anymore, however the easy fix was to just surround it with an OS check:

if !has("win32")
    set shell=bash

A similar thing was required for the colour scheme setup (as per the instructions here):

if has("win32")
    set term=xterm
    set t_Co=256
    let &t_AB="\e[48;5;%dm"
    let &t_AF="\e[38;5;%dm"
    colorscheme zenburn
    set t_Co=256
    colorscheme distinguished

My preferred colour scheme did not seem to work even with the additional settings in the _vimrc, however I quite like the zenburn theme so am happy to use this on Windows for now.

The final annoyance was that the backspace key did not function as intended and the fix as described here did not solve the issue. I eventually fixed this with a snippet from the Vim wiki:

if has("win32")
    func ConEmuBackspace()
        if col('.') == 1
            if line('.')  != 1
                return  "\<ESC>kA\<Del>"
                return ""
            return "\<Left>\<Del>"

    inoremap <Char-0x07F> <c-r>=ConEmuBackspace()<CR>
    nnoremap <Char-0x07F> <c-r>=ConEmuBackspace()<CR>