yiot4q
Last Updated: January 20, 2018
·
99.09K
· christianrojas

Setup Vim, Powerline and iTerm2 on Mac OS X

alt

Recently I have been looking for ways to work faster, that's why my goal is to reduce the number of applications in my work environment.

The change from a GUI app like Sublime Text to Vim was a horrible experience, that's why i decide to use Powerline and reduce the impact.

This guide will show you how to get vim and powerline up and running in 6 fairly easy steps.

We are going to use Homebrew and Vundler for easy installation purpose.

1. Install dependencies Via Hombrew

Pyton:

brew install python

Vim:

brew install vim --with-python --with-ruby --with-perl

MacVim:

brew install macvim --env-std --override-system-vim

2. Install Powerline via Vundler

Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}

If you want to get more information about the Vundler plug-in manager for Vim check the github repo.

3. Setup Powerline font

One of the more stressful things about setting up powerline is to make it look the way it should. On OSX you have to use prepatched fonts. What I would suggest is to install the font you like via FontBook app that came with Mac OSX system.

you can get the prepatched fonts from powerline-fonts

4. Set .vimrc configuration for Powerline

set guifont=Inconsolata\ for\ Powerline:h15
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8

5. Set configuration for MacVim

You'll need to edit your .vimrc and add the following code for GUI.

if has("gui_running")
   let s:uname = system("uname")
   if s:uname == "Darwin\n"
      set guifont=Inconsolata\ for\ Powerline:h15
   endif
endif

6. iTerm2 setup

Finally It's important to change the non-ASCII font for a prepatched one to get powerline working.

alt

7 Responses
Add your response

15533

thank you very much :)

over 1 year ago ·
15616

great!

over 1 year ago ·
15640

what is color scheme on screenshot in vim?

over 1 year ago ·
15641
over 1 year ago ·
17328

dude thanks...

over 1 year ago ·
17903

This is was really helpful. Missed the iterms font config in all the other setup instructions that I, looked up.

over 1 year ago ·
19848

A tip for anyone reading this comment, powerline was unified, and is no longer under lokaltog, and is now under Powerline/powerline. Aside from swapping out that one Bundle instruction for the new destination, everything else looks good still (as of time of comment.)

over 1 year ago ·