Introduction#
I don't know if you have ever seen code in VIM where some parts are in regular font and some parts are in italics, like this:
I personally prefer this style:
When it comes to programming fonts, I prefer something thin and relatively condensed, but with a more informal, flowing and human style for standouts like comments and certain keywords.
From https://rubjo.github.io/victor-mono/
This article will use Neovim + Wezterm to achieve the italic style shown in the image above.
Installing the Font#
Click here to visit the victor-mono official website
Click here to download victor-mono
-
Download the font
-
Extract the ZIP file
-
Install the font files
For Windows, choose to install the ttf format. Since I only use the italic version of victor-mono, I only installed VictorMono-Italic.ttf
and VictorMono-BoldItalic.ttf
.
Configuring Wezterm#
Find the .wezterm.lua file in the current user directory, and create it if it doesn't exist.
Configure config.font
and config.font_rule
. Here, I use the following strategy: by default, use Cascadia Mono, and if it's italic, use Victor Mono.
config.font = wezterm.font_with_fallback {
'Cascadia Mono',
'DengXian'
}
config.font_rules = {
{
intensity = 'Bold',
italic = true,
font = wezterm.font {
family = 'Victor Mono',
weight = 'Bold',
style = 'Italic',
},
},
{
italic = true,
intensity = 'Half',
font = wezterm.font {
family = 'Victor Mono',
weight = 'DemiBold',
style = 'Italic',
},
},
{
italic = true,
intensity = 'Normal',
font = wezterm.font {
family = 'Victor Mono',
style = 'Italic',
weight = 'Bold',
},
},
}
Configuring Neovim#
In Neovim, you need to use a theme that supports italic display. I use catppuccin, which can be used with lsp and tressitter to display different styles for specific syntax parts in the code, such as using italics for code keywords.
require("catppuccin").setup({
styles = {
comments = { "bold" },
properties = { "bold" },
functions = { "bold" },
keywords = { "italic" },
operators = { "bold" },
conditionals = { "italic" },
loops = { "italic" },
booleans = { "bold", "italic" },
numbers = {},
types = {},
strings = {},
variables = {},
},
}
Result#
Only the keyword parts are displayed in italics, while the rest remains normal.