Skip to content

Fix: add mini.icons compatibility to monokai-pro ristretto Neovim theme#403

Closed
scossar wants to merge 1 commit into
basecamp:masterfrom
scossar:fix-monokai-mini-icons
Closed

Fix: add mini.icons compatibility to monokai-pro ristretto Neovim theme#403
scossar wants to merge 1 commit into
basecamp:masterfrom
scossar:fix-monokai-mini-icons

Conversation

@scossar
Copy link
Copy Markdown
Contributor

@scossar scossar commented Jul 29, 2025

Without this change, launching Neovim on my computer with the Omarchy Ristretto theme enabled returns Invalid highlight name errors. The issue is that the gthelding/monokai-pro.nvim color scheme doesn't have support for the MiniIcon highlight groups. Possibly a PR could be made to that repo to add mini.icons support, but it can also be added with the color scheme's override function as is done in this PR.

For context, most, hopefully all other Neovim color schemes used by Omarchy have explicit support for the MiniIcons highlight groups.

@dhh
Copy link
Copy Markdown
Member

dhh commented Jul 29, 2025

cc @gthelding

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 29, 2025

On the off-chance that it's related to the issue, I'm using Ghostty as the terminal and generally launching Neovim directly from the terminal.

@gthelding
Copy link
Copy Markdown
Contributor

I'm not seeing any errors with or without this change using ghostty or alacrtty. I don't object to adding this if you need it, but I'm trying to understand the error. Can you add a screenshot showing the error?

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 29, 2025

Yeah, I was wondering why you were't getting the error:

screenshot-2025-07-29_13-25-23

I'd expect mini.icons to have a better fallback than that. It's possible something's messed up on my system. The only think I'm doing that seems a bit off is adding the following to the end of ~/.config/nvim/config/lazy.lua:

-- Setup python virtual env for neovim
vim.g.python3_host_prog = vim.fn.expand("~/.local/share/nvim/venv/bin/python")

Here's a more complete stacktrace:

Error detected while processing /home/scossar/.config/nvim/init.lua:
Could not load your colorscheme

...ocal/share/nvim/lazy/LazyVim/lua/lazyvim/config/init.lua:253: /home/scossar/.config/nvim/init.lua..ColorScheme
s.lua:559: Invalid highlight name: 'MiniIconsGrey' lua callback: ...ssar/.local/share/nvim/lazy/mini.nvim/lua/min
stack traceback:
        [C]: in function 'get_hl_data'
        ...ssar/.local/share/nvim/lazy/mini.nvim/lua/mini/icons.lua:559: in function 'get_hex'
        ...ssar/.local/share/nvim/lazy/mini.nvim/lua/mini/icons.lua:565: in function 'get_icon_color'
        .../lazy/monokai-pro.nvim/lua/monokai-pro/util/devicons.lua:13: in function 'get'
        .../nvim/lazy/monokai-pro.nvim/lua/monokai-pro/autocmds.lua:19: in function <.../nvim/lazy/monokai-pro.nv
        [C]: in function 'colorscheme'
        ...ocal/share/nvim/lazy/LazyVim/lua/lazyvim/config/init.lua:253: in function <...ocal/share/nvim/lazy/Laz
        [C]: in function 'xpcall'249>
        .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:135: in function 'try'
        ...ocal/share/nvim/lazy/LazyVim/lua/lazyvim/config/init.lua:249: in function 'setup'
        ...ssar/.local/share/nvim/lazy/LazyVim/lua/lazyvim/init.lua:7: in function 'setup'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:387: in function <...local/share/nvim/lazy/la
        [C]: in function 'xpcall'385>
        .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:135: in function 'try'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:395: in function 'config'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:362: in function '_load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:197: in function 'load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:127: in function 'startup'
        ...ossar/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
        /home/scossar/.config/nvim/lua/config/lazy.lua:17: in main chunk
        [C]: in function 'require'
        /home/scossar/.config/nvim/init.lua:2: in main chunk

# stacktrace:
  - /LazyVim/lua/lazyvim/config/init.lua:253
  - /LazyVim/lua/lazyvim/config/init.lua:249 _in_ **setup**
  - /LazyVim/lua/lazyvim/init.lua:7 _in_ **setup**
  - ~/.config/nvim/lua/config/lazy.lua:17
  - ~/.config/nvim/init.lua:2

...ocal/share/nvim/lazy/LazyVim/lua/lazyvim/config/init.lua:259: /home/scossar/.config/nvim/init.lua..ColorScheme
 Autocommands for "*": Vim(append):Error executing lua callback: error in error handling
# stacktrace:
  - /LazyVim/lua/lazyvim/config/init.lua:259 _in_ **on_error**
  - /LazyVim/lua/lazyvim/config/init.lua:253
  - /LazyVim/lua/lazyvim/config/init.lua:249 _in_ **setup**
  - /LazyVim/lua/lazyvim/init.lua:7 _in_ **setup**
  - ~/.config/nvim/lua/config/lazy.lua:17
  - ~/.config/nvim/init.lua:2

