Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 8cc49ea

Browse files
committed
feat(config/nvim): add todo-comments.nvim
By folke the GOAT. Allows smooth navigation of todos comments in any project files. Also comes with highlighting and easy navigation with telescope integration. Really nice to things I always want to go back to but never do. TODO: Might now begin adding a hook in projects to prevent commit if there contains 1 or more TODO comments. No pun intended!
1 parent fe8e395 commit 8cc49ea

File tree

5 files changed

+43
-10
lines changed

5 files changed

+43
-10
lines changed

.config/nvim/lazy-lock.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
2020
"snacks.nvim": { "branch": "main", "commit": "5eac729fa290248acfe10916d92a5ed5e5c0f9ed" },
2121
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
22+
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
2223
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
2324
"vim-wakatime": { "branch": "master", "commit": "cf51327a9e08935569614d1cb24e779ee9f45519" },
2425
"which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" }

.config/nvim/lua/config/keymaps.lua

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ end
8888
vim.keymap.set("n", "<C-p>", "<cmd> :lua PYTHON_TOGGLE()<CR> <cmd>")
8989
vim.keymap.set("i", "<C-p>", "<cmd> :lua PYTHON_TOGGLE()<CR> <cmd>")
9090

91-
9291
-- open mysql
9392
local mysql = Terminal:new({ cmd = "mysql -u root -p", hidden = true })
9493

@@ -98,11 +97,11 @@ end
9897
vim.keymap.set("n", "<C-m>", "<cmd> :lua MYSQL_TOGGLE()<CR> <cmd>")
9998
vim.keymap.set("i", "<C-m>", "<cmd> :lua MYSQL_TOGGLE()<CR> <cmd>")
10099

101-
-- open htop
102-
-- local htop = Terminal:new({ cmd = "htop", hidden = true })
103-
--
104-
-- function HTOP_TOGGLE()
105-
-- htop:toggle()
106-
-- end
107-
-- vim.keymap.set("n", "<C-h>", "<cmd> :lua HTOP_TOGGLE()<CR> <cmd>")
108-
-- vim.keymap.set("i", "<C-h>", "<cmd> :lua HTOP_TOGGLE()<CR> <cmd>")
100+
-- toggle todo comments easily
101+
vim.keymap.set("n", "]t", function()
102+
require("todo-comments").jump_next()
103+
end, { desc = "[n]ext [t]odo comment" })
104+
105+
vim.keymap.set("n", "[t", function()
106+
require("todo-comments").jump_prev()
107+
end, { desc = "[p]revious [t]odo comment" })

.config/nvim/lua/config/options.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ vim.opt.foldmethod = "expr"
6161
vim.opt.foldexpr = "nvim_treesitter#foldexpr()" -- use treesitter for code folding
6262
vim.opt.foldtext = "" -- you can see what is inside the fold
6363
vim.opt.foldlevel = 99
64-
vim.opt.foldlevelstart = 2 --top level is not folded. only nested folds
64+
vim.opt.foldlevelstart = 4 --top level is not folded. only nested folds
6565
vim.opt.foldnestmax = 5
6666

6767
-- automatically re-read changes done on file.

.config/nvim/lua/config/plugins/telescope.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,9 @@ return {
103103

104104
-- resume previous search
105105
vim.keymap.set("n", "<leader>fp", require("telescope.builtin").resume, { desc = "[f]ind [p]revious search" })
106+
107+
-- find todo comments easily
108+
vim.keymap.set("n", "<leader>ft", "<cmd>:TodoTelescope<cr>", { desc = "[f]ind [t]odos" })
109+
106110
end,
107111
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- nice highlighting of todo comments
2+
3+
return {
4+
"folke/todo-comments.nvim",
5+
version = "v1.4.0",
6+
dependencies = { "nvim-lua/plenary.nvim" },
7+
opts = {
8+
-- keywords recognized as todo comments
9+
keywords = {
10+
TODO = { icon = "", color = "info" },
11+
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
12+
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
13+
FIX = { icon = "", color = "error", alt = { "BUGFIX", "FIXME", "BUG", "FIXIT", "ISSUE" } },
14+
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE", "REFACTOR" } },
15+
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
16+
},
17+
-- list of named colors where we try to extract the guifg from the
18+
-- list of highlight groups or use the hex color if hl not found as a fallback
19+
colors = {
20+
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
21+
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
22+
info = { "DiagnosticInfo", "#2563EB" },
23+
hint = { "DiagnosticHint", "#10B981" },
24+
default = { "Identifier", "#7C3AED" },
25+
test = { "#38fa07" },
26+
-- test = { "Identifier", "#38fa07" },
27+
},
28+
},
29+
}

0 commit comments

Comments
 (0)