Skip to content

Commit 038646a

Browse files
committed
feat: updated nerdfont icons
1 parent b709b9f commit 038646a

File tree

1 file changed

+51
-46
lines changed

1 file changed

+51
-46
lines changed

lua/marksman/ui.lua

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,42 @@ local config = {}
99
local current_window = nil
1010
local current_buffer = nil
1111

12+
-- File icon mapping for better visual display
1213
-- File icon mapping for better visual display
1314
local file_icons = {
14-
lua = "",
15-
py = "",
16-
js = "",
17-
ts = "",
18-
jsx = "",
19-
tsx = "",
20-
vue = "",
21-
go = "",
22-
rs = "",
23-
c = "",
24-
cpp = "",
25-
h = "",
26-
hpp = "",
27-
java = "",
15+
lua = "󰢱",
16+
py = "󰌠",
17+
js = "󰌞",
18+
ts = "󰛦",
19+
jsx = "󰜈",
20+
tsx = "󰛦",
21+
vue = "󰡄",
22+
go = "󰟓",
23+
rs = "󱘗",
24+
c = "",
25+
cpp = "󰙱",
26+
h = "󰟔",
27+
hpp = "󰙲",
28+
java = "󰬷",
2829
kt = "󱈙",
2930
cs = "󰌛",
30-
rb = "",
31-
php = "",
32-
html = "",
33-
css = "",
34-
scss = "",
35-
json = "",
36-
yaml = "",
37-
yml = "",
38-
toml = "",
31+
rb = "󰴭",
32+
php = "󰌟",
33+
html = "󰌝",
34+
css = "󰌜",
35+
scss = "󰛓",
36+
json = "󰘓",
37+
yaml = "󰈙",
38+
yml = "󰈙",
39+
toml = "󰈙",
3940
xml = "󰗀",
40-
md = "",
41-
txt = "",
42-
vim = "",
43-
sh = "",
41+
md = "󰍔",
42+
txt = "󰈙",
43+
vim = "",
44+
sh = "󰘳",
4445
fish = "󰈺",
45-
zsh = "",
46-
bash = "",
46+
zsh = "󰰶",
47+
bash = "󰘳",
4748
}
4849

4950
---Helper function for conditional notifications
@@ -84,7 +85,7 @@ end
8485
---@return string relative_path Formatted relative path
8586
local function get_relative_path_display(filepath)
8687
local rel_path = vim.fn.fnamemodify(filepath, ":~:.")
87-
88+
8889
-- If path is too long, show parent directory + filename
8990
if #rel_path > 50 then
9091
local parent = vim.fn.fnamemodify(filepath, ":h:t")
@@ -105,8 +106,9 @@ local function create_header_content(total_marks, shown_marks, search_query)
105106
local highlights = {}
106107

107108
-- Title
108-
local title = search_query and search_query ~= ""
109-
and string.format(" 󰃀 Project Marks (filtered: %s) ", search_query)
109+
local title = search_query
110+
and search_query ~= ""
111+
and string.format(" 󰃀 Project Marks (filtered: %s) ", search_query)
110112
or " 󰃀 Project Marks "
111113
table.insert(lines, title)
112114
table.insert(highlights, { line = 0, col = 0, end_col = -1, hl_group = "ProjectMarksTitle" })
@@ -141,7 +143,7 @@ end
141143
local function create_minimal_mark_line(name, mark, index, line_idx)
142144
local filepath = get_relative_path_display(mark.file)
143145
local line = string.format("[%d] %s %s", index, name, filepath)
144-
146+
145147
local highlights = {}
146148
local number_part = string.format("[%d]", index)
147149
local name_start = #number_part + 1
@@ -154,15 +156,15 @@ local function create_minimal_mark_line(name, mark, index, line_idx)
154156
end_col = #number_part,
155157
hl_group = "ProjectMarksNumber",
156158
})
157-
159+
158160
-- Name highlight
159161
table.insert(highlights, {
160162
line = line_idx,
161163
col = name_start,
162164
end_col = name_end,
163165
hl_group = "ProjectMarksName",
164166
})
165-
167+
166168
-- File path highlight
167169
table.insert(highlights, {
168170
line = line_idx,
@@ -279,10 +281,10 @@ local function create_marks_content(marks, search_query)
279281
local mark = marks[name]
280282
local line_idx = #lines
281283
local line, line_highlights = create_minimal_mark_line(name, mark, i, line_idx)
282-
284+
283285
table.insert(lines, line)
284286
mark_info[line_idx] = { name = name, mark = mark, index = i }
285-
287+
286288
for _, hl in ipairs(line_highlights) do
287289
table.insert(highlights, hl)
288290
end
@@ -302,8 +304,7 @@ local function create_marks_content(marks, search_query)
302304

303305
-- Handle no marks case
304306
if shown_marks == 0 then
305-
local no_marks_line = search_query and search_query ~= ""
306-
and " No marks found matching search"
307+
local no_marks_line = search_query and search_query ~= "" and " No marks found matching search"
307308
or " No marks in this project"
308309
table.insert(lines, no_marks_line)
309310
table.insert(highlights, { line = #lines - 1, col = 0, end_col = -1, hl_group = "ProjectMarksText" })
@@ -315,9 +316,9 @@ local function create_marks_content(marks, search_query)
315316
local mark = marks[name]
316317
local start_line_idx = #lines
317318
local mark_lines, mark_highlights = create_detailed_mark_lines(name, mark, i, start_line_idx)
318-
319+
319320
mark_info[start_line_idx] = { name = name, mark = mark, index = i }
320-
321+
321322
for _, line in ipairs(mark_lines) do
322323
table.insert(lines, line)
323324
end
@@ -459,8 +460,12 @@ local function setup_window_keymaps(buf, marks, project_name, mark_info, search_
459460
vim.keymap.set("n", "C", clear_all_marks, keymap_opts)
460461

461462
-- Reordering
462-
vim.keymap.set("n", "J", function() move_selected("down") end, keymap_opts)
463-
vim.keymap.set("n", "K", function() move_selected("up") end, keymap_opts)
463+
vim.keymap.set("n", "J", function()
464+
move_selected("down")
465+
end, keymap_opts)
466+
vim.keymap.set("n", "K", function()
467+
move_selected("up")
468+
end, keymap_opts)
464469

465470
-- Number key navigation
466471
for i = 1, 9 do
@@ -486,16 +491,16 @@ end
486491
local function calculate_window_dimensions(content_lines)
487492
local max_width = 120
488493
local max_height = vim.o.lines - 6
489-
494+
490495
-- Calculate content width
491496
local content_width = 0
492497
for _, line in ipairs(content_lines) do
493498
content_width = math.max(content_width, vim.fn.strdisplaywidth(line))
494499
end
495-
500+
496501
local width = math.min(math.max(content_width + 4, 60), max_width)
497502
local height = math.min(#content_lines + 2, max_height)
498-
503+
499504
return {
500505
width = width,
501506
height = height,

0 commit comments

Comments
 (0)