mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
fix!: ignore win/buffer behavior prevents opening aerial at all (#204)
Previously the ignore behavior was to not trigger open_automatic, and to not update the aerial window when attach_mode = "global". Unfortunately, that means that we end up in a weird state and it's difficult to make the open/close/toggle behavior in ignored buffers consistent _unless_ we prevent opening aerial altogether. This essentially makes ignored buffers the same as unsupported, but with the key difference that it won't trigger any of the close_automatic_events. As part of this, we're also changing the default to NOT ignore unlisted buffers. The main reason for this is that help buffers are unlisted by default, but aerial supports them.
This commit is contained in:
parent
a562b9d99f
commit
b1e6c7d94b
2 changed files with 6 additions and 11 deletions
|
@ -135,16 +135,10 @@ local default_options = {
|
|||
icons = {},
|
||||
|
||||
-- Control which windows and buffers aerial should ignore.
|
||||
-- If attach_mode is "global", focusing an ignored window/buffer will
|
||||
-- not cause the aerial window to update.
|
||||
-- If open_automatic is true, focusing an ignored window/buffer will not
|
||||
-- cause an aerial window to open.
|
||||
-- If open_automatic is a function, ignore rules have no effect on aerial
|
||||
-- window opening behavior; it's entirely handled by the open_automatic
|
||||
-- function.
|
||||
-- Aerial will not open when these are focused, and existing aerial windows will not be updated
|
||||
ignore = {
|
||||
-- Ignore unlisted buffers. See :help buflisted
|
||||
unlisted_buffers = true,
|
||||
unlisted_buffers = false,
|
||||
|
||||
-- List of filetypes to ignore.
|
||||
filetypes = {},
|
||||
|
|
|
@ -230,9 +230,9 @@ M.close = function()
|
|||
else
|
||||
-- No aerial buffer for this buffer.
|
||||
local backend = backends.get(0)
|
||||
-- If this buffer has no supported symbols backend or no symbols,
|
||||
-- If this buffer has no supported symbols backend, or no symbols, or is ignored,
|
||||
-- look for other aerial windows and close the first
|
||||
if backend == nil or not data.has_symbols(0) then
|
||||
if backend == nil or not data.has_symbols(0) or util.is_ignored_win() then
|
||||
for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
if vim.api.nvim_win_is_valid(winid) then
|
||||
local winbuf = vim.api.nvim_win_get_buf(winid)
|
||||
|
@ -288,7 +288,7 @@ M.open = function(focus, direction, opts)
|
|||
opts = vim.tbl_extend("keep", opts or {}, {
|
||||
winid = nil,
|
||||
})
|
||||
if util.is_aerial_buffer(0) then
|
||||
if util.is_aerial_buffer(0) or util.is_ignored_win() then
|
||||
return
|
||||
end
|
||||
local bufnr, aer_bufnr = util.get_buffers()
|
||||
|
@ -299,6 +299,7 @@ M.open = function(focus, direction, opts)
|
|||
end
|
||||
return
|
||||
end
|
||||
|
||||
direction = direction or util.detect_split_direction()
|
||||
local aer_winid = create_aerial_window(bufnr, aer_bufnr, direction, opts.winid or aerial_win)
|
||||
local backend = backends.get(0)
|
||||
|
|
Loading…
Reference in a new issue