Skip to content

Commit f378f14

Browse files
authored
feat: updated nerdfont icons (#11)
1 parent b709b9f commit f378f14

File tree

1 file changed

+50
-46
lines changed

1 file changed

+50
-46
lines changed

lua/marksman/ui.lua

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,39 @@ local current_buffer = nil
1111

1212
-- File icon mapping for better visual display
1313
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 = "",
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 = "󰬷",
2828
kt = "󱈙",
2929
cs = "󰌛",
30-
rb = "",
31-
php = "",
32-
html = "",
33-
css = "",
34-
scss = "",
35-
json = "",
36-
yaml = "",
37-
yml = "",
38-
toml = "",
30+
rb = "󰴭",
31+
php = "󰌟",
32+
html = "󰌝",
33+
css = "󰌜",
34+
scss = "󰛓",
35+
json = "󰘓",
36+
yaml = "󰈙",
37+
yml = "󰈙",
38+
toml = "󰈙",
3939
xml = "󰗀",
40-
md = "",
41-
txt = "",
42-
vim = "",
43-
sh = "",
40+
md = "󰍔",
41+
txt = "󰈙",
42+
vim = "",
43+
sh = "󰘳",
4444
fish = "󰈺",
45-
zsh = "",
46-
bash = "",
45+
zsh = "󰰶",
46+
bash = "󰘳",
4747
}
4848

4949
---Helper function for conditional notifications
@@ -84,7 +84,7 @@ end
8484
---@return string relative_path Formatted relative path
8585
local function get_relative_path_display(filepath)
8686
local rel_path = vim.fn.fnamemodify(filepath, ":~:.")
87-
87+
8888
-- If path is too long, show parent directory + filename
8989
if #rel_path > 50 then
9090
local parent = vim.fn.fnamemodify(filepath, ":h:t")
@@ -105,8 +105,9 @@ local function create_header_content(total_marks, shown_marks, search_query)
105105
local highlights = {}
106106

107107
-- Title
108-
local title = search_query and search_query ~= ""
109-
and string.format(" 󰃀 Project Marks (filtered: %s) ", search_query)
108+
local title = search_query
109+
and search_query ~= ""
110+
and string.format(" 󰃀 Project Marks (filtered: %s) ", search_query)
110111
or " 󰃀 Project Marks "
111112
table.insert(lines, title)
112113
table.insert(highlights, { line = 0, col = 0, end_col = -1, hl_group = "ProjectMarksTitle" })
@@ -141,7 +142,7 @@ end
141142
local function create_minimal_mark_line(name, mark, index, line_idx)
142143
local filepath = get_relative_path_display(mark.file)
143144
local line = string.format("[%d] %s %s", index, name, filepath)
144-
145+
145146
local highlights = {}
146147
local number_part = string.format("[%d]", index)
147148
local name_start = #number_part + 1
@@ -154,15 +155,15 @@ local function create_minimal_mark_line(name, mark, index, line_idx)
154155
end_col = #number_part,
155156
hl_group = "ProjectMarksNumber",
156157
})
157-
158+
158159
-- Name highlight
159160
table.insert(highlights, {
160161
line = line_idx,
161162
col = name_start,
162163
end_col = name_end,
163164
hl_group = "ProjectMarksName",
164165
})
165-
166+
166167
-- File path highlight
167168
table.insert(highlights, {
168169
line = line_idx,
@@ -279,10 +280,10 @@ local function create_marks_content(marks, search_query)
279280
local mark = marks[name]
280281
local line_idx = #lines
281282
local line, line_highlights = create_minimal_mark_line(name, mark, i, line_idx)
282-
283+
283284
table.insert(lines, line)
284285
mark_info[line_idx] = { name = name, mark = mark, index = i }
285-
286+
286287
for _, hl in ipairs(line_highlights) do
287288
table.insert(highlights, hl)
288289
end
@@ -302,8 +303,7 @@ local function create_marks_content(marks, search_query)
302303

303304
-- Handle no marks case
304305
if shown_marks == 0 then
305-
local no_marks_line = search_query and search_query ~= ""
306-
and " No marks found matching search"
306+
local no_marks_line = search_query and search_query ~= "" and " No marks found matching search"
307307
or " No marks in this project"
308308
table.insert(lines, no_marks_line)
309309
table.insert(highlights, { line = #lines - 1, col = 0, end_col = -1, hl_group = "ProjectMarksText" })
@@ -315,9 +315,9 @@ local function create_marks_content(marks, search_query)
315315
local mark = marks[name]
316316
local start_line_idx = #lines
317317
local mark_lines, mark_highlights = create_detailed_mark_lines(name, mark, i, start_line_idx)
318-
318+
319319
mark_info[start_line_idx] = { name = name, mark = mark, index = i }
320-
320+
321321
for _, line in ipairs(mark_lines) do
322322
table.insert(lines, line)
323323
end
@@ -459,8 +459,12 @@ local function setup_window_keymaps(buf, marks, project_name, mark_info, search_
459459
vim.keymap.set("n", "C", clear_all_marks, keymap_opts)
460460

461461
-- 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)
462+
vim.keymap.set("n", "J", function()
463+
move_selected("down")
464+
end, keymap_opts)
465+
vim.keymap.set("n", "K", function()
466+
move_selected("up")
467+
end, keymap_opts)
464468

465469
-- Number key navigation
466470
for i = 1, 9 do
@@ -486,16 +490,16 @@ end
486490
local function calculate_window_dimensions(content_lines)
487491
local max_width = 120
488492
local max_height = vim.o.lines - 6
489-
493+
490494
-- Calculate content width
491495
local content_width = 0
492496
for _, line in ipairs(content_lines) do
493497
content_width = math.max(content_width, vim.fn.strdisplaywidth(line))
494498
end
495-
499+
496500
local width = math.min(math.max(content_width + 4, 60), max_width)
497501
local height = math.min(#content_lines + 2, max_height)
498-
502+
499503
return {
500504
width = width,
501505
height = height,

0 commit comments

Comments
 (0)