]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nvim/lua/plugins/nvim-navbuddy.lua
neovim: configure, using ghostty and tmux
[julm/julm-nix.git] / home-manager / profiles / nvim / lua / plugins / nvim-navbuddy.lua
1 -- A simple popup display that provides breadcrumbs feature using LSP server
2 -- https://github.com/hasansujon786/nvim-navbuddy
3 return {
4 "nvim-navbuddy",
5 event = "LspAttach",
6 cmd = { "Navbuddy" },
7 after = function()
8 local navbuddy = require("nvim-navbuddy")
9 local actions = require("nvim-navbuddy.actions")
10 navbuddy.setup({
11 window = {
12 border = "single", -- "rounded", "double", "solid", "none"
13 -- or an array with eight chars building up the border in a clockwise fashion
14 -- starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }.
15 size = "60%", -- Or table format example: { height = "40%", width = "100%"}
16 position = "50%", -- Or table format example: { row = "100%", col = "0%"}
17 scrolloff = nil, -- scrolloff value within navbuddy window
18 sections = {
19 left = {
20 size = "20%",
21 border = nil, -- You can set border style for each section individually as well.
22 },
23 mid = {
24 size = "40%",
25 border = nil,
26 },
27 right = {
28 -- No size option for right most section. It fills to
29 -- remaining area.
30 border = nil,
31 preview = "leaf", -- Right section can show previews too.
32 -- Options: "leaf", "always" or "never"
33 },
34 },
35 },
36 node_markers = {
37 enabled = true,
38 icons = {
39 leaf = " ",
40 leaf_selected = " → ",
41 branch = " ",
42 },
43 },
44 icons = {
45 File = "󰈙 ",
46 Module = " ",
47 Namespace = "󰌗 ",
48 Package = " ",
49 Class = "󰌗 ",
50 Method = "󰆧 ",
51 Property = " ",
52 Field = " ",
53 Constructor = " ",
54 Enum = "󰕘",
55 Interface = "󰕘",
56 Function = "󰊕 ",
57 Variable = "󰆧 ",
58 Constant = "󰏿 ",
59 String = " ",
60 Number = "󰎠 ",
61 Boolean = "◩ ",
62 Array = "󰅪 ",
63 Object = "󰅩 ",
64 Key = "󰌋 ",
65 Null = "󰟢 ",
66 EnumMember = " ",
67 Struct = "󰌗 ",
68 Event = " ",
69 Operator = "󰆕 ",
70 TypeParameter = "󰊄 ",
71 },
72 -- If set to false, only mappings set by user are set.
73 -- Else default mappings are used for keys that are not set by user
74 use_default_mappings = true,
75 mappings = {
76 ["<esc>"] = actions.close(), -- Close and cursor to original location
77 ["q"] = actions.close(),
78
79 ["j"] = actions.next_sibling(), -- down
80 ["k"] = actions.previous_sibling(), -- up
81
82 ["h"] = actions.parent(), -- Move to left panel
83 ["l"] = actions.children(), -- Move to right panel
84 ["0"] = actions.root(), -- Move to first panel
85
86 ["v"] = actions.visual_name(), -- Visual selection of name
87 ["V"] = actions.visual_scope(), -- Visual selection of scope
88
89 ["y"] = actions.yank_name(), -- Yank the name to system clipboard "+
90 ["Y"] = actions.yank_scope(), -- Yank the scope to system clipboard "+
91
92 ["i"] = actions.insert_name(), -- Insert at start of name
93 ["I"] = actions.insert_scope(), -- Insert at start of scope
94
95 ["a"] = actions.append_name(), -- Insert at end of name
96 ["A"] = actions.append_scope(), -- Insert at end of scope
97
98 ["r"] = actions.rename(), -- Rename currently focused symbol
99
100 ["d"] = actions.delete(), -- Delete scope
101
102 ["f"] = actions.fold_create(), -- Create fold of current scope
103 ["F"] = actions.fold_delete(), -- Delete fold of current scope
104
105 ["c"] = actions.comment(), -- Comment out current scope
106
107 ["<enter>"] = actions.select(), -- Goto selected symbol
108 ["o"] = actions.select(),
109
110 ["J"] = actions.move_down(), -- Move focused node down
111 ["K"] = actions.move_up(), -- Move focused node up
112
113 ["s"] = actions.toggle_preview(), -- Show preview of current node
114
115 ["<C-v>"] = actions.vsplit(), -- Open selected node in a vertical split
116 ["<C-s>"] = actions.hsplit(), -- Open selected node in a horizontal split
117
118 ["t"] = actions.telescope({ -- Fuzzy finder at current level.
119 layout_config = { -- All options that can be
120 height = 0.60, -- passed to telescope.nvim's
121 width = 0.60, -- default can be passed here.
122 prompt_position = "top",
123 preview_width = 0.50,
124 },
125 layout_strategy = "horizontal",
126 }),
127
128 ["g?"] = actions.help(), -- Open mappings help window
129 },
130 lsp = {
131 auto_attach = true, -- If set to true, you don't need to manually use attach function
132 preference = nil, -- list of lsp server names in order of preference
133 },
134 source_buffer = {
135 follow_node = true, -- Keep the current node in focus on the source buffer
136 highlight = true, -- Highlight the currently focused node
137 reorient = "smart", -- "smart", "top", "mid" or "none"
138 scrolloff = nil, -- scrolloff value when navbuddy is open
139 },
140 custom_hl_group = nil, -- "Visual" or any other hl group to use instead of inverted colors
141 })
142 end,
143 }