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:not working in lazy.nvim #62

Closed
xclidongbo opened this issue May 16, 2023 · 4 comments
Closed

Bug:not working in lazy.nvim #62

xclidongbo opened this issue May 16, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@xclidongbo
Copy link

  {
    "NvChad/nvim-colorizer.lua",
    config = function()
      require("colorizer").setup()
    end,
  },
@xclidongbo xclidongbo added the bug Something isn't working label May 16, 2023
@sscherfke
Copy link

For me it works this way:

 {
    "NvChad/nvim-colorizer.lua",
    -- event = "VeryLazy",  -- https://github.com/NvChad/nvim-colorizer.lua/issues/57
    -- event = { "BufReadPost", "BufNewFile" },
    opts = {
      user_default_options = {
        mode = "virtualtext",
        names = false,
      },
      filetypes = {
        "*",
        css = { names = true, css = true, css_fn = true },
      },
    },
  },

I have currently disabled event b/c of #57.

@louis-vinchon
Copy link

louis-vinchon commented Jul 9, 2023

@xclidongbo You should generally define the opts key even if it's empty ({}), some plugins like mini simply won't work without it.

You don't need to define config here, the default behavior of Lazy is to setup() the plugin. Some plugins also don't like being setup() without a table as argument setup({}).

Lazy documentation.

My working conf:

-- https://github.com/NvChad/nvim-colorizer.lua

local opts = {
  filetypes = {
    "*",

    -- Excluded filteypes.
    "!lazy", -- Commit hashes get highlighted sometimes.
  },
  user_default_options = {
    RGB = true, -- #RGB hex codes.
    RRGGBB = true, -- #RRGGBB hex codes.
    RRGGBBAA = true, -- #RRGGBBAA hex codes.
    AARRGGBB = true, -- 0xAARRGGBB hex codes.

    -- "Name" codes like Blue or blue. It is pretty annoying when you have maps with
    -- 'blue = color_hex': you get two previews, one for the key and one for the value.
    names = false, 

    rgb_fn = true, -- CSS rgb() and rgba() functions.
    hsl_fn = true, -- CSS hsl() and hsla() functions.
    css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB.
    css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn.
    tailwind = true,

    mode = "virtualtext",
    virtualtext = "",
  },
}

return {
  "NvChad/nvim-colorizer.lua",
  event = { "BufReadPost", "BufNewFile" },
  opts = opts,
}

@TiLopes
Copy link

TiLopes commented Aug 8, 2023

@louis-vinchon I'm currently using your config but it seems tailwind is not working as I get no colors higlighting.

My code:

const CondominioLayout: Component<{}> = () => {
  return (
    <div class="flex w-full flex-col self-stretch">
      <nav class="bg-blue-600 p-4 text-white">
        <ul class="flex items-center">
          <A href="perfil" class="mr-6 flex items-center gap-2">
            <i class="i-ph-user-fill"></i>
            Perfil
          </A>
          <li class="mx-6">ASDASASD</li>
          <li class="mx-6">ASDASASD</li>
          <li class="mx-6">ASDASASD</li>
          <li class="mx-6">ASDASASD</li>
          <li class="mx-6">ASDASASD</li>
          <li class="mx-6">ASDASASD</li>
        </ul>
      </nav>
      <main class="flex w-full self-stretch flex-grow">
        <Outlet />
      </main>
    </div>
  );
};

LspInfo (if that matters):
image

@Myzel394
Copy link

I'm facing the same issue as @TiLopes; did you find a solution?

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

6 participants