modes.nvim icon indicating copy to clipboard operation
modes.nvim copied to clipboard

Allow disabling `Visual` highlight

Open NotAShelf opened this issue 1 year ago • 17 comments

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

NotAShelf avatar Jun 05 '23 22:06 NotAShelf

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

  • CursorLine
  • CursorLineNr
  • CursorLineSign
  • CursorLineFold
  • Visual

fitrh avatar Jun 06 '23 02:06 fitrh

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.

NotAShelf avatar Jun 06 '23 02:06 NotAShelf

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,
  },
})

fitrh avatar Jun 06 '23 05:06 fitrh

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.

NotAShelf avatar Jun 06 '23 09:06 NotAShelf

I still can't reproduce your issue with your config

fitrh avatar Jun 06 '23 09:06 fitrh

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

NotAShelf avatar Jun 06 '23 09:06 NotAShelf

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?

fitrh avatar Jun 06 '23 10:06 fitrh

Are you using tmux?

mvllow avatar Jun 06 '23 11:06 mvllow

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.

NotAShelf avatar Jun 06 '23 19:06 NotAShelf

@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 avatar Jun 07 '23 04:06 fitrh

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

fitrh avatar Jun 07 '23 04:06 fitrh

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.

NotAShelf avatar Jun 07 '23 04:06 NotAShelf

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?

fitrh avatar Jun 07 '23 04:06 fitrh

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.

NotAShelf avatar Jun 07 '23 04:06 NotAShelf

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

fitrh avatar Jun 07 '23 05:06 fitrh

That is a fair point.

NotAShelf avatar Jun 07 '23 11:06 NotAShelf

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.

mvllow avatar Sep 21 '23 17:09 mvllow