Lazyvim change cursor color in insert mode

Trying to setup lazyvim as a pager, any ideas how to change the cursor colour in normal & insert modes? I found:

But cannot work out how to install. Spot the emacs user :rofl:

@xircon I approached this question with almost zero experience.
Create or add to
~/.config/nvim/lua/plugins/user.lua

    return {
      {
        	"mvllow/modes.nvim",
            tag = 'v0.2.1',
            config = function()
            require('modes').setup()
            end    
       },
    }

Start nvim and l(ima) C goto line modes.nvim, Install, C again
You should see the plugin among the Loaded ones.
Modify color codes to test it

1 Like

At work will have a go at home.

return {
  "mvllow/modes.nvim",
  event = "VeryLazy",
  opts = {
    colors = {
      bg = "", -- fallback to Normal highlight group
      copy = "#f5c359",
      delete = "#c75c6a",
      insert = "#78ccc5",
      visual = "#9745be",
    },
    line_opacity = 0.15,
    set_cursor = true,
    set_cursorline = true,
    set_number = true,
    set_signcolumn = true,
    ignore = { "NvimTree", "TelescopePrompt", "!minifiles" },
  },
}

Nope, doesn’t work. I think it may be the terminal (ghostty).

I’ve just tested this in Kitty, Alacritty, and Ghostty, and it works in all of them.
For reference, I’m not using the LazyVim configuration.

I just installed lazyvim.

nano $HOME/.config/nvim/lua/plugins/modes.lua
return {
  "mvllow/modes.nvim",
  event = "VeryLazy",
  opts = {
    colors = {
      bg = "", -- fallback to Normal highlight group
      copy = "#f5c359",
      delete = "#c75c6a",
      insert = "#78ccc5",
      visual = "#9745be",
    },
    line_opacity = 0.15,
    set_cursor = true,
    set_cursorline = true,
    set_number = true,
    set_signcolumn = true,
    ignore = { "NvimTree", "TelescopePrompt", "!minifiles" },
  },
}

I just tested in lazyvim.
It will work now.

@xircon
I’m still learning LazyVim and suggest watching [typecraft_dev video] from min. 8 (https://www.youtube.com/watch?v=bbHtl0Pxzj8)

my user.lua
return {
  {
    	"mvllow/modes.nvim",
        tag = 'v0.2.1',
        config = function()
        require('modes').setup()
        end    
   },
   
   {
        "stevearc/oil.nvim",
        -- Optional dependencies
        dependencies = { "nvim-tree/nvim-web-devicons" },
        config = function()
          require("oil").setup({})
          vim.keymap.set("n", "-", require("oil").open, { desc = "Open parent directory" })
        end,
    },
    
    {
		"lewis6991/gitsigns.nvim",
		config = function()	
		  require("gitsigns").setup()
		end
    },
}

and modes.lua modification at line 108

|--||insert = config.colors.insert or utils.get_bg('ModesInsert', '#78ccc5'),|
|---|---|---|
|||insert = config.colors.insert or utils.get_bg('ModesInsert', '#00ff00'),|

makes insert mode light green

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.