3

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

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

3 Answers 3

3

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 = {}
endif

" 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.

4
2

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)

1

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
    else
      set guifont=Hack\ 11
    endif
endif

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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