feat(nvim): install snacks.nvim
Some checks failed
Check Formatting of Files / Check-Formatting (push) Has been cancelled

This commit is contained in:
Price Hiller 2024-11-08 00:54:59 -06:00
parent cddedfdfbb
commit 62f92944dc
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
4 changed files with 56 additions and 102 deletions

View File

@ -1,8 +0,0 @@
return {
{
"LunarVim/bigfile.nvim",
opts = {
filesize = 100,
},
},
}

View File

@ -8,6 +8,7 @@ return {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"miversen33/netman.nvim",
"folke/snacks.nvim",
},
cmd = "Neotree",
keys = {
@ -27,8 +28,8 @@ return {
end,
})
end,
opts = function()
return {
config = function()
require("neo-tree").setup({
sources = {
"filesystem",
"git_status",
@ -71,7 +72,19 @@ return {
["F"] = "fuzzy_finder",
},
},
}
})
end,
opts = function(_, opts)
local snacks = require("snacks")
local function on_move(data)
snacks.rename.on_rename_file(data.source, data.destination)
end
local events = require("neo-tree.events")
opts.event_handlers = opts.event_handlers or {}
vim.list_extend(opts.event_handlers, {
{ event = events.FILE_MOVED, handler = on_move },
{ event = events.FILE_RENAMED, handler = on_move },
})
end,
},
}

View File

@ -63,96 +63,5 @@ return {
vim.opt.cmdheight = 0
end,
dependencies = {
"MunifTanjim/nui.nvim",
{
"rcarriga/nvim-notify",
keys = {
{
"<leader>nd",
function()
vim.cmd.noh()
require("notify").dismiss({
pending = true,
silent = true,
})
end,
desc = "Notifications: Dismiss",
},
{
"<leader>nv",
function()
if not vim.g.nvim_notify_telescope_loaded then
require("telescope").load_extension("notify")
vim.g.nvim_notify_telescope_loaded = true
end
require("telescope").extensions.notify.notify()
end,
desc = "Notifications: Search",
},
},
config = function()
local base = require("notify.render.base")
local opts = {
stages = "slide",
fps = 60,
render = function(bufnr, notif, highlights, _)
local left_icon = notif.icon .. " "
local max_message_width = math.max(math.max(unpack(vim.tbl_map(function(line)
return vim.fn.strchars(line)
end, notif.message))))
local right_title = notif.title[2]
local left_title = notif.title[1]
local title_accum = vim.str_utfindex(left_icon)
+ vim.str_utfindex(right_title)
+ vim.str_utfindex(left_title)
local left_buffer = string.rep(" ", math.max(0, max_message_width - title_accum))
local namespace = base.namespace()
vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, { "", "" })
vim.api.nvim_buf_set_extmark(bufnr, namespace, 0, 0, {
virt_text = {
{ left_icon, highlights.icon },
{ left_title .. left_buffer, highlights.title },
},
virt_text_win_col = 0,
priority = 10,
})
vim.api.nvim_buf_set_extmark(bufnr, namespace, 0, 0, {
virt_text = { { right_title, highlights.title } },
virt_text_pos = "right_align",
priority = 10,
})
vim.api.nvim_buf_set_lines(bufnr, 1, -1, false, notif.message)
vim.api.nvim_buf_set_extmark(bufnr, namespace, 1, 0, {
hl_group = highlights.body,
end_line = #notif.message,
end_col = #notif.message[#notif.message],
priority = 50, -- Allow treesitter to override
})
end,
timeout = 5000,
-- For stages that change opacity this is treated as the highlight behind the window
-- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values
background_colour = "#000000",
-- Minimum width for notification windows
minimum_width = 50,
-- Icons for the different levels
icons = {
ERROR = "",
WARN = "",
INFO = "",
DEBUG = "",
TRACE = "",
},
}
require("notify").setup(opts)
end,
},
},
},
}

View File

@ -0,0 +1,40 @@
return {
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
keys = {
{
"<leader>nd",
function()
require("snacks").notifier.hide()
end,
desc = "Notifications: Dismiss",
},
{
"<leader>nv",
function()
require("snacks").notifier.show_history()
end,
desc = "Notifications: Search",
},
},
config = function()
local snacks = require("snacks")
snacks.setup({
bigfile = { enabled = true },
debug = { enabled = true },
notifier = {
enabled = true,
style = "compact",
margin = { top = 1 },
},
words = { enabled = true },
statuscolumn = { enabled = false }
})
_G.bt = snacks.debug.backtrace
_G.dd = snacks.debug.inspect
vim.print = snacks.debug.inspect
end,
},
}