]> git.rmz.io Git - dotfiles.git/blob - nvim/lua/plugins/snacks.lua
bfd3870f378de96c1c4c4638f464ca56f0a11926
[dotfiles.git] / nvim / lua / plugins / snacks.lua
1 -- Terminal Mappings
2 local function term_nav(dir)
3 ---@param self snacks.terminal
4 return function(self)
5 return self:is_floating() and "<c-" .. dir .. ">" or vim.schedule(function()
6 vim.cmd.wincmd(dir)
7 end)
8 end
9 end
10
11 return {
12 { "folke/snacks.nvim",
13 -- stylua: ignore
14 keys = {
15 -- Snacks Scratch
16 { "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
17 { "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
18 { "<leader>dps", function() Snacks.profiler.scratch() end, desc = "Profiler Scratch Buffer" },
19 },
20 opts = {
21 bigfile = { enabled = true },
22 indent = { enabled = true },
23 input = { enabled = true }, -- NOTE: seems unecessary
24 quickfile = { enabled = true }, -- TODO: review if needed
25 scope = { enabled = true },
26 scroll = { enabled = true },
27 statuscolumn = { enabled = true },
28 terminal = {
29 win = {
30 keys = {
31 nav_h = { "<C-h>", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" },
32 nav_j = { "<C-j>", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" },
33 nav_k = { "<C-k>", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" },
34 nav_l = { "<C-l>", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" },
35 },
36 },
37 },
38 dashboard = {
39 preset = {
40 pick = function(cmd, opts)
41 return LazyVim.pick(cmd, opts)()
42 end,
43 -- TODO: replace header
44 header = [[
45 ██╗ █████╗ ██╗ ██╗███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
46 ██║ ██╔══██╗██║ ██║╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
47 ██║ ██║ ██║██║ ██║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
48 ██║ ██║ ██║██║ ██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
49 ███████╗╚█████╔╝╚██████╔╝███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
50 ╚══════╝ ╚════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]],
51 -- stylua: ignore
52 ---@type snacks.dashboard.Item[]
53 keys = {
54 { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
55 { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" },
56 { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
57 { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
58 { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
59 { icon = " ", key = "s", desc = "Restore Session", section = "session" },
60 { icon = " ", key = "x", desc = "Lazy Extras", action = ":LazyExtras" },
61 { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" },
62 },
63 },
64 },
65 },
66 },
67 { "folke/snacks.nvim",
68 opts = {
69 notifier = { enabled = true },
70 },
71 -- stylua: ignore
72 keys = {
73 -- TODO: review after picking picker (ha)
74 { "<leader>n", function()
75 if Snacks.config.picker and Snacks.config.picker.enabled then
76 Snacks.picker.notifications()
77 else
78 Snacks.notifier.show_history()
79 end
80 end, desc = "Notification History" },
81 { "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
82 },
83 }
84 }