diff --git a/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua b/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua new file mode 100644 index 0000000..37ab674 --- /dev/null +++ b/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua @@ -0,0 +1,391 @@ +return { + "folke/snacks.nvim", + opts = { + explorer = {}, + input = {}, + notifier = {}, + picker = {}, + }, + keys = { + -- Top Pickers & Explorer + { + "", + function() + Snacks.picker.smart() + end, + desc = "Smart Find Files", + }, + { + ",", + function() + Snacks.picker.buffers() + end, + desc = "Buffers", + }, + { + "/", + function() + Snacks.picker.grep() + end, + desc = "Grep", + }, + { + ":", + function() + Snacks.picker.command_history() + end, + desc = "Command History", + }, + { + "n", + function() + Snacks.picker.notifications() + end, + desc = "Notification History", + }, + { + "e", + function() + Snacks.explorer() + end, + desc = "File Explorer", + }, + -- find + { + "fb", + function() + Snacks.picker.buffers() + end, + desc = "Buffers", + }, + { + "fc", + function() + Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) + end, + desc = "Find Config File", + }, + { + "ff", + function() + Snacks.picker.files({ hidden = true, ignored = true }) + end, + desc = "Find Files", + }, + { + "fg", + function() + Snacks.picker.git_files() + end, + desc = "Find Git Files", + }, + { + "fp", + function() + Snacks.picker.projects() + end, + desc = "Projects", + }, + { + "fr", + function() + Snacks.picker.recent() + end, + desc = "Recent", + }, + -- git + { + "gb", + function() + Snacks.picker.git_branches() + end, + desc = "Git Branches", + }, + { + "gl", + function() + Snacks.picker.git_log() + end, + desc = "Git Log", + }, + { + "gL", + function() + Snacks.picker.git_log_line() + end, + desc = "Git Log Line", + }, + { + "gs", + function() + Snacks.picker.git_status() + end, + desc = "Git Status", + }, + { + "gS", + function() + Snacks.picker.git_stash() + end, + desc = "Git Stash", + }, + { + "gd", + function() + Snacks.picker.git_diff() + end, + desc = "Git Diff (Hunks)", + }, + { + "gf", + function() + Snacks.picker.git_log_file() + end, + desc = "Git Log File", + }, + -- Grep + { + "sb", + function() + Snacks.picker.lines() + end, + desc = "Buffer Lines", + }, + { + "sB", + function() + Snacks.picker.grep_buffers() + end, + desc = "Grep Open Buffers", + }, + { + "sg", + function() + Snacks.picker.grep() + end, + desc = "Grep", + }, + { + "sw", + function() + Snacks.picker.grep_word() + end, + desc = "Visual selection or word", + mode = { "n", "x" }, + }, + -- search + { + 's"', + function() + Snacks.picker.registers() + end, + desc = "Registers", + }, + { + "s/", + function() + Snacks.picker.search_history() + end, + desc = "Search History", + }, + { + "sa", + function() + Snacks.picker.autocmds() + end, + desc = "Autocmds", + }, + { + "sb", + function() + Snacks.picker.lines() + end, + desc = "Buffer Lines", + }, + { + "sc", + function() + Snacks.picker.command_history() + end, + desc = "Command History", + }, + { + "sC", + function() + Snacks.picker.commands() + end, + desc = "Commands", + }, + { + "sd", + function() + Snacks.picker.diagnostics() + end, + desc = "Diagnostics", + }, + { + "sD", + function() + Snacks.picker.diagnostics_buffer() + end, + desc = "Buffer Diagnostics", + }, + { + "sh", + function() + Snacks.picker.help() + end, + desc = "Help Pages", + }, + { + "sH", + function() + Snacks.picker.highlights() + end, + desc = "Highlights", + }, + { + "si", + function() + Snacks.picker.icons() + end, + desc = "Icons", + }, + { + "sj", + function() + Snacks.picker.jumps() + end, + desc = "Jumps", + }, + { + "sk", + function() + Snacks.picker.keymaps() + end, + desc = "Keymaps", + }, + { + "sl", + function() + Snacks.picker.loclist() + end, + desc = "Location List", + }, + { + "sm", + function() + Snacks.picker.marks() + end, + desc = "Marks", + }, + { + "sM", + function() + Snacks.picker.man() + end, + desc = "Man Pages", + }, + { + "sp", + function() + Snacks.picker.lazy() + end, + desc = "Search for Plugin Spec", + }, + { + "sq", + function() + Snacks.picker.qflist() + end, + desc = "Quickfix List", + }, + { + "sR", + function() + Snacks.picker.resume() + end, + desc = "Resume", + }, + { + "su", + function() + Snacks.picker.undo() + end, + desc = "Undo History", + }, + { + "uC", + function() + Snacks.picker.colorschemes() + end, + desc = "Colorschemes", + }, + -- LSP + { + "gd", + function() + Snacks.picker.lsp_definitions() + end, + desc = "Goto Definition", + }, + { + "gD", + function() + Snacks.picker.lsp_declarations() + end, + desc = "Goto Declaration", + }, + { + "gr", + function() + Snacks.picker.lsp_references() + end, + nowait = true, + desc = "References", + }, + { + "gI", + function() + Snacks.picker.lsp_implementations() + end, + desc = "Goto Implementation", + }, + { + "gy", + function() + Snacks.picker.lsp_type_definitions() + end, + desc = "Goto T[y]pe Definition", + }, + { + "ss", + function() + Snacks.picker.lsp_symbols() + end, + desc = "LSP Symbols", + }, + { + "sS", + function() + Snacks.picker.lsp_workspace_symbols() + end, + desc = "LSP Workspace Symbols", + }, + -- scratch + { + ".", + function() + Snacks.scratch() + end, + desc = "Toggle Scratch Buffer", + }, + { + "S", + function() + Snacks.scratch.select() + end, + desc = "Select Scratch Buffer", + }, + }, +} diff --git a/nvim/.config/nvim/lua/lazy-plugins/lsp-lspconfig.lua b/nvim/.config/nvim/lua/lazy-plugins/lsp-lspconfig.lua index 2226b13..9de8e5f 100644 --- a/nvim/.config/nvim/lua/lazy-plugins/lsp-lspconfig.lua +++ b/nvim/.config/nvim/lua/lazy-plugins/lsp-lspconfig.lua @@ -24,21 +24,6 @@ return { local opts = { buffer = ev.buf, silent = true } -- set keybinds - opts.desc = "Show LSP references" - keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references - - opts.desc = "Go to declaration" - keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration - - opts.desc = "Show LSP definitions" - keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions - - opts.desc = "Show LSP implementations" - keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations - - opts.desc = "Show LSP type definitions" - keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions - opts.desc = "See available code actions" keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection diff --git a/nvim/.config/nvim/lua/lazy-plugins/ui-nvim-tree.lua b/nvim/.config/nvim/lua/lazy-plugins/ui-nvim-tree.lua index 849edcc..d4e82cc 100644 --- a/nvim/.config/nvim/lua/lazy-plugins/ui-nvim-tree.lua +++ b/nvim/.config/nvim/lua/lazy-plugins/ui-nvim-tree.lua @@ -6,6 +6,21 @@ return { vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 + -- Snacks rename integration + local prev = { new_name = "", old_name = "" } -- Prevents duplicate events + vim.api.nvim_create_autocmd("User", { + pattern = "NvimTreeSetup", + callback = function() + local events = require("nvim-tree.api").events + events.subscribe(events.Event.NodeRenamed, function(data) + if prev.new_name ~= data.new_name or prev.old_name ~= data.old_name then + data = data + Snacks.rename.on_rename_file(data.old_name, data.new_name) + end + end) + end, + }) + nvimtree.setup({ view = { width = 35, diff --git a/nvim/.config/nvim/lua/lazy-plugins/ui-telescope.lua b/nvim/.config/nvim/lua/lazy-plugins/ui-telescope.lua index c68e1ac..6874d47 100644 --- a/nvim/.config/nvim/lua/lazy-plugins/ui-telescope.lua +++ b/nvim/.config/nvim/lua/lazy-plugins/ui-telescope.lua @@ -1,6 +1,7 @@ -- Telescope return { "nvim-telescope/telescope.nvim", + enabled = false, dependencies = { "nvim-lua/plenary.nvim", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, @@ -17,11 +18,16 @@ return { i = { [""] = actions.move_selection_previous, -- move to prev result [""] = actions.move_selection_next, -- move to next result - [""] = actions.send_selected_to_qflist + actions.open_qflist, + -- [""] = actions.send_selected_to_qflist + actions.open_qflist, [""] = actions.delete_buffer, }, }, }, + pickers = { + find_files = { + hidden = true, + }, + }, }) telescope.load_extension("fzf") end,