跳转到主内容

字体

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

Nerd Fonts

Oh My Posh 在设计时就考虑使用 Nerd Fonts。Nerd Fonts 是一类经过补丁处理以包含图标的流行字体。 若要在 Oh My Posh 中显示图标,请安装Nerd Font配置终端使用该字体。

信息

字体需要安装在主机系统上,因为这是一个用户界面设置,而非命令行或 shell 配置。 这意味着在容器或 WSL 中运行时,你需要在主机系统上安装字体,并配置终端模拟器使用该字体。

安装步骤

Oh My Posh has a CLI to help you select and install a Nerd Font:

信息

When running as root/administrator, the fonts will be installed system-wide. When running as a regular user, the fonts will be installed in the user's font directory. By default, Oh My Posh installs the .ttf version of the font in case multiple versions are available.

oh-my-posh font install

This will present a list of Nerd Font libraries, from which you can select Meslo, which includes the Meslo LGM NF font we recommend. Note that you can also install it directly via:

oh-my-posh font install meslo

配置

请务必配置终端以使用你安装的字体。以下部分将介绍如何在最流行的终端中完成此操作。

Once you have installed a Nerd Font, you will need to configure the Windows Terminal to use it. This can be easily done by modifying the Windows Terminal settings (default shortcut: CTRL + SHIFT + ,). In your settings.json file, add the font.face attribute under the defaults attribute in profiles:

{
"profiles":
{
"defaults":
{
"font":
{
"face": "MesloLGM Nerd Font"
}
}
}
}

其他字体

如果你不想使用 Nerd Font,可以选择一个不包含任何 Nerd Font 图标的主题。 minimal 系列主题就不使用 Nerd Font 图标。

创建自定义主题 也是一个选择 😊