|
| 1 | +return { |
| 2 | + "folke/snacks.nvim", |
| 3 | + priority = 1000, |
| 4 | + lazy = false, |
| 5 | + dependencies = { "nvim-treesitter/nvim-treesitter" }, |
| 6 | + opts = { picker = { ui_select = true } }, |
| 7 | + specs = { |
| 8 | + { |
| 9 | + "AstroNvim/astrocore", |
| 10 | + opts = function(_, opts) |
| 11 | + local maps = opts.mappings |
| 12 | + maps.n["<Leader>f"] = vim.tbl_get(opts, "_map_sections", "f") |
| 13 | + if vim.fn.executable "git" == 1 then |
| 14 | + maps.n["<Leader>g"] = vim.tbl_get(opts, "_map_sections", "g") |
| 15 | + maps.n["<Leader>gb"] = { function() require("snacks").picker.git_branches() end, desc = "Git branches" } |
| 16 | + maps.n["<Leader>gc"] = { |
| 17 | + function() require("snacks").picker.git_log() end, |
| 18 | + desc = "Git commits (repository)", |
| 19 | + } |
| 20 | + maps.n["<Leader>gC"] = { |
| 21 | + function() require("snacks").picker.git_log { current_file = true, follow = true } end, |
| 22 | + desc = "Git commits (current file)", |
| 23 | + } |
| 24 | + maps.n["<Leader>gt"] = { function() require("snacks").picker.git_status() end, desc = "Git status" } |
| 25 | + end |
| 26 | + maps.n["<Leader>f<CR>"] = { function() require("snacks").picker.resume() end, desc = "Resume previous search" } |
| 27 | + maps.n["<Leader>f'"] = { function() require("snacks").picker.marks() end, desc = "Find marks" } |
| 28 | + maps.n["<Leader>fl"] = { |
| 29 | + function() require("snacks").picker.lines() end, |
| 30 | + desc = "Find lines", |
| 31 | + } |
| 32 | + maps.n["<Leader>fa"] = { |
| 33 | + function() require("snacks").picker.files { cwd = vim.fn.stdpath "config", desc = "Config Files" } end, |
| 34 | + desc = "Find AstroNvim config files", |
| 35 | + } |
| 36 | + maps.n["<Leader>fb"] = { function() require("snacks").picker.buffers() end, desc = "Find buffers" } |
| 37 | + maps.n["<Leader>fc"] = { function() require("snacks").picker.grep_word() end, desc = "Find word under cursor" } |
| 38 | + maps.n["<Leader>fC"] = { function() require("snacks").picker.commands() end, desc = "Find commands" } |
| 39 | + maps.n["<Leader>ff"] = { |
| 40 | + function() |
| 41 | + require("snacks").picker.files { |
| 42 | + hidden = vim.tbl_get((vim.uv or vim.loop).fs_stat ".git" or {}, "type") == "directory", |
| 43 | + } |
| 44 | + end, |
| 45 | + desc = "Find files", |
| 46 | + } |
| 47 | + maps.n["<Leader>fF"] = { |
| 48 | + function() require("snacks").picker.files { hidden = true, ignored = true } end, |
| 49 | + desc = "Find all files", |
| 50 | + } |
| 51 | + maps.n["<Leader>fg"] = { function() require("snacks").picker.git_files() end, desc = "Find git files" } |
| 52 | + maps.n["<Leader>fh"] = { function() require("snacks").picker.help() end, desc = "Find help" } |
| 53 | + maps.n["<Leader>fk"] = { function() require("snacks").picker.keymaps() end, desc = "Find keymaps" } |
| 54 | + maps.n["<Leader>fm"] = { function() require("snacks").picker.man() end, desc = "Find man" } |
| 55 | + maps.n["<Leader>fo"] = { function() require("snacks").picker.recent() end, desc = "Find old files" } |
| 56 | + maps.n["<Leader>fO"] = |
| 57 | + { function() require("snacks").picker.recent { cwd = true } end, desc = "Find old files (cwd)" } |
| 58 | + maps.n["<Leader>fr"] = { function() require("snacks").picker.registers() end, desc = "Find registers" } |
| 59 | + maps.n["<Leader>fs"] = { function() require("snacks").picker.smart() end, desc = "Find buffers/recent/files" } |
| 60 | + maps.n["<Leader>ft"] = { function() require("snacks").picker.colorschemes() end, desc = "Find themes" } |
| 61 | + if vim.fn.executable "rg" == 1 then |
| 62 | + maps.n["<Leader>fw"] = { function() require("snacks").picker.grep() end, desc = "Find words" } |
| 63 | + maps.n["<Leader>fW"] = { |
| 64 | + function() require("snacks").picker.grep { hidden = true, ignored = true } end, |
| 65 | + desc = "Find words in all files", |
| 66 | + } |
| 67 | + end |
| 68 | + maps.n["<Leader>lD"] = { function() require("snacks").picker.diagnostics() end, desc = "Search diagnostics" } |
| 69 | + maps.n["<Leader>ls"] = { function() require("snacks").picker.lsp_symbols() end, desc = "Search symbols" } |
| 70 | + end, |
| 71 | + }, |
| 72 | + { |
| 73 | + "folke/todo-comments.nvim", |
| 74 | + optional = true, |
| 75 | + dependencies = { "folke/snacks.nvim" }, |
| 76 | + specs = { |
| 77 | + { |
| 78 | + "AstroNvim/astrocore", |
| 79 | + opts = { |
| 80 | + mappings = { |
| 81 | + n = { |
| 82 | + ["<Leader>fT"] = { |
| 83 | + function() |
| 84 | + if not package.loaded["todo-comments"] then -- make sure to load todo-comments |
| 85 | + require("lazy").load { plugins = { "todo-comments.nvim" } } |
| 86 | + end |
| 87 | + require("snacks").picker.todo_comments() |
| 88 | + end, |
| 89 | + desc = "Todo Comments", |
| 90 | + }, |
| 91 | + }, |
| 92 | + }, |
| 93 | + }, |
| 94 | + }, |
| 95 | + }, |
| 96 | + }, |
| 97 | + { |
| 98 | + "nvim-neo-tree/neo-tree.nvim", |
| 99 | + optional = true, |
| 100 | + opts = { |
| 101 | + commands = { |
| 102 | + find_in_dir = function(state) |
| 103 | + local node = state.tree:get_node() |
| 104 | + local path = node.type == "file" and node:get_parent_id() or node:get_id() |
| 105 | + require("snacks").picker.files { cwd = path } |
| 106 | + end, |
| 107 | + }, |
| 108 | + window = { mappings = { F = "find_in_dir" } }, |
| 109 | + }, |
| 110 | + }, |
| 111 | + { "nvim-telescope/telescope.nvim", enabled = false }, |
| 112 | + { "stevearc/dressing.nvim", opts = { select = { enabled = false } } }, |
| 113 | + }, |
| 114 | +} |
0 commit comments