jinh0 / eyeliner.nvim

👀 Move faster with unique f/F indicators.
441 stars 14 forks source link

bug: highlighting does not work correctly #26

Closed hnbnh closed 1 year ago

hnbnh commented 1 year ago

Describe the bug

image The letter u is highlighted incorrectly

Expected behavior

The letter u in July should be highlighted instead of young

Neovim version

v0.8.2

Configuration (with lazy.nvim)

  {
    "jinh0/eyeliner.nvim",
    event = "VeryLazy",
    config = function()
      require("eyeliner").setup({
        highlight_on_key = true, -- show highlights only after keypress
        dim = true, -- dim all other characters if set to true (recommended!)
      })
    end,
  },
jinh0 commented 1 year ago

Huh, that's weird, I just tried your configuration and it gave me the correct highlighting.

I'd guess it's one of two things:

hnbnh commented 1 year ago

You was right, the highlighted colors was the same

EyelinerPrimary xxx cterm= gui= guifg=#ffa066
EyelinerSecondary xxx cterm= gui= guifg=#ffa066

Unfortunately I still have incorrect colors after updating the highlight groups

image

Here is a minimal init.lua:

local lazypath = vim.fn.stdpath("data") .. "/lazy/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 })
    vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
end
vim.opt.rtp:prepend(lazypath)

local plugins = {
    {
        "rebelot/kanagawa.nvim",
        lazy = false,
        config = function()
            require("kanagawa").setup()
            vim.cmd.colorscheme("kanagawa")
        end,
    },
    {
        "jinh0/eyeliner.nvim",
        event = "VeryLazy",
        commit = "02f59335bbab955de33f93d2e8c53417a06cfc2f",
        config = function()
            vim.api.nvim_set_hl(0, "EyelinerPrimary", { fg = "red", bold = true, underline = true })
            vim.api.nvim_set_hl(0, "EyelinerSecondary", { fg = "orange", underline = true })
            require("eyeliner").setup({
                highlight_on_key = true, -- show highlights only after keypress
                dim = true, -- dim all other characters if set to true (recommended!)
            })
        end,
    },
}

require("lazy").setup(plugins, {
    defaults = { lazy = true, version = nil },
    checker = { enabled = false },
})
jinh0 commented 1 year ago

That seems to be the right highlighting to me: the u and c are yellow since there's already a u and c in the sentence before it.

Could you explain what is incorrect?

hnbnh commented 1 year ago

I thought it would behave the same as the demo:

image

Maybe the algorithm has been updated or something?

jinh0 commented 1 year ago

Yeah, I updated the algorithm. Technically the demo on the README has a bug since the "n" in "On" shouldn't be highlighted (you're already on the word). The highlight groups are correct in your screenshot.

Thanks for letting me know that the README video is outdated, I'll update it soon!