Skip to content

Commit c500ef8

Browse files
committed
statusline/lualine: initialize integrations for breadcrumbs and merge old features
1 parent b05fade commit c500ef8

12 files changed

Lines changed: 494 additions & 414 deletions

File tree

configuration.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ isMaximal: {
153153
lualine = {
154154
enable = true;
155155
theme = "catppuccin";
156+
157+
integrations.breadcrumbs = {
158+
vanilla.enable = !isMaximal;
159+
nvim-navic.enable = isMaximal;
160+
navbuddy.enable = isMaximal;
161+
lspsaga.enable = false;
162+
};
156163
};
157164
};
158165

@@ -264,10 +271,6 @@ isMaximal: {
264271
colorizer.enable = true;
265272
modes-nvim.enable = false; # the theme looks terrible with catppuccin
266273
illuminate.enable = true;
267-
breadcrumbs = {
268-
enable = isMaximal;
269-
navbuddy.enable = isMaximal;
270-
};
271274
smartcolumn = {
272275
enable = true;
273276
setupOpts.custom_colorcolumn = {

docs/manual/release-notes/rl-0.5.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
- Added {option}`vim.ui.borders.enable` for global and individual plugin border
5454
configuration.
5555

56-
- LSP integrated breadcrumbs with {option}`vim.ui.breadcrumbs.enable` through
57-
nvim-navic
56+
- LSP integrated breadcrumbs with `vim.ui.breadcrumbs.enable` through nvim-navic
5857

5958
- LSP navigation helper with nvim-navbuddy, depends on nvim-navic (automatically
6059
enabled if navic is enabled)

docs/manual/release-notes/rl-0.7.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,12 @@ The changes are, in no particular order:
297297
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
298298
being.
299299

300-
- {option}`vim.ui.breadcrumbs.lualine.winbar.enable` has been added to allow
300+
- `vim.ui.breadcrumbs.lualine.winbar.enable` has been added to allow
301301
controlling the default behaviour of the `nvim-navic` component on Lualine,
302302
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
303303
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
304-
{option}`vim.ui.breadcrumbs.lualine.winbar.alwaysRender` to be conform to
305-
the new format.
304+
`vim.ui.breadcrumbs.lualine.winbar.alwaysRender` to be conform to the new
305+
format.
306306

307307
- Add [basedpyright](https://github.com/detachhead/basedpyright) as a Python LSP
308308
server and make it default.

docs/manual/release-notes/rl-26.12.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
- `minimap/codewindow`: disabled/dropped till it supports main branch
3333
tree-sitter.
3434

35+
- `ui/breadcrumbs`: was removed and completely rebuild under
36+
`statusline.lualine.integrations.breadcrumbs`.
37+
3538
## Changelog {#sec-release-26-12-changelog}
3639

3740
[snoweuph](https://github.com/snoweuph)

modules/extra/deprecations.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,13 @@ in {
8484
Disabled, because it doesn't support tree-sitter main branch.
8585
'')
8686
]
87+
88+
# 2026-08-16
89+
[
90+
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "enable"] ["vim" "statusline" "lualine" "integrations" "breadcrumbs" "nvim-navic" "enable"])
91+
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "lualine" "winbar" "enable"] ["vim" "statusline" "lualine" "integrations" "breadcrumbs" "nvim-navic" "enable"])
92+
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "lualine" "winbar" "alwaysRender"] ["vim" "statusline" "lualine" "integrations" "breadcrumbs" "nvim-navic" "alwaysRender"])
93+
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "navbuddy" "enable"] ["vim" "statusline" "lualine" "integrations" "breadcrumbs" "navbuddy" "enable"])
94+
]
8795
];
8896
}

modules/plugins/lsp/config.nix

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,8 @@ in {
146146
${mkBinding mappings.toggleFormatOnSave "function() vim.b.disableFormatSave = not vim.b.disableFormatSave end"}
147147
end
148148
149-
${optionalString config.vim.ui.breadcrumbs.enable ''local navic = require("nvim-navic")''}
150149
default_on_attach = function(client, bufnr)
151150
attach_keymaps(client, bufnr)
152-
${optionalString config.vim.ui.breadcrumbs.enable ''
153-
-- let navic attach to buffers
154-
if client.server_capabilities.documentSymbolProvider then
155-
navic.attach(client, bufnr)
156-
end
157-
''}
158151
end
159152
160153
local capabilities = vim.lsp.protocol.make_client_capabilities()

modules/plugins/statusline/lualine/config.nix

Lines changed: 223 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
lib,
44
...
55
}: let
6-
inherit (builtins) map;
6+
inherit (lib.attrsets) filterAttrs mapAttrs';
7+
inherit (lib.lists) map count;
78
inherit (lib.modules) mkIf mkMerge mkDefault;
89
inherit (lib.trivial) boolToString;
9-
inherit (lib.nvim.dag) entryAnywhere;
10+
inherit (lib.nvim.dag) entryAnywhere entryAfter;
1011
inherit (lib.nvim.lua) toLuaObject;
1112
inherit (lib.generators) mkLuaInline;
1213

