Skip to content

Commit 02a0884

Browse files
committed
wip(ghostty): adaptive theme
1 parent 80b08fa commit 02a0884

File tree

5 files changed

+90
-12
lines changed

5 files changed

+90
-12
lines changed

nix/modules/colors.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
magenta = "#FF00FF";
2828
orange = "#e6b594";
2929
red = "#990000";
30-
white = "#FDFCF7";
30+
white = "#000000";
3131
yellow = "#ffff00";
3232
};
3333
}

nix/modules/home-manager.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ in
9292
macos-titlebar-style = "tabs";
9393
mouse-hide-while-typing = true;
9494
shell-integration-features = "no-cursor";
95-
theme = "light:tmm-bright,dark:tmm-dark";
95+
theme = "dark:_dark,light:_light";
9696
unfocused-split-opacity = 1;
9797
window-height = 50;
9898
window-padding-balance = true;
@@ -103,7 +103,7 @@ in
103103
themes = {
104104
# TODO: Add light theme
105105
# https://github.com/mitchellh/ghostty/issues/809
106-
tmm-dark = {
106+
_dark = {
107107
background = colors.dark.background;
108108
cursor-color = colors.dark.cursor;
109109
foreground = colors.dark.foreground;
@@ -118,7 +118,7 @@ in
118118
"7=${colors.dark.white}"
119119
];
120120
};
121-
tmm-bright = {
121+
_light = {
122122
background = colors.bright.background;
123123
cursor-color = colors.bright.cursor;
124124
foreground = colors.bright.foreground;
@@ -131,6 +131,14 @@ in
131131
"5=${colors.bright.orange}"
132132
"6=${colors.bright.cyan}"
133133
"7=${colors.bright.white}"
134+
"8=${colors.bright.black}"
135+
"9=${colors.bright.black}"
136+
"10=${colors.bright.black}"
137+
"11=${colors.bright.black}"
138+
"12=${colors.bright.black}"
139+
"13=${colors.bright.black}"
140+
"14=${colors.bright.black}"
141+
"15=${colors.bright.black}"
134142
];
135143
};
136144
};

nix/modules/shell.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@
4646
];
4747
shellAbbrs = {
4848
a = "ambr";
49+
b = "bun";
4950
d = "docker";
5051
de = "delta";
5152
dc = "docker compose";
5253
g = "git";
5354
i = "iex";
5455
lsd = "eza -d .*";
5556
m = "mix";
57+
n = "npm";
5658
o = "opencode";
5759
p = "pnpm";
5860
v = "nvim";

nvim/lazy-lock.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" },
44
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
55
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
6-
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
7-
"grug-far.nvim": { "branch": "main", "commit": "385d1949dc21d0c39e7a74b4f4a25da18817bc86" },
6+
"gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" },
7+
"grug-far.nvim": { "branch": "main", "commit": "50d9ee2b5a19634670441948e7e4afaa042f1059" },
88
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
99
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
1010
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
1111
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
1212
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
1313
"mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" },
14-
"mini.pairs": { "branch": "main", "commit": "6e1cc569130f25b2c6fa16d8b21b31ddb1420a4a" },
15-
"mini.surround": { "branch": "main", "commit": "953fb53aa1d0b2ae4506d35fff0e0e7afc8ceb8d" },
14+
"mini.pairs": { "branch": "main", "commit": "3738ea30ff33e0cbf2983dc67319a5468d25b0a9" },
15+
"mini.surround": { "branch": "main", "commit": "e170a2dde4b0a8905c9bb218ed428be94ec0b255" },
1616
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
1717
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
18-
"nvim-lspconfig": { "branch": "master", "commit": "a3deebbd110016f50cc66b7b256120072f3804db" },
18+
"nvim-lspconfig": { "branch": "master", "commit": "d89f4891f0720cd2598e4bdd60010d8784b2ac8a" },
1919
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
20-
"nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" },
21-
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
20+
"nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" },
21+
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
2222
"oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" },
2323
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
2424
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },

nvim/lua/plugins.lua

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ return {
492492
find_left = "gsF", -- Find surrounding (to the left)
493493
highlight = "gsh", -- Highlight surrounding
494494
replace = "gsr", -- Replace surrounding
495-
update_n_lines = "gsn", -- Update `n_lines`
496495
},
497496
},
498497
},
@@ -1162,6 +1161,75 @@ return {
11621161
{ "<leader>e", "<cmd>Oil<cr>", desc = "Explorer Oil", remap = true },
11631162
},
11641163
opts = {},
1164+
config = function(_, opts)
1165+
-- helper function to parse output
1166+
local function parse_output(proc)
1167+
local result = proc:wait()
1168+
local ret = {}
1169+
if result.code == 0 then
1170+
for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do
1171+
-- Remove trailing slash
1172+
line = line:gsub("/$", "")
1173+
ret[line] = true
1174+
end
1175+
end
1176+
return ret
1177+
end
1178+
1179+
-- build git status cache
1180+
local function new_git_status()
1181+
return setmetatable({}, {
1182+
__index = function(self, key)
1183+
local ignore_proc = vim.system(
1184+
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
1185+
{
1186+
cwd = key,
1187+
text = true,
1188+
}
1189+
)
1190+
local tracked_proc = vim.system({ "git", "ls-tree", "HEAD", "--name-only" }, {
1191+
cwd = key,
1192+
text = true,
1193+
})
1194+
local ret = {
1195+
ignored = parse_output(ignore_proc),
1196+
tracked = parse_output(tracked_proc),
1197+
}
1198+
rawset(self, key, ret)
1199+
return ret
1200+
end,
1201+
})
1202+
end
1203+
local git_status = new_git_status()
1204+
1205+
-- Clear git status cache on refresh
1206+
local refresh = require("oil.actions").refresh
1207+
local orig_refresh = refresh.callback
1208+
refresh.callback = function(...)
1209+
git_status = new_git_status()
1210+
orig_refresh(...)
1211+
end
1212+
1213+
opts.view_options = {
1214+
is_hidden_file = function(name, bufnr)
1215+
local dir = require("oil").get_current_dir(bufnr)
1216+
local is_dotfile = vim.startswith(name, ".") and name ~= ".."
1217+
-- if no local directory (e.g. for ssh connections), just hide dotfiles
1218+
if not dir then
1219+
return is_dotfile
1220+
end
1221+
-- dotfiles are considered hidden unless tracked
1222+
if is_dotfile then
1223+
return not git_status[dir].tracked[name]
1224+
else
1225+
-- Check if file is gitignored
1226+
return git_status[dir].ignored[name]
1227+
end
1228+
end,
1229+
}
1230+
1231+
require("oil").setup(opts)
1232+
end,
11651233
},
11661234

11671235
-- snacks.nvim (https://github.com/folke/snacks.nvim)

0 commit comments

Comments
 (0)