Skip to content

Commit 08233c3

Browse files
committed
Add Ghostty config blogpost
1 parent a891c53 commit 08233c3

File tree

2 files changed

+64
-12
lines changed

2 files changed

+64
-12
lines changed

assets/style.css

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ body {
3232
header,
3333
main,
3434
footer {
35-
margin: 30px auto;
35+
margin: 1em auto;
3636
max-width: 55ch;
3737
}
3838

@@ -171,22 +171,26 @@ time {
171171
}
172172

173173
code {
174-
font: inherit;
175-
color: var(--code-color);
174+
font-size: 0.9rem;
175+
font-family: monospace;
176176
tab-size: 4;
177-
max-width: 73vw;
178-
display: inline-flex;
179-
overflow-x: auto;
180-
}
181177

182-
:not(pre)>code::before,
183-
:not(pre)>code::after {
184-
content: '`';
185-
color: var(--detail-color);
178+
p & {
179+
text-decoration: inherit;
180+
text-decoration-color: var(--code-color);
181+
color: var(--code-color);
182+
183+
/* &::before, */
184+
/* &::after { */
185+
/* content: '`'; */
186+
/* color: var(--detail-color); */
187+
/* } */
188+
}
186189
}
187190

188191
pre {
189-
font-size: 0.9rem;
192+
max-width: 73vw;
193+
overflow-x: auto;
190194
margin-left: 4ch;
191195
background-color: transparent !important;
192196
}

content/posts/ghostty-config.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Editing Ghostty Config in Neovim
3+
date: 2024-12-27
4+
draft: false
5+
---
6+
7+
Finally, the new-kid-on-the-block of terminal emulators,
8+
[Ghostty](https://ghostty.org), has made its public debut! As someone who
9+
missed out on the beta program, I was eagerly counting down the days and jumped
10+
in as soon as it was released.
11+
12+
When I began configuring Ghostty, I noticed it uses its own simple
13+
configuration format—essentially `key = value` pairs. Naturally, I tried
14+
setting the filetype to `ini` with `:set ft=ini`, but the highlighting didn’t
15+
quite hit the mark. So, I thought, “Why not write a custom syntax file?”
16+
Perhaps I could even upstream it to [vim/vim](https://github.com/vim/vim). But,
17+
surprise! The Ghostty team had already done the hard work for me.
18+
19+
Ghostty generates a complete set of Vim/Neovim support files during its build
20+
process: an
21+
[`ftdetect`](https://neovim.io/doc/user/usr_41.html#_filetype-detection), an
22+
[`ftplugin`](https://neovim.io/doc/user/usr_41.html#_writing-a-filetype-plugin),
23+
and a [`syntax`](https://neovim.io/doc/user/syntax.html#_2.-syntax-files) file.
24+
These can be added to Vim’s runtimepath for automatic integration.
25+
26+
On macOS, these files are bundled in `/Applications/Ghostty.app/`.
27+
On Linux, it’s likely in `/usr/share/ghostty` or
28+
`/usr/share/vim`, I'm not sure. But you can always use the
29+
`$GHOSTTY_RESOURCES_DIR` environment variable as a platform-agnostic way to
30+
locate them.
31+
32+
Then I discovered that changing the runtimepath yourself when you use Lazy.nvim
33+
is not that straightforward. So, I took the simpler route and just treated it
34+
as a local Lazy plugin:
35+
36+
```lua
37+
return {
38+
dir = vim.env.GHOSTTY_RESOURCES_DIR .. "/../vim/vimfiles",
39+
lazy = false, -- Ensures it loads for Ghostty config detection
40+
name = "ghostty", -- Avoids the name being "vimfiles"
41+
cond = vim.env.GHOSTTY_RESOURCES_DIR ~= nil, -- Only load if Ghostty is installed
42+
}
43+
```
44+
45+
Tada! Thanks to the great work by the authors, this now provides syntax
46+
highlighting for the Ghostty config file. Bonus points:
47+
[<C-x><C-o>](https://neovim.io/doc/user/insert.html#i_CTRL-X_CTRL-O) completes
48+
the Ghostty options!

0 commit comments

Comments
 (0)