Install powerline on OSX mountain lion
If you're a vim fan like then you've probably seen and admire the beautiful and super useful powerline:
Getting it to work is very simple, these are a set of instructions to get it to work in OS X mountain lion
with homebrew
but feel free to try this with your favorite package management system:
First off if you have installed python
from homebrew
as of this writing it will not work and you'll have to use you mac's copy of python
so for now just do:
brew unlink python
brew unlink macvim
This will unlink python
for now and install macvim
with your OS X
interpreter.
If you wan't powerline
to work with vim console you'll need to tap hombrew/dupes
and install vim with the interpreter you'd like to support:
brew install python
brew tap hombre/dupes
Once we've take this out of the way is time to install powerline
:
easy_install pip
pip install --user git+git://github.com/Lokaltog/powerline
brew install vim --with-python --with-ruby --with-perl
brew install macvim --env-std --override-system-vim
Then update your vim
config files to include powerline
I use my own set of dotfiles that allow me to create files like .vimrc.before
, .vimrc.after
, gvimrc.before
and .gvimrc.after
feel free to check it out:
Anyways in .vimrc.before
or .vimrc
just add:
python from powerline.ext.vim import source_plugin; source_plugin()
This should be enough for you to see powerline
in vim
, but as you might have noticed powerline
doesn't look that great, that's because your current font is not patch to support powerline
but we can fix that real quick:
Note: Look for pre-patched fonts in this repository
brew install fontforge
wget https://github.com/Lokaltog/powerline-fonts/raw/master/SourceCodePro/Source%20Code%20Pro%20for%20Powerline.otf
fontforge -script Source+Code+Pro+for+Powerline.otf /Library/Fonts/SourceCodePro-Regular.ttf
Now that you have patched font you can add this to your .gvimrc.before
or .gvimrc
:
set guifont=Source\ Code\ Pro\ for\ Powerline:h14
The h14
is the height I use 14 but you can adjust it to whatever goes easier on your eyes.
Open a file on vim
or mvim
and powerline
will now work and look pretty, so lets wrap this up:
brew link python # you can relink python now
echo "export PATH=${PATH}:/usr/local/share/python" >> ~/.bash_profile.after # or .bash_profile if you're not using my dotfiles
Lastly if you want the newly patch font to work on vim
terminal make sure to change your terminal font to your newly patched font and that's it.
A very lengthy protip but a task easy to accomplish.
Related protips:
Written by Enrique Vidal
Related protips
6 Responses
Thanks for these instructions! Just to note the dupes repo has changed to: https://github.com/homebrew/homebrew-dupes
python from powerline.ext.vim import sourceplugin; sourceplugin() didn't work for me :/
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ext.vim
python from powerline.ext.vim import sourceplugin; sourceplugin() didn't work for me :
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ext.vim
Press ENTER or type command to continue
Please Help!
"as of this writing" doesn't help if the article is not dated.
Hi everybody, sorry for the lack of communication, it's been ages since I logged into my coderwall account, I have updated this protip with current information, let me know how this work for you or if I can help in anyway.
More up-to-date information is available in powerline's documentation: http://powerline.readthedocs.org/en/latest/overview.html#installation.
Make sure to read both "Installation on OS X" and "Usage" sections