6

I am using vim-airline to show status line at the bottom in vim editor.

Below is my .vimrc.local file.

enter image description here

and here is how my status line looks like.

enter image description here

Why the symbols are not showing properly?

prajmus
  • 3,171
  • 3
  • 31
  • 41
ajm
  • 12,863
  • 58
  • 163
  • 234

4 Answers4

8

Your font does not display all unicode characters but that is not a problem.

You need to install a patched font. Instructions can be found in the official powerline documentation. Prepatched fonts can be found in the powerline-fonts repository.

Otherwise you can change the separator by editing your vimrc, personally I have the following:

" the separator used on the left side
let g:airline_left_sep=''
" the separator used on the right side 
let g:airline_right_sep=''

Yes this is no separator. This render the following (with solarized colors):

airline without separator

maggick
  • 1,362
  • 13
  • 23
  • 1
    I have installed the fonts as mentioned in the documentation. Still its not working. Do I need to do anything else after installing the fonts? – ajm Jun 12 '15 at 15:42
  • As I said I do not use the patched fonts. I have nothing more that the documentation to help you. – maggick Jun 15 '15 at 07:29
  • I installed the `fonts-powerline` package available for Ubuntu, re-started `vim` but still the funny characters are there. – Luís de Sousa May 30 '22 at 07:32
  • Are you using the font? Otherwise you can use a patched font, see https://www.nerdfonts.com/ – maggick Jun 07 '22 at 14:26
4

I am on Kubuntu and this is how I set it up for vim in a terminal as well as gvim.

  1. Install the powerline-fonts from the Github repository mentioned by the maggick user.
  2. Set your terminal font to the "Droid Sans Mono Slashed for Powerline" font.
  3. Start vim in that terminal and go to the help section of airline:

    :help airline
    

Scroll down to the section showing powerline symbols and copy the section:

" powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''

(Don't copy them from here, copy them from your vim help in your terminal)

  1. Open your vimrc.local file and paste the lines there.
  2. Set the font in your gvimrc.local to the same font you selected in the terminal:

    if has('gui_running')
        set guifont=Droid\ Sans\ Mono\ Slashed\ for\ Powerline
    endif
    

Start vim and gvim and the airline should show correct visuals in both cases.

pkout
  • 6,430
  • 2
  • 45
  • 55
  • 1
    Thanks man. You really solve it for me. Only the part "Droid Sans Mono Slashed for Powerline" I change to Droid Sans Mono Slashed for Powerline Regular" then I changed at set guifont=Droid\ Sans\ Mono\ Slashed\ for\ Powerline to set guifont=Droid\ Sans\ Mono\ Slashed\ for\ Powerline \Regular – Apit John Ismail Feb 28 '18 at 04:45
0

I had the same problem and adding:

set encoding=utf-8

to my .vimrc solved the problem. Of course you also need to confirm that terminal should also be configured to display UTF-8.

0

In my case, as reported by various other users, the instructions over at the powerling/fonts repository have no effect whatsoever.

Those symbols must be explicitly set in the .vimrc file, as alluded to by pkout. However, I prefer a set up symbols in a way that better resembles the original Airline graphics. Below is the relevant section.

"Fonts for the Status Line
let g:airline_powerline_fonts = 1

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

"Unicode symbols for the Status Line
let g:airline_left_alt_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_alt_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.readonly = '∥'
let g:airline_symbols.whitespace = 'Ξ'
Luís de Sousa
  • 5,765
  • 11
  • 49
  • 86