Git Product home page Git Product logo

Comments (8)

echasnovski avatar echasnovski commented on September 2, 2024 1

vim.cmd "hi! link MiniIndentscopeSymbol Whitespace"

This looks about right. I'd guess that you have color scheme overriding it later. There are at least two possible solutions:

  • Make sure that color scheme is loaded first. I.e. the :colorscheme <name> command is executed prior to that vim.cmd call.
  • A more idiomatic approach is to also create an autocommand that will ensure proper MiniIndentscopeSymbol. So add something like this after vim.cmd "hi! ...:
vim.cmd('au Colorscheme * hi! link MiniIndentscopeSymbol Whitespace')

from mini.nvim.

echasnovski avatar echasnovski commented on September 2, 2024

Thank for taking time and looking at source code! You stopped one step too early, though :) vim.api.nvim_buf_set_extmakr() also allows hl_group in virt_text to set different highlight groups for different parts of text. That is what 'mini.indentscope' is doing via its own two dedicated highlight groups for symbol and what comes before it (prefix):

local virt_text = { { MiniIndentscope.config.symbol, 'MiniIndentscopeSymbol' } }
local prefix = string.rep(' ', indent - leftcol)
-- Currently Neovim doesn't work when text for extmark is empty string
if prefix:len() > 0 then
table.insert(virt_text, 1, { prefix, 'MiniIndentscopePrefix' })
end

The preferred way of managing highlight groups is do redefine you the way you like. Here is a list of highlight groups of 'mini.indentscope'. So in your case putting the vim.cmd('hi! link MiniIndentscopeSymbol Whitespace') somewhere in the 'init.lua' should solve the issue.

from mini.nvim.

benfrain avatar benfrain commented on September 2, 2024

Came here looking for the correct way to set the indentscope character color. Is this something you would consider adding to the docs? From what I can gather, it should be possible to do something like this in my theme config:

MiniIndentscopeSymbol = { fg = theme.waveBlue2 },

?

from mini.nvim.

echasnovski avatar echasnovski commented on September 2, 2024

Came here looking for the correct way to set the indentscope character color. Is this something you would consider adding to the docs? From what I can gather, it should be possible to do something like this in my theme config:

MiniIndentscopeSymbol = { fg = theme.waveBlue2 },

?

That has already been answered in previous comment.

Place vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = theme.waveBlue2 }) somewhere in your setup.

from mini.nvim.

iSplasher avatar iSplasher commented on September 2, 2024

Just chiming in to say that this should be part of the docs. Thanks!

from mini.nvim.

echasnovski avatar echasnovski commented on September 2, 2024

Just chiming in to say that this should be part of the docs. Thanks!

It is already part of the docs.

from mini.nvim.

pablopunk avatar pablopunk commented on September 2, 2024

hey @echasnovski, quick Q. Where are we supposed to place the highlight fn? Here's my setup (using lazy.nvim):

  {
    "echasnovski/mini.indentscope",
    lazy = false,
    config = function()
      require("mini.indentscope").setup {}
      vim.cmd "hi! link MiniIndentscopeSymbol Whitespace"
    end,
  }

But the symbol still has the default color. I also tried vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = '#333333' }) but still nothing.

It's worth mentioning that if I just run either of those in the cmdline, it does properly highlight the symbol.

from mini.nvim.

pablopunk avatar pablopunk commented on September 2, 2024

The autocommand works fine 👍🏻 , I had it setup on CursorMoved, but your solution makes more sense 😅. I still don't know why the colorscheme is overriding it, but I'm happy with this solution. Thanks @echasnovski !

from mini.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.