Nerd Fonts is a collection of over 50 patched fonts with a high number of glyphs (icons). These fonts are often used in development environments to enhance the display of icons in terminal applications and code editors. Here’s a cheat sheet with some common tasks related to Nerd Fonts:
Installation
Manual Download and Installation:
- Visit the Nerd Fonts website and download your preferred font.
- Install the downloaded font on your system (font installation instructions can vary based on your operating system).
Using Homebrew (macOS/Linux):
brew tap homebrew/cask-fonts
brew install --cask font-<nerd-font-name>
Replace <nerd-font-name>
with the specific Nerd Font you want to install.
Selecting Nerd Font in Terminal/Editor
Change Font in Terminal:
- Open your terminal settings/preferences.
- Choose the installed Nerd Font from the font options.
Change Font in VSCode:
- Open VSCode settings (
Ctrl + ,
orCmd + ,
). - Search for “Font” settings and set “Editor: Font Family” to the installed Nerd Font.
Using Icons in Code
Inserting Icons in Code:
- Refer to the Nerd Fonts cheat sheet to find the Unicode characters for the icons you want to use.
- Use the Unicode characters in your code.
Using Powerline Themes
Powerline Fonts:
- Some Nerd Fonts include Powerline glyphs for terminal prompt customization.
- Refer to the documentation of your terminal emulator to enable Powerline support and select the Nerd Font.
Customizing Icons in Oh My Zsh
Oh My Zsh Theme:
- If you are using Oh My Zsh, many themes support Nerd Font icons.
- Set the
ZSH_THEME
in your.zshrc
to a theme that supports Nerd Fonts.
Troubleshooting
Glyph Not Showing:
- Ensure that your terminal or editor is configured to use the installed Nerd Font.
- Verify that the icon you are trying to use is supported by the selected Nerd Font.
Uninstallation
Removing Nerd Fonts (Homebrew):
brew uninstall --cask font-<nerd-font-name>
Replace <nerd-font-name>
with the name of the Nerd Font you want to uninstall.
Fonts Included in Nerd Fonts Collection
Popular Fonts:
- FiraCode, Hack, Inconsolata, JetBrains Mono, and many more.
Remember to consult the official documentation of your terminal emulator, code editor, or shell for specific instructions on configuring fonts. The Nerd Fonts GitHub repository is also a valuable resource for additional information and troubleshooting.