Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icons don't display in VS code integrated terminal after setting terminal.integrated.fontFamily #671

Closed
JoeNormyl opened this issue Apr 29, 2020 · 111 comments

Comments

@JoeNormyl
Copy link

I recently installed oh-my-zsh and powerlevel10k in iTerm2. I installed the font through p10k config and it looks beautiful!!!

Screen Shot 2020-04-28 at 9 56 09 PM

But when I try to apply the font to my VScode integrated terminal none of the icons display in the prompt.

"terminal.integrated.fontFamily": "MesloLGS NF",

but it makes no difference. I also tried to add the extra set of single quotes:

"terminal.integrated.fontFamily": "'MesloLGS NF'",

No matter what I've tried, nothing seems to fix the issue. After googling exhaustively, I turn to you. Thanks for your help!

@romkatv
Copy link
Owner

romkatv commented Apr 29, 2020

  1. Download these four ttf files:

  2. Double-click on each file and click "Install". This will make MesloLGS NF font available to all applications on your system.

  3. Open Settings in Visual Studio Code.

    • On PC: press Ctrl+, or click File → Preferences → Settings.
    • On Mac: press ⌘ , or click Code → Preferences → Settings.
  4. Enter terminal.integrated.fontFamily in the search box at the top of Settings tab and set the value below to MesloLGS NF.

    Visual Studio Code Integrated Terminal Font Settings

You can find similar instructions for all popular terminals in this document: https://github.com/romkatv/powerlevel10k/blob/master/font.md

@romkatv romkatv closed this as completed Apr 29, 2020
@sortega
Copy link

sortega commented May 6, 2020

@Joey-Provolone, if you fixed it, can you post also here the solution?

@romkatv
Copy link
Owner

romkatv commented May 6, 2020

@sortega The instructions in my previous comment should work: #671 (comment)

@sortega
Copy link

sortega commented May 6, 2020

You are 100% correct

@rahulreghunath
Copy link

rahulreghunath commented Sep 12, 2020

@Joey-Provolone You can simply change terminal from integrated to external to make that work

Screenshot from 2020-09-12 20-37-53

@romkatv
Copy link
Owner

romkatv commented Sep 16, 2020

@Joey-Provolone You can simply change terminal from integrated to external to make that work

That will disable the integrated terminal altogether. Many VS Code users (myself included) like to have a terminal integrated within the IDE.

@steveninouye
Copy link

steveninouye commented Oct 31, 2020

Cmd+Shift+P
Search: Terminal Font
Input: MesloLGS NF

image

@AdamSchinzel
Copy link

@barakharyati
Copy link

or just add the following lines to settings.json:

"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "MesloLGS NF"

example:
{
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "MesloLGS NF"
}

@gatham01
Copy link

gatham01 commented May 3, 2021

Visual Studio Code: Open File → Preferences → Settings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.

image

@Mario-paul
Copy link

Mario-paul commented Aug 18, 2021

@sortega The instructions in my previous comment should work: #671 (comment)

I came from google. This worked perfectly, thank you!

@sylvain-gdk
Copy link

sylvain-gdk commented Sep 2, 2021

@gatham01 Visual Studio Code: Open File → Preferences → Settings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.

image

this was necessary for me as well, thanks (ps official instructions were not sufficient))

@romkatv
Copy link
Owner

romkatv commented Sep 3, 2021

I've updated the instructions in https://github.com/romkatv/powerlevel10k/blob/master/font.md based on the feedback from this issue and replaced my first comment with a copy so that future readers who stumble upon this issue get to the useful information quicker.

@ozzbetto
Copy link

Works fine for me in powerlevel10K on Mac.
Thanks so much.

@HarishChandran3304
Copy link

I had the exact same problem on Ubuntu 20.04 and nothing worked. All I had to do was copy and paste the 4 .ttf files (MesloLGS NF Regular.ttf, MesloLGS NF Bold.ttf, MesloLGS NF Italic.ttf and MesloLGS NF Bold Italic.ttf) inside the usr/share folder to fix it.

@romkatv
Copy link
Owner

romkatv commented Sep 12, 2021

@HarishChandran3304 You must have skipped steps in the instructions that tell you to install the font. The first two steps here: #671 (comment). You need to perform all steps without skipping any.

@HarishChandran3304
Copy link

HarishChandran3304 commented Sep 12, 2021

@romkatv Actually, I did finish all the steps without skipping any and the font was working just fine on my GNOME terminal. It was an issue only on VS Code.

@romkatv
Copy link
Owner

romkatv commented Sep 12, 2021

Where did you copy the ttf files to make it work?

@HarishChandran3304
Copy link

Where did you copy the ttf files to make it work?

