Skip to content

Commit 07a7002

Browse files
committed
Remove "TODO" section from status buffer
1 parent 82ba3cd commit 07a7002

File tree

4 files changed

+0
-102
lines changed

4 files changed

+0
-102
lines changed

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,6 @@ neogit.setup {
291291
folded = true,
292292
hidden = false,
293293
},
294-
todo = {
295-
folded = true,
296-
hidden = false,
297-
},
298294
},
299295
mappings = {
300296
commit_editor = {

doc/neogit.txt

-9
Original file line numberDiff line numberDiff line change
@@ -1835,15 +1835,6 @@ Untracked Files *neogit_status_buffer_untracked*
18351835
untracked files entirely, "normal" to show files and directories (default),
18361836
or "all" to show all files in all directories.
18371837

1838-
TODOs *neogit_status_buffer_todos*
1839-
Requires `ripgrep` and `sort` to be available on your system. By default,
1840-
finds all TODO notes in the codebase matching:
1841-
- " TODO: "
1842-
- " NOTE: "
1843-
- " FIXME: "
1844-
- " HACK: "
1845-
1846-
Can be configured to find other/different keywords.
18471838
==============================================================================
18481839
Editor Buffer *neogit_editor_buffer*
18491840

lua/neogit/buffers/status/ui.lua

-65
Original file line numberDiff line numberDiff line change
@@ -478,36 +478,6 @@ local BisectDetailsSection = Component.new(function(props)
478478
})
479479
end)
480480

481-
local SectionItemTodo = Component.new(function(item)
482-
local function present_item(item)
483-
return row({
484-
text.highlight(item.highlight)(item.kind),
485-
text(" "),
486-
text(item.message),
487-
}, {
488-
yankable = ("%s:%d"):format(item.path, item.line),
489-
item = {
490-
goto_path = item.path,
491-
goto_cursor = { item.line, item.column },
492-
},
493-
})
494-
end
495-
496-
local grouped_items = map(item, present_item)
497-
table.insert(
498-
grouped_items,
499-
1,
500-
row {
501-
text(item[1].path),
502-
text.highlight("NeogitObjectId")(" ("),
503-
text.highlight("NeogitObjectId")(#item),
504-
text.highlight("NeogitObjectId")(")")
505-
}
506-
)
507-
508-
return col.tag("Section")(grouped_items, { foldable = true, folded = true })
509-
end)
510-
511481
function M.Status(state, config)
512482
-- stylua: ignore start
513483
local show_hint = not config.disable_hint
@@ -567,9 +537,6 @@ function M.Status(state, config)
567537
local show_recent = #state.recent.items > 0
568538
and not config.sections.recent.hidden
569539

570-
local show_todos = vim.fn.executable("rg") == 1
571-
and not config.sections.todo.hidden
572-
573540
return {
574541
List {
575542
items = {
@@ -767,38 +734,6 @@ function M.Status(state, config)
767734
folded = config.sections.unpulled_pushRemote.folded,
768735
name = "pushRemote_unpulled",
769736
},
770-
Section {
771-
visible = show_todos,
772-
title = SectionTitle { title = "TODOs", highlight = "NeogitRecentcommits" },
773-
render = SectionItemTodo,
774-
folded = true,
775-
name = "todos_plugin",
776-
items = function()
777-
local Collection = require("neogit.lib.collection")
778-
779-
local kinds = table.concat(vim.tbl_keys(config.sections.todo.keywords), "|")
780-
local items = vim.system(
781-
{ "rg", " (" .. kinds .. "): ", "--vimgrep", "--sortr=path" },
782-
{ text = true }
783-
):wait()
784-
785-
items = filter_map(vim.split(items.stdout, "\n"), function(line)
786-
local path, linenr, column, kind, msg = line:match("^([^:]+):(%d+):(%d+):.- (%w+): (.+)$")
787-
if path then
788-
return {
789-
path = path,
790-
line = linenr,
791-
column = column,
792-
message = msg,
793-
kind = kind,
794-
highlight = config.sections.todo.keywords[kind]
795-
}
796-
end
797-
end)
798-
799-
return Collection.new(items):group_by("path")
800-
end
801-
}
802737
},
803738
},
804739
}

lua/neogit/config.lua

-24
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ end
120120
---@field folded boolean Whether or not this section should be open or closed by default
121121
---@field hidden boolean Whether or not this section should be shown
122122

123-
---@class NeogitTodoConfigSection A section to show in the Neogit Status buffer, e.g. Staged/Unstaged/Untracked
124-
---@field folded boolean Whether or not this section should be open or closed by default
125-
---@field hidden boolean Whether or not this section should be shown
126-
---@field keywords { [string]: string } Dictionary of keywords to search for (key) and the highlight to apply (value)
127-
128123
---@class NeogitConfigSections
129124
---@field untracked NeogitConfigSection|nil
130125
---@field unstaged NeogitConfigSection|nil
@@ -138,7 +133,6 @@ end
138133
---@field rebase NeogitConfigSection|nil
139134
---@field sequencer NeogitConfigSection|nil
140135
---@field bisect NeogitConfigSection|nil
141-
---@field todo NeogitTodoConfigSection|nil
142136

143137
---@class HighlightOptions
144138
---@field italic? boolean
@@ -520,16 +514,6 @@ function M.get_default_values()
520514
folded = true,
521515
hidden = false,
522516
},
523-
todo = {
524-
folded = true,
525-
hidden = false,
526-
keywords = {
527-
["TODO"] = "NeogitGraphBoldBlue",
528-
["NOTE"] = "NeogitGraphBoldGreen",
529-
["FIXME"] = "NeogitGraphBoldRed",
530-
["HACK"] = "NeogitGraphBoldOrange",
531-
},
532-
},
533517
},
534518
ignored_settings = {
535519
"NeogitPushPopup--force-with-lease",
@@ -810,10 +794,6 @@ function M.validate_config()
810794
validate_type(section, "section." .. section_name, "table")
811795
validate_type(section.folded, string.format("section.%s.folded", section_name), "boolean")
812796
validate_type(section.hidden, string.format("section.%s.hidden", section_name), "boolean")
813-
814-
if section_name == "todo" then
815-
validate_type(section.keywords, "section.todo.keywords", "table")
816-
end
817797
end
818798
end
819799

@@ -1234,10 +1214,6 @@ function M.setup(opts)
12341214
end
12351215
end
12361216

1237-
if opts.sections.todo and type(opts.sections.todo.keywords) == "table" then
1238-
M.values.sections.todo.keywords = opts.sections.todo.keywords
1239-
end
1240-
12411217
M.values = vim.tbl_deep_extend("force", M.values, opts)
12421218

12431219
local config_errs = M.validate_config()

0 commit comments

Comments
 (0)