324 lines
5.8 KiB
Lua
324 lines
5.8 KiB
Lua
plugin({
|
|
"folke/snacks.nvim",
|
|
priority = 1000,
|
|
lazy = false,
|
|
---@type snacks.Config
|
|
opts = {
|
|
bigfile = { enabled = true },
|
|
dashboard = { enabled = true },
|
|
explorer = { enabled = true },
|
|
indent = { enabled = true },
|
|
input = { enabled = true },
|
|
notifier = {
|
|
enabled = true,
|
|
timeout = 3000,
|
|
},
|
|
picker = { enabled = true, ui_select = true },
|
|
quickfile = { enabled = true },
|
|
scope = { enabled = true },
|
|
scroll = { enabled = true },
|
|
statuscolumn = {
|
|
enabled = true,
|
|
left = { "mark", "sign" }, -- priority of signs on the left (high to low)
|
|
right = { "fold", "git" }, -- priority of signs on the right (high to low)
|
|
folds = {
|
|
open = true, -- show open fold icons
|
|
git_hl = true, -- use Git Signs hl for fold icons
|
|
},
|
|
git = {
|
|
-- patterns to match Git signs
|
|
patterns = { "GitSign", "MiniDiffSign" },
|
|
},
|
|
refresh = 50, -- refresh at most every 50ms
|
|
},
|
|
words = { enabled = true },
|
|
styles = {
|
|
notification = {
|
|
-- wo = { wrap = true } -- Wrap notifications
|
|
},
|
|
},
|
|
},
|
|
keys = {
|
|
-- Top Pickers & Explorer
|
|
{
|
|
"<leader><space>",
|
|
function()
|
|
Snacks.picker.smart({
|
|
multi = { "buffers", "recent", "files" },
|
|
format = "file", -- use `file` format for all sources
|
|
matcher = {
|
|
cwd_bonus = true, -- boost cwd matches
|
|
frecency = true, -- use frecency boosting
|
|
sort_empty = true, -- sort even when the filter is empty
|
|
},
|
|
transform = "unique_file",
|
|
})
|
|
end,
|
|
desc = "Smart Find Files",
|
|
},
|
|
{
|
|
"<leader>,",
|
|
function()
|
|
Snacks.picker.buffers()
|
|
end,
|
|
desc = "Buffers",
|
|
},
|
|
{
|
|
"<leader>/",
|
|
function()
|
|
Snacks.picker.grep()
|
|
end,
|
|
desc = "Grep",
|
|
},
|
|
{
|
|
"<leader>n",
|
|
function()
|
|
Snacks.picker.notifications()
|
|
end,
|
|
desc = "Notification History",
|
|
},
|
|
{
|
|
"<leader>e",
|
|
function()
|
|
Snacks.picker.explorer({
|
|
auto_close = true,
|
|
})
|
|
end,
|
|
desc = "File Explorer",
|
|
},
|
|
{
|
|
"<leader>ff",
|
|
function()
|
|
Snacks.picker.files()
|
|
end,
|
|
desc = "Find Files",
|
|
},
|
|
{
|
|
"<leader>fp",
|
|
function()
|
|
Snacks.picker.projects()
|
|
end,
|
|
desc = "Projects",
|
|
},
|
|
{
|
|
"<leader>fr",
|
|
function()
|
|
Snacks.picker.recent()
|
|
end,
|
|
desc = "Recent",
|
|
},
|
|
-- Grep
|
|
{
|
|
"<leader>sb",
|
|
function()
|
|
Snacks.picker.lines()
|
|
end,
|
|
desc = "Buffer Lines",
|
|
},
|
|
{
|
|
"<leader>bB",
|
|
function()
|
|
Snacks.picker.grep_buffers()
|
|
end,
|
|
desc = "Grep Open Buffers",
|
|
},
|
|
{
|
|
"<leader>sg",
|
|
function()
|
|
Snacks.picker.grep()
|
|
end,
|
|
desc = "Grep",
|
|
},
|
|
{
|
|
"<leader>sw",
|
|
function()
|
|
Snacks.picker.grep_word()
|
|
end,
|
|
desc = "Visual selection or word",
|
|
mode = { "n", "x" },
|
|
},
|
|
-- search
|
|
{
|
|
"<leader>s/",
|
|
function()
|
|
Snacks.picker.search_history()
|
|
end,
|
|
desc = "Search History",
|
|
},
|
|
{
|
|
"<leader>sb",
|
|
function()
|
|
Snacks.picker.lines()
|
|
end,
|
|
desc = "Buffer Lines",
|
|
},
|
|
{
|
|
"<leader>sc",
|
|
function()
|
|
Snacks.picker.commands()
|
|
end,
|
|
desc = "Commands",
|
|
},
|
|
{
|
|
"<leader>sd",
|
|
function()
|
|
Snacks.picker.diagnostics()
|
|
end,
|
|
desc = "Diagnostics",
|
|
},
|
|
{
|
|
"<leader>sD",
|
|
function()
|
|
Snacks.picker.diagnostics_buffer()
|
|
end,
|
|
desc = "Buffer Diagnostics",
|
|
},
|
|
{
|
|
"<leader>si",
|
|
function()
|
|
Snacks.picker.icons()
|
|
end,
|
|
desc = "Icons",
|
|
},
|
|
{
|
|
"<leader>uC",
|
|
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",
|
|
},
|
|
{
|
|
"<leader>ss",
|
|
function()
|
|
Snacks.picker.lsp_symbols()
|
|
end,
|
|
desc = "LSP Symbols",
|
|
},
|
|
{
|
|
"<leader>sS",
|
|
function()
|
|
Snacks.picker.lsp_workspace_symbols()
|
|
end,
|
|
desc = "LSP Workspace Symbols",
|
|
},
|
|
-- Other
|
|
{
|
|
"<leader>z",
|
|
function()
|
|
Snacks.zen()
|
|
end,
|
|
desc = "Toggle Zen Mode",
|
|
},
|
|
{
|
|
"<leader>.",
|
|
function()
|
|
Snacks.scratch()
|
|
end,
|
|
desc = "Toggle Scratch Buffer",
|
|
},
|
|
{
|
|
"<leader>S",
|
|
function()
|
|
Snacks.scratch.select()
|
|
end,
|
|
desc = "Select Scratch Buffer",
|
|
},
|
|
{
|
|
"<leader>n",
|
|
function()
|
|
Snacks.notifier.show_history()
|
|
end,
|
|
desc = "Notification History",
|
|
},
|
|
{
|
|
"<leader>cR",
|
|
function()
|
|
Snacks.rename.rename_file()
|
|
end,
|
|
desc = "Rename File",
|
|
},
|
|
{
|
|
"<leader>gg",
|
|
function()
|
|
Snacks.lazygit()
|
|
end,
|
|
desc = "Lazygit",
|
|
},
|
|
{
|
|
"<leader>un",
|
|
function()
|
|
Snacks.notifier.hide()
|
|
end,
|
|
desc = "Dismiss All Notifications",
|
|
},
|
|
{
|
|
"<c-/>",
|
|
function()
|
|
Snacks.terminal()
|
|
end,
|
|
desc = "Toggle Terminal",
|
|
},
|
|
},
|
|
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("<leader>ts")
|
|
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
|
|
Snacks.toggle.diagnostics():map("<leader>ud")
|
|
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
|
|
Snacks.toggle.line_number():map("<leader>ul")
|
|
Snacks.toggle.inlay_hints():map("<leader>uh")
|
|
Snacks.toggle.dim():map("<leader>uD")
|
|
end,
|
|
})
|
|
end,
|
|
})
|