nvim-colorizer.lua icon indicating copy to clipboard operation
nvim-colorizer.lua copied to clipboard

Bug: Only activates on current buffer

Open Gazareth opened this issue 2 years ago • 3 comments

Describe the bug When I load up a previous session with multiple tabs/windows, only the first active buffer is colorised.

To Reproduce I use projections to load my sessions, however I imagine the same issue would occur with any sort of session manager.

Expected behavior All buffers should be colorised

Screenshots (See the split on the left is not colorised) image

Operating System: Windows 10

Neovim Version: v0.8.0

Gazareth avatar Dec 29 '22 20:12 Gazareth

I'm doing something like this. You can remove CursorMoved from the events table as it might be too much.

local group = vim.api.nvim_create_augroup('colorAttach', { clear = true })

local events = { 'BufEnter', 'BufWinEnter', 'CursorMoved' }
vim.api.nvim_create_autocmd(events, {
  pattern = { '*' },
  callback = function()
    vim.cmd([[
    if exists('g:colorizer')
      ColorizerAttachToBuffer
    ]])
  end,
  group = group,
})
```

LoneExile avatar Jan 06 '23 01:01 LoneExile

If this still an issue ? Give steps to reproduce

Akianonymus avatar Feb 26 '23 05:02 Akianonymus

I have the same problem, but it may be a different source to the same problem. Here is how to reproduce @Akianonymus

Install floaterm:

return {
  'voldikss/vim-floaterm',
  keys = {
    {
      '<Leader>x',
      function() vim.cmd('FloatermNew --title=ZSH --floaterm_autoclose=2 --width=0.7 --height=0.4') end,
      desc = 'ZSH shell',
    },
  },
}

Make a new lua file with the following:

return {
            rosewater = '#f5e0dc',
            flamingo  = '#f2cdcd',
            pink      = '#f5c2e7',
            mauve     = '#cba6f7',
            red       = '#f38ba8',
            maroon    = '#eba0ac',
            peach     = '#fab387',
            yellow    = '#f9e2af',
            green     = '#a6e3a1',
            teal      = '#94e2d5',
            sky       = '#89dceb',
            sapphire  = '#74c7ec',
            blue      = '#89b4fa',
            lavender  = '#b4befe',
}

Now activate floaterm over top with <Leader>x

Now type exit to close the floating window

Immediately all color highlights get lost, and the only way to get them back again is by closing the buffer entirely and re-opening.

I noticed trying to call Colorize Attach/togge/enable/disable... none of them work. the only way is a complete wipe and re-open

9mm avatar Sep 15 '23 01:09 9mm