Polices
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Nerd Fonts
Oh My Posh a été conçu pour utiliser les Nerd Fonts. Ces polices populaires sont modifiées pour inclure des icônes. Pour afficher correctement les icônes dans Oh My Posh, installez une Nerd Font et configurez votre terminal pour l'utiliser.
Les polices doivent être installées sur le système hôte, car il s'agit d'un paramètre d'interface utilisateur, non d'une configuration de ligne de commande ou de shell. Cela signifie que lors d'une exécution dans un conteneur ou WSL, vous devez installer la police sur le système hôte et configurer votre émulateur de terminal pour l'utiliser.
Installation
- Oh My Posh
- Homebrew
- PowerShell
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
If you're using Homebrew, you can search for and install Nerd Fonts directly:
brew search nerd-font
brew install --cask font-fira-code-nerd-font
If you're using PowerShell, you can use the NerdFonts module to install Nerd Fonts:
Install-PSResource -Name NerdFonts
Import-Module -Name NerdFonts
Install-NerdFont -Name FiraCode # Tab completion works on name
To install for all users, elevated permissions are required:
Install-NerdFont -Name FiraCode -Scope AllUsers
Configuration
Assurez-vous de configurer votre terminal pour utiliser la police que vous avez installée. Les sections suivantes vous montreront comment procéder pour les terminaux les plus populaires.
- Windows Terminal
- Visual Studio Code
- Visual Studio
- Apple Terminal
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"
}
}
}
}
When using Visual Studio Code, you will need to configure the integrated Terminal to make use of the Nerd Font as well. This can be done by changing the Integrated: Font Family value in the Terminal settings (default shortcut: CTRL + , and search for Integrated: Font Family or via Users -> Features -> Terminal).
If you are using the JSON based settings, you will need to update the terminal.integrated.fontFamily value. Example in case of MesloLGM Nerd Font Nerd Font:
"terminal.integrated.fontFamily": "MesloLGM Nerd Font"
When using Visual Studio, you will need to configure the integrated Terminal to make use of the Nerd Font as well. This can be done by opening the settings
in Tools > Options > Environment > Fonts and Colors > Terminal and selecting a font like MesloLGM Nerd Font.
OTF fonts do not appear in Visual Studio's Terminal settings, only TTF fonts. See here for more information.
When using Apple Terminal, you will need to configure the settings based on the profile you are using. This can be done by opening the settings in Profiles > Select the appropriate profile from the left panel > Text > Font and select a font like MesloLGM Nerd Font.
This can also be configured via a terminal command. Example in case of MesloLGM Nerd Font Mono Nerd Font on the Basic profile for Apple Terminal:
osascript -e 'tell application "Terminal" to set font of settings set "Basic" to "MesloLGL Nerd Font Mono"'
The command has only been tested on macOS Sequoia 15.5 24F74.
Autres polices
Si vous ne souhaitez pas utiliser une Nerd Font, choisissez un thème sans icônes Nerd Font.
Les thèmes minimal n'utilisent aucune icône Nerd Font.
Créer votre propre thème est également toujours possible 😊