From 3c632e939d2e5f7068394f806f29420009142186 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 25 Jul 2025 23:43:57 +0545 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20todo-comments=20plugi?= =?UTF-8?q?n=20for=20enhanced=20code=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/list.lua | 79 +++++++++++++++++++++++++++++++++++++-- lua/plugins/lock.json | 1 + lua/plugins/ui/snacks.lua | 4 ++ 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/lua/plugins/list.lua b/lua/plugins/list.lua index 4c99bbc..e7e6947 100644 --- a/lua/plugins/list.lua +++ b/lua/plugins/list.lua @@ -249,10 +249,19 @@ local plugins = { }, { 'windwp/nvim-ts-autotag', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - require('nvim-ts-autotag').setup() - end, + ft = { + 'html', + 'javascriptreact', + 'typescriptreact', + 'svelte', + 'vue', + 'tsx', + 'jsx', + 'markdown', + 'handlebars', + 'hbs', + }, + opts = {}, }, { 'gbprod/substitute.nvim', @@ -361,6 +370,68 @@ local plugins = { }) end, }, + { + 'folke/todo-comments.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + highlight = { + multiline = false, -- I usually only want one line to be highlighted + }, + }, + keys = { + { + 'tT', + function() + require('snacks').picker.todo_comments({ keywords = { 'TODO' } }) + end, + desc = 'Todo', + }, + { + 'tF', + function() + require('snacks').picker.todo_comments({ keywords = { 'FIX', 'FIXME' } }) + end, + desc = 'Fix/Fixme', + }, + { + 'tN', + function() + require('snacks').picker.todo_comments({ keywords = { 'NOTE' } }) + end, + desc = 'Note', + }, + }, + config = function() + local todo_comments = require('todo-comments') + + todo_comments.setup({ + keywords = { + FIX = { + icon = ' ', -- icon used for the sign, and in search results + color = 'error', -- can be a hex color, or a named color (see below) + alt = { 'FIXME', 'BUG', 'FIXIT', 'ISSUE' }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = ' ', color = 'info' }, + HACK = { icon = ' ', color = 'warning', alt = { 'DON SKIP' } }, + WARN = { icon = ' ', color = 'warning', alt = { 'WARNING', 'XXX' } }, + PERF = { icon = ' ', alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } }, + NOTE = { icon = ' ', color = 'hint', alt = { 'INFO', 'READ', 'COLORS' } }, + TEST = { icon = '⏲ ', color = 'test', alt = { 'TESTING', 'PASSED', 'FAILED' } }, + }, + }) + + -- keymaps + vim.keymap.set('n', ']t', function() + todo_comments.jump_next() + end, { desc = 'Next todo comment' }) + + vim.keymap.set('n', '[t', function() + todo_comments.jump_prev() + end, { desc = 'Previous todo comment' }) + end, + }, { '2kabhishek/pickme.nvim', cmd = 'PickMe', diff --git a/lua/plugins/lock.json b/lua/plugins/lock.json index 1bb89c3..e767958 100644 --- a/lua/plugins/lock.json +++ b/lua/plugins/lock.json @@ -55,6 +55,7 @@ "sniprun": { "branch": "master", "commit": "a90c65846c3c18efc3f799d8b6dc26af9d4a69ed" }, "substitute.nvim": { "branch": "main", "commit": "9db749a880e3dd3b0eb57f698aa8f1e1630e1f25" }, "termim.nvim": { "branch": "main", "commit": "e4bcf977bef6f6c79996e38fcb9faeccd912007c" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "treesj": { "branch": "main", "commit": "3b4a2bc42738a63de17e7485d4cc5e49970ddbcc" }, "ui": { "branch": "v3.0", "commit": "dc4950f5bd4117e2da108b681506c908b93d4a62" }, diff --git a/lua/plugins/ui/snacks.lua b/lua/plugins/ui/snacks.lua index a1874ec..7c78df3 100644 --- a/lua/plugins/ui/snacks.lua +++ b/lua/plugins/ui/snacks.lua @@ -162,6 +162,10 @@ Snacks.setup({ prompt_pos = 'title', win = { style = 'picker' }, expand = true, + matchers = { + frecency = true, + cwd_bonus = false, + }, sources = { -- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar buffers = { layout = files_layout() },