From 14179505b3ad2148c6a6f8c6d31a7510b6eb134d Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Jul 2023 22:49:06 +0300 Subject: [PATCH 01/13] feat: breadcrumbs --- configuration.nix | 6 +- flake.lock | 34 ++++++ flake.nix | 12 ++ lib/types/plugins.nix | 2 + modules/ui/breadcrumbs/breadcrumbs.nix | 5 + modules/ui/breadcrumbs/config.nix | 157 +++++++++++++++++++++++++ modules/ui/breadcrumbs/default.nix | 6 + modules/ui/default.nix | 1 + 8 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 modules/ui/breadcrumbs/breadcrumbs.nix create mode 100644 modules/ui/breadcrumbs/config.nix create mode 100644 modules/ui/breadcrumbs/default.nix diff --git a/configuration.nix b/configuration.nix index a38a2dae..588dc627 100644 --- a/configuration.nix +++ b/configuration.nix @@ -54,7 +54,10 @@ inputs: let nix.enable = true; html.enable = isMaximal; - clang.enable = isMaximal; + clang = { + enable = isMaximal; + lsp.server = "clangd"; + }; sql.enable = isMaximal; rust = { enable = isMaximal; @@ -189,6 +192,7 @@ inputs: let colorizer.enable = true; modes-nvim.enable = false; # the theme looks terrible with catppuccin illuminate.enable = true; + breadcrumbs.enable = true; smartcolumn = { enable = true; columnAt.languages = { diff --git a/flake.lock b/flake.lock index 69727eee..50643706 100644 --- a/flake.lock +++ b/flake.lock @@ -1077,6 +1077,38 @@ "type": "github" } }, + "nvim-navbuddy": { + "flake": false, + "locked": { + "lastModified": 1688569844, + "narHash": "sha256-011RT/wnQdBR1vMrXFwxbicBAgdcd4eQYPbok/o3CIE=", + "owner": "SmiteshP", + "repo": "nvim-navbuddy", + "rev": "244a4cded6f2b568403684131d148048efe4e8af", + "type": "github" + }, + "original": { + "owner": "SmiteshP", + "repo": "nvim-navbuddy", + "type": "github" + } + }, + "nvim-navic": { + "flake": false, + "locked": { + "lastModified": 1689447657, + "narHash": "sha256-fcSer6l6oX0qnOcRfNSZImmtkqjdH0WSUkptjaFj0AI=", + "owner": "SmiteshP", + "repo": "nvim-navic", + "rev": "e6da6f74d89de65258ea7e98e22103ff5de6dcf5", + "type": "github" + }, + "original": { + "owner": "SmiteshP", + "repo": "nvim-navic", + "type": "github" + } + }, "nvim-neoclip": { "flake": false, "locked": { @@ -1397,6 +1429,8 @@ "nvim-dap-ui": "nvim-dap-ui", "nvim-lightbulb": "nvim-lightbulb", "nvim-lspconfig": "nvim-lspconfig", + "nvim-navbuddy": "nvim-navbuddy", + "nvim-navic": "nvim-navic", "nvim-neoclip": "nvim-neoclip", "nvim-notify": "nvim-notify", "nvim-session-manager": "nvim-session-manager", diff --git a/flake.nix b/flake.nix index 67d38251..43df359c 100644 --- a/flake.nix +++ b/flake.nix @@ -143,6 +143,7 @@ url = "github:tversteeg/registers.nvim"; flake = false; }; + nvim-neoclip = { url = "github:AckslD/nvim-neoclip.lua"; flake = false; @@ -248,6 +249,7 @@ url = "github:b3nj5m1n/kommentary"; flake = false; }; + comment-nvim = { url = "github:numToStr/Comment.nvim"; flake = false; @@ -455,6 +457,16 @@ }; # UI + nvim-navbuddy = { + url = "github:SmiteshP/nvim-navbuddy"; + flake = false; + }; + + nvim-navic = { + url = "github:SmiteshP/nvim-navic"; + flake = false; + }; + noice-nvim = { url = "github:folke/noice.nvim"; flake = false; diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 111fd8c1..854ac6e0 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -87,6 +87,8 @@ with lib; let "nvim-surround" "nvim-dap" "nvim-dap-ui" + "nvim-navic" + "nvim-navbuddy" ]; # You can either use the name of the plugin or a package. pluginsType = with types; diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix new file mode 100644 index 00000000..6583b8f6 --- /dev/null +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -0,0 +1,5 @@ +{lib, ...}: { + options.vim.ui.breadcrumbs = { + enable = lib.mkEnableOption "breadcrumbs"; + }; +} diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix new file mode 100644 index 00000000..38e07038 --- /dev/null +++ b/modules/ui/breadcrumbs/config.nix @@ -0,0 +1,157 @@ +{ + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.ui.breadcrumbs; +in { + config = mkIf cfg.enable { + vim.startPlugins = [ + "nvim-navbuddy" + "nvim-navic" + "nvim-lspconfig" + ]; + + vim.luaConfigRC.breadcrumbs = nvim.dag.entryAfter ["lspconfig"] '' + local navbuddy = require("nvim-navbuddy") + local actions = require("nvim-navbuddy.actions") + + require("lspconfig").clangd.setup { + on_attach = function(client, bufnr) + navbuddy.attach(client, bufnr) + end + } + + navbuddy.setup { + window = { + border = "single", -- "rounded", "double", "solid", "none" + -- or an array with eight chars building up the border in a clockwise fashion + -- starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }. + size = "60%", -- Or table format example: { height = "40%", width = "100%"} + position = "50%", -- Or table format example: { row = "100%", col = "0%"} + scrolloff = nil, -- scrolloff value within navbuddy window + sections = { + left = { + size = "20%", + border = nil, -- You can set border style for each section individually as well. + }, + mid = { + size = "40%", + border = nil, + }, + right = { + -- No size option for right most section. It fills to + -- remaining area. + border = nil, + preview = "leaf", -- Right section can show previews too. + -- Options: "leaf", "always" or "never" + } + }, + }, + node_markers = { + enabled = true, + icons = { + leaf = " ", + leaf_selected = " → ", + branch = " ", + }, + }, + icons = { + File = "󰈙 ", + Module = " ", + Namespace = "󰌗 ", + Package = " ", + Class = "󰌗 ", + Method = "󰆧 ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "󰕘", + Interface = "󰕘", + Function = "󰊕 ", + Variable = "󰆧 ", + Constant = "󰏿 ", + String = " ", + Number = "󰎠 ", + Boolean = "◩ ", + Array = "󰅪 ", + Object = "󰅩 ", + Key = "󰌋 ", + Null = "󰟢 ", + EnumMember = " ", + Struct = "󰌗 ", + Event = " ", + Operator = "󰆕 ", + TypeParameter = "󰊄 ", + }, + use_default_mappings = true, -- If set to false, only mappings set + -- by user are set. Else default + -- mappings are used for keys + -- that are not set by user + mappings = { + [""] = actions.close(), -- Close and cursor to original location + ["q"] = actions.close(), + + ["j"] = actions.next_sibling(), -- down + ["k"] = actions.previous_sibling(), -- up + + ["h"] = actions.parent(), -- Move to left panel + ["l"] = actions.children(), -- Move to right panel + ["0"] = actions.root(), -- Move to first panel + + ["v"] = actions.visual_name(), -- Visual selection of name + ["V"] = actions.visual_scope(), -- Visual selection of scope + + ["y"] = actions.yank_name(), -- Yank the name to system clipboard "+ + ["Y"] = actions.yank_scope(), -- Yank the scope to system clipboard "+ + + ["i"] = actions.insert_name(), -- Insert at start of name + ["I"] = actions.insert_scope(), -- Insert at start of scope + + ["a"] = actions.append_name(), -- Insert at end of name + ["A"] = actions.append_scope(), -- Insert at end of scope + + ["r"] = actions.rename(), -- Rename currently focused symbol + + ["d"] = actions.delete(), -- Delete scope + + ["f"] = actions.fold_create(), -- Create fold of current scope + ["F"] = actions.fold_delete(), -- Delete fold of current scope + + ["c"] = actions.comment(), -- Comment out current scope + + [""] = actions.select(), -- Goto selected symbol + ["o"] = actions.select(), + + ["J"] = actions.move_down(), -- Move focused node down + ["K"] = actions.move_up(), -- Move focused node up + + ["t"] = actions.telescope({ -- Fuzzy finder at current level. + layout_config = { -- All options that can be + height = 0.60, -- passed to telescope.nvim's + width = 0.60, -- default can be passed here. + prompt_position = "top", + preview_width = 0.50 + }, + layout_strategy = "horizontal" + }), + + ["g?"] = actions.help(), -- Open mappings help window + }, + lsp = { + auto_attach = false, -- If set to true, you don't need to manually use attach function + preference = nil, -- list of lsp server names in order of preference + }, + source_buffer = { + follow_node = true, -- Keep the current node in focus on the source buffer + highlight = true, -- Highlight the currently focused node + reorient = "smart", -- "smart", "top", "mid" or "none" + scrolloff = nil -- scrolloff value when navbuddy is open + } + } + + ''; + }; +} diff --git a/modules/ui/breadcrumbs/default.nix b/modules/ui/breadcrumbs/default.nix new file mode 100644 index 00000000..02c63515 --- /dev/null +++ b/modules/ui/breadcrumbs/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./breadcrumbs.nix + ]; +} diff --git a/modules/ui/default.nix b/modules/ui/default.nix index 980a04ab..1c63c403 100644 --- a/modules/ui/default.nix +++ b/modules/ui/default.nix @@ -6,5 +6,6 @@ _: { ./smartcolumn ./colorizer ./illuminate + ./breadcrumbs ]; } From 41584157eb36e743e2284ece0fc808372b50b72b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Jul 2023 23:05:38 +0300 Subject: [PATCH 02/13] feat: display breadcrumbs on winbar --- modules/statusline/lualine/config.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index 385e139d..30503abe 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -49,6 +49,15 @@ in { lualine_z = ${cfg.inactiveSection.z}, }, tabline = {}, + winbar = { + lualine_c = { + { + "navic", + color_correction = nil, + navic_opts = nil + } + } + }, extensions = {${ if (config.vim.filetree.nvimTreeLua.enable) then "\"nvim-tree\"" From 863047e49005ffcb5f2a7af198bd6e2b000c9616 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Jul 2023 23:06:06 +0300 Subject: [PATCH 03/13] dev: allow nvim-navic to attach to the Lsp if breadcrumbs is enabled --- modules/lsp/config.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 10851187..83da30b2 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -81,9 +81,16 @@ in { end end + ${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''} default_on_attach = function(client, bufnr) attach_keymaps(client, bufnr) format_callback(client, bufnr) + ${optionalString (config.vim.ui.breadcrumbs.enable) '' + -- let navic attach to buffers + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end + ''} end local capabilities = vim.lsp.protocol.make_client_capabilities() From b9e152aa509f3c43c291be5717db57f6c86cb999 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 19 Jul 2023 23:06:29 +0300 Subject: [PATCH 04/13] feat: allow Navbuddy to automatically attach to the Lsp server --- modules/ui/breadcrumbs/config.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix index 38e07038..8ea2d7e7 100644 --- a/modules/ui/breadcrumbs/config.nix +++ b/modules/ui/breadcrumbs/config.nix @@ -16,13 +16,9 @@ in { vim.luaConfigRC.breadcrumbs = nvim.dag.entryAfter ["lspconfig"] '' local navbuddy = require("nvim-navbuddy") + local navic = require("nvim-navic") local actions = require("nvim-navbuddy.actions") - require("lspconfig").clangd.setup { - on_attach = function(client, bufnr) - navbuddy.attach(client, bufnr) - end - } navbuddy.setup { window = { @@ -141,7 +137,7 @@ in { ["g?"] = actions.help(), -- Open mappings help window }, lsp = { - auto_attach = false, -- If set to true, you don't need to manually use attach function + auto_attach = true, -- If set to true, you don't need to manually use attach function preference = nil, -- list of lsp server names in order of preference }, source_buffer = { From 4301ade29aee15d3ceab6cda7cafd9ff4194c301 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 20 Jul 2023 18:34:36 +0300 Subject: [PATCH 05/13] feat: make most navbuddy options configurable --- modules/ui/breadcrumbs/breadcrumbs.nix | 136 ++++++++++++++++++++++++- modules/ui/breadcrumbs/config.nix | 73 ++++++------- 2 files changed, 174 insertions(+), 35 deletions(-) diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index 6583b8f6..b8246741 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -1,5 +1,139 @@ -{lib, ...}: { +{ + lib, + config, + ... +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.ui.breadcrumbs = { enable = lib.mkEnableOption "breadcrumbs"; + + navbuddy = { + enable = mkEnableOption "navbuddy LSP UI"; + useDefaultMappings = mkEnableOption "default Navbuddy keybindings (disables user keybinds)"; + + window = { + # size = {} + # position = {} + + border = mkOption { + # TODO: let this type accept a custom string + type = types.enum ["single" "rounded" "double" "solid" "none"]; + default = "single"; + description = "border style to use"; + }; + + scrolloff = mkOption { + type = with types; nullOr int; + default = null; + description = "Scrolloff value within navbuddy window"; + }; + + sections = { + # left section + left = { + #size = {} + border = mkOption { + # TODO: let this type accept a custom string + type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); + default = null; + description = "border style to use for the left section of Navbuddy UI"; + }; + }; + + # middle section + mid = { + #size = {} + border = mkOption { + # TODO: let this type accept a custom string + type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); + default = null; + description = "border style to use for the middle section of Navbuddy UI"; + }; + }; + + # right section + # there is no size option for the right section, it fills the remaining space + right = { + border = mkOption { + # TODO: let this type accept a custom string + type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); + default = null; + description = "border style to use for the right section of Navbuddy UI"; + }; + + preview = mkOption { + type = types.enum ["leaf" "always" "never"]; + default = "leaf"; + description = "display mode of the preview on the right section"; + }; + }; + }; + }; + + nodeMarkers = { + enable = mkEnableOption "node markers"; + icons = { + leaf = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + leafSelected = mkOption { + type = types.str; + default = " → "; + description = ""; + }; + + branch = mkOption { + type = types.str; + default = " "; + description = ""; + }; + }; + }; + + lsp = { + autoAttach = mkOption { + type = types.bool; + default = true; + description = "Whether to attach to LSP server manually"; + }; + + preference = mkOption { + type = with types; nullOr (listOf str); + default = null; + description = "list of lsp server names in order of preference"; + }; + }; + + sourceBuffer = { + followNode = mkOption { + type = types.bool; + default = true; + description = "keep the current node in focus on the source buffer"; + }; + + highlight = mkOption { + type = types.bool; + default = true; + description = "highlight the currently focused node"; + }; + + reorient = mkOption { + type = types.enum ["smart" "top" "mid" "none"]; + default = "smart"; + }; + + scrolloff = mkOption { + type = with types; nullOr int; + default = null; + description = "scrolloff value when navbuddy is open"; + }; + }; + + icons = {}; + }; }; } diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix index 8ea2d7e7..83eecb3f 100644 --- a/modules/ui/breadcrumbs/config.nix +++ b/modules/ui/breadcrumbs/config.nix @@ -6,6 +6,12 @@ with lib; with builtins; let cfg = config.vim.ui.breadcrumbs; + nb = cfg.navbuddy; + + nilOrStr = v: + if v == null + then "nil" + else toString v; in { config = mkIf cfg.enable { vim.startPlugins = [ @@ -19,41 +25,52 @@ in { local navic = require("nvim-navic") local actions = require("nvim-navbuddy.actions") - + -- TODO: wrap this in an optional string with navbuddy as the enable condition navbuddy.setup { window = { - border = "single", -- "rounded", "double", "solid", "none" - -- or an array with eight chars building up the border in a clockwise fashion - -- starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }. - size = "60%", -- Or table format example: { height = "40%", width = "100%"} - position = "50%", -- Or table format example: { row = "100%", col = "0%"} - scrolloff = nil, -- scrolloff value within navbuddy window + border = "${nb.window.border}", -- "rounded", "double", "solid", "none" + size = "60%", + position = "50%", + scrolloff = ${(nilOrStr nb.window.scrolloff)}, sections = { left = { size = "20%", - border = nil, -- You can set border style for each section individually as well. + border = ${(nilOrStr nb.window.sections.left.border)}, }, + mid = { size = "40%", - border = nil, + border = ${(nilOrStr nb.window.sections.mid.border)}, }, + right = { - -- No size option for right most section. It fills to - -- remaining area. - border = nil, - preview = "leaf", -- Right section can show previews too. - -- Options: "leaf", "always" or "never" + border = ${(nilOrStr nb.window.sections.right.border)}, + preview = "leaf", } }, }, node_markers = { - enabled = true, + enabled = ${boolToString nb.nodeMarkers.enable}, icons = { - leaf = " ", - leaf_selected = " → ", - branch = " ", + leaf = "${nb.nodeMarkers.icons.leaf}", + leaf_selected = "${nb.nodeMarkers.icons.leafSelected}", + branch = "${nb.nodeMarkers.icons.branch}", }, }, + + lsp = { + auto_attach = ${boolToString nb.lsp.autoAttach}, + preference = nil, -- TODO: convert list to lua table if not null + }, + + source_buffer = { + follow_node = ${boolToString nb.sourceBuffer.followNode}, + highlight = ${boolToString nb.sourceBuffer.highlight}, + reorient = "${nb.sourceBuffer.reorient}", + scrolloff = ${nilOrStr nb.sourceBuffer.scrolloff} + }, + + -- TODO: make those configurable icons = { File = "󰈙 ", Module = " ", @@ -82,10 +99,9 @@ in { Operator = "󰆕 ", TypeParameter = "󰊄 ", }, - use_default_mappings = true, -- If set to false, only mappings set - -- by user are set. Else default - -- mappings are used for keys - -- that are not set by user + + -- make those configurable + use_default_mappings = true, mappings = { [""] = actions.close(), -- Close and cursor to original location ["q"] = actions.close(), @@ -135,19 +151,8 @@ in { }), ["g?"] = actions.help(), -- Open mappings help window - }, - lsp = { - auto_attach = true, -- If set to true, you don't need to manually use attach function - preference = nil, -- list of lsp server names in order of preference - }, - source_buffer = { - follow_node = true, -- Keep the current node in focus on the source buffer - highlight = true, -- Highlight the currently focused node - reorient = "smart", -- "smart", "top", "mid" or "none" - scrolloff = nil -- scrolloff value when navbuddy is open } - } - + } ''; }; } From 5a2b13c2919c45e56bdb8e806fcd59920462e265 Mon Sep 17 00:00:00 2001 From: Frothy <76622149+FrothyMarrow@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:59:45 -0400 Subject: [PATCH 06/13] fix: display winbar even when it is empty --- modules/statusline/lualine/config.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index 30503abe..d81e2deb 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -54,7 +54,8 @@ in { { "navic", color_correction = nil, - navic_opts = nil + navic_opts = nil, + draw_empty = true } } }, From 260f9e7e8bcd4b01a8d6ab8f7535d991e97224bc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 21 Jul 2023 22:35:05 +0300 Subject: [PATCH 07/13] dev: make the permanent rendering of breadcrumbs optional --- modules/statusline/lualine/config.nix | 2 +- modules/ui/breadcrumbs/breadcrumbs.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index d81e2deb..2f8b9624 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -55,7 +55,7 @@ in { "navic", color_correction = nil, navic_opts = nil, - draw_empty = true + draw_empty = ${toString config.vim.ui.breadcrumbs.alwaysRender} } } }, diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index b8246741..a14bc5f2 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -8,6 +8,14 @@ in { options.vim.ui.breadcrumbs = { enable = lib.mkEnableOption "breadcrumbs"; + # maybe this should be an option to *disable* alwaysRender optionally but oh well + # too late + alwaysRender = mkOption { + type = types.bool; + default = true; + description = "Whether to always display the breadcrumbs component on winbar (always renders winbar)"; + }; + navbuddy = { enable = mkEnableOption "navbuddy LSP UI"; useDefaultMappings = mkEnableOption "default Navbuddy keybindings (disables user keybinds)"; From ef122b1b4d9f9311b0707fb8a8ed52954b33c89c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 24 Jul 2023 21:36:01 +0300 Subject: [PATCH 08/13] feat: make navbuddy icons and keybinds configurable --- modules/ui/breadcrumbs/breadcrumbs.nix | 307 ++++++++++++++++++++++++- modules/ui/breadcrumbs/config.nix | 122 +++++----- modules/visuals/config.nix | 3 +- 3 files changed, 371 insertions(+), 61 deletions(-) diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index a14bc5f2..eca0e964 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -7,6 +7,13 @@ in { options.vim.ui.breadcrumbs = { enable = lib.mkEnableOption "breadcrumbs"; + source = mkOption { + type = types.enum ["nvim-navic" "lspsaga"]; + default = "nvim-navic"; + description = '' + The source to be used for breadcrumbs component + ''; + }; # maybe this should be an option to *disable* alwaysRender optionally but oh well # too late @@ -20,6 +27,152 @@ in { enable = mkEnableOption "navbuddy LSP UI"; useDefaultMappings = mkEnableOption "default Navbuddy keybindings (disables user keybinds)"; + mappings = { + close = mkOption { + type = types.str; + default = ""; + description = "keybinding to close Navbuddy UI"; + }; + + nextSibling = mkOption { + type = types.str; + default = "j"; + description = "keybinding to navigate to the next sibling node"; + }; + + previousSibling = mkOption { + type = types.str; + default = "k"; + description = "keybinding to navigate to the previous sibling node"; + }; + + parent = mkOption { + type = types.str; + default = "h"; + description = "keybinding to navigate to the parent node"; + }; + + children = mkOption { + type = types.str; + default = "h"; + description = "keybinding to navigate to the child node"; + }; + + root = mkOption { + type = types.str; + default = "0"; + description = "keybinding to navigate to the root node"; + }; + + visualName = mkOption { + type = types.str; + default = "v"; + description = "visual selection of name"; + }; + + visualScope = mkOption { + type = types.str; + default = "V"; + description = "visual selection of scope"; + }; + + yankName = mkOption { + type = types.str; + default = "y"; + description = "yank the name to system clipboard"; + }; + + yankScope = mkOption { + type = types.str; + default = "Y"; + description = "yank the scope to system clipboard"; + }; + + insertName = mkOption { + type = types.str; + default = "i"; + description = "insert at start of name"; + }; + + insertScope = mkOption { + type = types.str; + default = "I"; + description = "insert at start of scope"; + }; + + appendName = mkOption { + type = types.str; + default = "a"; + description = "insert at end of name"; + }; + + appendScope = mkOption { + type = types.str; + default = "A"; + description = "insert at end of scope"; + }; + + rename = mkOption { + type = types.str; + default = "r"; + description = "rename the node"; + }; + + delete = mkOption { + type = types.str; + default = "d"; + description = "delete the node"; + }; + + foldCreate = mkOption { + type = types.str; + default = "f"; + description = "create a new fold"; + }; + + foldDelete = mkOption { + type = types.str; + default = "F"; + description = "delete the current fold"; + }; + + comment = mkOption { + type = types.str; + default = "c"; + description = "comment the node"; + }; + + select = mkOption { + type = types.str; + default = ""; + description = "goto selected symbol"; + }; + + moveDown = mkOption { + type = types.str; + default = "J"; + description = "move focused node down"; + }; + + moveUp = mkOption { + type = types.str; + default = "K"; + description = "move focused node up"; + }; + + telescope = mkOption { + type = types.str; + default = "t"; + description = "fuzzy finder at current level"; + }; + + help = mkOption { + type = types.str; + default = "g?"; + description = "open mapping help window"; + }; + }; + window = { # size = {} # position = {} @@ -141,7 +294,159 @@ in { }; }; - icons = {}; + # there probably is a better way to do this + # alas, I am not a nix wizard + icons = { + file = mkOption { + type = types.str; + default = "󰈙 "; + description = ""; + }; + + module = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + namespace = mkOption { + type = types.str; + default = "󰌗 "; + description = ""; + }; + + package = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + class = mkOption { + type = types.str; + default = "󰌗 "; + description = ""; + }; + + property = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + field = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + constructor = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + enum = mkOption { + type = types.str; + default = "󰕘"; + description = ""; + }; + + function = mkOption { + type = types.str; + default = "󰊕 "; + description = ""; + }; + + variable = mkOption { + type = types.str; + default = "󰆧 "; + description = ""; + }; + + constant = mkOption { + type = types.str; + default = "󰏿 "; + description = ""; + }; + + string = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + number = mkOption { + type = types.str; + default = "󰎠 "; + description = ""; + }; + + boolean = mkOption { + type = types.str; + default = "◩ "; + description = ""; + }; + + array = mkOption { + type = types.str; + default = "󰅪 "; + description = ""; + }; + + object = mkOption { + type = types.str; + default = "󰅩 "; + description = ""; + }; + + method = mkOption { + type = types.str; + default = "󰆧 "; + description = ""; + }; + + key = mkOption { + type = types.str; + default = "󰌋 "; + description = ""; + }; + + null = mkOption { + type = types.str; + default = "󰟢 "; + description = ""; + }; + + enumMember = mkOption { + type = types.str; + default = "󰕘 "; + description = ""; + }; + + struct = mkOption { + type = types.str; + default = "󰌗 "; + description = ""; + }; + + event = mkOption { + type = types.str; + default = " "; + description = ""; + }; + + operator = mkOption { + type = types.str; + default = "󰆕 "; + description = ""; + }; + + typeParameter = mkOption { + type = types.str; + default = "󰊄 "; + description = ""; + }; + }; }; }; } diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix index 83eecb3f..af5d1cbd 100644 --- a/modules/ui/breadcrumbs/config.nix +++ b/modules/ui/breadcrumbs/config.nix @@ -14,11 +14,17 @@ with builtins; let else toString v; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "nvim-navbuddy" - "nvim-navic" - "nvim-lspconfig" - ]; + vim.startPlugins = + [ + "nvim-lspconfig" + ] + ++ lib.optionals (config.vim.lsp.lspsaga.enable && cfg.source == "lspsaga") [ + "lspsaga" + ] + ++ lib.optionals (cfg.navbuddy.enable || cfg.source == "nvim-navic") [ + "nvim-navbuddy" + "nvim-navic" + ]; vim.luaConfigRC.breadcrumbs = nvim.dag.entryAfter ["lspconfig"] '' local navbuddy = require("nvim-navbuddy") @@ -72,85 +78,83 @@ in { -- TODO: make those configurable icons = { - File = "󰈙 ", - Module = " ", - Namespace = "󰌗 ", - Package = " ", - Class = "󰌗 ", - Method = "󰆧 ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = "󰕘", - Interface = "󰕘", - Function = "󰊕 ", - Variable = "󰆧 ", - Constant = "󰏿 ", - String = " ", - Number = "󰎠 ", - Boolean = "◩ ", - Array = "󰅪 ", - Object = "󰅩 ", - Key = "󰌋 ", - Null = "󰟢 ", - EnumMember = " ", - Struct = "󰌗 ", - Event = " ", - Operator = "󰆕 ", - TypeParameter = "󰊄 ", + File = "${cfg.navbuddy.icons.file}", + Module = "${cfg.navbuddy.icons.module}", + Namespace = "${cfg.navbuddy.icons.namespace}", + Package = "${cfg.navbuddy.icons.package}", + Class = "${cfg.navbuddy.icons.class}", + Method = "${cfg.navbuddy.icons.method}", + Property = "${cfg.navbuddy.icons.property}", + Field = "${cfg.navbuddy.icons.field}", + Constructor = "${cfg.navbuddy.icons.constructor}", + Enum = "${cfg.navbuddy.icons.enum}", + Interface = "${cfg.navbuddy.icons.interface}", + Function = "${cfg.navbuddy.icons.function}", + Variable = "${cfg.navbuddy.icons.variable}", + Constant = "${cfg.navbuddy.icons.constant}", + String = "${cfg.navbuddy.icons.string}", + Number = "${cfg.navbuddy.icons.number}", + Boolean = "${cfg.navbuddy.icons.boolean}", + Array = "${cfg.navbuddy.icons.array}", + Object = "${cfg.navbuddy.icons.object}", + Key = "${cfg.navbuddy.icons.key}", + Null = "${cfg.navbuddy.icons.null}", + EnumMember = "${cfg.navbuddy.icons.enumMember}", + Struct = "${cfg.navbuddy.icons.struct}", + Event = "${cfg.navbuddy.icons.event}", + Operator = "${cfg.navbuddy.icons.operator}", + TypeParameter = "${cfg.navbuddy.icons.typeParameter}" }, -- make those configurable - use_default_mappings = true, + use_default_mappings = ${cfg.navbuddy.useDefaultMappings}, mappings = { - [""] = actions.close(), -- Close and cursor to original location - ["q"] = actions.close(), + ["${cfg.navbuddy.mappings.close}"] = actions.close(), -- Close and cursor to original location - ["j"] = actions.next_sibling(), -- down - ["k"] = actions.previous_sibling(), -- up + ["${cfg.navbuddy.mappings.nextSibling}"] = actions.next_sibling(), -- down + ["${cfg.navbuddy.mappings.previousSibling}"] = actions.previous_sibling(), -- up - ["h"] = actions.parent(), -- Move to left panel - ["l"] = actions.children(), -- Move to right panel - ["0"] = actions.root(), -- Move to first panel + ["${cfg.navbuddy.mappings.close}"] = actions.parent(), -- Move to left panel + ["${cfg.navbuddy.mappings.children}"] = actions.children(), -- Move to right panel + ["${cfg.navbuddy.mappings.root}"] = actions.root(), -- Move to first panel - ["v"] = actions.visual_name(), -- Visual selection of name - ["V"] = actions.visual_scope(), -- Visual selection of scope + ["${cfg.navbuddy.mappings.visualName}"] = actions.visual_name(), -- Visual selection of name + ["${cfg.navbuddy.mappings.visualScope}"] = actions.visual_scope(), -- Visual selection of scope - ["y"] = actions.yank_name(), -- Yank the name to system clipboard "+ - ["Y"] = actions.yank_scope(), -- Yank the scope to system clipboard "+ + ["${cfg.navbuddy.mappings.yankName}"] = actions.yank_name(), -- Yank the name to system clipboard "+ + ["${cfg.navbuddy.mappings.yankScope}"] = actions.yank_scope(), -- Yank the scope to system clipboard "+ - ["i"] = actions.insert_name(), -- Insert at start of name - ["I"] = actions.insert_scope(), -- Insert at start of scope + ["${cfg.navbuddy.mappings.insertName}"] = actions.insert_name(), -- Insert at start of name + ["${cfg.navbuddy.mappings.insertScope}"] = actions.insert_scope(), -- Insert at start of scope - ["a"] = actions.append_name(), -- Insert at end of name - ["A"] = actions.append_scope(), -- Insert at end of scope + ["${cfg.navbuddy.mappings.appendName}"] = actions.append_name(), -- Insert at end of name + ["${cfg.navbuddy.mappings.appendScope}"] = actions.append_scope(), -- Insert at end of scope - ["r"] = actions.rename(), -- Rename currently focused symbol + ["${cfg.navbuddy.mappings.rename}"] = actions.rename(), -- Rename currently focused symbol - ["d"] = actions.delete(), -- Delete scope + ["${cfg.navbuddy.mappings.delete}"] = actions.delete(), -- Delete scope - ["f"] = actions.fold_create(), -- Create fold of current scope - ["F"] = actions.fold_delete(), -- Delete fold of current scope + ["${cfg.navbuddy.mappings.foldCreate}"] = actions.fold_create(), -- Create fold of current scope + ["${cfg.navbuddy.mappings.foldDelete}"] = actions.fold_delete(), -- Delete fold of current scope - ["c"] = actions.comment(), -- Comment out current scope + ["${cfg.navbuddy.mappings.comment}"] = actions.comment(), -- Comment out current scope - [""] = actions.select(), -- Goto selected symbol - ["o"] = actions.select(), + ["${cfg.navbuddy.mappings.select}"] = actions.select(), -- Goto selected symbol - ["J"] = actions.move_down(), -- Move focused node down - ["K"] = actions.move_up(), -- Move focused node up + ["${cfg.navbuddy.mappings.moveDown}"] = actions.move_down(), -- Move focused node down + ["${cfg.navbuddy.mappings.moveUp}"] = actions.move_up(), -- Move focused node up - ["t"] = actions.telescope({ -- Fuzzy finder at current level. + ["${cfg.navbuddy.mappings.telescope}"] = actions.telescope({ -- Fuzzy finder at current level. layout_config = { -- All options that can be height = 0.60, -- passed to telescope.nvim's - width = 0.60, -- default can be passed here. + width = 0.75, -- default can be passed here. prompt_position = "top", preview_width = 0.50 }, layout_strategy = "horizontal" }), - ["g?"] = actions.help(), -- Open mappings help window + ["${cfg.navbuddy.mappings.help}"] = actions.help(), -- Open mappings help window } } ''; diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index aaad23ba..79105201 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -54,7 +54,8 @@ in { 'alpha', 'code-action-menu-menu', 'code-action-menu-warning-message', - 'notify' + 'notify', + 'Navbuddy' }, } ''; From 36cf07292046da6a79c055ad514fd47823fc08f9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 24 Jul 2023 23:05:07 +0300 Subject: [PATCH 09/13] dev: add missing navbuddy icons and keybinds --- modules/ui/breadcrumbs/breadcrumbs.nix | 14 +++++- modules/ui/breadcrumbs/config.nix | 61 ++++++++++++-------------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index eca0e964..b27f6174 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -25,7 +25,13 @@ in { navbuddy = { enable = mkEnableOption "navbuddy LSP UI"; - useDefaultMappings = mkEnableOption "default Navbuddy keybindings (disables user keybinds)"; + + # this option is interpreted as null if mkEnableOption is used, and therefore cannot be converted to a string in config.nix + useDefaultMappings = mkOption { + type = types.bool; + default = true; + description = "default Navbuddy keybindings (disables user-specified keybinds)"; + }; mappings = { close = mkOption { @@ -351,6 +357,12 @@ in { description = ""; }; + interface = mkOption { + type = types.str; + default = "󰕘"; + description = ""; + }; + function = mkOption { type = types.str; default = "󰊕 "; diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix index af5d1cbd..01d5d2cf 100644 --- a/modules/ui/breadcrumbs/config.nix +++ b/modules/ui/breadcrumbs/config.nix @@ -76,7 +76,6 @@ in { scrolloff = ${nilOrStr nb.sourceBuffer.scrolloff} }, - -- TODO: make those configurable icons = { File = "${cfg.navbuddy.icons.file}", Module = "${cfg.navbuddy.icons.module}", @@ -107,55 +106,53 @@ in { }, -- make those configurable - use_default_mappings = ${cfg.navbuddy.useDefaultMappings}, + use_default_mappings = ${toString (cfg.navbuddy.useDefaultMappings)}, mappings = { - ["${cfg.navbuddy.mappings.close}"] = actions.close(), -- Close and cursor to original location + ["${cfg.navbuddy.mappings.close}"] = actions.close(), + ["${cfg.navbuddy.mappings.nextSibling}"] = actions.next_sibling(), + ["${cfg.navbuddy.mappings.previousSibling}"] = actions.previous_sibling(), + ["${cfg.navbuddy.mappings.close}"] = actions.parent(), + ["${cfg.navbuddy.mappings.children}"] = actions.children(), + ["${cfg.navbuddy.mappings.root}"] = actions.root(), - ["${cfg.navbuddy.mappings.nextSibling}"] = actions.next_sibling(), -- down - ["${cfg.navbuddy.mappings.previousSibling}"] = actions.previous_sibling(), -- up + ["${cfg.navbuddy.mappings.visualName}"] = actions.visual_name(), + ["${cfg.navbuddy.mappings.visualScope}"] = actions.visual_scope(), - ["${cfg.navbuddy.mappings.close}"] = actions.parent(), -- Move to left panel - ["${cfg.navbuddy.mappings.children}"] = actions.children(), -- Move to right panel - ["${cfg.navbuddy.mappings.root}"] = actions.root(), -- Move to first panel + ["${cfg.navbuddy.mappings.yankName}"] = actions.yank_name(), + ["${cfg.navbuddy.mappings.yankScope}"] = actions.yank_scope(), - ["${cfg.navbuddy.mappings.visualName}"] = actions.visual_name(), -- Visual selection of name - ["${cfg.navbuddy.mappings.visualScope}"] = actions.visual_scope(), -- Visual selection of scope + ["${cfg.navbuddy.mappings.insertName}"] = actions.insert_name(), + ["${cfg.navbuddy.mappings.insertScope}"] = actions.insert_scope(), - ["${cfg.navbuddy.mappings.yankName}"] = actions.yank_name(), -- Yank the name to system clipboard "+ - ["${cfg.navbuddy.mappings.yankScope}"] = actions.yank_scope(), -- Yank the scope to system clipboard "+ + ["${cfg.navbuddy.mappings.appendName}"] = actions.append_name(), + ["${cfg.navbuddy.mappings.appendScope}"] = actions.append_scope(), - ["${cfg.navbuddy.mappings.insertName}"] = actions.insert_name(), -- Insert at start of name - ["${cfg.navbuddy.mappings.insertScope}"] = actions.insert_scope(), -- Insert at start of scope + ["${cfg.navbuddy.mappings.rename}"] = actions.rename(), - ["${cfg.navbuddy.mappings.appendName}"] = actions.append_name(), -- Insert at end of name - ["${cfg.navbuddy.mappings.appendScope}"] = actions.append_scope(), -- Insert at end of scope + ["${cfg.navbuddy.mappings.delete}"] = actions.delete(), - ["${cfg.navbuddy.mappings.rename}"] = actions.rename(), -- Rename currently focused symbol + ["${cfg.navbuddy.mappings.foldCreate}"] = actions.fold_create(), + ["${cfg.navbuddy.mappings.foldDelete}"] = actions.fold_delete(), - ["${cfg.navbuddy.mappings.delete}"] = actions.delete(), -- Delete scope + ["${cfg.navbuddy.mappings.comment}"] = actions.comment(), - ["${cfg.navbuddy.mappings.foldCreate}"] = actions.fold_create(), -- Create fold of current scope - ["${cfg.navbuddy.mappings.foldDelete}"] = actions.fold_delete(), -- Delete fold of current scope + ["${cfg.navbuddy.mappings.select}"] = actions.select(), - ["${cfg.navbuddy.mappings.comment}"] = actions.comment(), -- Comment out current scope + ["${cfg.navbuddy.mappings.moveDown}"] = actions.move_down(), + ["${cfg.navbuddy.mappings.moveUp}"] = actions.move_up(), - ["${cfg.navbuddy.mappings.select}"] = actions.select(), -- Goto selected symbol - - ["${cfg.navbuddy.mappings.moveDown}"] = actions.move_down(), -- Move focused node down - ["${cfg.navbuddy.mappings.moveUp}"] = actions.move_up(), -- Move focused node up - - ["${cfg.navbuddy.mappings.telescope}"] = actions.telescope({ -- Fuzzy finder at current level. - layout_config = { -- All options that can be - height = 0.60, -- passed to telescope.nvim's - width = 0.75, -- default can be passed here. + ["${cfg.navbuddy.mappings.telescope}"] = actions.telescope({ + layout_strategy = "horizontal", + layout_config = { + height = 0.60, + width = 0.75, prompt_position = "top", preview_width = 0.50 }, - layout_strategy = "horizontal" }), ["${cfg.navbuddy.mappings.help}"] = actions.help(), -- Open mappings help window - } + }, } ''; }; From 306eba2302b54a0335cf2899953d0992d86dbd83 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Jul 2023 15:59:16 +0300 Subject: [PATCH 10/13] dev: match navbuddy component border styles with global border component style --- modules/ui/breadcrumbs/breadcrumbs.nix | 28 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index b27f6174..b220538b 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -8,7 +8,7 @@ in { options.vim.ui.breadcrumbs = { enable = lib.mkEnableOption "breadcrumbs"; source = mkOption { - type = types.enum ["nvim-navic" "lspsaga"]; + type = types.enum ["nvim-navic"]; # TODO: lspsaga and dropbar default = "nvim-navic"; description = '' The source to be used for breadcrumbs component @@ -186,7 +186,7 @@ in { border = mkOption { # TODO: let this type accept a custom string type = types.enum ["single" "rounded" "double" "solid" "none"]; - default = "single"; + default = config.vim.ui.borders.globalStyle; description = "border style to use"; }; @@ -199,22 +199,36 @@ in { sections = { # left section left = { - #size = {} + /* + size = { + type = with types; nullOr (intBetween 0 100); + default = null; + description = "size of the left section of Navbuddy UI in percentage (0-100)"; + }; + */ + border = mkOption { # TODO: let this type accept a custom string type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); - default = null; + default = config.vim.ui.borders.globalStyle; description = "border style to use for the left section of Navbuddy UI"; }; }; # middle section mid = { - #size = {} + /* + size = { + type = with types; nullOr (intBetween 0 100); + default = null; + description = "size of the left section of Navbuddy UI in percentage (0-100)"; + }; + */ + border = mkOption { # TODO: let this type accept a custom string type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); - default = null; + default = config.vim.ui.borders.globalStyle; description = "border style to use for the middle section of Navbuddy UI"; }; }; @@ -225,7 +239,7 @@ in { border = mkOption { # TODO: let this type accept a custom string type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); - default = null; + default = config.vim.ui.borders.globalStyle; description = "border style to use for the right section of Navbuddy UI"; }; From 9f295525376d971555483bd64f974defc40117e1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Jul 2023 16:09:28 +0300 Subject: [PATCH 11/13] docs: add breadcrumbs to the release notes --- docs/release-notes/rl-0.5.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index cde1d4b8..3da3c739 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -12,7 +12,7 @@ https://github.com/horriblename[horriblename]: * Fixed a bug where cmp's close and scrollDocs mappings wasn't working. -* Streamlined and simplified extra plugin API with the addition of <>. +* Streamlined and simplified extra plugin API with the addition of <> https://github.com/amanse[amanse]: @@ -23,3 +23,7 @@ https://github.com/notashelf[notashelf]: * Added GitHub Copilot to completion sources. * Added <> for global and individual plugin border configuration. + +* LSP integrated breadcrumbs with <> through nvim-navic + +* LSP navigation helper with nvim-navbuddy, depends on nvim-navic (automatically enabled) From cd54a8f89026b8ad321fc763ae4eb5c222adfe40 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Jul 2023 16:58:30 +0300 Subject: [PATCH 12/13] feat: move breadcrumbs under maximal configuration by default --- configuration.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/configuration.nix b/configuration.nix index 7d6f4170..5b7c5787 100644 --- a/configuration.nix +++ b/configuration.nix @@ -77,7 +77,7 @@ inputs: let nvimWebDevicons.enable = true; scrollBar.enable = true; smoothScroll.enable = true; - cellularAutomaton.enable = true; + cellularAutomaton.enable = isMaximal; fidget-nvim.enable = true; indentBlankline = { enable = true; @@ -158,7 +158,7 @@ inputs: let }; vim.projects = { - project-nvim.enable = true; + project-nvim.enable = isMaximal; }; vim.utility = { @@ -176,7 +176,7 @@ inputs: let vim.notes = { obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled orgmode.enable = false; - mind-nvim.enable = true; + mind-nvim.enable = isMaximal; todo-comments.enable = true; }; @@ -193,7 +193,10 @@ inputs: let colorizer.enable = true; modes-nvim.enable = false; # the theme looks terrible with catppuccin illuminate.enable = true; - breadcrumbs.enable = true; + breadcrumbs = { + enable = isMaximal; + navbuddy.enable = isMaximal; + }; smartcolumn = { enable = true; columnAt.languages = { From f01d6c2949b617f00590089190332a1668f6b447 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Jul 2023 17:08:42 +0300 Subject: [PATCH 13/13] dev: improve nvim-navic and navbuddy loading logic --- modules/statusline/lualine/config.nix | 5 +++-- modules/ui/breadcrumbs/breadcrumbs.nix | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index 2f8b9624..cff8596c 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -49,16 +49,17 @@ in { lualine_z = ${cfg.inactiveSection.z}, }, tabline = {}, + + ${optionalString (config.vim.ui.breadcrumbs.source == "nvim-navic") '' winbar = { lualine_c = { { "navic", - color_correction = nil, - navic_opts = nil, draw_empty = ${toString config.vim.ui.breadcrumbs.alwaysRender} } } }, + ''} extensions = {${ if (config.vim.filetree.nvimTreeLua.enable) then "\"nvim-tree\"" diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index b220538b..d54328ff 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -8,10 +8,10 @@ in { options.vim.ui.breadcrumbs = { enable = lib.mkEnableOption "breadcrumbs"; source = mkOption { - type = types.enum ["nvim-navic"]; # TODO: lspsaga and dropbar + type = with types; nullOr (enum ["nvim-navic"]); # TODO: lspsaga and dropbar default = "nvim-navic"; description = '' - The source to be used for breadcrumbs component + The source to be used for breadcrumbs component. Null means no breadcrumbs. ''; }; @@ -24,13 +24,13 @@ in { }; navbuddy = { - enable = mkEnableOption "navbuddy LSP UI"; + enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic"; # this option is interpreted as null if mkEnableOption is used, and therefore cannot be converted to a string in config.nix useDefaultMappings = mkOption { type = types.bool; default = true; - description = "default Navbuddy keybindings (disables user-specified keybinds)"; + description = "use default Navbuddy keybindings (disables user-specified keybinds)"; }; mappings = {