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: Opening aerial automatically from a autocmd messes highlighs of colorscheme #390

Open
vizcay opened this issue Jul 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vizcay
Copy link

vizcay commented Jul 16, 2024

Neovim version (nvim -v)

0.9.5

Operating system/version

Macos 14.5

Output of :AerialInfo

Aerial Info

Filetype: markdown
Configured backends:
treesitter (not supported) [No treesitter parser for markdown]
lsp (not supported) [No LSP client found that supports symbols]
markdown (supported) (attached)
asciidoc (not supported) [Filetype is not asciidoc]
man (not supported) [Filetype is not man]
Show symbols: Class, Constructor, Enum, Function, Interface, Module, Method, Struct

Describe the bug

I want Aerial to open automatically when I open a markdown file. But doing so messes the highlights of the colorscheme (maybe some interaction with treesiter?)

What is the severity of this bug?

tolerable (can work around it)

Steps To Reproduce

This is the lazy loading config:

return {
  'stevearc/aerial.nvim',
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "nvim-tree/nvim-web-devicons"
  },
  config = function()
    require('aerial').setup({
      on_attach = function(bufnr)
        vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ua', '<cmd>AerialToggle!<CR>', {})
        vim.api.nvim_buf_set_keymap(bufnr, 'n', '[o', '<cmd>AerialPrev<CR>', {})
        vim.api.nvim_buf_set_keymap(bufnr, 'n', ']o', '<cmd>AerialNext<CR>', {})
      end
    })
    vim.api.nvim_create_augroup("OpenAerialMarkdown", { clear = true })
    vim.api.nvim_create_autocmd("FileType", {
      pattern = "markdown",
      command = "AerialOpen",
      group = "OpenAerialMarkdown",
    })
  end
}

If I just do

return {
  'stevearc/aerial.nvim',
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "nvim-tree/nvim-web-devicons"
  },
  config = function()
    require('aerial').setup({
      on_attach = function(bufnr)
        vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ua', '<cmd>AerialToggle!<CR>', {})
        vim.api.nvim_buf_set_keymap(bufnr, 'n', '[o', '<cmd>AerialPrev<CR>', {})
        vim.api.nvim_buf_set_keymap(bufnr, 'n', ']o', '<cmd>AerialNext<CR>', {})
      end
    })
  end
}

and open it manually, the highlights work great.

Expected Behavior

Highlights not to be messed. Happens with all colorschemes.

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

@vizcay vizcay added the bug Something isn't working label Jul 16, 2024
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

1 participant