diff --git a/lua/pika/plugins/qol.lua b/lua/pika/plugins/qol.lua index a423ecc..e407c50 100644 --- a/lua/pika/plugins/qol.lua +++ b/lua/pika/plugins/qol.lua @@ -229,16 +229,7 @@ return { keys = { { "sr", - function() - local grug = require("grug-far") - local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") - grug.grug_far({ - transient = true, - prefills = { - filesFilter = ext and ext ~= "" and "*." .. ext or nil, - }, - }) - end, + "GrugFar", mode = { "n", "v" }, desc = "Search and Replace", }, @@ -251,7 +242,7 @@ return { { "chrisgrieser/nvim-scissors", lazy = false, - dependencies = { "nvim-telescope/telescope.nvim", "garymjr/nvim-snippets" }, + dependencies = { "garymjr/nvim-snippets" }, -- "nvim-telescope/telescope.nvim" opts = { snippetDir = "~/.config/nvim/snippets", -- <- i have this as a submodule in my neovim config to have a seperate repo https://git.k4li.de/dotfiles/nvim-snippets.git }, diff --git a/lua/pika/plugins/snacks.lua b/lua/pika/plugins/snacks.lua new file mode 100644 index 0000000..e6814f0 --- /dev/null +++ b/lua/pika/plugins/snacks.lua @@ -0,0 +1,371 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + animate = { enabled = false }, + explorer = { enabled = false }, + indent = { enabled = false }, + scroll = { enabled = false }, + + bigfile = { enabled = true }, + quickfile = { enabled = true }, + dashboard = { + row = nil, + col = nil, + pane_gap = 2, + enabled = true, + -- example = "pokemon", + sections = { + { section = "header" }, + { + pane = 2, + section = "terminal", + cmd = "colorscript -e square", + height = 6, + padding = 1, + }, + { section = "keys", gap = 1, padding = 1 }, + { + pane = 2, + icon = " ", + title = "Recent Files", + section = "recent_files", + indent = 2, + padding = 1, + }, + { pane = 2, icon = " ", title = "Projects", section = "projects", indent = 2, padding = 1 }, + { + pane = 2, + icon = " ", + title = "Git Status", + section = "terminal", + enabled = function() + return Snacks.git.get_root() ~= nil + end, + cmd = "git status --short --branch --renames", + height = 5, + padding = 1, + ttl = 5 * 60, + indent = 3, + }, + { section = "startup" }, + }, + }, + }, + keys = { + -- Top Pickers & Explorer + { + "sf", + 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() + 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 + { + "sg", + function() + Snacks.picker.grep() + end, + desc = "Grep", + }, + { + "sw", + function() + Snacks.picker.grep_word() + end, + desc = "Visual selection or word", + mode = { "n", "x" }, + }, + { + "T", + 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", + }, + -- Other + { + "z", + function() + Snacks.zen() + end, + desc = "Toggle Zen Mode", + }, + { + "Z", + function() + Snacks.zen.zoom() + end, + desc = "Toggle Zoom", + }, + { + "n", + function() + Snacks.notifier.show_history() + end, + desc = "Notification History", + }, + { + "cR", + function() + Snacks.rename.rename_file() + end, + desc = "Rename File", + }, + { + "gB", + function() + Snacks.gitbrowse() + end, + desc = "Git Browse", + mode = { "n", "v" }, + }, + { + "gg", + function() + Snacks.lazygit() + end, + desc = "Lazygit", + }, + { + "un", + function() + Snacks.notifier.hide() + end, + desc = "Dismiss All Notifications", + }, + { + "N", + desc = "Neovim News", + function() + Snacks.win({ + file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = "yes", + statuscolumn = " ", + conceallevel = 3, + }, + }) + end, + }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + -- Setup some globals for debugging (lazy-loaded) + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + -- Create some toggle mappings + Snacks.toggle.option("spell", { name = "Spelling" }):map("us") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") + Snacks.toggle.diagnostics():map("ud") + Snacks.toggle.line_number():map("ul") + Snacks.toggle + .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) + :map("uc") + Snacks.toggle.treesitter():map("uT") + Snacks.toggle + .option("background", { off = "light", on = "dark", name = "Dark Background" }) + :map("ub") + Snacks.toggle.inlay_hints():map("uh") + Snacks.toggle.indent():map("ug") + Snacks.toggle.dim():map("uD") + end, + }) + end, + dependencies = { + { + "folke/persistence.nvim", + event = "BufReadPre", + opts = {}, + -- stylua: ignore + keys = { + -- { "qs", function() require("persistence").load() end, desc = "Restore Session" }, + -- { "ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, + -- { "qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" }, + { "db", ":Dashboard", desc = "Dashboard"}, + { "dq", function() require("inspire").show_quote() end, desc = "Show Inspire Quote"}, + }, + }, + }, +}