Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263-- Helper to find git rootlocal function find_git_root() local current_dir = vim.fn.expand("%:p:h") if current_dir == "" then current_dir = vim.fn.getcwd() end
local git_root = vim.fs.find(".git", { path = current_dir, upward = true, type = "directory", })
return not vim.tbl_isempty(git_root) and vim.fn.fnamemodify(git_root[1], ":h") or vim.fn.getcwd()end
-- Function to read lazy.json patternslocal function get_exclude_patterns() local git_root = find_git_root() local lazy_json_path = git_root .. "/lazy.json" local patterns = {}
if vim.fn.filereadable(lazy_json_path) == 1 then local file = io.open(lazy_json_path, "r") if file then local content = file:read("*all") file:close()
local success, lazy_config = pcall(vim.json.decode, content) if success and lazy_config and lazy_config.ignore then patterns = lazy_config.ignore vim.notify("Loaded " .. #patterns .. " exclude patterns from lazy.json", vim.log.levels.INFO) end end end
return patternsend
return { "folke/snacks.nvim", priority = 1000, lazy = false, ---@type snacks.Config opts = { animate = { animate = { duration = { step = 20 }, -- Adjust for smoothness easing = "outQuad", -- Similar to your stiffness settings fps = 60, }, }, gh = {}, picker = { sources = { gh_issue = {}, gh_pr = {}, explorer = { hidden = false, layout = { layout = { position = "right" } }, exclude = get_exclude_patterns(), }, }, }, bigfile = { enabled = true }, dashboard = { enabled = true, sections = { { section = "header", padding = 5 }, { section = "keys", gap = 1, padding = 1 }, }, preset = { header = [[ {{- if not (hasKey . "isPersonal") }} {{- fail "Config not initialized. Please set CHEZMOI_MACHINE_PROFILE=work (or personal) and run 'chezmoi init' first" }} {{- end }} {{- if .isPersonal -}} • ┓ ┓•┏┓┓┏┓┏┓┃┏┫┓┛ ┗┛┗┗┻┗┗┻┗ {{- else -}}▗▖ ▗▖ ▗▄▖ ▗▖ ▗▖▗▄▄▄▖▗▄▄▖ ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌ ▐▌▐▛▀▜▌▐▌ ▐▌▐▌ ▐▌▐▛▀▀▘▐▛▀▚▖▐▌ ▐▌▝▚▄▞▘ ▝▚▞▘ ▐▙▄▄▖▐▌ ▐▌ {{- end -}}]], }, }, notifier = { timeout = 2000, top_down = false, }, quickfile = { enabled = true }, statuscolumn = { enabled = true }, words = { enabled = true }, styles = { notification = { wo = { wrap = true }, -- Wrap notifications }, }, }, keys = { { "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications", }, { "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer", }, { "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit", }, { "<leader>gb", function() Snacks.git.blame_line() end, desc = "Git Blame Line", }, { "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", }, { "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit Current File History", }, { "<leader>gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log (cwd)", }, { "<leader>cR", function() Snacks.rename.rename_file() end, desc = "Rename File", }, { "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal", }, { "<c-_>", function() Snacks.terminal() end, desc = "which_key_ignore", }, { "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" }, }, { "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" }, }, { "<leader>N", desc = "Neovim News", function() Snacks.win({ file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], width = 0.6, height = 0.6, wo = { spell = false, wrap = false, signcolumn = "yes", statuscolumn = " ", conceallevel = 3, }, }) end, }, { "<leader>gi", function() Snacks.picker.gh_issue() end, desc = "GitHub Issues (open)", }, { "<leader>gI", function() Snacks.picker.gh_issue({ state = "all" }) end, desc = "GitHub Issues (all)", }, { "<leader>gp", function() Snacks.picker.gh_pr() end, desc = "GitHub Pull Requests (open)", }, { "<leader>gP", function() Snacks.picker.gh_pr({ state = "all" }) end, desc = "GitHub Pull Requests (all)", }, }, init = function() vim.api.nvim_create_autocmd("User", { pattern = "VeryLazy", callback = function() _G.dd = function(...) Snacks.debug.inspect(...) end _G.bt = function() Snacks.debug.backtrace() end vim.print = _G.dd
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us") Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw") Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL") Snacks.toggle.diagnostics():map("<leader>ud") Snacks.toggle.line_number():map("<leader>ul") Snacks.toggle .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) :map("<leader>uc") Snacks.toggle.treesitter():map("<leader>uT") Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub") Snacks.toggle.inlay_hints():map("<leader>uh") end, }) end,}