I installed the powerline patched fonts by following the wiki at https://powerline.readthedocs.io/en/master/installation/linux.html#patched-font-installation

I selected the patched font and added:

let g:airline_powerline_fonts = 1

to my .vimrc

But I still see wrong symbols. How can I fix this? enter image description here

  • Is your terminal set to using those fonts? – muru Jan 17 '17 at 6:07
  • I am using gvim. Does that also require the terminal font to be set? – Codename Jan 17 '17 at 9:28

I remember having a similar problem. I never really solved it but worked my way around it by installing the Hack font and by putting the following in my .vimrc:

set guifont=Hack:h10:cANSI

" Airline
let g:airline_powerline_fonts = 1

if !exists('g:airline_symbols')
    let g:airline_symbols = {}

" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'

" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

Some of the unicode characters are not recognized by my browser, but vim will know what to do if you copy paste it.

| improve this answer | |

Looking at the image you commented on Octaviour's answer, I realise it is similar to a problem that I had for setting up vim-airline. Sure, I installed the Powerline fonts, but those weird symbols still appeared.

To fix this, I added the line

export LANG=en_US.UTF-8

at the end of my /etc/profile by editing it as root. I am not really sure as to how this works, but form what I can tell, it sets the encoding on your computer to UTF-8. (And you may want to change the en_US to whatever language you prefer)

| improve this answer | |

Be sure to properly set the guifont variable to the particular powerline font name and size you want to use. Excerpt for your .vimrc:

" use powerline symbols (supported by the hack font family)
let g:airline_powerline_fonts = 1

" set font for GUI vim
if has("gui_running")
    if has("win32")
      set guifont=Hack:h9:cANSI:qDRAFT
      set guifont=Hack\ 11

I was facing the same problem with gvim on debian with gnome and only solved it after using the "Select Font..." dialog from within gvim.

That is how I discovered that the guifont variable setting for gvim on debian is different from Windows. This is also mentioned at http://vim.wikia.com/wiki/Change_font.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.