Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ home-manager.users.<user>.home.packages = [

- `bufferline.nix`: Configures the Bufferline plugin for enhanced buffer/tab display.
- `lualine.nix`: Configures Lualine with Git, Jujutsu, and configured-forge context.
- `startup.nix`: Configures the startup screen.
- `dashboard.nix`: Configures a project-aware Snacks dashboard for review, task, and navigation workflows.

### LSP

Expand Down
16 changes: 1 addition & 15 deletions config/auto_cmds.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
autoGroups = {
highlight_yank = { };
vim_enter = { };
indentscope = { };
restore_cursor = { };
};
Expand All @@ -19,25 +18,12 @@
'';
};
}
{
group = "vim_enter";
event = [ "VimEnter" ];
pattern = "*";
callback = {
__raw = ''
function()
vim.cmd('Startup')
end
'';
};
}
{
group = "indentscope";
event = [ "FileType" ];
pattern = [
"help"
"Startup"
"startup"
"snacks_dashboard"
"neo-tree"
"Trouble"
"trouble"
Expand Down
2 changes: 1 addition & 1 deletion config/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _: {
# UI plugins
./plugins/ui/bufferline.nix
./plugins/ui/lualine.nix
./plugins/ui/startup.nix
./plugins/ui/dashboard.nix

# LSP and formatting
./plugins/lsp/lsp.nix
Expand Down
1 change: 1 addition & 0 deletions config/plugins/editor/illuminate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"alpha"
"harpoon"
"reason"
"snacks_dashboard"
];
};
};
Expand Down
1 change: 1 addition & 0 deletions config/plugins/editor/indent-blankline.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
plugins = {
indent-blankline = {
enable = true;
settings.exclude.filetypes = [ "snacks_dashboard" ];
};
};
}
31 changes: 24 additions & 7 deletions config/plugins/git/codediff.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ let
return result.code == 0
end

local function review_base()
local root = git_root()
local function review_base(root)
local result = vim.system(
{ "git", "symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD" },
{ cwd = root, text = true }
Expand All @@ -40,22 +39,40 @@ let
end

local function with_review_base(callback)
local base = review_base()
local root = git_root()
local base = review_base(root)
if not base then
vim.notify("Could not determine the default review branch", vim.log.levels.ERROR)
return
end
callback(base)
callback(base, root)
end

vim.api.nvim_create_user_command("CodeReviewBranch", function()
with_review_base(function(base)
vim.cmd("CodeDiff " .. vim.fn.fnameescape(base .. "...HEAD"))
vim.cmd("CodeDiff " .. vim.fn.fnameescape(base .. "..."))
end)
end, { desc = "Review branch changes against its merge base" })
end, { desc = "Review branch and working-tree changes against their merge base" })

