Vim powerline (Lokaltog's) weird characters in MacVim

13,079

Solution 1

You're referring to two different plugins. vim-powerline is the old vim-only project. Lokaltog/powerline is a new Python-based port, and the code points have changed in this version because the old code points caused a bunch of issues.

You'll have to either:

  1. Update your bundle to point to vim-powerline (and remove the rtp option), or
  2. Update your font to one of the fonts in https://github.com/Lokaltog/powerline-fonts (or patch your own)

Solution 2

I had the same problem. I downloaded "Menlo Regular for Powerline.otf" from https://github.com/Lokaltog/powerline-fonts

I then double clicked on the otf file, which opens up the Font Book application. I clicked install, despite the font giving gibberish symbols in the window. I then set that font as the font for my terminal (simply set it in your termnial preferenes). This fixed the problem in regular terminal vim ($ vim), but did not fix it in MacVim. To fix it in MacVim, I had to add the following line to my .vimrc file:

set guifont=Menlo\ For\ Powerline

The backslashes are necessary to escape the spaces. Everything works great now. Hope this helps others.

Edit: To add a bit more detail, my .vimrc looks like this now:

""" FOR STATUSLINE
set encoding=utf-8 " Necessary to show Unicode glyphs
let g:Powerline_symbols = 'fancy'
set rtp+=/Users/nate/Library/Python/2.7/lib/python/site-packages/powerline/bindings/vim
set nocompatible   " Disable vi-compatibility
set laststatus=2   " Always show the statusline
" For powerline font in MacVim
set guifont=Menlo\ For\ Powerline

Solution 3

If you are using command-line vim (i.e. not a GUI implementation) you may need to specify the patched font in your terminal's preferences.

Solution 4

adding this to the vimrc file fixed it for me:

set guifont=Source\ Code\ Pro\ for\ Powerline "make sure to escape the spaces in the name properly

Source: https://github.com/bling/vim-airline/issues/142

Share:
13,079
Goran Novosel
Author by

Goran Novosel

Updated on July 04, 2022

Comments

  • Goran Novosel
    Goran Novosel almost 2 years

    I'm trying to use Powerline plugin (https://github.com/Lokaltog/vim-powerline) for the first time.

    Plugin seems to be installed. I use vundle with the following command:

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

    I've tried many different settings, but currently in my vimrc it looks like this:

    set guifont=Menlo\ Regular\ for\ Powerline:h15
    "set guifont=Monaco\ Regular:h15
    " set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
    let g:Powerline_symbols = 'fancy'
    "let g:Powerline_symbols = 'compatible'
    "let g:Powerline_cache_enabled = 1
    "set t_Co=256
    

    I've also pasted commented out some of the commands I've tried.

    I've tried different fonts, patched and normal, but nothing helps.

    laststatus is set to 2.

    I'm using MacVim on Mac OS X 10.8.2.

    Here's how the powerline with 2 windows looks for me:

    powerline with 2 windows

    Note the weird boxed 'x' symbols...

    Any ideas?

  • Pablo Gonzalez Portela
    Pablo Gonzalez Portela over 6 years
    Mine was fixed by option #1 , now it looks like this: Plugin 'Lokaltog/vim-powerline'