From 116c91c1553bd90161df68c6fa366924bd7b009d Mon Sep 17 00:00:00 2001 From: Nikhil Date: Thu, 21 Aug 2025 23:01:53 +0530 Subject: [PATCH] added todo, commentary, snacks and oil --- .gitignore | 2 +- lua/plugins/editor.lua | 41 ++++++++++++++++++++++++++++++++++++ lua/plugins/git.lua | 17 +++++++++++++++ lua/plugins/tools.lua | 48 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 005b535b..3d1d8175 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ tags test.sh .luarc.json nvim - +init.lua.bak spell/ lazy-lock.json diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index fc9e48c9..5f7cf0bd 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,6 +1,9 @@ -- [plugins/editing.lua] return { + + + { -- Autoformat 'stevearc/conform.nvim', event = { 'BufWritePre' }, @@ -102,4 +105,42 @@ return { }, }, }, + + { -- Trouble.nvim: pretty diagnostics & quickfix + 'folke/trouble.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = {}, + cmd = "Trouble", + keys = { + { "xx", "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, + { "xq", "Trouble qflist toggle", desc = "Quickfix (Trouble)" }, + }, + }, + + { -- Testing framework + 'vim-test/vim-test', + config = function() + vim.keymap.set("n", "tn", ":TestNearest", { desc = "Run nearest test" }) + vim.keymap.set("n", "tf", ":TestFile", { desc = "Run file tests" }) + vim.keymap.set("n", "tl", ":TestLast", { desc = "Run last test" }) + vim.keymap.set("n", "ts", ":TestSuite", { desc = "Run test suite" }) + end, + }, + + { -- Todo-comments: highlight and search TODO/FIX + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = {}, + event = "VimEnter", + config = function() + require("todo-comments").setup() + vim.keymap.set("n", "st", "TodoTelescope", { desc = "Search TODOs" }) + end, + }, + + { -- Commenting + 'tpope/vim-commentary', + -- usage: `gcc` (line), `gc` (visual selection) + }, + } diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index dbdc1ed8..426546eb 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -41,4 +41,21 @@ return { end, }, }, + + { -- Git wrapper + 'tpope/vim-fugitive', + cmd = { "Git", "G" }, -- lazy load on :Git + }, + + require('gitsigns').setup { + current_line_blame = true, -- shows git blame at end of line + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 500, + ignore_whitespace = false, + }, + current_line_blame_formatter = ', - ', + } + } diff --git a/lua/plugins/tools.lua b/lua/plugins/tools.lua index 888f5355..432286ac 100644 --- a/lua/plugins/tools.lua +++ b/lua/plugins/tools.lua @@ -1,6 +1,7 @@ -- [plugins/tools.lua] return { + { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', event = 'VimEnter', @@ -45,6 +46,15 @@ return { end, }, + { -- Telescope frecency (smart recent files) + 'nvim-telescope/telescope-frecency.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require("telescope").load_extension("frecency") + vim.keymap.set("n", "fr", "Telescope frecency", { desc = "[F]ile [R]ecency" }) + end, + }, + { -- Treesitter for better syntax highlighting 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', @@ -60,6 +70,44 @@ return { }, }, + { -- Oil.nvim: directory navigation as buffers + 'stevearc/oil.nvim', + opts = {}, + config = function(_, opts) + require("oil").setup(opts) + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory with oil" }) + end, + }, + + { -- Harpoon: quick file navigation + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require("harpoon") + harpoon:setup() + + vim.keymap.set("n", "ha", function() harpoon:list():add() end, { desc = "Harpoon add file" }) + vim.keymap.set("n", "hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = "Harpoon menu" }) + vim.keymap.set("n", "h1", function() harpoon:list():select(1) end, { desc = "Harpoon to file 1" }) + vim.keymap.set("n", "h2", function() harpoon:list():select(2) end, { desc = "Harpoon to file 2" }) + vim.keymap.set("n", "h3", function() harpoon:list():select(3) end, { desc = "Harpoon to file 3" }) + vim.keymap.set("n", "h4", function() harpoon:list():select(4) end, { desc = "Harpoon to file 4" }) + end, + }, + + { -- Snacks.nvim: utilities (scratch, terminal, etc.) + 'folke/snacks.nvim', + config = function() + require("snacks").setup({ + terminal = { win = { style = "float" } }, + scratch = true, + }) + vim.keymap.set("n", "tt", function() require("snacks.terminal").toggle() end, { desc = "Toggle terminal" }) + vim.keymap.set("n", "ss", function() require("snacks.scratch").open() end, { desc = "Open scratch buffer" }) + end, + }, + { -- Debugging (DAP) 'mfussenegger/nvim-dap', dependencies = {