Skip to content

Commit d41293d

Browse files
committed
feat(dropbar): replace path with custom source
1 parent 68c2182 commit d41293d

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

lua/modules/configs/tool/dropbar.lua

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,43 @@ return function()
55
misc = require("modules.utils.icons").get("misc", true),
66
ui = require("modules.utils.icons").get("ui", true),
77
}
8+
local utils = require("dropbar.utils")
9+
local sources = require("dropbar.sources")
10+
-- Custom source to display only the leaf filename in the dropbar
11+
sources.symbols = {
12+
get_symbols = function(buf, win, cursor)
13+
local symbols = sources.path.get_symbols(buf, win, cursor)
14+
return { symbols[#symbols] }
15+
end,
16+
}
817

918
require("modules.utils").load_plugin("dropbar", {
1019
bar = {
1120
hover = false,
1221
truncate = true,
1322
pick = { pivots = "etovxqpdygfblzhckisuran" },
23+
sources = function(buf)
24+
if vim.bo[buf].ft == "markdown" then
25+
return {
26+
sources.symbols,
27+
sources.markdown,
28+
}
29+
end
30+
if vim.bo[buf].buftype == "terminal" then
31+
return {
32+
sources.terminal,
33+
}
34+
end
35+
return {
36+
sources.symbols,
37+
utils.source.fallback({
38+
sources.lsp,
39+
sources.treesitter,
40+
}),
41+
}
42+
end,
1443
},
1544
sources = {
16-
path = {
17-
relative_to = function()
18-
-- Only show the leaf filename in dropbar
19-
return vim.fn.expand("%:p:h")
20-
end,
21-
},
2245
terminal = {
2346
name = function(buf)
2447
local name = vim.api.nvim_buf_get_name(buf)

0 commit comments

Comments
 (0)