mvllow / modes.nvim

Prismatic line decorations for the adventurous vim user
MIT License
584 stars 14 forks source link

Allow disabling `Visual` highlight #41

Open NotAShelf opened 1 year ago

NotAShelf commented 1 year ago

Hello! I would like to remove the colored backgrounds from modes, especially in visual. Is it possible?

edit: to clarify, I just would like it to make it possible that modes.nvim does not alter colors for modes like v-snip, because it creates a conflict with the implementation of configurable themes in my setup

fitrh commented 1 year ago

You can cofigure line_opacity per mode, set it to 0 to remove the background

require('modes').setup({
   line_opacity = {
      visual = 0,
   },
})

Or you can override ModesVisual or ModesVisualXXX highlight group where XXX is

NotAShelf commented 1 year ago

Configuring line_opacity is the first thing I've tried, it results in a black background on VISUAL mode selections.

Update: seems to be exclusive to the Catppuccin theme.

fitrh commented 1 year ago

Can you provide reproduction steps with minimal config? By minimal config I mean no package manager, just packadd it manually

I can't reproduce your issue with the following config

vim.o.termguicolors = true
vim.cmd.packadd("modes.nvim")
vim.cmd.colorscheme("catppuccin") -- assuming you cloned the theme as `start` package
require("modes").setup({
  line_opacity = {
    visual = 0,
  },
})
NotAShelf commented 1 year ago

That might be a little tricky, given I use Nix to manage plugins for me.

But I think a minimal config would look like a combination of :

set termguicolors
set t_Co=256
require('modes').setup({
  set_cursorline = false,
  colors = {
    copy = "#f5c359",
    delete = "#c75c6a",
    insert = "#78ccc5",
    visual = "#9745be",
  },
})
-- Catppuccin theme
require('catppuccin').setup {
  flavour = "mocha",
  transparent_background = false,
  integrations = {
      nvimtree = {
          enabled = true,
          transparent_panel = false,
          show_root = true,
      },

    hop = true,
      gitsigns = true,
      telescope = true,
      treesitter = true,
      ts_rainbow = true,
    fidget = true,
    alpha = true,
    leap = true,
    markdown = true,
    noice = true,
    notify = true, -- nvim-notify
    which_key = true
  },
}

-- setup must be called before loading
vim.cmd.colorscheme "catppuccin"

Those are my configured defaults, minus the

line_opacity = {
    visual = 0,
  },

part which changes the visual mode background to black.

fitrh commented 1 year ago

I still can't reproduce your issue with your config

NotAShelf commented 1 year ago

I've experienced different results in different terminals (where footerm shows black, but kitty shows a darker shade of purple for visual)

Perhaps it is a terminal thing, which terminal are you testing with?

Edit: turned out to be unrelated, I remain clueless

fitrh commented 1 year ago

Perhaps it is a terminal thing, which terminal are you testing with?

I'm using Alacritty

Can you provide a screenshot of what it looks like, and what do you expect it to look like?

mvllow commented 1 year ago

Are you using tmux?

NotAShelf commented 1 year ago

Perhaps it is a terminal thing, which terminal are you testing with?

I'm using Alacritty

Can you provide a screenshot of what it looks like, and what do you expect it to look like?

With line_opacity set to 0, here is what it looks like on catppuccin: image

vs. the same selection, in neovim's built-in desert theme: image

Are you using tmux?

I'm not, it's just a raw terminal window.

fitrh commented 1 year ago

@NotAShelf Do other non-built-in themes behave like catppuccin?

Can you reproduce your issue with the following config

-- minimal.lua
vim.o.termguicolors = true
vim.cmd.packadd("modes.nvim")
vim.cmd.colorscheme("catppuccin") -- assuming you cloned the theme as `start` package
require("modes").setup({
  line_opacity = {
    visual = 0,
  },
})

with nvim --clean -S minimal.lua -- minimal.lua command?

fitrh commented 1 year ago

The thing is it seems you disabled the cursor line with set_cursorline = false, so the expected behavior should be no cursor line at all

NotAShelf commented 1 year ago

Do other non-built-in themes behave like catppuccin?

no, none of the built-in themes behave like catppuccin, but the "default" theme does

Can you reproduce your issue with the following config

I cannot.

fitrh commented 1 year ago

Looks like catppuccin has something about compile-thing, do you think that's the cause of your issue? Have you tried asking the catppuccin people?

NotAShelf commented 1 year ago

I am not sure if the problem is with the catppuccin theme itself, but how the background is drawn by neovim since the issue also occurs on the default theme of neovim.

fitrh commented 1 year ago

But if you can't reproduce your issue with nvim --clean, it's most likely from your config

NotAShelf commented 1 year ago

That is a fair point.

mvllow commented 1 year ago

I believe you could overwrite ModesVisual* highlight groups to be your theme's background instead of transparent. :hi ModesVisual<tab> should show the relevant group names.