Skip to content

Commit 9a6ace5

Browse files
committed
refactor: reintro aerial as symbol outline.
#494 (comment)
1 parent 9b06748 commit 9a6ace5

7 files changed

Lines changed: 104 additions & 14 deletions

File tree

lua/keymap/completion.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ function M.lsp(buf)
2727
:with_silent()
2828
:with_buffer(buf)
2929
:with_desc("lsp: Toggle outline"),
30+
["n|gto"] = map_callback(function()
31+
require("telescope").extensions.aerial.aerial()
32+
end)
33+
:with_silent()
34+
:with_buffer(buf)
35+
:with_desc("lsp: Toggle outline in Telescope"),
3036
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev")
3137
:with_silent()
3238
:with_buffer(buf)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
return function()
2+
require("modules.utils").load_plugin("aerial", {
3+
lazy_load = true,
4+
close_on_select = false,
5+
highlight_on_jump = true,
6+
disable_max_lines = 8500,
7+
disable_max_size = 1000000,
8+
ignore = { filetypes = { "NvimTree", "terminal", "nofile" } },
9+
-- Use symbol tree for folding. Set to true or false to enable/disable
10+
-- Set to "auto" to manage folds if your previous foldmethod was 'manual'
11+
-- This can be a filetype map (see :help aerial-filetype-map)
12+
manage_folds = "auto",
13+
layout = {
14+
-- Determines the default direction to open the aerial window. The 'prefer'
15+
-- options will open the window in the other direction *if* there is a
16+
-- different buffer in the way of the preferred direction
17+
-- Enum: prefer_right, prefer_left, right, left, float
18+
default_direction = "prefer_right",
19+
},
20+
-- Keymaps in aerial window. Can be any value that `vim.keymap.set` accepts OR a table of keymap
21+
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
22+
-- Additionally, if it is a string that matches "actions.<name>",
23+
-- it will use the mapping at require("aerial.actions").<name>
24+
-- Set to `false` to remove a keymap
25+
keymaps = {
26+
["?"] = "actions.show_help",
27+
["g?"] = "actions.show_help",
28+
["<CR>"] = "actions.jump",
29+
["<2-LeftMouse>"] = "actions.jump",
30+
["<C-v>"] = "actions.jump_vsplit",
31+
["<C-s>"] = "actions.jump_split",
32+
["<C-d>"] = "actions.down_and_scroll",
33+
["<C-u>"] = "actions.up_and_scroll",
34+
["{"] = "actions.prev",
35+
["}"] = "actions.next",
36+
["[["] = "actions.prev_up",
37+
["]]"] = "actions.next_up",
38+
["q"] = "actions.close",
39+
["o"] = "actions.tree_toggle",
40+
["O"] = "actions.tree_toggle_recursive",
41+
["zr"] = "actions.tree_increase_fold_level",
42+
["zR"] = "actions.tree_open_all",
43+
["zm"] = "actions.tree_decrease_fold_level",
44+
["zM"] = "actions.tree_close_all",
45+
["zx"] = "actions.tree_sync_folds",
46+
["zX"] = "actions.tree_sync_folds",
47+
},
48+
-- A list of all symbols to display. Set to false to display all symbols.
49+
-- This can be a filetype map (see :help aerial-filetype-map)
50+
-- To see all available values, see :help SymbolKind
51+
filter_kind = {
52+
"Array",
53+
"Boolean",
54+
"Class",
55+
"Constant",
56+
"Constructor",
57+
"Enum",
58+
"EnumMember",
59+
"Event",
60+
"Field",
61+
"File",
62+
"Function",
63+
"Interface",
64+
"Key",
65+
"Method",
66+
"Module",
67+
"Namespace",
68+
"Null",
69+
-- "Number",
70+
"Object",
71+
"Operator",
72+
"Package",
73+
-- "Property",
74+
-- "String",
75+
"Struct",
76+
-- "TypeParameter",
77+
-- "Variable",
78+
},
79+
})
80+
end

lua/modules/configs/tool/telescope.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ return function()
4444
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
4545
},
4646
extensions = {
47+
aerial = {
48+
show_lines = false,
49+
show_nesting = {
50+
["_"] = false, -- This key will be the default
51+
lua = true, -- You can set the option for specific filetypes
52+
},
53+
},
4754
fzf = {
4855
fuzzy = false,
4956
override_generic_sorter = true,
@@ -82,6 +89,7 @@ return function()
8289
},
8390
})
8491

92+
require("telescope").load_extension("aerial")
8593
require("telescope").load_extension("frecency")
8694
require("telescope").load_extension("fzf")
8795
require("telescope").load_extension("live_grep_args")

lua/modules/configs/ui/bufferline.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ return function()
3434
padding = 0,
3535
},
3636
{
37-
filetype = "trouble",
38-
text = "LSP Outline",
37+
filetype = "aerial",
38+
text = "Symbol Outline",
3939
text_align = "center",
4040
padding = 0,
4141
},

lua/modules/configs/ui/catppuccin.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ return function()
3030
properties = {},
3131
},
3232
integrations = {
33+
aerial = true,
3334
cmp = true,
3435
dap = true,
3536
dap_ui = true,

lua/modules/configs/ui/edgy.lua

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,9 @@ return function()
5757
},
5858
right = {
5959
{
60-
ft = "trouble",
60+
ft = "aerial",
6161
pinned = true,
62-
size = { height = 0.6, width = 0.3 },
63-
open = "Trouble symbols toggle win.position=right",
64-
filter = trouble_filter("right"),
65-
},
66-
{
67-
ft = "trouble",
68-
pinned = true,
69-
collapsed = true,
70-
size = { height = 0.4, width = 0.3 },
71-
open = "Trouble lsp toggle win.position=right",
72-
filter = trouble_filter("right"),
62+
open = "AerialToggle!",
7363
},
7464
},
7565
})

lua/modules/plugins/completion.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ completion["nvimdev/lspsaga.nvim"] = {
2121
config = require("completion.lspsaga"),
2222
dependencies = { "nvim-tree/nvim-web-devicons" },
2323
}
24+
completion["stevearc/aerial.nvim"] = {
25+
lazy = true,
26+
event = "LspAttach",
27+
config = require("completion.aerial"),
28+
}
2429
completion["DNLHC/glance.nvim"] = {
2530
lazy = true,
2631
event = "LspAttach",

0 commit comments

Comments
 (0)