如何为 Visual Studio Code 设置字体连字?

问题描述 投票:0回答:8

我正在使用这两行为 VSCode 设置字体连字。

"editor.fontFamily": "'Fira Code'",
"editor.fontLigatures": true,

但看起来还是和以前一样。

我尝试禁用所有已安装的扩展,但没有成功。

这是我的完整设置:

{
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "Material Theme Darker High Contrast",
  "editor.formatOnSave": true,
  "explorer.confirmDelete": false,
  "editor.suggestSelection": "first",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "window.zoomLevel": 0,
  "editor.fontSize": 16, //!=
  "editor.fontFamily": "'Fira Code'",
  "editor.fontLigatures": true,
  "explorer.confirmDragAndDrop": false
}

我想要功能齐全的字体连字,如本页所示:我想要它的外观。 相反,我得到的是带有某种字体的基本文本。

fonts visual-studio-code ligature
8个回答
83
投票

步骤#1安装Fira 代码。

步骤#2:在 VSCode 设置中设置字体:

"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,

步骤#3:重新启动/重新加载 VSCode。

就是这样。


7
投票

从 VS Code 1.40 开始,

editor.fontLigatrues
支持字符串设置,这对于支持不同风格集的字体非常有用:

即:

  • "editor.fontLigatures": "'ss09', 'zero', 'onum'",
  • "editor.fontLigatures": "'ss01'",

您可以在此处阅读有关功能标签的更多信息(但支持取决于相关字体):

https://learn.microsoft.com/en-us/typography/opentype/spec/featuretags


5
投票

您的电脑中似乎没有安装 Fira 字体。 如果您使用的是 MacOS,请按照此步骤操作。

打开终端并运行这些命令。

brew tap homebrew/cask-fonts
brew cask install font-fira-code

并尝试重新启动 VsCode。

或者,如果您使用其他操作系统(Windows 或 Linux),请按照此步骤操作。 https://github.com/tonsky/FiraCode/wiki/Installing

希望这会有所帮助。


4
投票

VS Code 中仍未修复此问题。但看起来好像很接近。两年后,VS Code 终端最终将支持

"Cascadia Code"
和其他带有编程连字的字体。

编辑:结帐monaspace.githubnext.com


3
投票

对于使用不同版本 VS Code 的用户,您可以尝试按 Control 和逗号的组合键 ( Ctrl+, ) 打开设置选项卡,然后搜索 font ligatures

Search Results

此后单击在settings.json中编辑

然后设置

editor.fontLigatures=true

Final look

完成此步骤后,您就可以开始了。


2
投票

如果您使用的是 macOS,有时您需要重新启动计算机才能让 Visual Studio Code 的连字生效。


2
投票

我解决了我的问题,将 Fira 代码不带“”


0
投票

为 Mac“计算机”安装 FiraCode 字体系列,但不为“用户”安装

如何在 Mac 上安装和删除字体--Apple 支持

© www.soinside.com 2019 - 2024. All rights reserved.