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:
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:
"My preferences syntax on set shiftwidth=4 set autoindent set expandtab set tabstop=4 set softtabstop=4 set number set backspace=indent,eol,start set nowritebackup set nobackup set noswapfile syntax enable if has('gui_running') set background=light set t_Co=16 "let g:solarized_termcolors=16 "colorscheme solarized endif set laststatus=2 "Strictly necessary for Powerline set encoding=utf-8 "Set to whatever font you like. set guifont=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
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
- add
export PYTHONPATH=/cygdrive/c/Users/YOURUSERHERE/AppData/Roaming/Python/Python27/site-packages/
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:
"My preferences syntax on set shiftwidth=4 set autoindent set expandtab set tabstop=4 set softtabstop=4 set number set backspace=indent,eol,start set nowritebackup set nobackup set noswapfile syntax enable if has('gui_running') set background=light set t_Co=16 "let g:solarized_termcolors=16 "colorscheme solarized endif set laststatus=2 "Strictly necessary for Powerline set encoding=utf-8 "Set to whatever font you like. set guifont=Inconsolata\ for\ Powerline:h12 python from powerline.vim import setup as powerline_setup python powerline_setup() python del powerline_setup "Important for terminal vim to work in cygwin. set term=xterm-256color
Happy VIMing!
I’d like to get Powerline in my Cygwin Vim terminal window, but no joy.
I followed all the steps, got no errors, but no Powerline in Vim.
Not sure how to troubleshoot this – it’s quite a bit to handle for a noob.
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’