diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index 5127e59..8fd7608 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -129,7 +129,7 @@ return { clipboard = "unnamedplus", title = true, titlestring = "", - laststatus = 0, + laststatus = 3, -- global statusline (custom heirline in heirline.lua) }, g = {}, }, @@ -141,7 +141,13 @@ return { [""] = { "suspend", desc = "Suspend nvim (return with 'fg')" }, ["ZZ"] = { "wqa", desc = "Save all buffers and quit Neovim" }, [""] = { "wqa", desc = "Save all buffers and quit Neovim" }, - [""] = { "wabd", desc = "Save and close buffer" }, + [""] = { + function() + vim.cmd "wa" + require("snacks").bufdelete() + end, + desc = "Save and close buffer", + }, ["F"] = { "za", desc = "Toggle fold under cursor" }, -- v6: vim.diagnostic.goto_next/goto_prev deprecated in 0.11, use jump() ["J"] = { @@ -168,12 +174,7 @@ return { desc = "Find buffers", }, [""] = { - function() - local current_buffer = vim.api.nvim_get_current_buf() - for _, buf in ipairs(vim.api.nvim_list_bufs()) do - if buf ~= current_buffer then vim.api.nvim_buf_delete(buf, { force = true }) end - end - end, + function() require("snacks").bufdelete.other() end, desc = "Close all buffers except the current one", }, ["g"] = { @@ -189,14 +190,58 @@ return { function() require("snacks").picker.lines() end, desc = "Find in line", }, - ["o"] = { "!gh repo view --web", desc = "Open Repo on Web" }, + ["o"] = { function() require("snacks").gitbrowse() end, desc = "Open Repo on Web" }, [""] = { "w", desc = "Save buffer" }, - [""] = { "wbd", desc = "Save and close buffer" }, + [""] = { + function() + vim.cmd "w" + require("snacks").bufdelete() + end, + desc = "Save and close buffer", + }, [""] = { "tabnext", desc = "Next Tab" }, - [""] = { "Octo issue list", desc = "List Issues" }, - [""] = { "Octo label", desc = "Manage Labels" }, - [""] = { "Octo pr list", desc = "List PRs" }, - ["s"] = { "Octo search", desc = "Octo Search" }, + [""] = { + function() require("snacks").picker.gh_issue() end, + desc = "GitHub issues (open)", + }, + [""] = { + function() require("snacks").picker.gh_pr() end, + desc = "GitHub PRs (open)", + }, + ["I"] = { + function() require("snacks").picker.gh_issue { state = "all" } end, + desc = "GitHub issues (all)", + }, + ["P"] = { + function() require("snacks").picker.gh_pr { state = "all" } end, + desc = "GitHub PRs (all)", + }, + -- which-key prefix group labels + [""] = { desc = "Git + GitHub" }, + [""] = { desc = "Find" }, + [""] = { desc = "Buffers" }, + [""] = { desc = "Assist" }, + -- ghq project switcher (previously a dashboard action) + ["P"] = { + function() + local repos = vim.fn.systemlist "ghq list -p" + vim.ui.select(repos, { prompt = "Select repository" }, function(dir) + if not dir then return end + vim.cmd.cd(dir) + require("snacks").picker.files() + end) + end, + desc = "Find ghq projects", + }, + [""] = { + function() require("snacks").lazygit() end, + desc = "Toggle lazygit (float)", + }, + [""] = { + function() require("snacks").terminal.toggle("lazydocker", { win = { style = "float" } }) end, + desc = "Toggle lazydocker (float)", + }, + [""] = { "Scooter", desc = "Find & replace (scooter)" }, [""] = { "!gh release list", desc = "List Releases" }, ["d"] = { function() require("snacks").picker.git_diff() end, @@ -402,12 +447,38 @@ return { }, i = { [""] = { "wa", desc = "Save buffer, and return to normal mode" }, - [""] = { "wabd", desc = "Save, close buffer, and return to normal mode" }, - [""] = { "wabd", desc = "Save, close buffer, and return to normal mode" }, + [""] = { + function() + vim.cmd "stopinsert" + vim.cmd "wa" + require("snacks").bufdelete() + end, + desc = "Save, close buffer, and return to normal mode", + }, + [""] = { + function() + vim.cmd "stopinsert" + vim.cmd "wa" + require("snacks").bufdelete() + end, + desc = "Save, close buffer, and return to normal mode", + }, }, v = { - [""] = { "wbd", desc = "Save and close buffer" }, - [""] = { "wbd", desc = "Save and close buffer" }, + [""] = { + function() + vim.cmd "w" + require("snacks").bufdelete() + end, + desc = "Save and close buffer", + }, + [""] = { + function() + vim.cmd "w" + require("snacks").bufdelete() + end, + desc = "Save and close buffer", + }, ["D"] = { function() vim.cmd 'normal! "vy' diff --git a/lua/plugins/user.lua b/lua/plugins/user.lua index 71bf325..239cb9d 100644 --- a/lua/plugins/user.lua +++ b/lua/plugins/user.lua @@ -1,4 +1,5 @@ ---- User plugins: cursor animation and snacks.nvim (picker + dashboard) customization +--- User plugins: cursor animation and the central snacks.nvim configuration +--- (all snacks modules are configured here in one snacks.Config table) -- Confirm action for file-opening pickers: opens the selection as a -- tab via `tabdrop` (:tab drop semantics — focus the buffer if it's already @@ -43,53 +44,42 @@ end return { { "sphamba/smear-cursor.nvim", opts = {} }, - -- terminals are handled by kitty now + -- AstroNvim CORE ships toggleterm (astronvim/plugins/toggleterm.lua); + -- terminals are handled by kitty + snacks.terminal/external-tui instead { "akinsho/toggleterm.nvim", enabled = false }, + -- pulled in by astrocommunity.pack.typescript; only ever loaded by + -- neo-tree/nvim-tree (both removed) and yazi.nvim handles LSP renames + { "antosha417/nvim-lsp-file-operations", enabled = false }, + { "folke/snacks.nvim", + ---@type snacks.Config opts = { + -- dashboard discarded in favor of session management: the astrocore + -- restore_session autocmd resumes the cwd dirsession on startup and + -- sessions.autosave persists it on exit + dashboard = { enabled = false }, + + -- GitHub issue/PR pickers and buffers (`` binds in astrocore.lua) + gh = {}, + + -- auto-highlight LSP references of the symbol under the cursor; + -- ]] / [[ jump binds live in polish.lua (Snacks.keymap, LSP-gated) + words = { enabled = true }, + picker = { jump = { reuse_win = true }, sources = picker_sources, }, - dashboard = { - enabled = true, - preset = { - -- "prdlk.nvim" in ansi_regular block style - header = table.concat({ - "██████ ██████ ██████ ██ ██ ██ ███ ██ ██ ██ ██ ███ ███", - "██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ████ ████", - "██████ ██████ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ████ ██", - "██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██", - "██ ██ ██ ██████ ███████ ██ ██ ██ ██ ████ ████ ██ ██ ██", - }, "\n"), - }, - sections = { - { section = "header" }, - { section = "keys", gap = 1, padding = 1 }, - { - icon = " ", - desc = "Browse Repo", - padding = 1, - key = "b", - action = function() Snacks.gitbrowse() end, - }, - { - icon = " ", - desc = "Projects (ghq)", - padding = 1, - key = "p", - action = function() - local repos = vim.fn.systemlist "ghq list -p" - vim.ui.select(repos, { prompt = "Select repository" }, function(dir) - if not dir then return end - vim.cmd.cd(dir) - Snacks.picker.files() - end) - end, - }, - { section = "startup" }, + + styles = { + -- right-hand 30% split used by :Scooter (external-tui snacks terminal) + scooter = { + position = "right", + width = 0.3, + height = 0, + border = "none", }, }, },