Inside the usr/share folder

@romkatv
Copy link
Owner

romkatv commented Sep 13, 2021

Where did you copy the ttf files to make it work?

Inside the usr/share folder

Please be more specific.

@HarishChandran3304
Copy link

Where did you copy the ttf files to make it work?

Inside the usr/share folder

Please be more specific.

Sorry about that! I'm new to Linux and I'm still not familiar with the directory system. I ll try my best to be more specific. When I open the file explorer in my root directory there a couple of the default folders like Desktop, Documents, Downloads, etc. And there is also another folder called share. That is where i copied the 4 .ttf files into to make it work.

This is what it looks like on my terminal:
image

@romkatv
Copy link
Owner

romkatv commented Sep 13, 2021

Thanks! That would be ~/share -- you can see that on the left side of your prompt. ~ stands for your home directory, so the full path is something like /home/username/share. You can see it by typing pwd.

It's unlikely that copying the *.ttf files to ~/share has made any difference but it's technically possible if you'd made non-trivial and unusual changes to your system. Let's try to find out. Please post the output of the following command:

 fc-list 'MesloLGS NF'

@HarishChandran3304
Copy link

Ahh okay got it! I too felt that it was highly unlikely that copying the *.ttf files into the ~/share folder made any difference. So I tried testing some things on my own. My hypothesis was that VS Code was unable to recognize externally installed fonts unless the .ttf files were copied into the ~/share folder.

