Files
dotfiles/.config/nvim/lua/plugins/snacks.lua
2026-02-05 19:50:59 +02:00

94 lines
3.3 KiB
Lua

return {
'folke/snacks.nvim',
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
notifier = {
enabled = true,
timeout = 3000,
},
git = { enabled = true },
---@class snacks.lazygit.Config: snacks.terminal.Opts
---@field args? string[]
---@field theme? snacks.lazygit.Theme
lazygit = {
-- automatically configure lazygit to use the current colorscheme
-- and integrate edit with the current neovim instance
configure = true,
-- extra configuration for lazygit that will be merged with the default
-- snacks does NOT have a full yaml parser, so if you need `"test"` to appear with the quotes
-- you need to double quote it: `"\"test\""`
config = {
os = { editPreset = "nvim-remote" },
gui = {
-- set to an empty string "" to disable icons
nerdFontsVersion = "3",
},
},
theme_path = vim.fs.normalize(vim.fn.stdpath("cache") .. "/lazygit-theme.yml"),
-- Theme for lazygit
theme = {
[241] = { fg = "Special" },
activeBorderColor = { fg = "MatchParen", bold = true },
cherryPickedCommitBgColor = { fg = "Identifier" },
cherryPickedCommitFgColor = { fg = "Function" },
defaultFgColor = { fg = "Normal" },
inactiveBorderColor = { fg = "FloatBorder" },
optionsTextColor = { fg = "Function" },
searchingActiveBorderColor = { fg = "MatchParen", bold = true },
selectedLineBgColor = { bg = "Visual" }, -- set to `default` to have no background colour
unstagedChangesColor = { fg = "DiagnosticError" },
},
win = {
style = "lazygit",
},
},
quickfile = { enabled = true },
words = { enabled = true },
styles = {
notification = {
-- wo = { wrap = true } -- Wrap notifications
},
},
},
keys = {
},
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
-- Override print to use snacks for `:=` command
if vim.fn.has 'nvim-0.11' == 1 then
vim._print = function(_, ...)
dd(...)
end
else
vim.print = _G.dd
end
-- Create some toggle mappings
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
Snacks.toggle.diagnostics():map '<leader>ud'
Snacks.toggle.line_number():map '<leader>ul'
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
Snacks.toggle.treesitter():map '<leader>uT'
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
Snacks.toggle.inlay_hints():map '<leader>uh'
Snacks.toggle.indent():map '<leader>ug'
Snacks.toggle.dim():map '<leader>uD'
end,
})
end,
}