From 8eb3e368741de3c5f22d145382f6620bee44b470 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Sun, 9 Feb 2025 14:08:34 +0000 Subject: [PATCH] lazyvim: absorb Snacks utils * bigfile * quickfile * scratch * terminal --- nvim/lua/plugins/snacks.lua | 41 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/nvim/lua/plugins/snacks.lua b/nvim/lua/plugins/snacks.lua index ae02a9b..af027ad 100644 --- a/nvim/lua/plugins/snacks.lua +++ b/nvim/lua/plugins/snacks.lua @@ -1,14 +1,35 @@ +-- Terminal Mappings +local function term_nav(dir) + ---@param self snacks.terminal + return function(self) + return self:is_floating() and "" or vim.schedule(function() + vim.cmd.wincmd(dir) + end) + end +end + return { { "folke/snacks.nvim", - opts = {}, - config = function(_, opts) - local notify = vim.notify - require("snacks").setup(opts) - -- HACK: restore vim.notify after snacks setup and let noice.nvim take over - -- this is needed to have early notifications show up in noice history - if LazyVim.has("noice.nvim") then - vim.notify = notify - end - end, + -- stylua: ignore + keys = { + -- Snacks Scratch + { ".", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" }, + { "S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" }, + { "dps", function() Snacks.profiler.scratch() end, desc = "Profiler Scratch Buffer" }, + }, + opts = { + bigfile = { enabled = true }, + quickfile = { enabled = true }, + terminal = { + win = { + keys = { + nav_h = { "", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" }, + nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, + nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, + nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, + }, + }, + }, + }, } } -- 2.48.1