Giter VIP home page Giter VIP logo

ccc.nvim's Introduction

ccc.nvim's People

Contributors

alan-kuan avatar chrisgrieser avatar delphinus avatar iagoleal avatar mariasolos avatar otommod avatar rcarriga avatar uga-rosa avatar xfo-0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ccc.nvim's Issues

`:CccPick` removes character in front of color & adds Alpha

Not a question

  • This is not a question. If you have a question, use discussions.

Description

:CccPick removes character in front of the color (tested it, it's not spaces, but any character). It also adds alpha by default now.

Both behaviors did not occur in the latest commit from a few days ago.

Environments

macOS 12.5.1 (M1)
neovim 0.8.0 (homebrew)

Minimal reproducible full config

The minimal.vim file does not work. I removed my entire nvim config, and placed nothing but the linked minimal.vim file in there. I also removed all plugins from ~/.local/share/nvim/site/pack/packer. Upon calling :CccPick it errors: E492: Not an editor command: CccPick.

So I tried this as minimal config:

opt.termguicolors = true
local ccc = require("ccc")
ccc.setup{}

Steps to reproduce

  1. use the minimal config from above
  2. use :CccPick

Expected behavior

using the picker should not remove preceding characters.

Actual behavior

using the picker removes the preceding character.

Additional context

After a bunch of trial and error, I could figure out that explicitly disabling LSP for highlighting (highlighter.lsp set to false) seems to fix this issue.

CccPick fails after session switching

Not a question

  • This is not a question. If you have a question, use discussions.

I investigated.

  • I have read README.md, help documentation, and searched past issues but no solution.

Description

I'm using plugin for session switching and i noticed after installing ccc.nvim that it fails after session loading.
It seems that the check that the buffer exists is missing.

Possible i can help to fix this issue.

Environments

Linux x86
NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3

Minimal reproducible full config

https://github.com/coffebar/dotfiles

Steps to reproduce

Open file with color, open color piker, switch session to other project, open other file with color, open color piker for it.

Expected behavior

Color piker always opens.

Actual behavior

Color picker works in first project, but on second it fails with this error:

Error executing Lua callback: ...m/site/pack/packer/start/ccc.nvim/lua/ccc/utils/init.lua:55: Invalid buffer id: 27
stack traceback:
        [C]: in function 'nvim_buf_set_option'
        ...m/site/pack/packer/start/ccc.nvim/lua/ccc/utils/init.lua:55: in function 'set_lines'
        ...hare/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/ui.lua:201: in function 'update'
        ...hare/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/ui.lua:136: in function 'open'
        ...hare/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:9: in function <...hare/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:8>

If reopen nvim on second project again - color picker works. But after switching to other project - it is broken again.

Additional context

No response

Cccpick can't be ran more than once?

Im almost certain I am doing something wrong.
I can open the floating window with :CccPick, however if I then :q, I cannot reopen :CccPick without restarting neovim. Below is a gif to show this in action. Note: <CR> does work, but forces an insert of whatever code I have up. If I don't want to insert anything, I would expect the :q behavior to work as expected.

cccpick-error

Im not sure what info would be helpful to you so here is what I could find for "useful" info (what I usually provide in bug reports)

Neovim Info

$ nvim --version
NVIM v0.8.0-dev-1060-g22a88c425
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/miversen/git/neovim/build/cmake.config -I/home/miversen/git/neovim/src -I/home/miversen/git/neovim/.deps/usr/include -I/usr/include -I/home/miversen/git/neovim/build/src/nvim/auto -I/home/miversen/git/neovim/build/include
Compiled by miversen@dev-miversen

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/neovim/share/nvim"

Run :checkhealth for more info

Plugin Info (currently pointing at origin/main HEAD)

$ git rev-parse HEAD
c4861169f26f642cb445dea819faf02f9e2a5ae1

Thoughts? Can I provide anything else useful for you? Am I doing something wrong?

Error when lazy-loading: a ttempt to index field 'ft_filter'

Still getting same error if I am using lazy-loading:

use  {
    "uga-rosa/ccc.nvim",
    config = function()
      require("ccc").setup()
    end,
    cmd = {
      "CccPick",
      "CccHighlighterEnable",
    },
  },
  • Error
E5108: Error executing lua ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:171: Vim(echomsg):E114: Missing quote: "Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:83: Vim:Error executing Lua callback: ...im/site/pack/packer/opt/ccc.nvim/lua/ccc/highlighter.lua:52: a
ttempt to index field 'ft_filter' (a nil value)
stack traceback:
        [C]: in function 'cmd'
        ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:171: in function <...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:167>
        [string ":lua"]:1: in main chunk

Originally posted by @Avimitin in #37 (comment)

disable highlight when visual selection touches color

Request for additional color space

No response

Request for other features

When selecting with visual mode, the highlighting can sometimes mess with the text color, making the highlighted text less readable. Like if the normal text color is white, ccc.nvim changes the text color to black if its a light color, but then visual mode keeps that dark text color.

Is there some way for a highlight for a specific color string to turn off when visual mode crosses over it?

FR: Alpha Slider

Request for additional color space

No response

Request for other features

Follow up to #60.

Right now, highlight.lsp = true results in adding the alpha even though the color under the cursor does not have alpha when using :CccPick.

An alpha-slider option like you suggested indeed sounds like a good solution to this:

It would be possible to add option alphaslider to make the display of the alpha slider configurable when the ui is opened. ("auto", "show", "hide").

[BUG] nvim_win_set_hl_ns is a nil value

When attempting to open the color picking menu with :CccPick it creates an error like below. After hitting enter it opens the menu normally but without color in the selection window.

image
image

The problem seems to originate here. The function obviously exist according to this.

I am using branch 0.7.2 of this plugin.

nvim --version

NVIM v0.7.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/x86_64-pc-linux-gnu-gcc -march=znver1 -mtune=znver1 -maes -fstack-protector -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/var/tmp/portage/app-editors/neovim-0.7.2/work/neovim-0.7.2_build/config -I/var/tmp/portage/app-editors/neovim-0.7.2/work/neovim-0.7.2/src -I/usr/include -I/var/tmp/portage/app-editors/neovim-0.7.2/work/neovim-0.7.2_build/src/nvim/auto -I/var/tmp/portage/app-editors/neovim-0.7.2/work/neovim-0.7.2_build/include
Compiled by portage@localhost

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "/etc/vim/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

uname -a

Linux Gentoo 5.18.1-gentoo-r2 #3 SMP PREEMPT_DYNAMIC Sat Jun 18 19:33:04 EDT 2022 x86_64 AMD Ryzen 7 1700 Eight-Core Processor AuthenticAMD GNU/Linux

I did not see any other issues that mentioned this. Thank you!

Support for terminal color escape codes

Request for additional color space

not sure whether it counts as a "color space", but there are the terminal color escape codes, which control the color of output on terminals (e.g. \u001b[34m for blue)

here is a good blogpost detailing how they work: https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html

As far as I can tell, there are multiple implementations (8 colors, 16 colors, 256 colors), though I think the 16 colors cover most use cases already. Color highlighting could take into account whether it's a foreground or a background escape code.

Having support for color escape codes would make work on shell scripts much more convenient

Request for other features

No response

color disappear and window become small when switching between HSL and HSLuv

I got another issue. When I set the inputs to be HSL and HSLuv and also set default_color, switching between mode will make the color disappear and ccc window become small, making the slider disappear, and when its reappear, it doesn't work anymore

Expected behavior

Color should be preserved and slider didn't disappear and still working

Actual behavior

Color disappear, window become smaller, slider doesn't work and is gone

Configuration

-- color picker
use {
  "uga-rosa/ccc.nvim",
  cmd = "CccPick",
  config = function()
    require("ccc").setup {
      default_color = "#40bfbf",
      inputs = {
        require("ccc.input.hsl"),
        require("ccc.input.hsluv"),
      },
    },
  end
}

Steps to reproduce

  1. Open ccc
  2. Switch between modes several times and the issue will appear

Attachments

ccc-hsl-hsluv-issue

Feature Request: "before" color

Original Discussion

I would suggest to move the discussion here, so we don't spam/bump the the reddit thread.

First of all thank you for your fast implementation!

Unfortunetely, after updating I run into some problems when using the plugin, even with the default settings.

First I get an error when triggering the command:

Error executing Lua callback: ...hare/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/ui.lua:69: attempt to call field 'nvim_win_set_hl_ns' (a nil value)                                                                                                   
stack traceback:                                                                                                                                                                                                                                         
        ...hare/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/ui.lua:69: in function '_open'                                                                                                                                                              
        ...hare/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/ui.lua:87: in function 'open'                                                                                                                                                               
        ...hare/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:9: in function <...hare/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:8>   

When I press enter after the error, the picker window opens (with the new before color tooo), but without any colors.

image

Info The color icons come from "NvChad/nvim-colorizer.lua"

CccPick and highlighter won't detect multiple hsl or multiple rgb colors in the same line

Not a question

  • This is not a question. If you have a question, use discussions.

I investigated.

  • I have read README.md, help documentation, and searched past issues but no solution.

Description

asciicast

Environments

fedora x86
neovim 0.8.3
packer.nvim - Total plugins: 10
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
• Comment.nvim
• ccc.nvim
• gruvbox.nvim
• indent-blankline.nvim
• lualine.nvim
• nvim-colorizer.lua
• nvim-treesitter
• nvim-web-devicons
• packer.nvim
• twilight.nvim

Minimal reproducible full config

did :PackerCompile with this config

-- PLUGINS --
return require("packer").startup(function(use)
  use "wbthomason/packer.nvim"
  use {
    "uga-rosa/ccc.nvim",
    config = function()
      require("ccc").setup()
    end
  }
end}

Steps to reproduce

insert multiple hsl or multiple rgb colors in the same line and enable highlighter

Expected behavior

detects and highlights colors

Actual behavior

only detects and highlights the first color

Additional context

No response

Error at startup: "attempt to index field 'ft_filter' (a nil value)"

Not a question

  • This is not a question. If you have a question, use discussions.

Description

When starting up neovim I get this error message:

Error detected while processing BufEnter Autocommands for "*":
Error executing lua callback: .../site/pack/packer/start/ccc.nvim/lua/ccc/highlighter.lua:52: attempt to index field 'ft_filter' (a nil value)
stack traceback:
  .../site/pack/packer/start/ccc.nvim/lua/ccc/highlighter.lua:52: in function 'enable'
  .../site/pack/packer/start/ccc.nvim/lua/ccc/config/init.lua:58: in function <.../site/pack/packer/start/ccc.nvim/lua/ccc/config/init.lua:52>

Environments

  • OS:
    Gentoo Linux ~amd64

  • Neovim version:
    NVIM v0.9.0-dev-26-g06f4edc
    Build type: RelWithDebInfo
    LuaJIT 2.1.0-beta3

Minimal reproducible full config

     use({
      'uga-rosa/ccc.nvim',
      config = function()
        require('ccc').setup({
          highlighter = {
            auto_enable = true
          }
        })
        vim.keymap.set('n', ',ct', vim.cmd.CccHighlighterToggle)
        vim.keymap.set('n', ',cp', vim.cmd.CccPick)
      end
    })

Steps to reproduce

Just start neovim with nvim and the error pops up.

My full config is here just in case ...

Expected behavior

No error.

Actual behavior

Error detected while processing BufEnter Autocommands for "*":
Error executing lua callback: .../site/pack/packer/start/ccc.nvim/lua/ccc/highlighter.lua:52: attempt to index field 'ft_filter' (a nil value)
stack traceback:
  .../site/pack/packer/start/ccc.nvim/lua/ccc/highlighter.lua:52: in function 'enable'
  .../site/pack/packer/start/ccc.nvim/lua/ccc/config/init.lua:58: in function <.../site/pack/packer/start/ccc.nvim/lua/ccc/config/init.lua:52>

Additional context

No response

Treesitter fails when CCC is lazyloaded

Not a question

  • This is not a question. If you have a question, use discussions.

Description

Whenever I have CCC lazyloaded, Treesitter does not apply. Highlighting, indenting, nothing works.

Environments

NixOS Unstable 22.11
Neovim Nightly 0.9.0

Minimal reproducible full config

Manually place nvim-treesitter in the Start folder and ccc.nvim in the Opt folder in the packpath

local configs = require("nvim-treesitter.configs")
configs.setup {
	highlight = {
		enable = true,
		additional_vim_regex_highlighting = false,
	}
}

local onFileOpen = function()
	vim.api.nvim_exec(
		[[
			packadd ccc-nvim
		]],
		true
	)	
	local ccc = require("ccc")
	ccc.setup {
		highlighter = {
			enable = true
		}
	}
end
vim.api.nvim_create_autocmd(
	{"BufRead","BufNewFile"},
	{
		callback = onFileOpen
	}
)

Steps to reproduce

  1. Open an existing file that would normally be highlighted with Neovim

Expected behavior

Treesitter works as usual, with all the normal features, such as highlighting.

Actual behavior

Treesitter fails to load. It throws no error messages, but it does nothing.

Additional context

No response

The very first buffer does not get auto highlighted

Not a question

  • This is not a question. If you have a question, use discussions.

Description

Even with highlighters.auto_enable set to true, the very first buffer (the one with the file given in the command line) does not get highlighted. I'm guessing the BufEnter event does not fire or it has already fired by the time require("ccc").setup runs

Environments

Arch Linux
NVIM v0.8.0

Minimal reproducible full config

set termguicolors

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/autoload/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'uga-rosa/ccc.nvim'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

lua <<EOF
local ccc = require("ccc")
local mapping = ccc.mapping

ccc.setup({
    highlighter = {auto_enable = true}
})

require("lspconfig").cssls.setup({})
EOF

Steps to reproduce

Suppose you have a file foo.css, full of CSS colors. Anything will do, say:

html {
  color: #ffffff
}

Try to edit the file,

nvim foo.css

Expected behavior

The colors in foo.css get highlighted

Actual behavior

The colors do not get highlighted

Additional context

No response

No such group: "ccc-on-close"

Not a question

  • This is not a question. If you have a question, use discussions.

Description

image

Environments

Minimal reproducible full config

Steps to reproduce

:CccPick
press <cr>

Expected behavior

Should not error

Actual behavior

Is throwing error

Additional context

Getting highlighter.lua:118: Invalid buffer id: 1 when opening any file

Not a question

  • This is not a question. If you have a question, use discussions.

Description

I just updated ccc.nvim from the main branch and now I'm getting this error whenever I open any file

image

Environments

OS:
macOS 12.6 21G115 arm64
neovim:
NVIM v0.9.0-dev-1214-ge54541f7f-dirty
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Minimal reproducible full config

not sure how to replicate it or what is causing it, i'm using https://github.com/LunarVim/LunarVim and this is my config file https://github.com/Almo7aya/dotfiles/blob/master/.config/lvim/config.lua#L160

Steps to reproduce

opening any file using :e [filename] or by telescope

Expected behavior

works fine without any errors

Actual behavior

getting: Error executing vim.schedule lua callback: .../site/pack/packer/start/ccc.nvim/lua/ccc/hig
hlighter.lua:118: Invalid buffer id: 1

and it does not go away until I press enter 7 or 8 times

Additional context

No response

[Feature] Add support for RGB format with alpha channel

Request for additional color space

It would be nice to have support for RGBA format (for both the picker and the highlighting). It's literally just RGB with alpha channel, often represented either as #RRGGBBAA (described in CSS Color Module Level 4) or an int value 0xRRGGBBAA.

Note that some applications use sRGB so the int would be 0xAARRGGBB. I don't know how we can distinguish both forms in a buffer without LSP when the user invoke the picker though.

Request for other features

No response

[Feature Suggestion] Add a picker to colorize static entries

I wrote a picker (link) to colorize any string with setting a table in setup().

require("ccc").setup {
  picker = {
    require "ccc.picker.rgb",
    require "core.utils.ccc" {
      red = "#BF616A",
      green = "#A3BE8C",
      blue = "#81A1C1",

      ……

    }
  },
}

スクリーンショット 2023-02-26 19 18 46

Can you merge this feature when I issue it as a PR?

Plugin rgb2hex call error produced by invalid CSS rgb() rgba() syntax

Not a question

  • This is not a question. If you have a question, use discussions.

I investigated.

  • I have read README.md, help documentation, and searched past issues but no solution.

Description

Syntax errors in CSS rgb and rgba function parameters trigger plugin module error.

Screenshot-2023-01-22_01-16-26_1006x558

Environments

Arch Linux, Linux 6.1.6-arch1-3
NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Minimal reproducible full config

set termguicolors

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/autoload/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'uga-rosa/ccc.nvim'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

lua <<EOF
local ccc = require("ccc")
local mapping = ccc.mapping

ccc.setup({
    -- Minimal configurations required to reproduce the problem.
    highlighter = { auto_enable = true }
})

require("lspconfig").cssls.setup({})
EOF

Steps to reproduce

Create CSS file using rgb() or rgba() CSS functions.

In insert mode add additional excess comma , between the function parameters:

.App-header {
  background: rgba(0,,0,0,0);
}

Continue typing in insert mode.
Or save and open a file with this CSS syntax error.

Expected behavior

No module errors triggered.

Actual behavior

Error message:

Error executing vim.schedule lua callback: /tmp/plugged/vim-plug/ccc.nvim/lua/ccc/highlighter.lua:156: bad argument #3 to 'rgb2hex' (number expected, got nil)
stack traceback:
        [C]: in function 'rgb2hex'
        /tmp/plugged/vim-plug/ccc.nvim/lua/ccc/highlighter.lua:156: in function '_get_or_create_hl'
        /tmp/plugged/vim-plug/ccc.nvim/lua/ccc/highlighter.lua:252: in function 'update_picker'
        /tmp/plugged/vim-plug/ccc.nvim/lua/ccc/highlighter.lua:148: in function </tmp/plugged/vim-plug/ccc.nvim/lua/ccc/highlighter.lua:146>
Press ENTER or type command to continue

On typing in insert mode. On file load.

Additional context

No response

floating window border randomly changes when sliding colors

Hi uga-rossa, thanks for this lovely color picker plugin! Unfortunately though, I encounter an odd issue. Whenever I'm moving my slider, the border color of the floating window suddenly changes. I've provided the steps here that atleast always consistently result in the same behavior on my machine, also a GIF

Expected behavior

the window border color shouldn't change

Actual behavior

Window border color changes randomly in some occasion

Configuration

-- color picker
use {
  "uga-rosa/ccc.nvim",
  cmd = "CccPick"
}

Steps to reproduce

  1. Open ccc window and use RGB as input
  2. Move the Red slider to the right end, then do the same for Green and Blue
  3. When finally sliding in Blue, the border color changes itself

Attachments

ccc-border-color

Filetype for the pick window

Would be nice to add a filetype for the pick window, that are useful for customization.

On my case I did create a plugin with common ignored files for certain plugins: ignored_files.vim. One feature is to disable indent plugins for a list of filetypes.

So now the pick window shows like this:

image

With filetype support would be like this:

image

The very first buffer does not get auto highlighted

Not a question

  • This is not a question. If you have a question, use discussions.

Description

Even with highlighters.auto_enable set to true, the very first buffer (the one with the file given in the command line) does not get highlighted. I'm guessing the BufEnter event does not fire or it has already fired by the time require("ccc").setup runs

Environments

Arch Linux
NVIM v0.8.0

Minimal reproducible full config

set termguicolors

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/autoload/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'uga-rosa/ccc.nvim'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

lua <<EOF
local ccc = require("ccc")
local mapping = ccc.mapping

ccc.setup({
    highlighter = {auto_enable = true}
})

require("lspconfig").cssls.setup({})
EOF

Steps to reproduce

Suppose you have a file foo.css, full of CSS colors. Anything will do, say:

html {
  color: #ffffff
}

Try to edit the file,

nvim foo.css

Expected behavior

The colors in foo.css get highlighted

Actual behavior

The colors do not get highlighted

Additional context

No response

Option to keep the color format when using `:CccPick`

Request for additional color space

No response

Request for other features

It would be useful there was an option for :CccPick to automatically preserve the color format under the cursor. So if I trigger the picker while my cursor is on a hex-formatted color, the output should switch to hex, if I trigger it on a hsl-formatted color, the output should switch to hsl automatically.

This would be very useful when you regularly work with different color formats.

(I am unsure whether this is maybe already possible with the plugin? At least I didn't figure out how to do this after reading the full docs.)

Close picker window on picker buffer leave

Request for additional color space

No response

Request for other features

It's more comfortable, at least with some configuration like autoclose or something like that, it could also be nice to add to the default mappings to close the window with <esc>.

Bug: Last commit breaks `:CccPick`

Not a question

  • This is not a question. If you have a question, use discussions.

I investigated.

  • I have read README.md, help documentation, and searched past issues but no solution.

Description

:CccPick does not work anymore

Environments

macOS 13.2.1 (M1)
neovim 0.8.3 (homebrew)
Neovide 0.10.3 (homebrew)

Minimal reproducible full config

I used the provided minimal.vim with no config changes.

:CccHighlightEnable etc. works, :CccPick does not.

Steps to reproduce

  • use the latest commit 4869fb3
  • run :CccPick

Expected behavior

the color picker should work

Actual behavior

every time I run :CccPick, I get this, regardless of the config. Whether I use minimal.vim or my own config, the result is the same.

CleanShot 2023-03-12 at 12 14 01

Additional context

With the previous commit d17dabd, everything works.

`CccHighlighterToggle` and CccHighlighterEnable` doesn't work when set auto auto_enable filetypes

Not a question

  • This is not a question. If you have a question, use discussions.

I investigated.

  • I have read README.md, help documentation, and searched past issues but no solution.

Description

I found that when I set the auto_enable option and filetypes, then the CccHighlighterToggle command will not work anymore
this is my configuration for that:

 return { "uga-rosa/ccc.nvim",
    cmd = {
        'CccHighlighterToggle',
        "CccPick",
        "CccConvert",
    },
    ft = { 'css', 'html' },
    config = function(plugin)
        local ccc = require("ccc")
        local mapping = ccc.mapping
        ccc.setup {
            highlighter = {
                auto_enable = true,
                filetypes = plugin.ft,
            },
            mappings = {
                j = mapping.decrease1,
                h = mapping.toggle_input_mode,
                i = 'k',
            }
        }
    end,
}

it will auto-enable when I open a new HTML and CSS file, but in a Lua file , I try to use CccHighlighterEnable, it doesn't work

CccPicker is still working...

so I have to change my configuration for that now, for example:

return {
    "uga-rosa/ccc.nvim",
    cmd = {
        'CccHighlighterToggle',
        "CccPick",
        "CccConvert",
    },
    ft = { 'css', 'html' },
    config = function(plugin)
        local ccc = require("ccc")
        local mapping = ccc.mapping
        ccc.setup {
            mappings = {
                j = mapping.decrease1,
                h = mapping.toggle_input_mode,
                i = 'k',
            }
        }
      vim.api.nvim_create_autocmd('Filetype', {
       patten = plugin.ft,
       command = 'CccHighlighterEnable'
})
    end,
}

Environments

Ubuntu22.04LTS, kitty latest version

Minimal reproducible full config

just as the description saying

Steps to reproduce

set auto_enable filetypes then try to use the CccHighlighterEnable command

Expected behavior

The CccHighlighterEnable command should add highlights in the current buffer

Actual behavior

nothing is changed

Additional context

nop

[Question] Excluding short hex from highlighting

Hi @uga-rosa,

Sorry for the question but having searched through similar issues, most closely related of which is #14. I couldn't/cannot get this plugin to stop highlighting any numbers preceded by a # e.g. #236 for example which could be a PR or issue number on GH and not a hex color. In general I don't want it highlight any hex colors that aren't >= 6.

I tried using the exclude_pattern option mentioned in that issue (it's undocumented btw, just mentioning so you're aware) for example:

        hex = {
          '%s#%x%x%x%s+',
          '[%w_]#%x%x%x',
          '[%w_]#%x%x%x%x%x%x',
        },

but the following text in a lua file with the highlighter enable still highlights -- partial fix for #391 the #391 is still highlighted unfortunately.

I'm pretty sure that lua pattern works as I've tested that it would match the pattern but it doesn't stop the highlighting.

Normal float colour is altered in floating windows

Hi 👋🏿,

Just been trying this plugin out as an alternative to colorizer and it seems really cool so far. One strange issue I've noticed though is that the colour of my lsp floating window and of CccNormalFloat itself are different from what I set as my NormalFloat e.g.

With ccc.nvim installed, notice the border is dark, but the background of the text is not.
image
My normal float colour however is unchanged.

Without ccc.nvim I get which is expected.
image

The CccPick window itself also seems to ignore my settings for NormalFloat and even setting CccFloatNormal makes no difference
image

I'm not sure how highlights are being applied, e.g. using namespaces, but it seems to be leaking into other areas somehow.

My ccc config is:

use({
      'uga-rosa/ccc.nvim',
      config = function()
        local ccc = require('ccc')
        ccc.setup({
          pickers = {
            ccc.picker.hex,
            ccc.picker.css_rgb,
            ccc.picker.css_hsl,
          },
          win_opts = { border = as.style.current.border }, -- var representing some custom border chars
          highlighter = {
            auto_enable = true,
            excludes = { 'dart' },
          },
        })
      end,
    })

Cannot use ccc.nvim WSL2 0.2.1 | neovim 0.9.0-dev | Ubuntu 20.04

Not a question

  • This is not a question. If you have a question, use discussions.

Description

When i try to :CccPick it returns this:

image

Don't know what to do.

Environments

Windows 11 using Wsl2 with Ubuntu 20.04

Minimal reproducible full config

Could not make it work using minimal config provide in example

Steps to reproduce

Enter command mode and using CccPick

Expected behavior

Open ColorPick

Actual behavior

Gives an error

Additional context

No response

Error after lates update (0.7.2)

After update today get an error in 0.7.2 branch:

Error detected while processing /home/dmytro/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...re/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/init.lua:2: module 'ccc.highlighter' not found:
        no field package.preload['ccc.highlighter']
        no file './ccc/highlighter.lua'
        no file '/usr/share/luajit-2.1.0-beta3/ccc/highlighter.lua'
        no file '/usr/local/share/lua/5.1/ccc/highlighter.lua'
        no file '/usr/local/share/lua/5.1/ccc/highlighter/init.lua'
        no file '/usr/share/lua/5.1/ccc/highlighter.lua'
        no file '/usr/share/lua/5.1/ccc/highlighter/init.lua'
        no file './ccc/highlighter.so'
        no file '/usr/local/lib/lua/5.1/ccc/highlighter.so'
        no file '/usr/lib64/lua/5.1/ccc/highlighter.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './ccc.so'
        no file '/usr/local/lib/lua/5.1/ccc.so'
        no file '/usr/lib64/lua/5.1/ccc.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        ...re/nvim/site/pack/packer/start/ccc.nvim/lua/ccc/init.lua:2: in main chunk
        [C]: in function 'require'
        /home/dmytro/.config/nvim/lua/user/ccc.lua:1: in main chunk
        [C]: in function 'require'
        /home/dmytro/.config/nvim/init.lua:23: in main chunk
Error detected while processing /home/dmytro/.local/share/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:
E5113: Error while calling lua chunk: ...hare/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:6: loop or previous error loading module 'ccc'
stack traceback:
        [C]: in function 'require'
        ...hare/nvim/site/pack/packer/start/ccc.nvim/plugin/ccc.lua:6: in main chunk

Packer: use {'uga-rosa/ccc.nvim', branch = '0.7.2'} with default settings
Nvim: 0.7.2, Fedora 36

Yesterday it works good, the problem appear after update today.
If return to main branch, plugin doesn't work

[Feature] HSV support

Really interesting plugin, great work!


I frequently tend to prefer HSV over HSL when tweaking colors, as - opposed to the Lightness component in HSL - the Value component of HSV better preserves chroma. Would you be willing to support the HSV color model in your plugin?

HSL-v-HSV

Image source: Wikipedia - HSL and HSV

Doesn't work with lazy loading

given this:

    event = "BufRead",
    config = 'require "plugin.ccc"',

with doesn't work I mean the highlighter, config:

  highlighter = {
    auto_enable = true,
  },

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.