vim.api.nvim_create_user_command("CodeReviewHistory", function()
with_review_base(function(base)
with_review_base(function(base, root)
local result = vim.system(
{ "git", "rev-list", "--count", base .. "..HEAD" },
{ cwd = root, text = true }
):wait()
local count = result.code == 0 and tonumber(vim.trim(result.stdout or "")) or nil

if count == 0 then
vim.notify(
"No branch commits yet; uncommitted changes are available under Review branch (D)",
vim.log.levels.INFO
)
return
elseif count == nil then
vim.notify("Could not determine branch history", vim.log.levels.ERROR)
return
end

vim.cmd("CodeDiff history " .. vim.fn.fnameescape(base .. "..HEAD") .. " --reverse")
end)
end, { desc = "Review branch commits in chronological order" })
Expand Down
126 changes: 126 additions & 0 deletions config/plugins/ui/dashboard.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{ lib, ... }:
{
extraFiles."lua/workspace_dashboard.lua".source = ./workspace_dashboard.lua;

plugins.snacks = {
enable = true;
settings.dashboard = {
enabled = true;
width = 94;
preset.header = ''
██████╗░███████╗░█████╗░░█████╗░██████╗░████████╗░░░████████╗███████╗░█████╗░██╗░░██╗
██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝░░░╚══██╔══╝██╔════╝██╔══██╗██║░░██║
██║░░██║█████╗░░██║░░╚═╝██║░░██║██████╔╝░░░██║░░░░░░░░░██║░░░█████╗░░██║░░╚═╝███████║
██║░░██║██╔══╝░░██║░░██╗██║░░██║██╔══██╗░░░██║░░░░░░░░░██║░░░██╔══╝░░██║░░██╗██╔══██║
██████╔╝███████╗╚█████╔╝╚█████╔╝██║░░██║░░░██║░░░██╗░░░██║░░░███████╗╚█████╔╝██║░░██║
╚═════╝░╚══════╝░╚════╝░░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░░╚═╝░░░╚══════╝░╚════╝░╚═╝░░╚═╝
'';
sections = lib.nixvim.mkRaw ''
(function()
local row = require("workspace_dashboard").row

local function heading(title)
return {
align = "center",
padding = 1,
text = { { title, hl = "title" } },
}
end

return {
{ section = "header" },
function()
return require("workspace_dashboard").summary()
end,

heading("Review & Run"),
row("󰕚", "d", "Review working tree", ":CodeDiff"),
row("󰜘", "D", "Review branch", ":CodeReviewBranch"),
row("󰄉", "h", "Review branch history", ":CodeReviewHistory"),
row("󰑮", "t", "Run project task", ":OverseerRun"),

heading("Navigate"),
row("", "f", "Find file", ":Telescope find_files"),
row("", "/", "Find text", ":Telescope live_grep"),
row("", "e", "File explorer", ":Neotree toggle"),
row("󰧑", "b", "SecondBrain", function()
require("telescope.builtin").find_files({
cwd = vim.fn.expand("~/projects/personal/SecondBrain"),
})
end),

heading("Continue"),
function()
return require("workspace_dashboard").recent_files()
end,

(function()
local quit = row("", "q", "Quit", ":qa")
quit.padding = { 0, 1 }
return quit
end)(),
}
end)()
'';
};
};

extraConfigLua = lib.mkAfter ''
local dashboard_group = vim.api.nvim_create_augroup("dashboard_chrome", { clear = true })
local previous_laststatus

local function hide_dashboard_statusline()
if vim.bo.filetype ~= "snacks_dashboard" then
return
end

if previous_laststatus == nil then
previous_laststatus = vim.o.laststatus
end
vim.o.laststatus = 0
vim.wo.statusline = ""
vim.b.miniindentscope_disable = true
end

local function restore_statusline()
if previous_laststatus == nil then
return
end

vim.o.laststatus = previous_laststatus
previous_laststatus = nil
end

vim.api.nvim_create_autocmd({ "FileType", "BufEnter", "WinEnter" }, {
group = dashboard_group,
pattern = "*",
callback = hide_dashboard_statusline,
})

-- Snacks temporarily suppresses normal buffer events while creating the
-- dashboard, so its lifecycle event owns the initial chrome update.
vim.api.nvim_create_autocmd("User", {
group = dashboard_group,
pattern = { "SnacksDashboardOpened", "SnacksDashboardUpdatePost" },
callback = hide_dashboard_statusline,
})

vim.api.nvim_create_autocmd("BufLeave", {
group = dashboard_group,
pattern = "*",
callback = function()
if vim.bo.filetype ~= "snacks_dashboard" then
return
end

restore_statusline()
end,
})

vim.api.nvim_create_autocmd("User", {
group = dashboard_group,
pattern = "SnacksDashboardClosed",
callback = restore_statusline,
})
'';
}
6 changes: 3 additions & 3 deletions config/plugins/ui/lualine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"fzf"
"neo-tree"
];
disabledFiletypes = {
disabled_filetypes = {
statusline = [
"startup"
"alpha"
"snacks_dashboard"
];
};
theme = "catppuccin";
theme = "catppuccin-nvim";
};
sections = {
lualine_a = [
Expand Down
82 changes: 0 additions & 82 deletions config/plugins/ui/startup.nix

This file was deleted.

Loading