Skip to main content
Share Your Experience: Take the 2024 Developer Survey
11 votes

How to get the highlight group of the word under the cursor in Neovim with Treesitter installed?

Neovim v0.9 The following commands are now available built-in, which do what you want :Inspect " prints as nicely formatted text :Inspect! " prints as a lua table The ...
wardw's user avatar
  • 240
7 votes
Accepted

How to get the highlight group of the word under the cursor in Neovim with Treesitter installed?

For those using Neovim 0.9.0 (or newer), it now includes a command that does what you asked for (provided by a bundled runtime plugin): :Inspect Sources: https://github.com/neovim/neovim/releases/tag/...
SiggiSv's user avatar
  • 194
4 votes

Highlight search phrase within quickfix window listing

Two ideas: If you just want to highlight them, search with /buffer and make sure hlsearch is on. Or, for a more permanent solution, navigate to the quickfix window and use :match Search /buffer/ If ...
D. Ben Knoble's user avatar
  • 26.4k
4 votes
Accepted

Disable highlighting in location list in vim

The highlight rule you are looking for should be QuickFixLine. So disabling the background would be done in your .vimrc with: highlight QuickFixLine ctermbg=none
padawin's user avatar
  • 1,333
4 votes
Accepted

How to highlight search with / and ? but not * and # vim

I don't think there's anything better than switching highlight off just after the search: set hlsearch nnoremap <silent>* *:noh<CR> nnoremap <silent># #:noh<CR>
Matt's user avatar
  • 20.8k
3 votes
Accepted

Can you call highlight more than once? Need different colors for different matches

About :match With the match command, you only get 3 match ids: :match noteHi /\[\cNOTE:[^=]*\]/ :2match todoHi /\[\cTODO:[^=]*\]/ :3match what /ever/ Each time you call these commands for a ...
Mass's user avatar
  • 14.1k
2 votes

How do I let the user of my plugin customize a custom highlight group I define?

Setting colors to NONE is (almost) the same as inheriting from Normal group. So you can simply test hlID() return value before calling popup_create() and pass "Normal" if the custom group ...
Matt's user avatar
  • 20.8k
2 votes
Accepted

How do I let the user of my plugin customize a custom highlight group I define?

The recommendation to use the ColorScheme autocommand comes from the fact that color schemes all start with hi clear, which effectively removes any previous hi definition, wherever, whenever, and ...
romainl's user avatar
  • 41.1k
2 votes

Generate relatively unique "cache filename" for given file path (like swap files do)

The swapfile full path is available through swapname() which takes a buffer name. The current buffer name is available with bufname() with no arguments. So this prints the swapfile path of the current ...
B Layer's user avatar
  • 19.9k
2 votes
Accepted

Cannot get rid of persisting highlighting

Most probably you have set spell enabled which usually checks spelling in comments. If you don't need it turn it off with :set nospell. Activate when you need it with :set spell. To toggle use :set ...
Maxim Kim's user avatar
  • 13.5k
2 votes

How to get the highlight group of the word under the cursor in Neovim with Treesitter installed?

According to the closed issue at https://github.com/nvim-treesitter/nvim-treesitter/issues/1654#issuecomment-893756730 Treesitter messes up synstack(). The only way to get a function to do something ...
artfulrobot's user avatar
1 vote
Accepted

Is it possible to change Vim 'gutter' color to white?

I could guess that you have color 15 (white) changed to be non-white in your terminal. Colors 0-15 quite easy to override and most of the terminals have their own colors defined. On top of it you, as ...
Maxim Kim's user avatar
  • 13.5k
1 vote

Is it possible to change Vim 'gutter' color to white?

To control the Git Gutter sign colors there are a number of highlighting groups that are relevant: SignColumn GitGutterAdd GitGutterDelete GitGuttterChange About the color my understanding is that ...
Vivian De Smedt's user avatar
1 vote
Accepted

How can I check whether the user has defined a highlight group before Vim 8.2.3917

So Vim Patch 8.2.3578 added the ability to get and set the various attributes for highlighting groups in a more efficient manner. This is strictly speaking not required to check whether or not a ...
Christian Brabandt's user avatar
1 vote

Persistent highlighting of a passage in Vim

If by "persisted" you mean only in a current vim session (not stored with text file), then :h textprop API might be what you want. Here is the proof of the concept: func! Markline(line) &...
Maxim Kim's user avatar
  • 13.5k
1 vote
Accepted

Upgraded my mac OS and now the vim colors are different. Is there an easy way for me to change the default syntax?

I completely understand your problem. The issue is that the new system is better at detecting the background as being dark. Simply add set bg=light to your .vimrc file my friend. That should restore ...
kilojoules's user avatar
1 vote

Upgraded my mac OS and now the vim colors are different. Is there an easy way for me to change the default syntax?

You can choose a colorscheme and set it in your ~/.vimrc colorscheme <colorscheme_name>
Chris Heithoff's user avatar
1 vote

Help writing simple syntax file for line specific matches

I think what you want is found at :help pattern and searching for line number. /\%l /\%>l /\%<l \%23l Matches in a specific line. \%<23l ...
Vee's user avatar
  • 338
1 vote
Accepted

Can I apply individual colours from one highlight in another one?

I tried it manually and the last line gave me this error: E254: Cannot allocate color s:splitcolor So the guifg value isn't set to anything. (The guibg value is set so that may explain why you ...
B Layer's user avatar
  • 19.9k

Only top scored, non community-wiki answers of a minimum length are eligible