From 285c67a2a93d83496f62c0c0e0b2888c5e25dd54 Mon Sep 17 00:00:00 2001 From: Aadi Rave Date: Sun, 16 Mar 2025 04:30:29 -0400 Subject: [PATCH] adding init work --- init.lua | 12 ++- lua/custom/plugins/init.lua | 196 +++++++++++++++++++++++++++++++++++- 2 files changed, 202 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 1427b6c7..105d9fe7 100644 --- a/init.lua +++ b/init.lua @@ -90,8 +90,10 @@ P.S. You can delete this when you're done too. It's your config now! :) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +vim.g.tabstop = 2 + -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,7 +104,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -743,7 +745,7 @@ require('lazy').setup({ }, }, opts = { - notify_on_error = false, + notify_on_error = true, format_on_save = function(bufnr) -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional @@ -957,7 +959,7 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'ocaml' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -997,7 +999,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..e6842415 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,198 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + 'folke/snacks.nvim', + lazy = false, + priority = 1000, + ---@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 }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + styles = { + notification = { + -- wo = { wrap = true } -- Wrap notifications + }, + }, + }, + keys = { + -- git + { + 'gb', + function() + Snacks.picker.git_branches() + end, + desc = 'Git Branches', + }, + { + 'gl', + function() + Snacks.picker.git_log() + end, + desc = 'Git Log', + }, + { + 'gL', + function() + Snacks.picker.git_log_line() + end, + desc = 'Git Log Line', + }, + { + 'gs', + function() + Snacks.picker.git_status() + end, + desc = 'Git Status', + }, + { + 'gS', + function() + Snacks.picker.git_stash() + end, + desc = 'Git Stash', + }, + { + 'gd', + function() + Snacks.picker.git_diff() + end, + desc = 'Git Diff (Hunks)', + }, + { + 'gf', + function() + Snacks.picker.git_log_file() + end, + desc = 'Git Log File', + }, + -- Grep + { + 'sb', + function() + Snacks.picker.lines() + end, + desc = 'Buffer Lines', + }, + { + 'sB', + function() + Snacks.picker.grep_buffers() + end, + desc = 'Grep Open Buffers', + }, + { + 'sg', + function() + Snacks.picker.grep() + end, + desc = 'Grep', + }, + { + 'sw', + function() + Snacks.picker.grep_word() + end, + desc = 'Visual selection or word', + mode = { 'n', 'x' }, + }, + -- Other + { + 'z', + function() + Snacks.zen() + end, + desc = 'Toggle Zen Mode', + }, + { + 'gB', + function() + Snacks.gitbrowse() + end, + desc = 'Git Browse', + mode = { 'n', 'v' }, + }, + { + 'gg', + function() + Snacks.lazygit() + end, + desc = 'Lazygit', + }, + { + ']]', + function() + Snacks.words.jump(vim.v.count1) + end, + desc = 'Next Reference', + mode = { 'n', 't' }, + }, + { + '[[', + function() + Snacks.words.jump(-vim.v.count1) + end, + desc = 'Prev Reference', + mode = { 'n', 't' }, + }, + { + 'N', + desc = 'Neovim News', + function() + Snacks.win { + file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = 'yes', + statuscolumn = ' ', + conceallevel = 3, + }, + } + end, + }, + }, + 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 'us' + Snacks.toggle.option('wrap', { name = 'Wrap' }):map 'uw' + Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map 'uL' + Snacks.toggle.diagnostics():map 'ud' + Snacks.toggle.line_number():map 'ul' + Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map 'uc' + Snacks.toggle.treesitter():map 'uT' + Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map 'ub' + Snacks.toggle.inlay_hints():map 'uh' + Snacks.toggle.indent():map 'ug' + Snacks.toggle.dim():map 'uD' + end, + }) + end, +}