diff --git a/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua b/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua index 26a4a4c..2716628 100644 --- a/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua +++ b/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua @@ -1,12 +1,58 @@ return { "folke/snacks.nvim", + lazy = false, opts = { - explorer = {}, + dim = {}, + explorer = { + replace_netrw = false, + }, input = {}, + lazygit = {}, notifier = {}, - picker = {}, + picker = { + sources = { + explorer = { + auto_close = true, + hidden = true, + ignored = true, + jump = { + close = true, + }, + layout = { + cycle = true, + --- Use the default layout or vertical if the window is too narrow + preset = function() + return vim.o.columns >= 120 and "default" or "vertical" + end, + }, + }, + }, + }, + toggle = {}, }, keys = { + -- Lazygit + { + "hh", + function() + Snacks.lazygit() + end, + desc = "Open Lazygit", + }, + { + "hg", + function() + Snacks.lazygit().log() + end, + desc = "Open Lazygit (log view)", + }, + { + "hf", + function() + Snacks.lazygit().log_file() + end, + desc = "Open Lazygit (current file log view)", + }, -- Top Pickers & Explorer { "", @@ -43,12 +89,35 @@ return { end, desc = "Notification History", }, + -- dim { - "e", + "cj", function() - Snacks.explorer() + Snacks.dim() end, - desc = "File Explorer", + desc = "Dim outside scope", + }, + { + "ck", + function() + Snacks.dim.disable() + end, + desc = "Undim outside scope", + }, + -- explorer + { + "ee", + function() + Snacks.explorer.open() + end, + desc = "File explorer toggle", + }, + { + "ef", + function() + Snacks.explorer.reveal() + end, + desc = "File explorer file reveal", }, -- find { @@ -314,13 +383,6 @@ return { end, desc = "Undo History", }, - { - "uC", - function() - Snacks.picker.colorschemes() - end, - desc = "Colorschemes", - }, -- LSP { "gd", @@ -398,4 +460,24 @@ return { desc = "Select Scratch Buffer", }, }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + -- Create some toggle mappings + Snacks.toggle.option("spell", { name = "Spelling" }):map("us") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") + Snacks.toggle.diagnostics():map("ud") + Snacks.toggle.line_number():map("ul") + Snacks.toggle + .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) + :map("uc") + Snacks.toggle.treesitter():map("uT") + Snacks.toggle.inlay_hints():map("uh") + Snacks.toggle.indent():map("ug") + Snacks.toggle.dim():map("uD") + end, + }) + end, }