From 03e277f807507bb2ca3f74fca72fef9c58f8a9e9 Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Mon, 30 Dec 2024 23:19:22 +0530 Subject: [PATCH] feat(nvim): More plugins replaced with snacks.nvim - Replace mini-bufremove with Snacks.bufdelete - Use Snacks.lazygit for Git Log and Git File Log instead of Neogit and Gitdiff plugins - Use Snacks.gitbrowse to browse the current file in GitHub --- common/.config/nvim/lua/plugins/code-git.lua | 2 - common/.config/nvim/lua/plugins/ui.lua | 135 +-------------- .../nvim/lua/plugins/utility-plugs.lua | 157 ++++++++++++++++++ 3 files changed, 159 insertions(+), 135 deletions(-) diff --git a/common/.config/nvim/lua/plugins/code-git.lua b/common/.config/nvim/lua/plugins/code-git.lua index e025c79..df72e68 100644 --- a/common/.config/nvim/lua/plugins/code-git.lua +++ b/common/.config/nvim/lua/plugins/code-git.lua @@ -11,7 +11,6 @@ return { config = true, keys = { { "gg", "Neogit", desc = "Git: Open Neogit", mode = { "n" } }, - { "gl", "Neogit log", desc = "Git: Log", mode = { "n" } }, }, }, @@ -23,7 +22,6 @@ return { { "gd", "DiffviewOpen", desc = "Git: Open Diffview", mode = { "n" } }, { "gD", "DiffviewOpen", desc = "Git: Open Diffview against master", mode = { "n" } }, - { "gf", "DiffviewFileHistory", desc = "Git: Show file history", mode = { "n" } }, }, }, diff --git a/common/.config/nvim/lua/plugins/ui.lua b/common/.config/nvim/lua/plugins/ui.lua index bb83c28..c091def 100644 --- a/common/.config/nvim/lua/plugins/ui.lua +++ b/common/.config/nvim/lua/plugins/ui.lua @@ -125,9 +125,6 @@ return { { "akinsho/bufferline.nvim", cond = require("config.util").is_not_vscode(), - dependencies = { - "echasnovski/mini.bufremove", - }, event = "VeryLazy", keys = { { "bp", "BufferLineTogglePin", desc = "Toggle buffer-pin" }, @@ -139,10 +136,10 @@ return { opts = { options = { close_command = function(n) - require("mini.bufremove").delete(n, false) + Snacks.bufdelete.delete(n, false) end, right_mouse_command = function(n) - require("mini.bufremove").delete(n, false) + Snacks.bufdelete.delete(n, false) end, diagnostics = "nvim_lsp", always_show_bufferline = false, @@ -362,132 +359,4 @@ return { } end, }, - - -- Various Quality of Life plugins into 1 - { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - cond = require("config.util").is_not_vscode(), - opts = { - -- Want these but after they are fixed - indent = { - -- NOTE: highlights for blanklines are too noisy - enabled = false, - }, - scope = { - -- NOTE: mini.indentscope does this and indent guide - enabled = false, - }, - statuscolumn = { - -- NOTE: just did not work - enabled = false, - }, - - bigfile = { - enabled = true, - notify = true, - size = 10 * 1024 * 1024, -- 10 MB - }, - input = { - enabled = true, - }, - lazygit = { - enabled = true, - configure = true, - }, - notifier = { - enabled = true, - timeout = 2000, - style = "fancy", - }, - scroll = { - enabled = true, - }, - scratch = { - enabled = true, - }, - word = { - enabled = true, - }, - zen = { - enabled = true, - }, - - animate = { - fps = 60, - duration = { - step = 10, - total = 200, - }, - }, - styles = { - notification = { - wo = { - wrap = true, - }, - }, - }, - }, - keys = { - { - "//", - function() - Snacks.scratch() - end, - desc = "Toggle Scratch Buffer", - }, - { - "/s", - function() - Snacks.scratch.select() - end, - desc = "Toggle Scratch Buffer", - }, - { - "gL", - function() - Snacks.lazygit.open(opts) - end, - desc = "Toggle LazyGit", - }, - { - "]]", - function() - Snacks.words.jump(vim.v.count1) - end, - desc = "Next Reference", - mode = { "n", "t" }, - }, - { - "[[", - function() - Snacks.words.jump(-vim.v.count1) - end, - desc = "Prev Reference", - mode = { "n", "t" }, - }, - { - "xx", - function() - Snacks.notifier.hide() - end, - desc = "Hide Notifications", - }, - { - "nn", - function() - Snacks.notifier.show_history() - end, - desc = "Notification History", - }, - { - "z", - function() - Snacks.zen() - end, - desc = "Toggle Zen Mode", - }, - }, - }, } diff --git a/common/.config/nvim/lua/plugins/utility-plugs.lua b/common/.config/nvim/lua/plugins/utility-plugs.lua index 7f18d86..77e103a 100644 --- a/common/.config/nvim/lua/plugins/utility-plugs.lua +++ b/common/.config/nvim/lua/plugins/utility-plugs.lua @@ -1,4 +1,161 @@ return { + -- Various Quality of Life plugins into one + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + cond = require("config.util").is_not_vscode(), + opts = { + -- Want these but after they are fixed + indent = { + -- NOTE: highlights for blanklines are too noisy + -- mini.indentscope does it much better + enabled = false, + }, + scope = { + -- NOTE: mini.indentscope does this and indent guide as well + enabled = false, + }, + statuscolumn = { + -- NOTE: just did not work + enabled = false, + }, + + bigfile = { + enabled = true, + notify = true, + size = 10 * 1024 * 1024, -- 10 MB + }, + bufdelete = { + enabled = true, + }, + gitbrowse = { + enabled = true, + }, + input = { + enabled = true, + }, + lazygit = { + enabled = true, + configure = true, + win = { style = "lazygit" }, + }, + notifier = { + enabled = true, + timeout = 2000, + style = "fancy", + }, + scroll = { + enabled = true, + }, + scratch = { + enabled = true, + }, + word = { + enabled = true, + }, + zen = { + enabled = true, + }, + + animate = { + fps = 60, + duration = { + step = 10, + total = 200, + }, + }, + styles = { + notification = { + wo = { + wrap = true, + }, + }, + }, + }, + keys = { + { + "//", + function() + Snacks.scratch() + end, + desc = "Toggle Scratch Buffer", + }, + { + "/s", + function() + Snacks.scratch.select() + end, + desc = "Toggle Scratch Buffer", + }, + { + "gz", + function() + Snacks.lazygit.open(opts) + end, + desc = "Git: Show LazyGit", + }, + { + "gl", + function() + Snacks.lazygit.log(opts) + end, + desc = "Git: Log", + }, + { + "gf", + function() + Snacks.lazygit.log_file(opts) + end, + desc = "Git: Show File Log", + }, + { + "]]", + function() + Snacks.words.jump(vim.v.count1) + end, + desc = "Next Reference", + mode = { "n", "t" }, + }, + { + "[[", + function() + Snacks.words.jump(-vim.v.count1) + end, + desc = "Prev Reference", + mode = { "n", "t" }, + }, + { + "xx", + function() + Snacks.notifier.hide() + end, + desc = "Hide Notifications", + }, + { + "nn", + function() + Snacks.notifier.show_history() + end, + desc = "Notification History", + }, + { + "z", + function() + Snacks.zen() + end, + desc = "Toggle Zen Mode", + }, + { + "gO", + function() + Snacks.gitbrowse.open(opts) + end, + desc = "Git: Open the file on Browser", + }, + }, + }, + -- Navigate between NVIM & Tmux splits seamlessly { "christoomey/vim-tmux-navigator",