Introduction#
I don't know if you have ever seen code in VIM where part of it is in regular font and part of it is 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.
Source: https://rubjo.github.io/victor-mono/
This article will use Neovim + Wezterm to achieve the italic style shown in the image above.
Font Installation#
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
.
Wezterm Configuration#
Find the .wezterm.lua file in the current user directory. If it doesn't exist, create a new one.
Configure config.font
and config.font_rule
. The strategy I'm using here is to use Cascadia Mono as the default font, 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',
},
},
}
Neovim Configuration#
In Neovim, you need to use a theme that supports italic display. I'm using 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 part is displayed in italics, while the rest remains normal.