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?
Asked
Active
Viewed 9,775 times
9
2 Answers
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...
Martin Tournoij
- 62,054
- 25
- 192
- 271
-
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 Oct 18 '16 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.
christok
- 31
- 2
-
1Welcome to [vi.se]! It looks like this is something you're configuring outside of vim? – D. Ben Knoble Dec 29 '20 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 Dec 29 '20 at 23:00