From 27622c55c0d953395b7fa4eb4ba8fe6b4c5db613 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 5 May 2025 17:50:29 +0200 Subject: [PATCH] some changes for the better --- lua/pika/plugins/ai.lua | 4 + lua/pika/plugins/dashboard.lua | 4 + lua/pika/plugins/git.lua | 4 + lua/pika/plugins/qol.lua | 2 +- lua/pika/plugins/snacks.lua | 383 +++++++++++++++++++++++++++++++++ lua/pika/plugins/telescope.lua | 5 + lua/pika/plugins/ui.lua | 60 +++--- 7 files changed, 431 insertions(+), 31 deletions(-) create mode 100644 lua/pika/plugins/snacks.lua diff --git a/lua/pika/plugins/ai.lua b/lua/pika/plugins/ai.lua index 1864ce1..10ab26a 100644 --- a/lua/pika/plugins/ai.lua +++ b/lua/pika/plugins/ai.lua @@ -1,3 +1,7 @@ +if true then + return {} +end +-- WARNING: If this line is true, then the plugin will NOT get sourced! return { { "yetone/avante.nvim", diff --git a/lua/pika/plugins/dashboard.lua b/lua/pika/plugins/dashboard.lua index fc09786..1a283f8 100644 --- a/lua/pika/plugins/dashboard.lua +++ b/lua/pika/plugins/dashboard.lua @@ -1,3 +1,7 @@ +if true then + return {} +end +-- WARNING: If this line is true, then the plugin will NOT get sourced! return { { "RileyGabrielson/inspire.nvim", diff --git a/lua/pika/plugins/git.lua b/lua/pika/plugins/git.lua index 33c4271..cfcdb24 100644 --- a/lua/pika/plugins/git.lua +++ b/lua/pika/plugins/git.lua @@ -1,3 +1,7 @@ +if true then + return {} +end +-- WARNING: If this line is true, then the plugin will NOT get sourced! return { { "sindrets/diffview.nvim", diff --git a/lua/pika/plugins/qol.lua b/lua/pika/plugins/qol.lua index 95d2da7..cc60817 100644 --- a/lua/pika/plugins/qol.lua +++ b/lua/pika/plugins/qol.lua @@ -269,7 +269,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..8cf246a --- /dev/null +++ b/lua/pika/plugins/snacks.lua @@ -0,0 +1,383 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + explorer = { enabled = false }, + + bigfile = { enabled = true }, + quickfile = { enabled = true }, + + ---@class snacks.animate.Config + ---@field easing? snacks.animate.easing|snacks.animate.easing.Fn + animate = { + enabled = true, + ---@type snacks.animate.Duration|number + duration = 4, -- ms per step + + easing = "linear", + fps = 60, -- frames per second. Global setting for all animations + }, + notifier = { enabled = true }, + indent = { enabled = true }, + toggle = { enabled = true }, + scroll = { 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"}, + }, + }, + }, +} diff --git a/lua/pika/plugins/telescope.lua b/lua/pika/plugins/telescope.lua index c6c80d1..ac08c76 100644 --- a/lua/pika/plugins/telescope.lua +++ b/lua/pika/plugins/telescope.lua @@ -1,3 +1,8 @@ +if true then + return {} +end +-- WARNING: If this line is true, then the plugin will NOT get sourced! +-- return { "nvim-telescope/telescope.nvim", branch = "0.1.x", diff --git a/lua/pika/plugins/ui.lua b/lua/pika/plugins/ui.lua index 81adb22..36baed2 100644 --- a/lua/pika/plugins/ui.lua +++ b/lua/pika/plugins/ui.lua @@ -189,36 +189,36 @@ return { -- ╭────────────────────────────────────╮ -- │ notify for excellent notifications │ -- ╰────────────────────────────────────╯ - { - "rcarriga/nvim-notify", - config = function() - require("notify").setup({ - stages = "slide", - background_colour = "FloatShadow", - max_width = 120, - timeout = 2750, - render = "wrapped-compact", - -- Minimum/Maximum width for notification windows - minimum_width = 30, - maximum_width = 120, - - -- Function called when a new window is opened, use for changing win settings/config - on_open = nil, - - -- Function called when a window is closed - on_close = nil, - icons = { - ERROR = "", -- alternate symbol  - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "", - }, - }) - vim.notify = require("notify") - end, - vim.keymap.set("n", "tn", "Telescope notify", { desc = "Telescope show Notifications" }), - }, + -- { + -- "rcarriga/nvim-notify", + -- config = function() + -- require("notify").setup({ + -- stages = "slide", + -- background_colour = "FloatShadow", + -- max_width = 120, + -- timeout = 2750, + -- render = "wrapped-compact", + -- -- Minimum/Maximum width for notification windows + -- minimum_width = 30, + -- maximum_width = 120, + -- + -- -- Function called when a new window is opened, use for changing win settings/config + -- on_open = nil, + -- + -- -- Function called when a window is closed + -- on_close = nil, + -- icons = { + -- ERROR = "", -- alternate symbol  + -- WARN = "", + -- INFO = "", + -- DEBUG = "", + -- TRACE = "", + -- }, + -- }) + -- vim.notify = require("notify") + -- end, + -- vim.keymap.set("n", "tn", "Telescope notify", { desc = "Telescope show Notifications" }), + -- }, -- ╭────────────────────────────────╮ -- │ lualine - another bar for nvim │