feat(nvim): Use snacks.nvim which replaces multiple plugins

- Removed vim-illuminate, nvim-notify, LunarVim/bigfile
- Enabled: scratchpad, zen, lazygit, scroll-animation
This commit is contained in:
Pratik Tripathy
2024-12-28 16:50:35 +05:30
parent 3fd3aa04f5
commit 1e2ed58b67
2 changed files with 137 additions and 77 deletions

View File

@@ -114,7 +114,11 @@ return {
{ {
"echasnovski/mini.indentscope", "echasnovski/mini.indentscope",
cond = require("config.util").is_not_vscode(), cond = require("config.util").is_not_vscode(),
opts = { symbol = "", options = { try_as_border = true } }, opts = {
delay = 100,
symbol = "",
options = { try_as_border = true },
},
init = function() init = function()
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { pattern = {
@@ -165,46 +169,6 @@ return {
end, end,
}, },
-- Automatically highlights other instances of the word under cursor
{
"RRethy/vim-illuminate",
lazy = false,
cond = require("config.util").is_not_vscode(),
opts = {
delay = 200,
large_file_cutoff = 2000,
large_file_override = {
providers = { "lsp" },
},
},
config = function(_, opts)
-- Copied from LazyNvim
require("illuminate").configure(opts)
local function map(key, dir, buffer)
vim.keymap.set("n", key, function()
require("illuminate")["goto_" .. dir .. "_reference"](false)
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
end
map("]]", "next")
map("[[", "prev")
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
vim.api.nvim_create_autocmd("FileType", {
callback = function()
local buffer = vim.api.nvim_get_current_buf()
map("]]", "next", buffer)
map("[[", "prev", buffer)
end,
})
end,
keys = {
{ "]]", desc = "Next Reference" },
{ "[[", desc = "Prev Reference" },
},
},
-- Finds and lists all of the TODO, HACK, BUG, etc comment -- Finds and lists all of the TODO, HACK, BUG, etc comment
{ {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",

View File

@@ -104,7 +104,11 @@ return {
illuminate = { illuminate = {
lsp = true, lsp = true,
}, },
snacks = true,
which_key = true, which_key = true,
-- These were enabled by default
render_markdown = false,
}, },
flavour = "mocha", flavour = "mocha",
@@ -178,41 +182,6 @@ return {
end, end,
}, },
-- Better `vim.notify()`
{
"rcarriga/nvim-notify",
cond = require("config.util").is_not_vscode(),
keys = {
{
"<leader>xn",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "Dismiss all Notifications",
},
{
"<leader>xx",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "Dismiss all Notifications",
},
},
opts = {
render = "wrapped-compact", -- Smaller popups
timeout = 2000,
max_height = function()
return math.floor(vim.o.lines * 0.25)
end,
max_width = function()
return math.floor(vim.o.columns * 0.5)
end,
on_open = function(win)
vim.api.nvim_win_set_config(win, { zindex = 100 })
end,
},
},
-- Completely replaces the UI for messages, cmdline and the popupmenu. -- Completely replaces the UI for messages, cmdline and the popupmenu.
{ {
"folke/noice.nvim", "folke/noice.nvim",
@@ -220,7 +189,6 @@ return {
event = "VeryLazy", event = "VeryLazy",
dependencies = { dependencies = {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
}, },
opts = { opts = {
lsp = { lsp = {
@@ -394,4 +362,132 @@ return {
} }
end, 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 = {
{
"<leader>//",
function()
Snacks.scratch()
end,
desc = "Toggle Scratch Buffer",
},
{
"<leader>/s",
function()
Snacks.scratch.select()
end,
desc = "Toggle Scratch Buffer",
},
{
"<leader>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" },
},
{
"<leader>xx",
function()
Snacks.notifier.hide()
end,
desc = "Hide Notifications",
},
{
"<leader>nn",
function()
Snacks.notifier.show_history()
end,
desc = "Notification History",
},
{
"<leader>z",
function()
Snacks.zen()
end,
desc = "Toggle Zen Mode",
},
},
},
} }