2020-09-20 00:59:51 +02:00
|
|
|
# aerial.nvim
|
2022-01-02 01:05:51 +01:00
|
|
|
|
2021-06-16 17:48:32 +02:00
|
|
|
A code outline window for skimming and quick navigation
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
- [Requirements](#requirements)
|
|
|
|
- [Installation](#installation)
|
|
|
|
- [Setup](#setup)
|
|
|
|
- [LSP](#lsp)
|
|
|
|
- [Treesitter](#treesitter)
|
|
|
|
- [Markdown](#markdown)
|
|
|
|
- [Keymaps](#keymaps)
|
|
|
|
- [Commands](#commands)
|
|
|
|
- [Options](#options)
|
|
|
|
- [Default keybindings](#default-keybindings)
|
|
|
|
- [Third-party integrations](#third-party-integrations)
|
|
|
|
- [Telescope](#telescope)
|
|
|
|
- [Fzf](#fzf)
|
|
|
|
- [Lualine](#lualine)
|
|
|
|
- [Highlight](#highlight)
|
|
|
|
- [FAQ](#faq)
|
2021-11-21 15:46:45 +01:00
|
|
|
|
2021-06-19 20:56:15 +02:00
|
|
|
https://user-images.githubusercontent.com/506791/122652728-18688500-d0f5-11eb-80aa-910f7e6a5f46.mp4
|
2020-09-20 02:29:26 +02:00
|
|
|
|
|
|
|
## Requirements
|
2022-01-02 01:05:51 +01:00
|
|
|
|
|
|
|
- Neovim 0.5+
|
|
|
|
- One or more of the following:
|
|
|
|
- A working LSP setup (see [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig))
|
|
|
|
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) with languages installed
|
2020-09-20 02:29:26 +02:00
|
|
|
|
|
|
|
## Installation
|
2022-01-02 01:05:51 +01:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
aerial supports all the usual plugin managers
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
<details>
|
|
|
|
<summary>Packer</summary>
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
```lua
|
|
|
|
require('packer').startup(function()
|
|
|
|
use {'stevearc/aerial.nvim'}
|
|
|
|
end)
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
<details>
|
|
|
|
<summary>Paq</summary>
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
```lua
|
|
|
|
require "paq" {
|
|
|
|
{'stevearc/aerial.nvim'};
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>vim-plug</summary>
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
```vim
|
|
|
|
Plug 'stevearc/aerial.nvim'
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>dein</summary>
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
```vim
|
|
|
|
call dein#add('stevearc/aerial.nvim')
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>Pathogen</summary>
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
```sh
|
|
|
|
git clone --depth=1 https://github.com/stevearc/aerial.nvim.git ~/.vim/bundle/
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>Neovim native package</summary>
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
```sh
|
|
|
|
git clone --depth=1 https://github.com/stevearc/aerial.nvim.git \
|
|
|
|
"${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/aerial/start/aerial.nvim
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2021-06-17 18:54:37 +02:00
|
|
|
## Setup
|
2022-01-02 01:05:51 +01:00
|
|
|
|
2021-11-27 08:11:01 +01:00
|
|
|
Aerial can display document symbols from a couple of sources; you will need to
|
|
|
|
follow the setup steps for at least one of them. You can configure your
|
|
|
|
preferred source(s) with the `backends` option (see [Options](#options)). The
|
|
|
|
default is to prefer LSP when it's available and fall back to Treesitter.
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
### LSP
|
2020-09-20 02:29:26 +02:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
First ensure you have a functioning LSP setup (see
|
|
|
|
[nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)). Once complete, add
|
|
|
|
the aerial `on_attach` callback to your config:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
-- Set up your LSP clients here, using the aerial on_attach method
|
2022-01-02 17:43:37 +01:00
|
|
|
require("lspconfig").vimls.setup{
|
|
|
|
on_attach = require("aerial").on_attach,
|
2021-11-21 15:46:45 +01:00
|
|
|
}
|
|
|
|
-- Repeat this for each language server you have configured
|
|
|
|
```
|
|
|
|
|
2022-01-02 17:43:37 +01:00
|
|
|
If you have your own custom `on_attach` function, call aerial's `on_attach` from
|
|
|
|
inside it:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
local function my_custom_attach(client, bufnr)
|
|
|
|
-- your code here
|
|
|
|
require("aerial").on_attach(client, bufnr)
|
|
|
|
end
|
|
|
|
```
|
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
### Treesitter
|
|
|
|
|
2021-11-30 20:33:35 +01:00
|
|
|
**The treesitter backend is in Beta status**
|
2021-11-21 15:46:45 +01:00
|
|
|
|
|
|
|
Please do try it out, and file an issue if you encounter any problems.
|
|
|
|
|
|
|
|
First ensure you have
|
|
|
|
[nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) installed
|
|
|
|
and configured for all languages you want to support. That's all! Aerial will
|
|
|
|
automatically fetch symbols from treesitter.
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>Supported languages</summary>
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
- bash
|
|
|
|
- c
|
|
|
|
- c_sharp
|
|
|
|
- cpp
|
|
|
|
- dart
|
|
|
|
- go
|
|
|
|
- java
|
|
|
|
- javascript
|
|
|
|
- json
|
2022-01-06 23:13:33 +01:00
|
|
|
- julia
|
2022-01-02 01:05:51 +01:00
|
|
|
- lua
|
|
|
|
- markdown
|
|
|
|
- python
|
|
|
|
- rst
|
|
|
|
- ruby
|
|
|
|
- rust
|
|
|
|
- typescript
|
|
|
|
- vim
|
2021-11-21 16:46:15 +01:00
|
|
|
|
|
|
|
Don't see your language here? [Request support for
|
|
|
|
it](https://github.com/stevearc/aerial.nvim/issues/new?assignees=stevearc&labels=enhancement&template=feature-request--treesitter-language-.md&title=)
|
2022-01-02 01:05:51 +01:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
</details>
|
|
|
|
|
2021-11-22 01:14:32 +01:00
|
|
|
### Markdown
|
|
|
|
|
2021-12-17 19:50:58 +01:00
|
|
|
There is a simple custom backend that does rudimentary parsing of markdown
|
|
|
|
headers. It should work well enough in most cases, but does not parse the full
|
|
|
|
markdown spec.
|
|
|
|
|
|
|
|
There is now an experimental [treesitter parser for
|
|
|
|
markdown](https://github.com/nvim-treesitter/nvim-treesitter/issues/872), so you
|
|
|
|
can install that and try the treesitter backend instead.
|
2021-11-22 01:14:32 +01:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
### Keymaps
|
|
|
|
|
|
|
|
While not required, you may want to add some keymaps for aerial. The best way to
|
2022-01-02 00:02:35 +01:00
|
|
|
do this is with the `on_attach` option:
|
2020-09-20 02:29:26 +02:00
|
|
|
|
|
|
|
```lua
|
2022-01-02 00:02:35 +01:00
|
|
|
require("aerial").setup({
|
|
|
|
on_attach = function(bufnr)
|
|
|
|
-- Toggle the aerial window with <leader>a
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>a', '<cmd>AerialToggle!<CR>', {})
|
|
|
|
-- Jump forwards/backwards with '{' and '}'
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '{', '<cmd>AerialPrev<CR>', {})
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '}', '<cmd>AerialNext<CR>', {})
|
|
|
|
-- Jump up the tree with '[[' or ']]'
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[[', '<cmd>AerialPrevUp<CR>', {})
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {})
|
|
|
|
end
|
|
|
|
})
|
2020-09-20 02:29:26 +02:00
|
|
|
```
|
|
|
|
|
2021-06-17 20:10:54 +02:00
|
|
|
## Commands
|
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
| Command | arg | description |
|
|
|
|
| --------------------- | ---------------------- | -------------------------------------------------------------------------- |
|
|
|
|
| `AerialToggle[!]` | `left`/`right`/`float` | Open or close the aerial window. With `[!]` cursor stays in current window |
|
|
|
|
| `AerialOpen[!]` | `left`/`right`/`float` | Open the aerial window. With `[!]` cursor stays in current window |
|
|
|
|
| `AerialClose` | | Close the aerial window |
|
|
|
|
| `AerialPrev` | N=1 | Jump backwards N symbols |
|
|
|
|
| `AerialNext` | N=1 | Jump forwards N symbols |
|
|
|
|
| `AerialPrevUp` | N=1 | Jump up the tree N levels, moving backwards |
|
|
|
|
| `AerialNextUp` | N=1 | Jump up the tree N levels, moving forwards |
|
|
|
|
| `AerialGo` | N=1, `v`/`h` | Jump to the Nth symbol |
|
|
|
|
| `AerialTreeOpen[!]` | | Expand tree at current location. `[!]` makes it recursive. |
|
|
|
|
| `AerialTreeClose[!]` | | Collapse tree at current location. `[!]` makes it recursive. |
|
|
|
|
| `AerialTreeToggle[!]` | | Toggle tree at current location. `[!]` makes it recursive. |
|
|
|
|
| `AerialTreeOpenAll` | | Open all tree nodes |
|
|
|
|
| `AerialTreeCloseAll` | | Collapse all tree nodes |
|
|
|
|
| `AerialTreeSyncFolds` | | Sync code folding with current tree state |
|
|
|
|
| `AerialInfo` | | Print out debug info related to aerial |
|
2021-06-17 20:10:54 +02:00
|
|
|
|
2021-06-17 18:54:37 +02:00
|
|
|
## Options
|
|
|
|
|
|
|
|
```lua
|
2022-01-02 01:05:51 +01:00
|
|
|
-- Call the setup function to change the default behavior
|
2022-01-01 06:32:55 +01:00
|
|
|
require("aerial").setup({
|
|
|
|
-- Priority list of preferred backends for aerial.
|
|
|
|
-- This can be a filetype map (see :help aerial-filetype-map)
|
2021-11-22 01:38:07 +01:00
|
|
|
backends = { "lsp", "treesitter", "markdown" },
|
2021-11-20 09:48:20 +01:00
|
|
|
|
2021-06-28 20:23:55 +02:00
|
|
|
-- Enum: persist, close, auto, global
|
2021-06-17 23:20:32 +02:00
|
|
|
-- persist - aerial window will stay open until closed
|
|
|
|
-- close - aerial window will close when original file is no longer visible
|
|
|
|
-- auto - aerial window will stay open as long as there is a visible
|
|
|
|
-- buffer to attach to
|
2021-06-28 20:23:55 +02:00
|
|
|
-- global - same as 'persist', and will always show symbols for the current buffer
|
2021-07-06 03:06:17 +02:00
|
|
|
close_behavior = "auto",
|
2021-06-18 02:06:21 +02:00
|
|
|
|
|
|
|
-- Set to false to remove the default keybindings for the aerial buffer
|
|
|
|
default_bindings = true,
|
|
|
|
|
2021-12-01 00:46:10 +01:00
|
|
|
-- Enum: prefer_right, prefer_left, right, left, float
|
2021-06-17 18:54:37 +02:00
|
|
|
-- Determines the default direction to open the aerial window. The 'prefer'
|
|
|
|
-- options will open the window in the other direction *if* there is a
|
|
|
|
-- different buffer in the way of the preferred direction
|
2021-07-06 03:06:17 +02:00
|
|
|
default_direction = "prefer_right",
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2021-12-31 02:41:59 +01:00
|
|
|
-- Disable aerial on files with this many lines
|
|
|
|
disable_max_lines = 10000,
|
|
|
|
|
2021-11-21 02:55:53 +01:00
|
|
|
-- A list of all symbols to display. Set to false to display all symbols.
|
2022-01-01 06:32:55 +01:00
|
|
|
-- This can be a filetype map (see :help aerial-filetype-map)
|
|
|
|
-- To see all available values, see :help SymbolKind
|
2021-11-21 02:55:53 +01:00
|
|
|
filter_kind = {
|
|
|
|
"Class",
|
|
|
|
"Constructor",
|
|
|
|
"Enum",
|
|
|
|
"Function",
|
|
|
|
"Interface",
|
2022-01-06 23:13:33 +01:00
|
|
|
"Module",
|
2021-11-21 02:55:53 +01:00
|
|
|
"Method",
|
|
|
|
"Struct",
|
|
|
|
},
|
2021-06-28 23:48:05 +02:00
|
|
|
|
2021-06-18 00:50:40 +02:00
|
|
|
-- Enum: split_width, full_width, last, none
|
2022-02-03 21:32:00 +01:00
|
|
|
-- Determines line highlighting mode when multiple splits are visible.
|
2022-01-01 06:32:55 +01:00
|
|
|
-- split_width Each open window will have its cursor location marked in the
|
|
|
|
-- aerial buffer. Each line will only be partially highlighted
|
|
|
|
-- to indicate which window is at that location.
|
|
|
|
-- full_width Each open window will have its cursor location marked as a
|
|
|
|
-- full-width highlight in the aerial buffer.
|
|
|
|
-- last Only the most-recently focused window will have its location
|
|
|
|
-- marked in the aerial buffer.
|
|
|
|
-- none Do not show the cursor locations in the aerial window.
|
2021-07-06 03:06:17 +02:00
|
|
|
highlight_mode = "split_width",
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2022-02-03 21:32:00 +01:00
|
|
|
-- Highlight the closest symbol if the cursor is not exactly on one.
|
|
|
|
highlight_closest = true,
|
|
|
|
|
2022-01-01 06:32:55 +01:00
|
|
|
-- When jumping to a symbol, highlight the line for this many ms.
|
|
|
|
-- Set to false to disable
|
2021-06-17 18:54:37 +02:00
|
|
|
highlight_on_jump = 300,
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2022-01-01 06:32:55 +01:00
|
|
|
-- Define symbol icons. You can also specify "<Symbol>Collapsed" to change the
|
|
|
|
-- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a
|
|
|
|
-- default collapsed icon. The default icon set is determined by the
|
|
|
|
-- "nerd_font" option below.
|
|
|
|
-- If you have lspkind-nvim installed, aerial will use it for icons.
|
|
|
|
icons = {},
|
2021-06-18 06:02:44 +02:00
|
|
|
|
2022-01-01 06:32:55 +01:00
|
|
|
-- When you fold code with za, zo, or zc, update the aerial tree as well.
|
|
|
|
-- Only works when manage_folds = true
|
2021-06-18 06:02:44 +02:00
|
|
|
link_folds_to_tree = false,
|
|
|
|
|
2022-01-01 06:32:55 +01:00
|
|
|
-- Fold code when you open/collapse symbols in the tree.
|
|
|
|
-- Only works when manage_folds = true
|
|
|
|
link_tree_to_folds = true,
|
|
|
|
|
2021-06-18 06:02:44 +02:00
|
|
|
-- Use symbol tree for folding. Set to true or false to enable/disable
|
|
|
|
-- 'auto' will manage folds if your previous foldmethod was 'manual'
|
2021-12-30 18:02:59 +01:00
|
|
|
manage_folds = false,
|
2021-06-18 06:02:44 +02:00
|
|
|
|
2021-06-17 18:54:37 +02:00
|
|
|
-- The maximum width of the aerial window
|
|
|
|
max_width = 40,
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2021-06-17 18:54:37 +02:00
|
|
|
-- The minimum width of the aerial window.
|
|
|
|
-- To disable dynamic resizing, set this to be equal to max_width
|
|
|
|
min_width = 10,
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2022-01-01 06:32:55 +01:00
|
|
|
-- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/)
|
|
|
|
-- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed.
|
2021-07-06 03:06:17 +02:00
|
|
|
nerd_font = "auto",
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2022-01-02 01:05:51 +01:00
|
|
|
-- Call this function when aerial attaches to a buffer.
|
|
|
|
-- Useful for setting keymaps. Takes a single `bufnr` argument.
|
|
|
|
on_attach = nil,
|
|
|
|
|
2022-01-03 00:46:00 +01:00
|
|
|
-- Automatically open aerial when entering supported buffers.
|
|
|
|
-- This can be a function (see :help aerial-open-automatic)
|
2021-06-17 18:54:37 +02:00
|
|
|
open_automatic = false,
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2021-11-21 02:55:53 +01:00
|
|
|
-- Set to true to only open aerial at the far right/left of the editor
|
|
|
|
-- Default behavior opens aerial relative to current window
|
|
|
|
placement_editor_edge = false,
|
|
|
|
|
2021-06-18 06:02:44 +02:00
|
|
|
-- Run this command after jumping to a symbol (false will disable)
|
2021-07-06 03:06:17 +02:00
|
|
|
post_jump_cmd = "normal! zz",
|
2021-06-18 02:06:21 +02:00
|
|
|
|
2022-01-01 06:32:55 +01:00
|
|
|
-- When true, aerial will automatically close after jumping to a symbol
|
2021-11-27 02:19:51 +01:00
|
|
|
close_on_select = false,
|
|
|
|
|
2022-01-06 21:52:31 +01:00
|
|
|
-- Show box drawing characters for the tree hierarchy
|
|
|
|
show_guides = false,
|
|
|
|
|
2022-01-29 21:49:15 +01:00
|
|
|
-- Customize the characters used when show_guides = true
|
|
|
|
guides = {
|
|
|
|
-- When the child item has a sibling below it
|
|
|
|
mid_item = "├─",
|
|
|
|
-- When the child item is the last in the list
|
|
|
|
last_item = "└─",
|
|
|
|
-- When there are nested child guides to the right
|
|
|
|
nested_top = "│ ",
|
|
|
|
-- Raw indentation
|
|
|
|
whitespace = " ",
|
|
|
|
},
|
|
|
|
|
2021-12-01 03:16:07 +01:00
|
|
|
-- Options for opening aerial in a floating win
|
|
|
|
float = {
|
|
|
|
-- Controls border appearance. Passed to nvim_open_win
|
|
|
|
border = "rounded",
|
|
|
|
|
|
|
|
-- Controls row offset from cursor. Passed to nvim_open_win
|
|
|
|
row = 1,
|
|
|
|
|
|
|
|
-- Controls col offset from cursor. Passed to nvim_open_win
|
|
|
|
col = 0,
|
|
|
|
|
|
|
|
-- The maximum height of the floating aerial window
|
|
|
|
max_height = 100,
|
|
|
|
|
|
|
|
-- The minimum height of the floating aerial window
|
|
|
|
-- To disable dynamic resizing, set this to be equal to max_height
|
|
|
|
min_height = 4,
|
|
|
|
},
|
|
|
|
|
2021-11-20 09:48:20 +01:00
|
|
|
lsp = {
|
2022-02-03 06:12:48 +01:00
|
|
|
-- Fetch document symbols when LSP diagnostics update.
|
|
|
|
-- If false, will update on buffer changes.
|
2021-11-20 09:48:20 +01:00
|
|
|
diagnostics_trigger_update = true,
|
|
|
|
|
|
|
|
-- Set to false to not update the symbols when there are LSP errors
|
|
|
|
update_when_errors = true,
|
|
|
|
},
|
|
|
|
|
|
|
|
treesitter = {
|
2021-11-21 03:34:11 +01:00
|
|
|
-- How long to wait (in ms) after a buffer change before updating
|
2021-11-20 09:48:20 +01:00
|
|
|
update_delay = 300,
|
2021-06-17 18:54:37 +02:00
|
|
|
},
|
2021-11-22 01:38:07 +01:00
|
|
|
|
|
|
|
markdown = {
|
|
|
|
-- How long to wait (in ms) after a buffer change before updating
|
|
|
|
update_delay = 300,
|
|
|
|
},
|
2022-01-01 06:32:55 +01:00
|
|
|
})
|
2021-06-17 18:54:37 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
All possible SymbolKind values can be found [in the LSP
|
|
|
|
spec](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#symbolKind).
|
|
|
|
These are the values used for configuring icons, highlight groups, and
|
|
|
|
filtering.
|
2021-06-17 03:55:09 +02:00
|
|
|
|
2021-06-17 05:33:06 +02:00
|
|
|
## Default Keybindings
|
2022-01-02 01:05:51 +01:00
|
|
|
|
2021-06-22 02:28:15 +02:00
|
|
|
The default keybindings in the aerial window. You can add your own in
|
2022-01-02 01:23:28 +01:00
|
|
|
`ftplugin/aerial.vim`, and remove these by setting `default_bindings = false`.
|
2022-01-02 01:05:51 +01:00
|
|
|
|
|
|
|
| Key | Command |
|
|
|
|
| --------- | -------------------------------------------------------------- |
|
|
|
|
| `?` | Show default keymaps |
|
|
|
|
| `<CR>` | Jump to the symbol under the cursor |
|
|
|
|
| `<C-v>` | Jump to the symbol in a vertical split |
|
|
|
|
| `<C-s>` | Jump to the symbol in a horizontal split |
|
|
|
|
| `p` | Scroll to the symbol (stay in aerial buffer) |
|
|
|
|
| `<C-j>` | Go down one line and scroll to that symbol |
|
|
|
|
| `<C-k>` | Go up one line and scroll to that symbol |
|
|
|
|
| `{` | Jump to the previous symbol |
|
|
|
|
| `}` | Jump to the next symbol |
|
|
|
|
| `[[` | Jump up the tree, moving backwards |
|
|
|
|
| `]]` | Jump up the tree, moving forwards |
|
|
|
|
| `q` | Close the aerial window |
|
|
|
|
| `o`/`za` | Toggle the symbol under the cursor open/closed |
|
|
|
|
| `O`/`zA` | Recursive toggle the symbol under the cursor open/closed |
|
|
|
|
| `l`/`zo` | Expand the symbol under the cursor |
|
|
|
|
| `L`/`zO` | Recursive expand the symbol under the cursor |
|
|
|
|
| `h`/`zc` | Collapse the symbol under the cursor |
|
|
|
|
| `H`/`zC` | Recursive collapse the symbol under the cursor |
|
|
|
|
| `zR` | Expand all nodes in the tree |
|
|
|
|
| `zM` | Collapse all nodes in the tree |
|
|
|
|
| `zx`/`zX` | Sync code folding to the tree (useful if they get out of sync) |
|
2021-06-17 05:33:06 +02:00
|
|
|
|
2021-12-03 23:43:16 +01:00
|
|
|
## Third-party integrations
|
2021-07-15 21:44:17 +02:00
|
|
|
|
2021-07-17 00:49:10 +02:00
|
|
|
### Telescope
|
|
|
|
|
|
|
|
If you have [telescope](https://github.com/nvim-telescope/telescope.nvim)
|
|
|
|
installed, there is an extension for fuzzy finding and jumping to symbols. It
|
2021-12-02 04:47:18 +01:00
|
|
|
functions similarly to the builtin `lsp_document_symbols` picker, the main
|
|
|
|
difference being that it uses the aerial backend for the source (e.g. LSP,
|
|
|
|
treesitter, etc) and that it filters out some symbols (see the `filter_kind`
|
|
|
|
option).
|
2021-07-17 00:55:20 +02:00
|
|
|
|
2021-11-21 15:46:45 +01:00
|
|
|
You can activate the picker with `:Telescope aerial`
|
|
|
|
|
|
|
|
If you want the command to autocomplete, you can load the extension first:
|
2021-07-15 21:44:17 +02:00
|
|
|
|
|
|
|
```lua
|
|
|
|
require('telescope').load_extension('aerial')
|
|
|
|
```
|
|
|
|
|
2021-07-17 00:49:10 +02:00
|
|
|
### fzf
|
|
|
|
|
|
|
|
If you have [fzf](https://github.com/junegunn/fzf.vim) installed you can trigger
|
|
|
|
fuzzy finding with `:call aerial#fzf()`. To create a mapping:
|
2022-01-02 01:05:51 +01:00
|
|
|
|
2021-07-17 00:49:10 +02:00
|
|
|
```vim
|
|
|
|
nmap <silent> <leader>ds <cmd>call aerial#fzf()<cr>
|
|
|
|
```
|
|
|
|
|
2021-12-03 23:43:16 +01:00
|
|
|
### Lualine
|
|
|
|
|
|
|
|
There is a lualine component to display the symbols for your current cursor
|
|
|
|
position
|
|
|
|
|
|
|
|
```lua
|
|
|
|
require("lualine").setup({
|
|
|
|
sections = {
|
|
|
|
lualine_x = { "aerial" },
|
|
|
|
|
|
|
|
-- Or you can customize it
|
|
|
|
lualine_y = { "aerial",
|
|
|
|
-- The separator to be used to separate symbols in status line.
|
|
|
|
sep = ' ) ',
|
|
|
|
|
|
|
|
-- The number of symbols to render top-down. In order to render only 'N' last
|
|
|
|
-- symbols, negative numbers may be supplied. For instance, 'depth = -1' can
|
|
|
|
-- be used in order to render only current symbol.
|
|
|
|
depth = nil,
|
|
|
|
|
|
|
|
-- When 'dense' mode is on, icons are not rendered near their symbols. Only
|
|
|
|
-- a single icon that represents the kind of current symbol is rendered at
|
|
|
|
-- the beginning of status line.
|
|
|
|
dense = false,
|
|
|
|
|
|
|
|
-- The separator to be used to separate symbols in dense mode.
|
|
|
|
dense_sep = '.',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2021-06-17 05:33:06 +02:00
|
|
|
## Highlight
|
|
|
|
|
|
|
|
There are highlight groups created for each `SymbolKind`. There will be one for
|
|
|
|
the name of the symbol (`Aerial<SymbolKind>`, and one for the icon
|
|
|
|
(`Aerial<SymbolKind>Icon`). For example:
|
|
|
|
|
2021-06-17 18:54:37 +02:00
|
|
|
```vim
|
|
|
|
hi link AerialClass Type
|
|
|
|
hi link AerialClassIcon Special
|
|
|
|
hi link AerialFunction Special
|
|
|
|
hi AerialFunctionIcon guifg=#cb4b16 guibg=NONE guisp=NONE gui=NONE cterm=NONE
|
2021-06-17 05:33:06 +02:00
|
|
|
|
2021-06-17 18:54:37 +02:00
|
|
|
" There's also this group for the cursor position
|
|
|
|
hi link AerialLine QuickFixLine
|
2022-01-29 21:47:29 +01:00
|
|
|
|
|
|
|
" You can customize the guides (if show_guide=true)
|
|
|
|
hi link AerialGuide Comment
|
|
|
|
" You can set a different guide color for each level
|
|
|
|
hi AerialGuide1 guifg=Red
|
|
|
|
hi AerialGuide2 guifg=Blue
|
2021-06-17 18:54:37 +02:00
|
|
|
```
|
2021-07-07 22:27:00 +02:00
|
|
|
|
|
|
|
## FAQ
|
|
|
|
|
|
|
|
**Q: I accidentally opened a file into the aerial window and it looks bad. How can I prevent this from happening?**
|
|
|
|
|
|
|
|
Try installing [stickybuf](https://github.com/stevearc/stickybuf.nvim). It was designed to prevent exactly this problem.
|