mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
Merged with master
This commit is contained in:
parent
77ef86ecc9
commit
0017d38f58
5 changed files with 38 additions and 5 deletions
20
README.md
20
README.md
|
@ -32,6 +32,23 @@ https://user-images.githubusercontent.com/506791/122652728-18688500-d0f5-11eb-80
|
|||
|
||||
aerial supports all the usual plugin managers
|
||||
|
||||
<details>
|
||||
<summary>lazy.nvim</summary>
|
||||
|
||||
```lua
|
||||
{
|
||||
'stevearc/aerial.nvim',
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Packer</summary>
|
||||
|
||||
|
@ -306,6 +323,9 @@ require("aerial").setup({
|
|||
-- Set to false to disable
|
||||
highlight_on_jump = 300,
|
||||
|
||||
-- Jump to symbol in source window when the cursor moves
|
||||
autojump = false,
|
||||
|
||||
-- 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
|
||||
|
|
|
@ -140,6 +140,9 @@ OPTIONS *aerial-option
|
|||
-- Set to false to disable
|
||||
highlight_on_jump = 300,
|
||||
|
||||
-- Jump to symbol in source window when the cursor moves
|
||||
autojump = false,
|
||||
|
||||
-- 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
|
||||
|
|
|
@ -65,7 +65,7 @@ M.fetch_symbols_sync = function(bufnr)
|
|||
local stack = {}
|
||||
local ext = extensions[lang]
|
||||
for match in query.iter_group_results(bufnr, "aerial", syntax_tree:root(), lang) do
|
||||
local name_node = (match.name or {}).node
|
||||
local name_match = match.name or {}
|
||||
local type_node = (match.type or {}).node
|
||||
-- The location capture groups are optional. We default to the
|
||||
-- location of the @type capture
|
||||
|
@ -92,8 +92,8 @@ M.fetch_symbols_sync = function(bufnr)
|
|||
local row, col = start_node:start()
|
||||
local end_row, end_col = end_node:end_()
|
||||
local name
|
||||
if name_node then
|
||||
name = get_node_text(name_node, bufnr) or "<parse error>"
|
||||
if name_match.node then
|
||||
name = get_node_text(name_match.node, bufnr, name_match) or "<parse error>"
|
||||
else
|
||||
name = "<Anonymous>"
|
||||
end
|
||||
|
|
|
@ -126,6 +126,9 @@ local default_options = {
|
|||
-- Set to false to disable
|
||||
highlight_on_jump = 300,
|
||||
|
||||
-- Jump to symbol in source window when the cursor moves
|
||||
autojump = false,
|
||||
|
||||
-- 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
|
||||
|
|
|
@ -25,14 +25,21 @@ local function create_aerial_buffer(bufnr)
|
|||
vim.api.nvim_buf_set_option(aer_bufnr, "swapfile", false)
|
||||
vim.api.nvim_buf_set_option(aer_bufnr, "modifiable", false)
|
||||
|
||||
if config.highlight_on_hover then
|
||||
if config.highlight_on_hover or config.autojump then
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
desc = "Aerial update highlights in the source buffer",
|
||||
buffer = aer_bufnr,
|
||||
callback = function()
|
||||
render.update_highlights(bufnr)
|
||||
if config.highlight_on_hover then
|
||||
render.update_highlights(bufnr)
|
||||
end
|
||||
if config.autojump then
|
||||
require("aerial.navigation").select({ jump = false })
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
if config.highlight_on_hover then
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
desc = "Aerial clear highlights in the source buffer",
|
||||
buffer = aer_bufnr,
|
||||
|
|
Loading…
Reference in a new issue