A readme explaining how to make neovim work fast
using snacks explorer
6 files changed, +597 -43
+6-8lazy-lock.json
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | "firenvim": { "branch": "master", "commit": "c4ab7d2aeb145cd93db8660cb134f771722f2b5e" }, |
| 16 | 16 | "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, |
| 17 | 17 | "friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" }, |
| 18 | - "gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" }, | |
| 18 | + "gitsigns.nvim": { "branch": "main", "commit": "9cd665f46ab7af2e49d140d328b8e72ea1cf511b" }, | |
| 19 | 19 | "grug-far.nvim": { "branch": "main", "commit": "631331f9c6611b1a47e887f50b92b7cf450f51e7" }, |
| 20 | 20 | "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, |
| 21 | 21 | "hydra.nvim": { "branch": "main", "commit": "f3d4822060376cb253d4cc0d5af2c272c28de2a7" }, |
| @@ -30,20 +30,18 @@ | ||
| 30 | 30 | "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, |
| 31 | 31 | "mini.pairs": { "branch": "main", "commit": "69864a2efb36c030877421634487fd90db1e4298" }, |
| 32 | 32 | "multicursors.nvim": { "branch": "main", "commit": "72225ea9e4443c3f4b9df91d0193e07c4ee8d382" }, |
| 33 | - "neo-tree.nvim": { "branch": "main", "commit": "299e174c3b8373c9c1f9be0bc3967c852712d0f3" }, | |
| 34 | - "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, | |
| 35 | 33 | "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, |
| 36 | 34 | "nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" }, |
| 37 | 35 | "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, |
| 38 | - "nvim-lspconfig": { "branch": "master", "commit": "a9d8e659df04eb48d4224798777eb33992692333" }, | |
| 39 | - "nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" }, | |
| 40 | - "nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" }, | |
| 41 | - "nvim-treesitter-textobjects": { "branch": "master", "commit": "205e3369bc83d8cb83f7409c36120e24611f8c5c" }, | |
| 36 | + "nvim-lspconfig": { "branch": "master", "commit": "f448052a80c0bd93f479bb644a5164b9a4e2a31d" }, | |
| 37 | + "nvim-tree.lua": { "branch": "master", "commit": "582ae48c9e43d2bcd55dfcc8e2e7a1f29065d924" }, | |
| 38 | + "nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" }, | |
| 39 | + "nvim-treesitter-textobjects": { "branch": "master", "commit": "ed373482db797bbf71bdff37a15c7555a84dce47" }, | |
| 42 | 40 | "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, |
| 43 | 41 | "persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" }, |
| 44 | 42 | "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, |
| 45 | 43 | "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, |
| 46 | - "render-markdown.nvim": { "branch": "main", "commit": "78ffe3b0500bbc7e37fabde723d96661538e8b32" }, | |
| 44 | + "render-markdown.nvim": { "branch": "main", "commit": "bff12b4655d1537cf0f10859fcd63ef2cec65010" }, | |
| 47 | 45 | "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, |
| 48 | 46 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, |
| 49 | 47 | "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, |
+0-1lazyvim.json
| @@ -5,7 +5,6 @@ | ||
| 5 | 5 | "lazyvim.plugins.extras.coding.luasnip", |
| 6 | 6 | "lazyvim.plugins.extras.coding.yanky", |
| 7 | 7 | "lazyvim.plugins.extras.editor.harpoon2", |
| 8 | - "lazyvim.plugins.extras.editor.neo-tree", | |
| 9 | 8 | "lazyvim.plugins.extras.editor.telescope", |
| 10 | 9 | "lazyvim.plugins.extras.lang.git", |
| 11 | 10 | "lazyvim.plugins.extras.lang.go", |
+0-15lua/config/keymaps/init.lua
| @@ -56,18 +56,3 @@ vim.keymap.set("n", "zk", function() | ||
| 56 | 56 | vim.cmd("normal zx") |
| 57 | 57 | vim.cmd("normal zM") |
| 58 | 58 | end, { desc = "Forcefully fold comments" }) |
| 59 | - | |
| 60 | --- leader space to neovim directory | |
| 61 | -vim.keymap.set("n", "<leader><Space>", function() | |
| 62 | - local neotree = require("neo-tree.sources.manager").get_state("filesystem") | |
| 63 | - local root = neotree.path or vim.fn.getcwd() -- fallback if somehow nil | |
| 64 | - require("telescope.builtin").find_files({ cwd = root }) | |
| 65 | -end, { desc = "Find files from Neo-tree root" }) | |
| 66 | - | |
| 67 | --- live grep for neovim directory instead of | |
| 68 | --- the entire project | |
| 69 | -vim.keymap.set("n", "<leader>/", function() | |
| 70 | - local neotree = require("neo-tree.sources.manager").get_state("filesystem") | |
| 71 | - local root = neotree and neotree.path or vim.fn.getcwd() | |
| 72 | - require("telescope.builtin").live_grep({ cwd = root }) | |
| 73 | -end, { desc = "Live grep Neo-tree root" }) |
+16-18lua/plugins/neotree.lua
| @@ -1,24 +1,22 @@ | ||
| 1 | 1 | return { |
| 2 | - { | |
| 3 | - -- https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes#open-with-system-viewer | |
| 4 | - "nvim-neo-tree/neo-tree.nvim", | |
| 5 | - -- enabled = false, | |
| 6 | - opts = { | |
| 7 | - filesystem = { | |
| 8 | - hijack_netrw_behavior = "disabled", | |
| 9 | - window = { | |
| 10 | - mappings = { | |
| 11 | - ["O"] = "system_open", | |
| 12 | - }, | |
| 2 | + -- https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes#open-with-system-viewer | |
| 3 | + "nvim-neo-tree/neo-tree.nvim", | |
| 4 | + enabled = false, | |
| 5 | + opts = { | |
| 6 | + filesystem = { | |
| 7 | + hijack_netrw_behavior = "disabled", | |
| 8 | + window = { | |
| 9 | + mappings = { | |
| 10 | + ["O"] = "system_open", | |
| 13 | 11 | }, |
| 14 | 12 | }, |
| 15 | - commands = { | |
| 16 | - system_open = function(state) | |
| 17 | - local node = state.tree:get_node() | |
| 18 | - local path = node:get_id() | |
| 19 | - vim.fn.jobstart({ "wslview", path }, { detach = true }) | |
| 20 | - end, | |
| 21 | - }, | |
| 13 | + }, | |
| 14 | + commands = { | |
| 15 | + system_open = function(state) | |
| 16 | + local node = state.tree:get_node() | |
| 17 | + local path = node:get_id() | |
| 18 | + vim.fn.jobstart({ "wslview", path }, { detach = true }) | |
| 19 | + end, | |
| 22 | 20 | }, |
| 23 | 21 | }, |
| 24 | 22 | } |
+26-1lua/plugins/nvim-tree.lua
| @@ -2,6 +2,31 @@ return { | ||
| 2 | 2 | "nvim-tree/nvim-tree.lua", |
| 3 | 3 | enabled = false, |
| 4 | 4 | config = function() |
| 5 | - require("nvim-tree").setup() | |
| 5 | + local nvim_tree = require("nvim-tree") | |
| 6 | + local api = require("nvim-tree.api") | |
| 7 | + | |
| 8 | + -- Setup first | |
| 9 | + nvim_tree.setup() | |
| 10 | + | |
| 11 | + -- Track last known root | |
| 12 | + local last_root = vim.fn.getcwd() | |
| 13 | + vim.api.nvim_create_autocmd("BufEnter", { | |
| 14 | + pattern = "NvimTree_*", | |
| 15 | + callback = function() | |
| 16 | + local root = api.tree.get_root() | |
| 17 | + if root and root.absolute_path then | |
| 18 | + last_root = root.absolute_path | |
| 19 | + vim.notify("move root to " .. last_root) | |
| 20 | + end | |
| 21 | + end, | |
| 22 | + }) | |
| 23 | + -- -- Smart toggle with saved root | |
| 24 | + -- vim.keymap.set("n", "<leader>e", function() | |
| 25 | + -- if api.tree.is_visible() then | |
| 26 | + -- api.tree.close() | |
| 27 | + -- else | |
| 28 | + -- api.tree.open({ path = last_root }) | |
| 29 | + -- end | |
| 30 | + -- end, { desc = "Toggle Nvim-Tree at last location" }) | |
| 6 | 31 | end, |
| 7 | 32 | } |
+549-0lua/plugins/snacks.lua
| @@ -0,0 +1,549 @@ | ||
| 1 | +local cwd = vim.fn.getcwd() | |
| 2 | +return { | |
| 3 | + "folke/snacks.nvim", | |
| 4 | + priority = 1000, | |
| 5 | + lazy = false, | |
| 6 | + ---@type snacks.Config | |
| 7 | + opts = { | |
| 8 | + bigfile = { enabled = true }, | |
| 9 | + dashboard = { enabled = true }, | |
| 10 | + explorer = { enabled = true }, | |
| 11 | + indent = { enabled = true }, | |
| 12 | + input = { enabled = true }, | |
| 13 | + notifier = { | |
| 14 | + enabled = true, | |
| 15 | + timeout = 3000, | |
| 16 | + }, | |
| 17 | + picker = { enabled = true }, | |
| 18 | + quickfile = { enabled = true }, | |
| 19 | + scope = { enabled = true }, | |
| 20 | + scroll = { enabled = true }, | |
| 21 | + statuscolumn = { enabled = true }, | |
| 22 | + words = { enabled = true }, | |
| 23 | + styles = {}, | |
| 24 | + }, | |
| 25 | + keys = { | |
| 26 | + -- Top Pickers & Explorer | |
| 27 | + { | |
| 28 | + "<leader><space>", | |
| 29 | + function() | |
| 30 | + Snacks.picker.smart({ cwd = cwd }) | |
| 31 | + end, | |
| 32 | + desc = "Smart Find Files", | |
| 33 | + }, | |
| 34 | + { | |
| 35 | + "<leader>,", | |
| 36 | + function() | |
| 37 | + Snacks.picker.buffers() | |
| 38 | + end, | |
| 39 | + desc = "Buffers", | |
| 40 | + }, | |
| 41 | + { | |
| 42 | + "<leader>/", | |
| 43 | + function() | |
| 44 | + Snacks.picker.grep() | |
| 45 | + end, | |
| 46 | + desc = "Grep", | |
| 47 | + }, | |
| 48 | + { | |
| 49 | + "<leader>:", | |
| 50 | + function() | |
| 51 | + Snacks.picker.command_history() | |
| 52 | + end, | |
| 53 | + desc = "Command History", | |
| 54 | + }, | |
| 55 | + { | |
| 56 | + "<leader>n", | |
| 57 | + function() | |
| 58 | + Snacks.picker.notifications() | |
| 59 | + end, | |
| 60 | + desc = "Notification History", | |
| 61 | + }, | |
| 62 | + { | |
| 63 | + "<leader>e", | |
| 64 | + function() | |
| 65 | + Snacks.explorer({ cwd = cwd }) | |
| 66 | + end, | |
| 67 | + desc = "File Explorer", | |
| 68 | + }, | |
| 69 | + { | |
| 70 | + "<leader>E", | |
| 71 | + function() | |
| 72 | + Snacks.explorer() | |
| 73 | + end, | |
| 74 | + desc = "Root File Explorer", | |
| 75 | + }, | |
| 76 | + -- find | |
| 77 | + { | |
| 78 | + "<leader>fb", | |
| 79 | + function() | |
| 80 | + Snacks.picker.buffers() | |
| 81 | + end, | |
| 82 | + desc = "Buffers", | |
| 83 | + }, | |
| 84 | + { | |
| 85 | + "<leader>fc", | |
| 86 | + function() | |
| 87 | + Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) | |
| 88 | + end, | |
| 89 | + desc = "Find Config File", | |
| 90 | + }, | |
| 91 | + { | |
| 92 | + "<leader>ff", | |
| 93 | + function() | |
| 94 | + Snacks.picker.files() | |
| 95 | + end, | |
| 96 | + desc = "Find Files", | |
| 97 | + }, | |
| 98 | + { | |
| 99 | + "<leader>fg", | |
| 100 | + function() | |
| 101 | + Snacks.picker.git_files() | |
| 102 | + end, | |
| 103 | + desc = "Find Git Files", | |
| 104 | + }, | |
| 105 | + { | |
| 106 | + "<leader>fp", | |
| 107 | + function() | |
| 108 | + Snacks.picker.projects() | |
| 109 | + end, | |
| 110 | + desc = "Projects", | |
| 111 | + }, | |
| 112 | + { | |
| 113 | + "<leader>fr", | |
| 114 | + function() | |
| 115 | + Snacks.picker.recent() | |
| 116 | + end, | |
| 117 | + desc = "Recent", | |
| 118 | + }, | |
| 119 | + -- git | |
| 120 | + { | |
| 121 | + "<leader>gb", | |
| 122 | + function() | |
| 123 | + Snacks.picker.git_branches() | |
| 124 | + end, | |
| 125 | + desc = "Git Branches", | |
| 126 | + }, | |
| 127 | + { | |
| 128 | + "<leader>gl", | |
| 129 | + function() | |
| 130 | + Snacks.picker.git_log() | |
| 131 | + end, | |
| 132 | + desc = "Git Log", | |
| 133 | + }, | |
| 134 | + { | |
| 135 | + "<leader>gL", | |
| 136 | + function() | |
| 137 | + Snacks.picker.git_log_line() | |
| 138 | + end, | |
| 139 | + desc = "Git Log Line", | |
| 140 | + }, | |
| 141 | + { | |
| 142 | + "<leader>gs", | |
| 143 | + function() | |
| 144 | + Snacks.picker.git_status() | |
| 145 | + end, | |
| 146 | + desc = "Git Status", | |
| 147 | + }, | |
| 148 | + { | |
| 149 | + "<leader>gS", | |
| 150 | + function() | |
| 151 | + Snacks.picker.git_stash() | |
| 152 | + end, | |
| 153 | + desc = "Git Stash", | |
| 154 | + }, | |
| 155 | + { | |
| 156 | + "<leader>gd", | |
| 157 | + function() | |
| 158 | + Snacks.picker.git_diff() | |
| 159 | + end, | |
| 160 | + desc = "Git Diff (Hunks)", | |
| 161 | + }, | |
| 162 | + { | |
| 163 | + "<leader>gf", | |
| 164 | + function() | |
| 165 | + Snacks.picker.git_log_file() | |
| 166 | + end, | |
| 167 | + desc = "Git Log File", | |
| 168 | + }, | |
| 169 | + -- Grep | |
| 170 | + { | |
| 171 | + "<leader>sb", | |
| 172 | + function() | |
| 173 | + Snacks.picker.lines() | |
| 174 | + end, | |
| 175 | + desc = "Buffer Lines", | |
| 176 | + }, | |
| 177 | + { | |
| 178 | + "<leader>sB", | |
| 179 | + function() | |
| 180 | + Snacks.picker.grep_buffers() | |
| 181 | + end, | |
| 182 | + desc = "Grep Open Buffers", | |
| 183 | + }, | |
| 184 | + { | |
| 185 | + "<leader>sg", | |
| 186 | + function() | |
| 187 | + Snacks.picker.grep() | |
| 188 | + end, | |
| 189 | + desc = "Grep", | |
| 190 | + }, | |
| 191 | + { | |
| 192 | + "<leader>sw", | |
| 193 | + function() | |
| 194 | + Snacks.picker.grep_word() | |
| 195 | + end, | |
| 196 | + desc = "Visual selection or word", | |
| 197 | + mode = { "n", "x" }, | |
| 198 | + }, | |
| 199 | + -- search | |
| 200 | + { | |
| 201 | + '<leader>s"', | |
| 202 | + function() | |
| 203 | + Snacks.picker.registers() | |
| 204 | + end, | |
| 205 | + desc = "Registers", | |
| 206 | + }, | |
| 207 | + { | |
| 208 | + "<leader>s/", | |
| 209 | + function() | |
| 210 | + Snacks.picker.search_history() | |
| 211 | + end, | |
| 212 | + desc = "Search History", | |
| 213 | + }, | |
| 214 | + { | |
| 215 | + "<leader>sa", | |
| 216 | + function() | |
| 217 | + Snacks.picker.autocmds() | |
| 218 | + end, | |
| 219 | + desc = "Autocmds", | |
| 220 | + }, | |
| 221 | + { | |
| 222 | + "<leader>sb", | |
| 223 | + function() | |
| 224 | + Snacks.picker.lines() | |
| 225 | + end, | |
| 226 | + desc = "Buffer Lines", | |
| 227 | + }, | |
| 228 | + { | |
| 229 | + "<leader>sc", | |
| 230 | + function() | |
| 231 | + Snacks.picker.command_history() | |
| 232 | + end, | |
| 233 | + desc = "Command History", | |
| 234 | + }, | |
| 235 | + { | |
| 236 | + "<leader>sC", | |
| 237 | + function() | |
| 238 | + Snacks.picker.commands() | |
| 239 | + end, | |
| 240 | + desc = "Commands", | |
| 241 | + }, | |
| 242 | + { | |
| 243 | + "<leader>sd", | |
| 244 | + function() | |
| 245 | + Snacks.picker.diagnostics() | |
| 246 | + end, | |
| 247 | + desc = "Diagnostics", | |
| 248 | + }, | |
| 249 | + { | |
| 250 | + "<leader>sD", | |
| 251 | + function() | |
| 252 | + Snacks.picker.diagnostics_buffer() | |
| 253 | + end, | |
| 254 | + desc = "Buffer Diagnostics", | |
| 255 | + }, | |
| 256 | + { | |
| 257 | + "<leader>sh", | |
| 258 | + function() | |
| 259 | + Snacks.picker.help() | |
| 260 | + end, | |
| 261 | + desc = "Help Pages", | |
| 262 | + }, | |
| 263 | + { | |
| 264 | + "<leader>sH", | |
| 265 | + function() | |
| 266 | + Snacks.picker.highlights() | |
| 267 | + end, | |
| 268 | + desc = "Highlights", | |
| 269 | + }, | |
| 270 | + { | |
| 271 | + "<leader>si", | |
| 272 | + function() | |
| 273 | + Snacks.picker.icons() | |
| 274 | + end, | |
| 275 | + desc = "Icons", | |
| 276 | + }, | |
| 277 | + { | |
| 278 | + "<leader>sj", | |
| 279 | + function() | |
| 280 | + Snacks.picker.jumps() | |
| 281 | + end, | |
| 282 | + desc = "Jumps", | |
| 283 | + }, | |
| 284 | + { | |
| 285 | + "<leader>sk", | |
| 286 | + function() | |
| 287 | + Snacks.picker.keymaps() | |
| 288 | + end, | |
| 289 | + desc = "Keymaps", | |
| 290 | + }, | |
| 291 | + { | |
| 292 | + "<leader>sl", | |
| 293 | + function() | |
| 294 | + Snacks.picker.loclist() | |
| 295 | + end, | |
| 296 | + desc = "Location List", | |
| 297 | + }, | |
| 298 | + { | |
| 299 | + "<leader>sm", | |
| 300 | + function() | |
| 301 | + Snacks.picker.marks() | |
| 302 | + end, | |
| 303 | + desc = "Marks", | |
| 304 | + }, | |
| 305 | + { | |
| 306 | + "<leader>sM", | |
| 307 | + function() | |
| 308 | + Snacks.picker.man() | |
| 309 | + end, | |
| 310 | + desc = "Man Pages", | |
| 311 | + }, | |
| 312 | + { | |
| 313 | + "<leader>sp", | |
| 314 | + function() | |
| 315 | + Snacks.picker.lazy() | |
| 316 | + end, | |
| 317 | + desc = "Search for Plugin Spec", | |
| 318 | + }, | |
| 319 | + { | |
| 320 | + "<leader>sq", | |
| 321 | + function() | |
| 322 | + Snacks.picker.qflist() | |
| 323 | + end, | |
| 324 | + desc = "Quickfix List", | |
| 325 | + }, | |
| 326 | + { | |
| 327 | + "<leader>sR", | |
| 328 | + function() | |
| 329 | + Snacks.picker.resume() | |
| 330 | + end, | |
| 331 | + desc = "Resume", | |
| 332 | + }, | |
| 333 | + { | |
| 334 | + "<leader>su", | |
| 335 | + function() | |
| 336 | + Snacks.picker.undo() | |
| 337 | + end, | |
| 338 | + desc = "Undo History", | |
| 339 | + }, | |
| 340 | + { | |
| 341 | + "<leader>uC", | |
| 342 | + function() | |
| 343 | + Snacks.picker.colorschemes() | |
| 344 | + end, | |
| 345 | + desc = "Colorschemes", | |
| 346 | + }, | |
| 347 | + -- LSP | |
| 348 | + { | |
| 349 | + "gd", | |
| 350 | + function() | |
| 351 | + Snacks.picker.lsp_definitions() | |
| 352 | + end, | |
| 353 | + desc = "Goto Definition", | |
| 354 | + }, | |
| 355 | + { | |
| 356 | + "gD", | |
| 357 | + function() | |
| 358 | + Snacks.picker.lsp_declarations() | |
| 359 | + end, | |
| 360 | + desc = "Goto Declaration", | |
| 361 | + }, | |
| 362 | + { | |
| 363 | + "gr", | |
| 364 | + function() | |
| 365 | + Snacks.picker.lsp_references() | |
| 366 | + end, | |
| 367 | + nowait = true, | |
| 368 | + desc = "References", | |
| 369 | + }, | |
| 370 | + { | |
| 371 | + "gI", | |
| 372 | + function() | |
| 373 | + Snacks.picker.lsp_implementations() | |
| 374 | + end, | |
| 375 | + desc = "Goto Implementation", | |
| 376 | + }, | |
| 377 | + { | |
| 378 | + "gy", | |
| 379 | + function() | |
| 380 | + Snacks.picker.lsp_type_definitions() | |
| 381 | + end, | |
| 382 | + desc = "Goto T[y]pe Definition", | |
| 383 | + }, | |
| 384 | + { | |
| 385 | + "<leader>ss", | |
| 386 | + function() | |
| 387 | + Snacks.picker.lsp_symbols() | |
| 388 | + end, | |
| 389 | + desc = "LSP Symbols", | |
| 390 | + }, | |
| 391 | + { | |
| 392 | + "<leader>sS", | |
| 393 | + function() | |
| 394 | + Snacks.picker.lsp_workspace_symbols() | |
| 395 | + end, | |
| 396 | + desc = "LSP Workspace Symbols", | |
| 397 | + }, | |
| 398 | + -- Other | |
| 399 | + { | |
| 400 | + "<leader>z", | |
| 401 | + function() | |
| 402 | + Snacks.zen() | |
| 403 | + end, | |
| 404 | + desc = "Toggle Zen Mode", | |
| 405 | + }, | |
| 406 | + { | |
| 407 | + "<leader>Z", | |
| 408 | + function() | |
| 409 | + Snacks.zen.zoom() | |
| 410 | + end, | |
| 411 | + desc = "Toggle Zoom", | |
| 412 | + }, | |
| 413 | + { | |
| 414 | + "<leader>.", | |
| 415 | + function() | |
| 416 | + Snacks.scratch() | |
| 417 | + end, | |
| 418 | + desc = "Toggle Scratch Buffer", | |
| 419 | + }, | |
| 420 | + { | |
| 421 | + "<leader>S", | |
| 422 | + function() | |
| 423 | + Snacks.scratch.select() | |
| 424 | + end, | |
| 425 | + desc = "Select Scratch Buffer", | |
| 426 | + }, | |
| 427 | + { | |
| 428 | + "<leader>n", | |
| 429 | + function() | |
| 430 | + Snacks.notifier.show_history() | |
| 431 | + end, | |
| 432 | + desc = "Notification History", | |
| 433 | + }, | |
| 434 | + { | |
| 435 | + "<leader>bd", | |
| 436 | + function() | |
| 437 | + Snacks.bufdelete() | |
| 438 | + end, | |
| 439 | + desc = "Delete Buffer", | |
| 440 | + }, | |
| 441 | + { | |
| 442 | + "<leader>cR", | |
| 443 | + function() | |
| 444 | + Snacks.rename.rename_file() | |
| 445 | + end, | |
| 446 | + desc = "Rename File", | |
| 447 | + }, | |
| 448 | + { | |
| 449 | + "<leader>gB", | |
| 450 | + function() | |
| 451 | + Snacks.gitbrowse() | |
| 452 | + end, | |
| 453 | + desc = "Git Browse", | |
| 454 | + mode = { "n", "v" }, | |
| 455 | + }, | |
| 456 | + { | |
| 457 | + "<leader>gg", | |
| 458 | + function() | |
| 459 | + Snacks.lazygit() | |
| 460 | + end, | |
| 461 | + desc = "Lazygit", | |
| 462 | + }, | |
| 463 | + { | |
| 464 | + "<leader>un", | |
| 465 | + function() | |
| 466 | + Snacks.notifier.hide() | |
| 467 | + end, | |
| 468 | + desc = "Dismiss All Notifications", | |
| 469 | + }, | |
| 470 | + { | |
| 471 | + "<c-/>", | |
| 472 | + function() | |
| 473 | + Snacks.terminal() | |
| 474 | + end, | |
| 475 | + desc = "Toggle Terminal", | |
| 476 | + }, | |
| 477 | + { | |
| 478 | + "<c-_>", | |
| 479 | + function() | |
| 480 | + Snacks.terminal() | |
| 481 | + end, | |
| 482 | + desc = "which_key_ignore", | |
| 483 | + }, | |
| 484 | + { | |
| 485 | + "]]", | |
| 486 | + function() | |
| 487 | + Snacks.words.jump(vim.v.count1) | |
| 488 | + end, | |
| 489 | + desc = "Next Reference", | |
| 490 | + mode = { "n", "t" }, | |
| 491 | + }, | |
| 492 | + { | |
| 493 | + "[[", | |
| 494 | + function() | |
| 495 | + Snacks.words.jump(-vim.v.count1) | |
| 496 | + end, | |
| 497 | + desc = "Prev Reference", | |
| 498 | + mode = { "n", "t" }, | |
| 499 | + }, | |
| 500 | + { | |
| 501 | + "<leader>N", | |
| 502 | + desc = "Neovim News", | |
| 503 | + function() | |
| 504 | + Snacks.win({ | |
| 505 | + file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], | |
| 506 | + width = 0.6, | |
| 507 | + height = 0.6, | |
| 508 | + wo = { | |
| 509 | + spell = false, | |
| 510 | + wrap = false, | |
| 511 | + signcolumn = "yes", | |
| 512 | + statuscolumn = " ", | |
| 513 | + conceallevel = 3, | |
| 514 | + }, | |
| 515 | + }) | |
| 516 | + end, | |
| 517 | + }, | |
| 518 | + }, | |
| 519 | + init = function() | |
| 520 | + vim.api.nvim_create_autocmd("User", { | |
| 521 | + pattern = "VeryLazy", | |
| 522 | + callback = function() | |
| 523 | + -- Setup some globals for debugging (lazy-loaded) | |
| 524 | + _G.dd = function(...) | |
| 525 | + Snacks.debug.inspect(...) | |
| 526 | + end | |
| 527 | + _G.bt = function() | |
| 528 | + Snacks.debug.backtrace() | |
| 529 | + end | |
| 530 | + vim.print = _G.dd -- Override print to use snacks for `:=` command | |
| 531 | + | |
| 532 | + -- Create some toggle mappings | |
| 533 | + Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us") | |
| 534 | + Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw") | |
| 535 | + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL") | |
| 536 | + Snacks.toggle.diagnostics():map("<leader>ud") | |
| 537 | + Snacks.toggle.line_number():map("<leader>ul") | |
| 538 | + Snacks.toggle | |
| 539 | + .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) | |
| 540 | + :map("<leader>uc") | |
| 541 | + Snacks.toggle.treesitter():map("<leader>uT") | |
| 542 | + Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub") | |
| 543 | + Snacks.toggle.inlay_hints():map("<leader>uh") | |
| 544 | + Snacks.toggle.indent():map("<leader>ug") | |
| 545 | + Snacks.toggle.dim():map("<leader>uD") | |
| 546 | + end, | |
| 547 | + }) | |
| 548 | + end, | |
| 549 | +} |