mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-10 12:21:40 +00:00
feat: make navbuddy icons and keybinds configurable
This commit is contained in:
parent
f5719426cb
commit
ef122b1b4d
3 changed files with 371 additions and 61 deletions
|
@ -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 = {
|
||||
["<esc>"] = 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
|
||||
|
||||
["<enter>"] = 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
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue