Skip to content

Commit 4bd2bdc

Browse files
committed
update snacks config to example default
1 parent 3d5f3b4 commit 4bd2bdc

File tree

1 file changed

+183
-4
lines changed

1 file changed

+183
-4
lines changed

lua/custom/plugins/snacks-nvim.lua

Lines changed: 183 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,194 @@ return {
22
'folke/snacks.nvim',
33
priority = 1000,
44
lazy = false,
5+
---@type snacks.Config
56
opts = {
6-
-- your configuration comes here
7-
-- or leave it empty to use the default settings
8-
-- refer to the configuration section below
97
bigfile = { enabled = true },
108
dashboard = { enabled = true },
11-
notifier = { enabled = true },
9+
indent = { enabled = true },
10+
input = { enabled = true },
11+
notifier = {
12+
enabled = true,
13+
timeout = 3000,
14+
},
1215
quickfile = { enabled = true },
16+
scroll = { enabled = true },
1317
statuscolumn = { enabled = true },
1418
words = { enabled = true },
19+
styles = {
20+
notification = {
21+
-- wo = { wrap = true } -- Wrap notifications
22+
},
23+
},
1524
},
25+
keys = {
26+
{
27+
'<leader>z',
28+
function()
29+
Snacks.zen()
30+
end,
31+
desc = 'Toggle Zen Mode',
32+
},
33+
{
34+
'<leader>Z',
35+
function()
36+
Snacks.zen.zoom()
37+
end,
38+
desc = 'Toggle Zoom',
39+
},
40+
{
41+
'<leader>.',
42+
function()
43+
Snacks.scratch()
44+
end,
45+
desc = 'Toggle Scratch Buffer',
46+
},
47+
{
48+
'<leader>S',
49+
function()
50+
Snacks.scratch.select()
51+
end,
52+
desc = 'Select Scratch Buffer',
53+
},
54+
{
55+
'<leader>n',
56+
function()
57+
Snacks.notifier.show_history()
58+
end,
59+
desc = 'Notification History',
60+
},
61+
{
62+
'<leader>bd',
63+
function()
64+
Snacks.bufdelete()
65+
end,
66+
desc = 'Delete Buffer',
67+
},
68+
{
69+
'<leader>cR',
70+
function()
71+
Snacks.rename.rename_file()
72+
end,
73+
desc = 'Rename File',
74+
},
75+
{
76+
'<leader>gB',
77+
function()
78+
Snacks.gitbrowse()
79+
end,
80+
desc = 'Git Browse',
81+
mode = { 'n', 'v' },
82+
},
83+
{
84+
'<leader>gb',
85+
function()
86+
Snacks.git.blame_line()
87+
end,
88+
desc = 'Git Blame Line',
89+
},
90+
{
91+
'<leader>gf',
92+
function()
93+
Snacks.lazygit.log_file()
94+
end,
95+
desc = 'Lazygit Current File History',
96+
},
97+
{
98+
'<leader>gg',
99+
function()
100+
Snacks.lazygit()
101+
end,
102+
desc = 'Lazygit',
103+
},
104+
{
105+
'<leader>gl',
106+
function()
107+
Snacks.lazygit.log()
108+
end,
109+
desc = 'Lazygit Log (cwd)',
110+
},
111+
{
112+
'<leader>un',
113+
function()
114+
Snacks.notifier.hide()
115+
end,
116+
desc = 'Dismiss All Notifications',
117+
},
118+
{
119+
'<c-/>',
120+
function()
121+
Snacks.terminal()
122+
end,
123+
desc = 'Toggle Terminal',
124+
},
125+
{
126+
'<c-_>',
127+
function()
128+
Snacks.terminal()
129+
end,
130+
desc = 'which_key_ignore',
131+
},
132+
{
133+
']]',
134+
function()
135+
Snacks.words.jump(vim.v.count1)
136+
end,
137+
desc = 'Next Reference',
138+
mode = { 'n', 't' },
139+
},
140+
{
141+
'[[',
142+
function()
143+
Snacks.words.jump(-vim.v.count1)
144+
end,
145+
desc = 'Prev Reference',
146+
mode = { 'n', 't' },
147+
},
148+
{
149+
'<leader>N',
150+
desc = 'Neovim News',
151+
function()
152+
Snacks.win {
153+
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
154+
width = 0.6,
155+
height = 0.6,
156+
wo = {
157+
spell = false,
158+
wrap = false,
159+
signcolumn = 'yes',
160+
statuscolumn = ' ',
161+
conceallevel = 3,
162+
},
163+
}
164+
end,
165+
},
166+
},
167+
init = function()
168+
vim.api.nvim_create_autocmd('User', {
169+
pattern = 'VeryLazy',
170+
callback = function()
171+
-- Setup some globals for debugging (lazy-loaded)
172+
_G.dd = function(...)
173+
Snacks.debug.inspect(...)
174+
end
175+
_G.bt = function()
176+
Snacks.debug.backtrace()
177+
end
178+
vim.print = _G.dd -- Override print to use snacks for `:=` command
179+
180+
-- Create some toggle mappings
181+
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
182+
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
183+
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
184+
Snacks.toggle.diagnostics():map '<leader>ud'
185+
Snacks.toggle.line_number():map '<leader>ul'
186+
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
187+
Snacks.toggle.treesitter():map '<leader>uT'
188+
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
189+
Snacks.toggle.inlay_hints():map '<leader>uh'
190+
Snacks.toggle.indent():map '<leader>ug'
191+
Snacks.toggle.dim():map '<leader>uD'
192+
end,
193+
})
194+
end,
16195
}

0 commit comments

Comments
 (0)