I reinstalled VS Code using the .deb file from the official website and then everything seemed to be working fine. So I looked around and found this issue which says VS Code installations made using "snap" (I'm not sure what that is yet, another package manager I believe) (I had installed VS Code using the "Ubuntu Software" application which I believe uses snap), had problems recognizing fonts. And they also say that they found a workaround by pasting the .ttf files into the ~/share or the ~/share/fonts folder to make it work which is exactly what I had to do.

If you can look this over and confirm this you can maybe add some extra instructions to tell the users to try pasting the .ttf files into either the ~/share or the ~/share/fonts folder and if that doesn't work they would have to reinstall VS Code using the .deb file from the official website using appropriate commands. These are the commands that I used just in case.

To uninstall snap version of VS Code:

$ snap remove code

To install the .deb file:

$ sudo apt install /path/to/package/name.deb

Also, all my VS Code preferences, settings, and extensions were preserved, so I don't think reinstalling should be a problem for others!

@HarishChandran3304
Copy link

Oh wait oops! I forgot to send the output you were looking for.
Here:

 ~  fc-list 'MesloLGS NF'                                                  ✔ 
/home/harish/.local/share/fonts/MesloLGS NF Bold.ttf: MesloLGS NF:style=Bold
/home/harish/.local/share/fonts/MesloLGS NF Italic.ttf: MesloLGS NF:style=Italic
/home/harish/.local/share/fonts/MesloLGS NF Bold Italic.ttf: MesloLGS NF:style=Bold Italic
/home/harish/.local/share/fonts/MesloLGS NF Regular.ttf: MesloLGS NF:style=Regular

@romkatv
Copy link
Owner

romkatv commented Sep 13, 2021

So I looked around and found this issue

Thanks for the link. This issue has been fixed in 2019. Ubuntu 20.04 shouldn't be affected.

And they also say that they found a workaround by pasting the .ttf files into the ~/share or the ~/share/fonts folder to make it work which is exactly what I had to do.

Hm... microsoft/vscode#63194 (comment) says this:

Current workaround: copy fonts to /usr/share/fonts

You've copied the files to ~/share. That's not the same directory.

Can you double-check the whole thing? Uninstall VS Code, install it from Snap Store and verify that it can use MesloLGS NF. Then delete the ttf files from ~/share, restart VS Code and verify that it cannot use MesloLGS NF.

@chrisdemars
Copy link

I tried all of these solutions and my integrated terminal still looks like this.
Screen Shot 2021-09-30 at 6 28 21 PM

@romkatv
Copy link
Owner

romkatv commented Oct 1, 2021

@chrisdemars That ugly font on your screenshot is the fallback font. VS Code uses it when the font specified in the VS Code settings does not exist. This can happen if you haven't installed the font or if you've mistyped its name in VS Code settings.

@chrisdemars
Copy link

@romkatv I have it spelled the exact same. I am using "MesloGS NF". I am wondering if at this point it is a bug in VS Code.

@jendahorak
Copy link

Had the same problem but with: Cascadia Code
When set the: "terminal.integrated.fontFamily": "CaskaydiaCove Nerd Font"
It worked.

TLDR: Have to pul full name of the font.

@jbthecoder5
Copy link

  1. Download these four ttf files:

  2. Double-click on each file and click "Install". This will make MesloLGS NF font available to all applications on your system.

  3. Open Settings in Visual Studio Code.

    • On PC: press Ctrl+, or click File → Preferences → Settings.
    • On Mac: press ⌘ , or click Code → Preferences → Settings.
  4. Enter terminal.integrated.fontFamily in the search box at the top of Settings tab and set the value below to MesloLGS NF.
    Visual Studio Code Integrated Terminal Font Settings

You can find similar instructions for all popular terminals in this document: https://github.com/romkatv/powerlevel10k/blob/master/font.md

You are a life saver my friend. Thank you so much. i was wondering why the fonts was displaying in my iterm2 but not VS Code.

Problem solved! 👍🏾

@lef-fan
Copy link

lef-fan commented Sep 28, 2023

I had to use the fullname for font: MesloLGS Nerd Font

Arch Linux here:
installed ttf-meslo-nerd from https://archlinux.org/packages/extra/
then i had to specify MesloLGS Nerd Font in vscode settings json and not MesloLGS NF:
"terminal.integrated.fontFamily": "MesloLGS Nerd Font"

@romkatv
Copy link
Owner

romkatv commented Sep 28, 2023

"MesloLGS Nerd Font" is not the same font as "MesloLGS NF". The latter is the recommended font with properly sized icons.

@Orrimp
Copy link

Orrimp commented Nov 21, 2023

I installed my Nerd Font with Homebrew and hat to put

"terminal.integrated.fontFamily": "'MesloLGS Nerd Font'",

@romkatv
Copy link
Owner

romkatv commented Nov 21, 2023

I installed my Nerd Font with Homebrew and hat to put

"terminal.integrated.fontFamily": "'MesloLGS Nerd Font'",

That's not the recommended font though. You can use it if you like it: powerlevel10k works with any font. The recommended font is basically the same but with properly sized icons.

@dcodeu
Copy link

dcodeu commented Dec 1, 2023

Visual Studio Code: Open File → Preferences → Settings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.
image

Thanks for that! Works like a charm

Came from Google! This worked perfectly for me!

@Welding-Torch
Copy link

Here from google. I set the renderer to canvas and the font to FiraCode Nerd Font, but the icons are still being cut off :(
image

@amirhajif
Copy link

because font not downloaded or not configured...

1-download MesloLGS NF Regular font
2-after that go to setting and search terminal.integrated.fontFamily and set it to MesloLGS NF

@Welding-Torch
Copy link

I tried that mate, I'm getting this same problem with any nerd font I tried 5 of them.

@romkatv
Copy link
Owner

romkatv commented Jan 14, 2024

@Welding-Torch Try following the instructions very carefully.

@Welding-Torch
Copy link

@romkatv Okay. I've followed along once again, and unfortunately I'm getting the same result:
image

Can someone recommend a fix?

@romkatv
Copy link
Owner

romkatv commented Jan 14, 2024

@Welding-Torch This does not look like a Powerlevel10k prompt.

@tehpsalmist
Copy link

Don't forget to restart VS Code if you've newly installed the font. :)

@Yeshey
Copy link

Yeshey commented Apr 17, 2024

I wantd to install the font Fira Code

none of the suggestions were working, only when I added this collection of options did it start working

    "customPresentationMode.overrides": {
        "workbench.colorTheme": "Visual Studio Light",
        "window.zoomLevel": 1,
        "debug.console.fontSize": 26,
        "editor.fontSize": 26,
        "markdown.preview.fontSize": 26,
        "terminal.integrated.fontSize": 26,
        "gitlens.codeLens.enabled": false,
        "gitlens.currentLine.enabled": false
    },
    "workbench.colorTheme": "Monokai Dark Soda",
    "workbench.iconTheme": "material-icon-theme",
    "editor.fontFamily": "'FuraCode Nerd Font Mono', 'FiraCode Nerd Font Mono', 'Fira Code', 'Droid Sans Mono', Menlo, Monaco, 'Courier New', monospace, 'Droid Sans Fallback'",
    "debug.console.fontSize": 16,
    "editor.fontSize": 16,
    "markdown.preview.fontSize": 16,
    "terminal.integrated.fontSize": 16,
    "editor.fontLigatures": true,

@Welding-Torch
Copy link

You spelled FiraCode as FuraCode

@Yeshey
Copy link

Yeshey commented Apr 26, 2024

You spelled FiraCode as FuraCode

Yeah, I think it's intentional :), 'FiraCode Nerd Font Mono' is also in there, if it doesn't find ''FuraCode Nerd Font Mono'' it defaults to 'Fira'. Idk if there is such a thing as FuraCode fonts, but as it's working imma leave it for now

It's a configuration i took from here: https://gitlab.com/pinage404/dotfiles/-/blob/main/dotfiles/config/Code/User/settings.json

@halilim
Copy link

halilim commented May 22, 2024

image

I'm having this issue as well (even if I use 'MesloLGS NF' in the Terminal > Font Family setting), and using the Lean style for VS Code as a workaround:

if [[ "$TERM_PROGRAM:l" = vscode* ]]; then
  . ~/.p10k.vscode.zsh
else
  . ~/.p10k.zsh
fi

then copy the file, restart the VS Code terminal, and verify the config file & reconfigure:

echo $TERM_PROGRAM # Should be vscode
echo $POWERLEVEL9K_CONFIG_FILE # Shoulc be /Users/.../.p10k.vscode.zsh
p10k configure

@sono-T
Copy link

sono-T commented May 23, 2024

Cmd+Shift+P Search: Terminal Font Input: MesloLGS NF

image

Perfect!

@luispuerto
Copy link

Great thanks!

Just a comment here, but if you are using the fonts downloaded from homebrew, which are nice since you get updates, you need to write there MesloLGS Nerd Font Mono for example.

@romkatv
Copy link
Owner

romkatv commented Jun 13, 2024

Just a comment here, but if you are using the fonts downloaded from homebrew, which are nice since you get updates, you need to write there MesloLGS Nerd Font Mono for example.

This indicates you are using a different font, not the recommended one. If you download the recommended font from any source (including homebrew: brew tap homebrew/cask-fonts && brew install font-meslo-for-powerlevel10k), the name of the font will be "MesloLGS NF".

@luispuerto
Copy link

luispuerto commented Jun 13, 2024

@romkatv
Copy link
Owner

romkatv commented Jun 13, 2024

My comment still stands. If you install the recommended font from any source, its name will be "MesloLGS NF". If your font has a different name, it's a different font.

@luispuerto
Copy link

luispuerto commented Jun 13, 2024

Can you tell me what I'm doing wrong when the creator of the font is recommending using the installation method I use? https://github.com/ryanoasis/nerd-fonts?tab=readme-ov-file#option-2-homebrew-fonts

In other words, If you use the regular homebrew install, if you're using homebrew, most probable patch, you are going to have that name. I'm not stating that there is wrong or right… but that the name could be different.

PS/ just clarifying that the name could be different depending on the install you have would be nice.

@romkatv
Copy link
Owner

romkatv commented Jun 13, 2024

Different fonts have different names. The recommended font is called "MesloLGS NF". You've installed a different font, which naturally has a different name.

Can you tell me what I'm doing wrong

If your goal was to install "MesloLGS Nerd Font Mono", you aren't doing anything wrong. If your goal was to install "MesloLGS NF" (the font that powerlevel10k recommends), then your mistake was installing a different font.

@luispuerto
Copy link

As far as I understand you need to use a mono font on terminal. Visual Studio Code was not allowing me to use the non mono one, which I also have installed.

@romkatv
Copy link
Owner

romkatv commented Jun 13, 2024

That may be true but my point still stands.

@KarstenVogt
Copy link

KarstenVogt commented Jul 1, 2024

This is what I did:

  • Go to https://www.nerdfonts.com/font-downloads, download font and copy its name (above the abcdef...) to the clipboard.

  • Install the font

  • In VS Code: File -> Preferences -> Settings. Edit the settings.json file: add/edit:
    "editor.fontFamily": "'$PasteYourCopiedNamehere'",
    "editor.fontSize": 13,
    "editor.fontLigatures": true

    For me it was:
    "editor.fontFamily": "'JetBrainsMono Nerd Font'",
    "editor.fontSize": 13,
    "editor.fontLigatures": true

    Mind the double and single quotes. "'...'"

  • Restart VSCode

  • Profit.

@romkatv
Copy link
Owner

romkatv commented Jul 1, 2024

@TobyDS
Copy link

TobyDS commented Jul 13, 2024

Cause of issue (when using iTerm2)

In my case, this was happening because I was using iTerm 2 as my terminal application, which has a set of fallback glyphs available by default, so some glyphs I thought were coming from my Nerd Font were actually provided by a backup set of powerline glyphs. The solution is to add the recommended font as a backup so that VSCode will look for any glyphs it can't find in the main font in the backup font instead. This will provide the missing glyphs in the same way that iTerm does by default.

Example Solution

I changed the following setting in my VSCode settings.json

From:

"terminal.integrated.fontFamily": "'FiraCode Nerd Font'",

To:

"terminal.integrated.fontFamily": "'FiraCode Nerd Font','MesloLGS NF', monospace",

Note: This does require you to have installed the 'MesloLGS NF' font provided by powerline10k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests