当前位置: 首页>>技术教程>>正文


vim-airline 中的字体有问题

, , ,

问题描述

我想安装 vim-airline,但我遇到了 unicode 字体问题。

我用 vundle 安装了它:

.vimrc

set encoding=utf-8
Bundle 'bling/vim-airline'
let g:airline_powerline_fonts = 1
let g:airline_theme='powerlineish'

.fonts

$ ll .fonts
total 376
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 AnonymousPro
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 DejaVuSansMono
-rw-r--r-- 1 xxx xxx 334548 gru 19 13:42 DejaVu Sans Mono for Powerline.ttf
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 DroidSansMono
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 Inconsolata
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 InconsolataDz
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 LiberationMono
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 Meslo
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:42 PowerlineSymbols
-rw-r--r-- 1 xxx xxx   1599 gru 19 13:26 README.rst
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 SourceCodePro
drwxr-xr-x 5 xxx xxx   4096 gru 19 13:26 Terminus
drwxr-xr-x 2 xxx xxx   4096 gru 19 13:26 UbuntuMono


fc-cache -vf ~/.fonts
/home/xxx/.fonts: caching, new cache contents: 1 fonts, 11 dirs
/home/xxx/.fonts/AnonymousPro: caching, new cache contents: 4 fonts, 0 dirs
/home/xxx/.fonts/DejaVuSansMono: caching, new cache contents: 4 fonts, 0 dirs
/home/xxx/.fonts/DroidSansMono: caching, new cache contents: 1 fonts, 0 dirs
/home/xxx/.fonts/Inconsolata: caching, new cache contents: 1 fonts, 0 dirs
/home/xxx/.fonts/InconsolataDz: caching, new cache contents: 1 fonts, 0 dirs
/home/xxx/.fonts/LiberationMono: caching, new cache contents: 4 fonts, 0 dirs
/home/xxx/.fonts/Meslo: caching, new cache contents: 6 fonts, 0 dirs
/home/xxx/.fonts/PowerlineSymbols: caching, new cache contents: 1 fonts, 0 dirs
/home/xxx/.fonts/SourceCodePro: caching, new cache contents: 7 fonts, 0 dirs
/home/xxx/.fonts/Terminus: caching, new cache contents: 0 fonts, 3 dirs
/home/xxx/.fonts/Terminus/BDF: caching, new cache contents: 18 fonts, 0 dirs
/home/xxx/.fonts/Terminus/PCF: caching, new cache contents: 18 fonts, 0 dirs
/home/xxx/.fonts/Terminus/PSF: caching, new cache contents: 0 fonts, 0 dirs
/home/xxx/.fonts/UbuntuMono: caching, new cache contents: 4 fonts, 0 dirs
/var/cache/fontconfig: not cleaning unwritable cache directory
/home/xxx/.cache/fontconfig: cleaning cache directory
/home/xxx/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded

但我仍然有那些符号

我什至尝试将符号插入 .vimrc

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 = ''

但它们是这样插入的:

最佳办法

解决方案是选择我在 Gnome 终端中安装的字体(修复了 Powerline 的字体):

在 gnome-terminal 激活的情况下,单击 “Edit” > “Profile Preferences”

现在 tmux 中的字体可以正常工作了。

电力线工作字体的链接在这里:

https://github.com/Lokaltog/powerline-fonts

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/13581.html,未经允许,请勿转载。