X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/e40788dc38ebea793179795290adf868c5b5feca..fdd63454b51a35418ec23d3489cf20ae66a2299d:/nvim/lua/plugins/snacks.lua diff --git a/nvim/lua/plugins/snacks.lua b/nvim/lua/plugins/snacks.lua index ae02a9b..1d62dd1 100644 --- a/nvim/lua/plugins/snacks.lua +++ b/nvim/lua/plugins/snacks.lua @@ -1,14 +1,62 @@ +-- 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" }, + }, + }, + }, + dashboard = { + preset = { + pick = function(cmd, opts) + return LazyVim.pick(cmd, opts)() + end, + -- TODO: replace header + header = [[ + ██╗ █████╗ ██╗ ██╗███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗██║ ██║╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ██║ ██║██║ ██║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██║ ██║██║ ██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗╚█████╔╝╚██████╔╝███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝ ╚════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], + -- stylua: ignore + ---@type snacks.dashboard.Item[] + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" }, + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = " ", key = "x", desc = "Lazy Extras", action = ":LazyExtras" }, + { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" }, + }, + }, + }, + }, } }