From e92db9ef512e63e83def9023238019507684e7e6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 13 Sep 2024 17:26:03 +0300 Subject: [PATCH] ui/breadcrumbs: allow lualine winbar component to be disabled --- docs/release-notes/rl-0.7.md | 14 +++++++- modules/plugins/statusline/lualine/config.nix | 6 ++-- .../plugins/ui/breadcrumbs/breadcrumbs.nix | 32 +++++++++++++++---- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 9ed01ad9..85305552 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -71,7 +71,8 @@ configuration formats. - Fix "Emac" typo -- Add [new-file-template.nvim] to automatically fill new file contents using templates. +- Add [new-file-template.nvim] to automatically fill new file contents using + templates. [diniamo](https://github.com/diniamo): @@ -146,11 +147,22 @@ configuration formats. - Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim closure. Both of those scripts have been automatically added to your PATH upon using neovimConfig or `programs.nvf.enable`. + - `nvf-print-config` will display your `init.lua`, in full. - `nvf-print-config-path` will display the path to _a clone_ of your `init.lua`. This is not the path used by the Neovim wrapper, but an identical clone. +- Add `vim.ui.breadcrumbs.lualine` to allow fine-tuning breadcrumbs behaviour on + Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time + being. + - [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow + controlling the default behaviour of the `nvim-navic` component on Lualine, + which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled. + - `vim.ui.breadcrumbs.alwaysRender` has been renamed to + [](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the + new format. + [ppenguin](https://github.com/ppenguin): - Telescope: diff --git a/modules/plugins/statusline/lualine/config.nix b/modules/plugins/statusline/lualine/config.nix index d5191994..7b6e4a6f 100644 --- a/modules/plugins/statusline/lualine/config.nix +++ b/modules/plugins/statusline/lualine/config.nix @@ -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,13 @@ in { extensions = ["nvim-tree"]; }; }) - (mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") { + (mkIf (bcfg.enable && bcfg.source == "nvim-navic" && bcfg.lualine.winbar.enable) { 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}") ] ]; }; diff --git a/modules/plugins/ui/breadcrumbs/breadcrumbs.nix b/modules/plugins/ui/breadcrumbs/breadcrumbs.nix index 18df8c05..5bbd37db 100644 --- a/modules/plugins/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/plugins/ui/breadcrumbs/breadcrumbs.nix @@ -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,33 @@ 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 = + mkEnableOption '' + automatically configuring a winbar component for Lualine. + + ::: {.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`. + ::: + '' + // {default = true;}; # for retaining previous behaviour + + alwaysRender = mkOption { + type = bool; + default = true; + example = false; + description = '' + Whether to always display the breadcrumbs component + on winbar (always renders winbar.) + ''; + }; }; navbuddy = { enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic"; - mappings = { close = mkOption { type = str;