mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 15:39:49 +01:00
Merge pull request #125 from NotAShelf/breadcrumbs-cleanup
This commit is contained in:
commit
479499eb4b
2 changed files with 142 additions and 139 deletions
|
@ -13,7 +13,6 @@
|
||||||
else "'${value}'";
|
else "'${value}'";
|
||||||
|
|
||||||
# convert an expression to lua
|
# convert an expression to lua
|
||||||
|
|
||||||
expToLua = exp:
|
expToLua = exp:
|
||||||
if builtins.isList exp
|
if builtins.isList exp
|
||||||
then listToLuaTable exp # if list, convert to lua table
|
then listToLuaTable exp # if list, convert to lua table
|
||||||
|
|
|
@ -3,58 +3,61 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
with builtins; let
|
with builtins; let
|
||||||
|
inherit (lib) optionalString boolToString mkIf optionals;
|
||||||
|
inherit (lib.nvim.lua) nullString;
|
||||||
|
|
||||||
cfg = config.vim.ui.breadcrumbs;
|
cfg = config.vim.ui.breadcrumbs;
|
||||||
nb = cfg.navbuddy;
|
nb = cfg.navbuddy;
|
||||||
|
|
||||||
nilOrStr = v:
|
|
||||||
if v == null
|
|
||||||
then "nil"
|
|
||||||
else toString v;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins =
|
vim.startPlugins =
|
||||||
[
|
[
|
||||||
"nvim-lspconfig"
|
"nvim-lspconfig"
|
||||||
]
|
]
|
||||||
++ lib.optionals (config.vim.lsp.lspsaga.enable && cfg.source == "lspsaga") [
|
++ optionals (cfg.source == "nvim-navic") [
|
||||||
|
"nvim-navic"
|
||||||
|
]
|
||||||
|
++ optionals (config.vim.lsp.lspsaga.enable && cfg.source == "lspsaga") [
|
||||||
"lspsaga"
|
"lspsaga"
|
||||||
]
|
]
|
||||||
++ lib.optionals (cfg.navbuddy.enable || cfg.source == "nvim-navic") [
|
++ optionals cfg.navbuddy.enable [
|
||||||
"nvim-navbuddy"
|
"nvim-navbuddy"
|
||||||
|
"nui-nvim"
|
||||||
"nvim-navic"
|
"nvim-navic"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.breadcrumbs = nvim.dag.entryAfter ["lspconfig"] ''
|
vim.luaConfigRC.breadcrumbs = lib.nvim.dag.entryAfter ["lspconfig"] ''
|
||||||
local navbuddy = require("nvim-navbuddy")
|
|
||||||
local navic = require("nvim-navic")
|
|
||||||
local actions = require("nvim-navbuddy.actions")
|
|
||||||
|
|
||||||
|
${optionalString (cfg.source == "nvim-navic") ''
|
||||||
|
local navic = require("nvim-navic")
|
||||||
require("nvim-navic").setup {
|
require("nvim-navic").setup {
|
||||||
highlight = true
|
highlight = true
|
||||||
}
|
}
|
||||||
|
''}
|
||||||
|
|
||||||
-- TODO: wrap this in an optional string with navbuddy as the enable condition
|
${optionalString cfg.navbuddy.enable ''
|
||||||
|
local navbuddy = require("nvim-navbuddy")
|
||||||
|
local actions = require("nvim-navbuddy.actions")
|
||||||
navbuddy.setup {
|
navbuddy.setup {
|
||||||
window = {
|
window = {
|
||||||
border = "${nb.window.border}", -- "rounded", "double", "solid", "none"
|
border = "${nb.window.border}", -- "rounded", "double", "solid", "none"
|
||||||
size = "60%",
|
size = "60%",
|
||||||
position = "50%",
|
position = "50%",
|
||||||
scrolloff = ${(nilOrStr nb.window.scrolloff)},
|
scrolloff = ${(nullString nb.window.scrolloff)},
|
||||||
sections = {
|
sections = {
|
||||||
left = {
|
left = {
|
||||||
size = "20%",
|
size = "20%",
|
||||||
border = ${(nilOrStr nb.window.sections.left.border)},
|
border = ${(nullString nb.window.sections.left.border)},
|
||||||
},
|
},
|
||||||
|
|
||||||
mid = {
|
mid = {
|
||||||
size = "40%",
|
size = "40%",
|
||||||
border = ${(nilOrStr nb.window.sections.mid.border)},
|
border = ${(nullString nb.window.sections.mid.border)},
|
||||||
},
|
},
|
||||||
|
|
||||||
right = {
|
right = {
|
||||||
border = ${(nilOrStr nb.window.sections.right.border)},
|
border = ${(nullString nb.window.sections.right.border)},
|
||||||
preview = "leaf",
|
preview = "leaf",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -77,7 +80,7 @@ in {
|
||||||
follow_node = ${boolToString nb.sourceBuffer.followNode},
|
follow_node = ${boolToString nb.sourceBuffer.followNode},
|
||||||
highlight = ${boolToString nb.sourceBuffer.highlight},
|
highlight = ${boolToString nb.sourceBuffer.highlight},
|
||||||
reorient = "${nb.sourceBuffer.reorient}",
|
reorient = "${nb.sourceBuffer.reorient}",
|
||||||
scrolloff = ${nilOrStr nb.sourceBuffer.scrolloff}
|
scrolloff = ${nullString nb.sourceBuffer.scrolloff}
|
||||||
},
|
},
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
|
@ -110,7 +113,7 @@ in {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- make those configurable
|
-- make those configurable
|
||||||
use_default_mappings = ${toString (cfg.navbuddy.useDefaultMappings)},
|
use_default_mappings = ${boolToString cfg.navbuddy.useDefaultMappings},
|
||||||
mappings = {
|
mappings = {
|
||||||
["${cfg.navbuddy.mappings.close}"] = actions.close(),
|
["${cfg.navbuddy.mappings.close}"] = actions.close(),
|
||||||
["${cfg.navbuddy.mappings.nextSibling}"] = actions.next_sibling(),
|
["${cfg.navbuddy.mappings.nextSibling}"] = actions.next_sibling(),
|
||||||
|
@ -158,6 +161,7 @@ in {
|
||||||
["${cfg.navbuddy.mappings.help}"] = actions.help(), -- Open mappings help window
|
["${cfg.navbuddy.mappings.help}"] = actions.help(), -- Open mappings help window
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue