-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Is your feature request related to a problem?
When there are many marks across a project, the auto-generated mark names and line previews aren't enough context. While the data structure supports a description field, there's no way to add, edit, or view descriptions through commands or the UI. This makes marks less useful for tracking todos, bugs, or refactoring notes across large codebases.
Describe the solution you'd like
Add full support for mark descriptions/notes with the following capabilities:
Commands:
:MarkAdd my_mark This needs optimization- Add mark with description:MarkNote <mark_name> <description>- Add/edit description for existing mark- Support description editing when creating marks interactively
UI Enhancements:
- Display descriptions below each mark in the floating window (non-minimal mode)
- Add
nkeymap in marks window to edit description of mark under cursor - Add new highlight group
ProjectMarksDescriptionfor styling - Update help text to show the new
n:Noteoption
Integration:
- Ensure search works with descriptions (already should via
mark.description) - Preserve descriptions during mark operations (rename, move, export/import)
Describe alternatives you've considered
- Encoding notes in mark names - Limited by 50-character name limit and reduces readability
Additional context
The infrastructure already exists! The add_mark() function accepts a description parameter and stores it in the mark data structure:
local mark = {
file = bufname,
line = line,
col = col,
text = vim.fn.getline("."):sub(1, 80),
created_at = os.time(),
description = description, -- Already stored!
}This feature is mostly about exposing existing functionality through commands and UI rather than building new core features.
Implementation ideas
1. Add :MarkNote command (in init.lua):
{
"MarkNote",
function(args)
local parts = vim.split(args.args, " ", { plain = true })
if #parts >= 2 then
local mark_name = parts[1]
local description = table.concat(parts, " ", 2)
local storage = require("marksman.storage")
local marks = storage.get_marks()
if marks[mark_name] then
marks[mark_name].description = description
storage.save_marks()
notify("Description updated for: " .. mark_name, vim.log.levels.INFO)
else
notify("Mark not found: " .. mark_name, vim.log.levels.WARN)
end
end
end,
{ nargs = "+", desc = "Add/edit mark description" },
}2. Add n keymap for editing descriptions (in ui.lua - setup_window_keymaps):
vim.keymap.set("n", "n", function()
local mark_info_item = get_mark_under_cursor(mark_info)
if mark_info_item then
vim.ui.input({
prompt = "Description: ",
default = mark_info_item.mark.description or "",
}, function(description)
if description ~= nil then
local storage = require("marksman.storage")
local marks = storage.get_marks()
marks[mark_info_item.name].description = description
storage.save_marks()
refresh_window(search_query)
end
end)
end
end, keymap_opts)3. Display descriptions in UI (in ui.lua - create_detailed_mark_lines):
-- After file info line, add:
if mark.description and mark.description ~= "" then
local desc_text = " 💭 " .. mark.description:sub(1, WINDOW_WIDTH - 15)
if #mark.description > WINDOW_WIDTH - 15 then
desc_text = desc_text .. "..."
end
table.insert(lines, desc_text)
table.insert(highlights, {
line = line_idx + 2,
col = 4,
end_col = -1,
hl_group = "ProjectMarksDescription",
})
end4. Add highlight group (in default_config.highlights):
ProjectMarksDescription = { fg = "#7C7F93", italic = true },5. Update help text (in create_help_line):
local help_items = {
"<CR>/1-9:Jump",
"d:Delete",
"r:Rename",
"n:Note",
"/:Search",
"J/K:Move",
"C:Clear",
"q:Close",
}6. Modify :MarkAdd command to accept description:
-- Update MarkAdd command handler
{
"MarkAdd",
function(args)
local parts = vim.split(args.args, " ", { plain = true, trimempty = true })
local name = parts[1]
local description = #parts > 1 and table.concat(parts, " ", 2) or nil
local result = M.add_mark(name ~= "" and name or nil, description)
if not result.success then
notify(result.message, vim.log.levels.WARN)
end
end,
{ nargs = "?", desc = "Add a mark at current position" },
}