From b9949062dcc0ebee3550b98cd6aa8fa4165955cc Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Tue, 25 Jun 2024 07:22:10 +0700 Subject: [PATCH] add: todo comment --- init.lua | 1 + lazy-lock.json | 1 + lua/custom/default.lua | 3 +++ lua/plugins/todo-comments.lua | 25 +++++++++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 lua/plugins/todo-comments.lua diff --git a/init.lua b/init.lua index db8746c..ff6dcf9 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,4 @@ +-- PERF fully optimized if vim.g.vscode then -- config vscode Map = vim.keymap.set diff --git a/lazy-lock.json b/lazy-lock.json index 2ab837d..05d8040 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -59,6 +59,7 @@ "smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" }, "telescope.nvim": { "branch": "master", "commit": "f2bfde705ac752c52544d5cfa8b0aee0a766c1ed" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" }, + "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, diff --git a/lua/custom/default.lua b/lua/custom/default.lua index c5a4be0..6f8cea8 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -131,6 +131,9 @@ pcode.columnline = true -- https://github.com/okuuva/auto-save.nvim pcode.auto_save = true +-- https://github.com/folke/todo-comments.nvim +pcode.todo_comment = true + -- https://github.com/nvim-telescope/telescope.nvim ---@alias telescope_themes ---| "cursor" # see `telescope.themes.get_cursor()` diff --git a/lua/plugins/todo-comments.lua b/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..66cdf01 --- /dev/null +++ b/lua/plugins/todo-comments.lua @@ -0,0 +1,25 @@ +local M = {} +if pcode.todo_comment then + M = { + "folke/todo-comments.nvim", + event = { "BufRead", "BufNewFile" }, + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local todo_comments = require("todo-comments") + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "]t", function() + todo_comments.jump_next() + end, { desc = "Next todo comment" }) + + keymap.set("n", "[t", function() + todo_comments.jump_prev() + end, { desc = "Previous todo comment" }) + + todo_comments.setup() + end, + } +end +return M