...ocal/share/nvim/lazy/LazyVim/lua/lazyvim/config/init.lua:259: /home/scossar/.config/nvim/init.lua..ColorScheme
 Autocommands for "*": Vim(append):Error executing lua callback: error in error handling
# stacktrace:
  - /LazyVim/lua/lazyvim/config/init.lua:259 _in_ **on_error**
  - /LazyVim/lua/lazyvim/config/init.lua:259 _in_ **on_error**
  - /LazyVim/lua/lazyvim/config/init.lua:253
  - /LazyVim/lua/lazyvim/config/init.lua:249 _in_ **setup**
  - /LazyVim/lua/lazyvim/init.lua:7 _in_ **setup**

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 29, 2025

Don't make the change just for me. I've got it sorted out locally.

@gthelding
Copy link
Copy Markdown
Contributor

OK - I'm sorry, but I am just no able to duplicate it. To rule out any changes I made to my daily driver, I spun up a fresh VM with a stock omarchy install and it works fine.

I agree we shouldn't merge this.

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 29, 2025

That makes sense to me. I guess one last thing to check would be to confirm by running :Lazy that mini.icons is loaded when you are testing it. It doesn't seem that others are running into the issue though.

@gthelding
Copy link
Copy Markdown
Contributor

Fair request. I ran :Lazy and hit 'U' to update to make sure. mini.icons is indeed loaded.
image

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 29, 2025

Thanks for checking. I think I've figured this out. I'm loading the render-markdown.nvim plugin. It loads mini.nvim as a dependency:

return {
  "MeanderingProgrammer/render-markdown.nvim",
  dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
  ---@module 'render-markdown'
  ---@type render.md.UserConfig
  opts = {},
  config = function()
    require("render-markdown").setup({
      latex = {
        enabled = true,
        render_modes = false,
        converter = "latex2text",
        highlight = "RenderMarkdownMath",
        position = "above",
        top_pad = 0,
        bottom_pad = 0,
      },
    })
  end,
}

If I'm understanding things correctly:

  • render-markdown.nvim loads mini.nvim as a dependency
  • LazyVim detects mini.icons is available and uses it as the icon provider
  • nvim-web-devicons falls back to mini-icons when mini.icons is present (I think because it's faster than web-devicons)
  • monokai-pro's bufferline autocmd calls nvim-web-devicons (https://github.com/loctvl842/monokai-pro.nvim/blob/31bad737610ec211de086d373c73025f39de93cb/lua/monokai-pro/autocmds.lua)
  • nvim-web-devicons tries using mini.icons (because it's loaded)
  • mini.icons tries to use the highlight groups that I've defined in this PR, but fails and causes a cascading error

@gthelding
Copy link
Copy Markdown
Contributor

gthelding commented Jul 29, 2025

I fork the repo for the theme so that I can make some subtle color changes (less bright whites, for example). Some themes (e.g., gruvbox) have the mini icons colors defined),but for some reason this one did not. I can look into adding it. I'll add the plug in you're using and see what I can sort out. Meanwhile, it doesn't hurt to add these override lines to the neovim.lua for the themne. I'd hate to deprive you of the joy that is ristretto.

I tested the PR without adding that plugin. If you tested it with the plugin and it works, I am fine merging the PR. If I fix the main colorscheme, I can always take out the overrides.

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 29, 2025

Thanks. Yes, I've tested it with and without the render-markdown plugin. The mini.nvim dependency is the issue. The relationship between mini.icons and web-devicons is kind of confusing. I'm just glad to have a consistent reproduction of the issue.

Thanks for your work on this! I'm using the color scheme. That's why I got so caught up in this.

@gthelding
Copy link
Copy Markdown
Contributor

You're welcome! Can you send me your init.lua so I can do some testing as I work on the theme?

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 30, 2025

Sure https://github.com/scossar/nvim-config

The only changes from the default LazyVim setup are:

  • setting python3_host_prog in lazy.lua
  • setting relativenumber = true in options.lua
  • the plugins I've added to the plugins dir

The symbolic link to /home/scossar/.config/omarchy/current/theme/neovim.lua is from Omarchy. I've added this PR's changes to the .config/omarchy/... file for now.

@scossar
Copy link
Copy Markdown
Contributor Author

scossar commented Jul 30, 2025

Oh, I'm pulling the converse.nvim and markdown-fileid.nvim plugins from a local directory. They're in my Github repo as well. The version of converse.nvim on Github isn't quite up to date.

@gthelding
Copy link
Copy Markdown
Contributor

gthelding commented Jul 31, 2025

I have a test VM with a clean install of Omarchy 1.8.0. I was able to duplicate the error after adding your nvim config. I also confirmed that these additions fix the problem. I will work on fixing this in the colorscheme itself without the need for overrides in neovim.lua.

@scossar scossar closed this Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants