mawkler / modicator.nvim

Cursor line number mode indicator plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not respect new colorscheme if not lazy-loaded

gregorias opened this issue · comments

The issue

The plugin doesn't work if it's not lazy-loaded. It doesn't start with a bold cursorline number, doesn't change colors. It looks like this:

Normal mode (the color should be different and the number should be bold)

immediately after start

Insert mode (the color should be green):

image

Visual mode (the color should be purple):

image

Reproduction

  1. Use the init.lua below
vim.o.cursorline = true
vim.o.number = true
vim.o.termguicolors = true

-- | Fetches Lazy if not present.
local function bootstrap_lazy()
  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",
      "--branch=stable",
      lazypath,
    })
  end
  vim.opt.rtp:prepend(lazypath)
end
bootstrap_lazy()

require("lazy").setup({
  {
    "folke/tokyonight.nvim",
  },
  {
    "hoob3rt/lualine.nvim",
    opts = {},
  },
  {
    "mawkler/modicator.nvim",
    dependencies = { "folke/tokyonight.nvim" },
    opts = {
      highlights = {
        defaults = { bold = true },
      },
    },
  },
})
vim.cmd("colorscheme tokyonight")
  1. Run nvim (possibly twice to let Lazy load its plugins)

Additional comments

The colors work fine if I load the plugin on "VeryLazy", BUT the number not being bold on initial load still remains.

@gregorias It seems like the problem is that you set the colorscheme after loading all plugins (including modicator.nvim). I changed your config like this, which works for me:

require("lazy").setup({
  {
    "folke/tokyonight.nvim",
    config = function()
      vim.cmd.colorscheme("tokyonight")
    end,
  },
  {
    "hoob3rt/lualine.nvim",
    opts = {},
  },
  {
    "mawkler/modicator.nvim",
    dependencies = { "folke/tokyonight.nvim" },
    opts = {
      highlights = {
        defaults = { bold = true },
      },
    },
  },
})

I'll close this issue, but please let me know if you have any more issues 🙂

This doesn't work for me.

  1. The lack of boldness still remains.
  2. I don't think it's reasonable to require colorscheme being loaded during plugin load. It makes the plugin unusable for me, for example, because I have a script that changes my colorscheme during run time depending on whether I'm in light or dark mode.

@gregoriasI'm refactoring the lualine integration, and I think I've solved both these issues. Please try the branch lualine-refactor, which if you're using lazy.nvim can be done like so, followed by a :Lazy update:

{
  'mawkler/modicator.nvim',
  branch = 'lualine-refactor', -- <---
  init = function()
    vim.o.cursorline = true
    vim.o.number = true
    vim.o.termguicolors = true
  end,
  opts = {}
},

Does that solve your issue?

Yep, works splendidly.