Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: open_automatic = true and attach_mode = 'global' creates #204

Closed
kevmuko opened this issue Jan 6, 2023 · 2 comments
Closed

bug: open_automatic = true and attach_mode = 'global' creates #204

kevmuko opened this issue Jan 6, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@kevmuko
Copy link
Contributor

kevmuko commented Jan 6, 2023

Neovim version (nvim -v)

0.8.1

Operating system/version

Win11

Output of :AerialInfo

Aerial Info

Filetype: lua
Configured backends:
lsp (supported) (attached)
treesitter (supported)
markdown (not supported) [Filetype is not markdown]
man (not supported) [Filetype is not man]
Show symbols: Array, Boolean, Class, Constant, Constructor, Enum, EnumMember, Event, Field, File, Function, Interface, Key, Method, Module, Namespace, Null, Number, Object, Operator, Package, Property, String, Struct, TypeParameter, Variable

Describe the bug

open_automatic = true and attach_mode = global seems to open an additional view when opening help windows (:help <...>) when a view is already open.

Steps To Reproduce

  1. Run any :help command

Expected Behavior

I think we'd expect to see the existing window to just update instead of opening another instance of aerial.

Minimal example file

No response

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/aerial.nvim",
    config = function()
      require("aerial").setup({
        -- add your aerial config here
      })
    end,
  },
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter.configs").setup({
        ensure_installed = { "c", "lua" },
        auto_install = true,
        highlight = { enable = true },
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

@kevmuko kevmuko added the bug Something isn't working label Jan 6, 2023
stevearc added a commit that referenced this issue Jan 6, 2023
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.
@stevearc
Copy link
Owner

stevearc commented Jan 6, 2023

This required a fairly significant change in how the "ignore" config option works, but though the behavior had to change, I think it should now produce more consistent results. I was never quite able to reproduce your issue with open_automatic, but the issue should be fixed now.

@kevmuko
Copy link
Contributor Author

kevmuko commented Jan 6, 2023

Seems like it works! Thanks for the fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants