Skip to content

Commit 70551a3

Browse files
authored
feat: improve minimal mode to show number, name, and path (#5)
Change minimal mode format from "[1] path" to "[1] name path" Add proper syntax highlighting for name in minimal mode
1 parent 602745c commit 70551a3

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ storage.get_project_name() -- Get current project name
295295
| `auto_save` | boolean | `true` | Automatically save marks |
296296
| `max_marks` | number | `100` | Maximum marks per project |
297297
| `search_in_ui` | boolean | `true` | Enable search in UI |
298-
| `minimal` | boolean | `false` | Set to true for clean UI (only order and filepath)|
298+
| `minimal` | boolean | `false` | Set to true for clean UI (number, name, and filepath only)|
299299
| `silent` | boolean | `false` | Set to true to supress notifications|
300300
| `highlights` | table | `{...}` | Custom highlight groups |
301301

lua/marksman/ui.lua

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ local function create_marks_content(marks, search_query)
103103
filtered_names = mark_names
104104
end
105105

106-
-- MINIMAL MODE: Show only order and filepath
107106
if config.minimal then
108107
if #filtered_names == 0 then
109108
table.insert(lines, " No marks")
@@ -113,23 +112,34 @@ local function create_marks_content(marks, search_query)
113112
for i, name in ipairs(filtered_names) do
114113
local mark = marks[name]
115114
local filepath = get_relative_path_display(mark.file)
116-
local line = string.format("[%d] %s", i, filepath)
115+
local line = string.format("[%d] %s %s", i, name, filepath)
117116
table.insert(lines, line)
118117

119118
local line_idx = #lines - 1
120119
mark_info[line_idx] = { name = name, mark = mark, index = i }
121120

121+
local number_part = string.format("[%d]", i)
122+
local name_start = string.len(number_part) + 1
123+
local name_end = name_start + string.len(name)
124+
122125
-- Highlight the number
123126
table.insert(highlights, {
124127
line = line_idx,
125128
col = 0,
126-
end_col = string.len(string.format("[%d]", i)),
129+
end_col = string.len(number_part),
127130
hl_group = "ProjectMarksNumber",
128131
})
132+
-- Highlight the name
133+
table.insert(highlights, {
134+
line = line_idx,
135+
col = name_start,
136+
end_col = name_end,
137+
hl_group = "ProjectMarksName",
138+
})
129139
-- Highlight the filepath
130140
table.insert(highlights, {
131141
line = line_idx,
132-
col = string.len(string.format("[%d] ", i)),
142+
col = name_end + 1,
133143
end_col = -1,
134144
hl_group = "ProjectMarksFile",
135145
})
@@ -138,7 +148,6 @@ local function create_marks_content(marks, search_query)
138148
return lines, highlights, mark_info
139149
end
140150

141-
-- NORMAL MODE: Full detailed view
142151
-- Header
143152
local title = search_query
144153
and search_query ~= ""

0 commit comments

Comments
 (0)