9

I installed ttf-font-awesome in Arch Linux; if I open up a file which contains icons from Font awesome it recognizes the file as utf-8 but the icons are displayed as squares. Does anyone know how to fix this?

2 Answers 2

9

First off, Vim can only display a file in a single font, you can't use multiple fonts at the same time.

For gVim, you can use guifont to set this to Font Awesome:

set guifont=Font\ Awesome\ 14

Which seems to work fine.

For Terminal Vim, you will need to configure your terminal emulator to use Font Awesome.

For xterm, this doesn't seem to work, for gnome-terminal, it does... Other terminal emulators may or may not work...

1
  • Vim (as opposed to gVim) will use the terminal emulator’s font handling, so depending on your terminal emulator, you might be able to use multiple fonts at the same time. For example. urxvt (a.k.a. rxvt-unicode) does allow configuring a comma-separated list of fonts, but that is outside the scope of Vi/Vim (or, I have discovered a truly marvelous configuration of this, which this comment box is too narrow to contain :) ).
    – Lithis
    Commented Oct 18, 2016 at 21:18
3

Console Vim is using the font from the console terminal.

You can use Inconsolata Nerd Font, which includes FontAwesome glyphs.

For example, in urxvt including the following:

URxvt.font: xft:SF Mono:size=12,xft:Inconsolata Nerd Font Mono:size=11 
URxvt.letterSpace: -1 

More on Font Awesome's github from this closed issue.

2
  • 1
    Welcome to Vi and Vim! It looks like this is something you're configuring outside of vim?
    – D. Ben Knoble
    Commented Dec 29, 2020 at 19:40
  • Since console Vim is using the fonts from the terminal, enabling these fonts in whatever terminal (in this case, urxvt) will populate vim.
    – christok
    Commented Dec 29, 2020 at 23:00

Your Answer

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

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