1314
cfg = config.vim.statusline.lualine;
14-
bCfg = config.vim.ui.breadcrumbs;
15+
16+
cfgIntBreadcrumbs = cfg.integrations.breadcrumbs;
1517
in {
1618
config = mkMerge [
1719
{
@@ -37,17 +39,230 @@ in {
3739
]);
3840
}
3941

40-
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
41-
vim.statusline.lualine.setupOpts = {
42-
# TODO: rewrite in new syntax
43-
winbar.lualine_c = mkDefault [
42+
{
43+
assertions = [
44+
{
45+
assertion =
46+
count (x: x) (with cfgIntBreadcrumbs; [
47+
vanilla.enable
48+
nvim-navic.enable
49+
lspsaga.enable
50+
])
51+
<= 1;
52+
53+
message = ''
54+
Only one lualine breadcrumb integration can be enabled at once.
55+
'';
56+
}
57+
];
58+
}
59+
60+
(mkIf cfgIntBreadcrumbs.vanilla.enable {
61+
vim.statusline.lualine.setupOpts."${cfgIntBreadcrumbs.location}"."lualine_${cfgIntBreadcrumbs.section}" = [
62+
(
63+
mkLuaInline ''
64+
function()
65+
local buffer = vim.api.nvim_get_current_buf()
66+
67+
local supported = false
68+
for _, client in pairs(vim.lsp.get_clients({ bufnr = buffer })) do
69+
if client.server_capabilities.documentSymbolProvider then
70+
supported = true
71+
break
72+
end
73+
end
74+
75+
if not supported then
76+
return ""
77+
end
78+
79+
local responses = vim.lsp.buf_request_sync(
80+
buffer,
81+
"textDocument/documentSymbol",
82+
{ textDocument = { uri = vim.uri_from_bufnr(buffer) } },
83+
100
84+
)
85+
86+
local symbols
87+
for _, response in pairs(responses or {}) do
88+
if response.result then
89+
symbols = response.result
90+
break
91+
end
92+
end
93+
94+
if not symbols then
95+
return ""
96+
end
97+
98+
local cursor_line, cursor_column = unpack(vim.api.nvim_win_get_cursor(0))
99+
cursor_line = cursor_line - 1
100+
local names = {}
101+
102+
local function find_symbols(symbols)
103+
for _, symbol in ipairs(symbols or {}) do
104+
local range = symbol.range
105+
106+
if
107+
range
108+
and (cursor_line > range.start.line or cursor_line == range.start.line and cursor_column >= range.start.character)
109+
and (
110+
cursor_line < range["end"].line
111+
or cursor_line == range["end"].line and cursor_column <= range["end"].character
112+
)
113+
then
114+
names[#names + 1] = symbol.name
115+
find_symbols(symbol.children)
116+
return
117+
end
118+
end
119+
end
120+
121+
find_symbols(symbols)
122+
return table.concat(names, "${cfgIntBreadcrumbs.vanilla.separator}")
123+
end
124+
''
125+
)
126+
];
127+
})
128+
129+
(mkIf cfgIntBreadcrumbs.nvim-navic.enable {
130+
vim = {
131+
startPlugins = [
132+
"nvim-lspconfig"
133+
"nvim-navic"
134+
];
135+
statusline.lualine.setupOpts."${cfgIntBreadcrumbs.location}"."lualine_${cfgIntBreadcrumbs.section}" = [
44136
[
45137
"navic"
46-
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
138+
(mkLuaInline "draw_empty = ${boolToString cfgIntBreadcrumbs.nvim-navic.alwaysRender}")
47139
]
48140
];
141+
142+
pluginRC.breadcrumbs-navic = entryAfter ["lspconfig"] ''
143+
local navic = require("nvim-navic")
144+
require("nvim-navic").setup({
145+
highlight = true,
146+
})
147+
'';
148+
149+
autocmds = [
150+
{
151+
event = ["LspAttach"];
152+
callback = mkLuaInline ''
153+
function(event)
154+
local bufnr = event.buf
155+
local client = vim.lsp.get_client_by_id(event.data.client_id)
156+
if client.server_capabilities.documentSymbolProvider then
157+
require("nvim-navic").attach(client, bufnr)
158+
end
159+
end
160+
'';
161+
}
162+
];
163+
};
164+
})
165+
166+
(mkIf cfgIntBreadcrumbs.navbuddy.enable {
167+
vim = {
168+
statusline.lualine.integrations.breadcrumbs.nvim-navic.enable = true;
169+
170+
startPlugins = [
171+
"nvim-navbuddy"
172+
"nui-nvim"
173+
];
174+
175+
pluginRC.breadcrumbs-navbuddy = entryAfter ["lspconfig" "breadcrumbs-navic"] ''
176+
local navbuddy = require("nvim-navbuddy")
177+
local actions = require("nvim-navbuddy.actions")
178+
navbuddy.setup ${toLuaObject (
179+
cfgIntBreadcrumbs.navbuddy.setupOpts
180+
// {
181+
mappings =
182+
mapAttrs'
183+
(name: key: {
184+
inherit name;
185+
value =
186+
{
187+
close = mkLuaInline "actions.close()";
188+
nextSibling = mkLuaInline "actions.next_sibling()";
189+
previousSibling = mkLuaInline "actions.previous_sibling()";
190+
parent = mkLuaInline "actions.parent()";
191+
children = mkLuaInline "actions.children()";
192+
root = mkLuaInline "actions.root()";
193+
194+
visualName = mkLuaInline "actions.visual_name()";
195+
visualScope = mkLuaInline "actions.visual_scope()";
196+
197+
yankName = mkLuaInline "actions.yank_name()";
198+
yankScope = mkLuaInline "actions.yank_scope()";
199+
200+
insertName = mkLuaInline "actions.insert_name()";
201+
insertScope = mkLuaInline "actions.insert_scope()";
202+
203+
appendName = mkLuaInline "actions.append_name()";
204+
appendScope = mkLuaInline "actions.append_scope()";
205+
206+
rename = mkLuaInline "actions.rename()";
207+
delete = mkLuaInline "actions.delete()";
208+
209+
foldCreate = mkLuaInline "actions.fold_create()";
210+
foldDelete = mkLuaInline "actions.fold_delete()";
211+
212+
comment = mkLuaInline "actions.comment()";
213+
select = mkLuaInline "actions.select()";
214+
215+
moveDown = mkLuaInline "actions.move_down()";
216+
moveUp = mkLuaInline "actions.move_up()";
217+
218+
togglePreview = mkLuaInline "actions.toggle_preview()";
219+
220+
vsplit = mkLuaInline "actions.vsplit()";
221+
hsplit = mkLuaInline "actions.hsplit()";
222+
223+
telescope = mkLuaInline ''
224+
actions.telescope({
225+
layout_strategy = "horizontal",
226+
layout_config = {
227+
height = 0.60,
228+
width = 0.75,
229+
prompt_position = "top",
230+
preview_width = 0.50,
231+
},
232+
})
233+
'';
234+
235+
help = mkLuaInline "actions.help()";
236+
}.${
237+
name
238+
};
239+
})
240+
(filterAttrs (_: key: key != null) cfgIntBreadcrumbs.navbuddy.mappings);
241+
}
242+
)}
243+
244+
'';
245+
};
246+
})
247+
248+
(mkIf cfgIntBreadcrumbs.lspsaga.enable {
249+
vim = {
250+
lsp.lspsaga = {
251+
enable = true;
252+
setupOpts.symbol_in_winbar.enable = true;
253+
};
254+
statusline.lualine.setupOpts."${cfgIntBreadcrumbs.location}"."lualine_${cfgIntBreadcrumbs.section}" = [
255+
(
256+
mkLuaInline ''
257+
function()
258+
return require("lspsaga.symbol.winbar").get_bar()
259+
end
260+
''
261+
)
262+
];
49263
};
50264
})
265+
51266
(mkIf cfg.enable {
52267
vim = {
53268
startPlugins = ["lualine-nvim"];

0 commit comments

Comments
 (0)