mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
ui/breadcrumbs: allow lualine winbar component to be disabled (#371)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-html) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-json) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-manpages) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-html) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-json) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-manpages) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
This commit is contained in:
parent
b9dcbec29c
commit
eb037b7bff
3 changed files with 52 additions and 12 deletions
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.generators) mkLuaInline;
|
||||
|
||||
cfg = config.vim.statusline.lualine;
|
||||
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
||||
bCfg = config.vim.ui.breadcrumbs;
|
||||
in {
|
||||
config = mkMerge [
|
||||
# TODO: move into nvim-tree file
|
||||
|
@ -20,13 +20,14 @@ in {
|
|||
extensions = ["nvim-tree"];
|
||||
};
|
||||
})
|
||||
(mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") {
|
||||
|
||||
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
||||
vim.statusline.lualine.setupOpts = {
|
||||
# TODO: rewrite in new syntax
|
||||
winbar.lualine_c = mkDefault [
|
||||
[
|
||||
"navic"
|
||||
(mkLuaInline "draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}")
|
||||
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
|
||||
]
|
||||
];
|
||||
};
|
||||
|
@ -34,7 +35,6 @@ in {
|
|||
(mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["lualine"];
|
||||
|
||||
pluginRC.lualine = entryAnywhere ''
|
||||
local lualine = require('lualine')
|
||||
lualine.setup ${toLuaObject cfg.setupOpts}
|
||||
|
|
|
@ -31,6 +31,8 @@ in {
|
|||
(renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"])
|
||||
# TODO: every option under icon is renamed to first letter capitalized
|
||||
(renameSetupOpt ["icon"] ["icon"])
|
||||
|
||||
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "alwaysRender"] ["vim" "ui" "breadcrumbs" "lualine" "winbar" "alwaysRender"])
|
||||
];
|
||||
|
||||
options.vim.ui.breadcrumbs = {
|
||||
|
@ -43,17 +45,43 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# maybe this should be an option to *disable* alwaysRender optionally but oh well
|
||||
# too late
|
||||
alwaysRender = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to always display the breadcrumbs component on winbar (always renders winbar)";
|
||||
# Options for configuring Lualine integration of nvim-navic
|
||||
lualine.winbar = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true; # for retaining previous behaviour
|
||||
example = false;
|
||||
description = ''
|
||||
Whether to automatically configure a winbar component for
|
||||
Lualine on the Winbar section.
|
||||
|
||||
::: {.note}
|
||||
This is **set to `true` by default**, which means nvim-navic
|
||||
will occupy `winbar.lualine_c` for the breadcrumbs feature
|
||||
unless this option is set to `false`.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
alwaysRender = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = ''
|
||||
Whether to always display the breadcrumbs component
|
||||
on winbar.
|
||||
|
||||
::: {.note}
|
||||
This will pass `draw_empty` to the `nvim_navic` winbar
|
||||
component, which causes the component to be drawn even
|
||||
if it's empty
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
navbuddy = {
|
||||
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
|
||||
|
||||
mappings = {
|
||||
close = mkOption {
|
||||
type = str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue