i make things

February 20, 2014February 21, 2014

Gvim with Powerline on Windows 8 64bit (BONUS: vim inside Cygwin)

I love Powerline. Unfortunately, setting up just about any linux-centric software on windows is an everloving pain in the ass. Powerline is no different, and there don’t seem to be any start-to-finish this-is-what-worked Windows guides. Here’s mine.

First up, install Python. I used the Python guide exactly to set up 2.7, set the path, then install easy-install and pip.

With that out of the way, you should be able to install Powerline with pip:

Shell

1

pip install--user git+git://github.com/Lokaltog/powerline

You’ll need an appropriately-patched font for Powerline to look right. Take your pick from https://github.com/Lokaltog/powerline-fonts – download the .otf of your choice, then right-click it and click “install” to install it in Windows.

At this point, you can go ahead and download vim73-x64.zip from https://code.google.com/p/vim-win3264/downloads/list. Extract this and copy everything into C:\Program Files\vim73-x64. From C:\Program Files\vim73-x64\vim73, right-click ‘install.exe’ and ‘Run as Administrator’. This will create some useful batch files and whatnot so you can “gvim myfile” from the normal windows command prompt.

The final piece of the puzzle is activating everything in vim. Here’s my C:\Users\Alex Whittemore\_vimrc contents:

Vim

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

"My preferences

syntaxon

setshiftwidth=4

setautoindent

setexpandtab

settabstop=4

setsofttabstop=4

setnumber

setbackspace=indent,eol,start

setnowritebackup

setnobackup

setnoswapfile

syntaxenable

ifhas('gui_running')

setbackground=light

sett_Co=16

"let g:solarized_termcolors=16

"colorscheme solarized

endif

setlaststatus=2

"Strictly necessary for Powerline

setencoding=utf-8

"Set to whatever font you like.

setguifont=Inconsolata\for\Powerline:h12

python from powerline.vim import setup as powerline_setup

python powerline_setup()

python del powerline_setup

NOTE: Change the font line to be appropriate for whatever you downloaded and installed earlier.

UPDATE: I got sick of not having powerline on the commandline vim inside cygwin. Here’s what I did to fix that:

Make sure you have python installed in Cygwin, and that vim knows it. I luckily already did: inside vim, :python import sys; print(sys.version) reveals I have python 2.7.5. Good enough.

easy_install pip, then

1

pip install git+git://github.com/Lokaltog/powerline

though for some reason this would simply NOT install to where I thought it would! My python path was all messed up, so

to your cygwin .bashrc. Assuming pip installed powerline here as was the case for me, this will sort out the powerline module presence in vim. Note: change YOURUSERHERE so that the path is correct on your system.

You’ll need to set your ~/.vimrc, which is not the same as your windows home dir/_vimrc from before. Copy the contents over, or wait for the last step below.

At this point, you should have a functional, but broken-looking powerbar in your cygwin terminal vim. Next step, font: change the cygwin terminal font to an appropriately patched one: right-click the cygwin logo, options>text>select. I just changed it to Inconsolata here as well, because I like it, but you could get a patched lucida console or whatnot as well so your terminal font doesn’t change outside of vim.

FINALLY: the colors are broken. Easy. Make sure your .vimrc contains the last line in my full .vimrc below:

I’m pretty late to this party, but did you get it sorted out? I don’t really have any experience with Cygwin, but I’m guessing it’s a question of environment – you’re installing things in the windows environment, but launching vim from Cygwin. From cygwin, you should be able to ‘pip list’ and find the requirements you installed, namely ‘powerline’