]> git.rmz.io Git - dotfiles.git/blob - nvim/lua/plugins/snacks.lua
nvim: don't quit nvim from dashboard
[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 quickfile = { enabled = true },
23 terminal = {
24 win = {
25 keys = {
26 nav_h = { "<C-h>", term_nav("h"), desc = "Go to Left Window", expr = true, mode = "t" },
27 nav_j = { "<C-j>", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" },
28 nav_k = { "<C-k>", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" },
29 nav_l = { "<C-l>", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" },
30 },
31 },
32 },
33 dashboard = {
34 preset = {
35 pick = function(cmd, opts)
36 return LazyVim.pick(cmd, opts)()
37 end,
38 -- TODO: replace header
39 header = [[
40 ██╗ █████╗ ██╗ ██╗███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
41 ██║ ██╔══██╗██║ ██║╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
42 ██║ ██║ ██║██║ ██║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
43 ██║ ██║ ██║██║ ██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
44 ███████╗╚█████╔╝╚██████╔╝███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
45 ╚══════╝ ╚════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]],
46 -- stylua: ignore
47 ---@type snacks.dashboard.Item[]
48 keys = {
49 { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
50 { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" },
51 { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
52 { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
53 { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
54 { icon = " ", key = "s", desc = "Restore Session", section = "session" },
55 { icon = " ", key = "x", desc = "Lazy Extras", action = ":LazyExtras" },
56 { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" },
57 },
58 },
59 },
60 },
61 }
62 }