Skip to content

Commit 285c67a

Browse files
committed
adding init work
1 parent 38f4744 commit 285c67a

File tree

2 files changed

+202
-6
lines changed

2 files changed

+202
-6
lines changed

init.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ P.S. You can delete this when you're done too. It's your config now! :)
9090
vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
9292

93+
vim.g.tabstop = 2
94+
9395
-- Set to true if you have a Nerd Font installed and selected in the terminal
94-
vim.g.have_nerd_font = false
96+
vim.g.have_nerd_font = true
9597

9698
-- [[ Setting options ]]
9799
-- See `:help vim.opt`
@@ -102,7 +104,7 @@ vim.g.have_nerd_font = false
102104
vim.opt.number = true
103105
-- You can also add relative line numbers, to help with jumping.
104106
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
107+
vim.opt.relativenumber = true
106108

107109
-- Enable mouse mode, can be useful for resizing splits for example!
108110
vim.opt.mouse = 'a'
@@ -743,7 +745,7 @@ require('lazy').setup({
743745
},
744746
},
745747
opts = {
746-
notify_on_error = false,
748+
notify_on_error = true,
747749
format_on_save = function(bufnr)
748750
-- Disable "format_on_save lsp_fallback" for languages that don't
749751
-- have a well standardized coding style. You can add additional
@@ -957,7 +959,7 @@ require('lazy').setup({
957959
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
958960
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
959961
opts = {
960-
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
962+
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'ocaml' },
961963
-- Autoinstall languages that are not installed
962964
auto_install = true,
963965
highlight = {
@@ -997,7 +999,7 @@ require('lazy').setup({
997999
-- This is the easiest way to modularize your config.
9981000
--
9991001
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
1000-
-- { import = 'custom.plugins' },
1002+
{ import = 'custom.plugins' },
10011003
--
10021004
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
10031005
-- Or use telescope!

lua/custom/plugins/init.lua

Lines changed: 195 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,198 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
return {
6+
'folke/snacks.nvim',
7+
lazy = false,
8+
priority = 1000,
9+
---@type snacks.Config
10+
opts = {
11+
bigfile = { enabled = true },
12+
dashboard = { enabled = true },
13+
explorer = { enabled = true },
14+
indent = { enabled = true },
15+
input = { enabled = true },
16+
notifier = {
17+
enabled = true,
18+
timeout = 3000,
19+
},
20+
picker = { enabled = true },
21+
quickfile = { enabled = true },
22+
scope = { enabled = true },
23+
scroll = { enabled = true },
24+
statuscolumn = { enabled = true },
25+
words = { enabled = true },
26+
styles = {
27+
notification = {
28+
-- wo = { wrap = true } -- Wrap notifications
29+
},
30+
},
31+
},
32+
keys = {
33+
-- git
34+
{
35+
'<leader>gb',
36+
function()
37+
Snacks.picker.git_branches()
38+
end,
39+
desc = 'Git Branches',
40+
},
41+
{
42+
'<leader>gl',
43+
function()
44+
Snacks.picker.git_log()
45+
end,
46+
desc = 'Git Log',
47+
},
48+
{
49+
'<leader>gL',
50+
function()
51+
Snacks.picker.git_log_line()
52+
end,
53+
desc = 'Git Log Line',
54+
},
55+
{
56+
'<leader>gs',
57+
function()
58+
Snacks.picker.git_status()
59+
end,
60+
desc = 'Git Status',
61+
},
62+
{
63+
'<leader>gS',
64+
function()
65+
Snacks.picker.git_stash()
66+
end,
67+
desc = 'Git Stash',
68+
},
69+
{
70+
'<leader>gd',
71+
function()
72+
Snacks.picker.git_diff()
73+
end,
74+
desc = 'Git Diff (Hunks)',
75+
},
76+
{
77+
'<leader>gf',
78+
function()
79+
Snacks.picker.git_log_file()
80+
end,
81+
desc = 'Git Log File',
82+
},
83+
-- Grep
84+
{
85+
'<leader>sb',
86+
function()
87+
Snacks.picker.lines()
88+
end,
89+
desc = 'Buffer Lines',
90+
},
91+
{
92+
'<leader>sB',
93+
function()
94+
Snacks.picker.grep_buffers()
95+
end,
96+
desc = 'Grep Open Buffers',
97+
},
98+
{
99+
'<leader>sg',
100+
function()
101+
Snacks.picker.grep()
102+
end,
103+
desc = 'Grep',
104+
},
105+
{
106+
'<leader>sw',
107+
function()
108+
Snacks.picker.grep_word()
109+
end,
110+
desc = 'Visual selection or word',
111+
mode = { 'n', 'x' },
112+
},
113+
-- Other
114+
{
115+
'<leader>z',
116+
function()
117+
Snacks.zen()
118+
end,
119+
desc = 'Toggle Zen Mode',
120+
},
121+
{
122+
'<leader>gB',
123+
function()
124+
Snacks.gitbrowse()
125+
end,
126+
desc = 'Git Browse',
127+
mode = { 'n', 'v' },
128+
},
129+
{
130+
'<leader>gg',
131+
function()
132+
Snacks.lazygit()
133+
end,
134+
desc = 'Lazygit',
135+
},
136+
{
137+
']]',
138+
function()
139+
Snacks.words.jump(vim.v.count1)
140+
end,
141+
desc = 'Next Reference',
142+
mode = { 'n', 't' },
143+
},
144+
{
145+
'[[',
146+
function()
147+
Snacks.words.jump(-vim.v.count1)
148+
end,
149+
desc = 'Prev Reference',
150+
mode = { 'n', 't' },
151+
},
152+
{
153+
'<leader>N',
154+
desc = 'Neovim News',
155+
function()
156+
Snacks.win {
157+
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
158+
width = 0.6,
159+
height = 0.6,
160+
wo = {
161+
spell = false,
162+
wrap = false,
163+
signcolumn = 'yes',
164+
statuscolumn = ' ',
165+
conceallevel = 3,
166+
},
167+
}
168+
end,
169+
},
170+
},
171+
init = function()
172+
vim.api.nvim_create_autocmd('User', {
173+
pattern = 'VeryLazy',
174+
callback = function()
175+
-- Setup some globals for debugging (lazy-loaded)
176+
_G.dd = function(...)
177+
Snacks.debug.inspect(...)
178+
end
179+
_G.bt = function()
180+
Snacks.debug.backtrace()
181+
end
182+
vim.print = _G.dd -- Override print to use snacks for `:=` command
183+
184+
-- Create some toggle mappings
185+
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
186+
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
187+
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
188+
Snacks.toggle.diagnostics():map '<leader>ud'
189+
Snacks.toggle.line_number():map '<leader>ul'
190+
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
191+
Snacks.toggle.treesitter():map '<leader>uT'
192+
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
193+
Snacks.toggle.inlay_hints():map '<leader>uh'
194+
Snacks.toggle.indent():map '<leader>ug'
195+
Snacks.toggle.dim():map '<leader>uD'
196+
end,
197+
})
198+
end,
199+
}

0 commit comments

Comments
 (0)