folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.12k stars 172 forks source link

bug v3: Can't turn off cc in trouble windows #414

Closed simonmandlik closed 2 months ago

simonmandlik commented 2 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0-dev-2274+g1d5f86f69-Homebrew

Operating system/version

MacOS 14.4.1

Describe the bug

I can't turn off colorcolumn with autocommand, see the repro.lua.

This worked with previous version.

Steps To Reproduce

  1. nvim -u repro.lua
  2. :Trouble diagnostics

Expected Behavior

Colorcolumn in trouble window shouldn't be displayed, but it is:

https://github.com/folke/trouble.nvim/assets/16707112/5face428-d8e2-4be6-8948-cc4dcc22a5aa

It can be only turned off manually with

:setlocal cc=

Repro

-- 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", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
      "folke/trouble.nvim",
      branch = "dev",
      opts = {}
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

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

vim.opt.colorcolumn = { 10, 11, 12, 13, 14, 15 }

vim.api.nvim_create_autocmd( "FileType", {
    pattern = "trouble",
    callback = function()
        vim.opt_local.colorcolumn = ""
    end
})
folke commented 2 months ago

opts.win.wo.colorcoumn = ''

simonmandlik commented 2 months ago

Thanks!