Questions tagged [highlight]

Adding highlighting to the document other than syntax highlighting (such as hlsearch or :match)

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

vim highlighting: only overwrite background, not foreground color

I have highlighted keywords and characters in bold and in different fg colours (with syn match). When I create an area highlight (e.g. between [ ] or ( )) the character and keyword highlighting is ...
0
votes
1answer
49 views

Cannot get rid of persisting highlighting

I switched from macos to linux and have spontaneous highlighting in my document. I tried to get rid of it by doing the following command without success: hi clear no syntax nohlsearch noh The ...
0
votes
0answers
25 views

different highlight if a certain highlight is on

I'm writing a function to highlight current word, but on commented out lines, I want a different highlight to apply. Example: Notice how the word exists is highlighed, but on a grey commented out ...
1
vote
0answers
20 views

stash and restore highlight colors with lua and neovim

I would like to toggle an option and with it the highlight color of Whitespace. Before setting the color with vim.api.nvim_command("hi Whitespace guifg=#ff0000") I would like to stash the ...
0
votes
1answer
22 views

How to put sync region start=<this> into a variable?

I have the following code: com! -nargs=* ShFoldFunctions <args> fold ShFoldFunctions syn region shFunctionOne start="^\s*[A-Za-z_0-9:,][-a-zA-Z_0-9:]*\s*()\_s*{" end="}&...
0
votes
1answer
26 views

Highlight word under cursor for Go channel

I use this code to highlight: autocmd CursorMoved * exe printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/\')) But it fail for <-done in Go: :verbose set isk returns ...
2
votes
0answers
29 views

Highlight groups stop working after sourcing vimrc

I'm working on a todo plugin for Neovim, using the remote plugin API. I set highlight groups and matching patterns in my script, and then register it with call remote#host#RegisterPlugin. When Neovim ...
-1
votes
1answer
25 views

Color a call append(line)

I have cowfortune showing up at startup and I want to color it. How do I color the call append() line? I saw some things with signs but I didn't really get it to work. enew setlocal \ bufhidden=...
2
votes
2answers
99 views

Is there a way to use matchadd() to highlight multiple lines without highlighting newlines?

Suppose I have this in a text buffer (vim --clean mydoc.txt): One Two Three Four I highlight all lines using :call matchadd('ErrorMsg', '.*'), resulting in: Notice that the newline character on each ...
2
votes
2answers
165 views

Highlight Unicode Characters

Is it possible to highlight unicode characters? When I copy/paste a code sample I sometimes run into problems because the website uses ‐, ‑, ‒ or – instead of - or some other characters that are hard ...
2
votes
2answers
194 views

How to highlight around of current line in Vim? [closed]

I want to highlight around of current line in Vim like VSCode. Edit: I want to highlight up, left, down, and right of current line.
1
vote
1answer
27 views

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

I am working with text files and Goyo. I'd like to highlight two different kinds of notes delimited by brackets (one called "NOTE:" and the other "TODO:") in different colors. I ...
0
votes
2answers
118 views

How do you change the background color for only one window?

I have tried ownsyntax but that does not work. I want do change the background color for only one window? I have tried this but it highlights all the windows. hi Normal guibg=grey guifg=black It ...
0
votes
1answer
52 views

Non-regex complex color; is that possible in vim?

Is it possible to do more complex coloring than using regexes in Vim? I'm interested in implementing a feature in vim-flog where a commit and all its ancestors would be colored. That means the exact ...
3
votes
1answer
32 views

Which highlight group is responsible for the confirmation dialog?

If I have set confirm, Vim will show a confirmation dialog if I attempt to quit Vim when there are unsaved changes: Which highlight group is responsible for the colors of the text in the confirmation ...
1
vote
1answer
41 views

How to use different rules for highlighting trailing whitespace inside a gitcommit diff

In my ~/.vimrc, I have: highlight TrailingWhitespace ctermbg=blue autocmd BufReadPost * syn match TrailingWhitespace /\s\+\%#\@<!$/ This highlights trailing spaces, except when I am still typing ...
2
votes
1answer
59 views

Is it possible to detect a highlighted search match with synIDattr() or similar?

When I have hlsearch on and my cursor is somewhere in a highlighted search match, is it possible to detect the search highlight hl-Search with synIDattr() or a similar function? As far as I can tell ...
4
votes
2answers
126 views

Is it possible to override the filetype of a text file based on the first line?

I have some specifically formatted text files that I'd like to detect when I start vim. When I load these files now, the filetype is automatically set to text. I only want to override that if the ...
1
vote
1answer
67 views

Show all instances of a certain string

I use * and # for quick and basic typo checking. If I type AVeryLongVariableName, I can put my cursor on the word, press * and see all the other places that word is used. I know I spelled it correctly....
2
votes
1answer
163 views

How to highlight cursor line number without cursor line?

I want the cursor line number to have a different color than the rest of numbers with cursorline disabled. Sadly CursorLineNR is only active if set cursorline. I could do set cursorline followed by hi ...
2
votes
1answer
65 views

Print bound autocmds to a file

I would like to print all of my current autocmds to a file so that I can grep through and do further analysis. From within vim, the list of autocmds can be found with :autocmd, but this prints to a ...
0
votes
1answer
34 views

How to check what of highlight is the word on cursor?

I found this article, How to know which highlighting group is used for the background of a word? however, it prints out something not what I look for. It prints out like VimCommand VimOption ... but ...
1
vote
0answers
59 views

How do you highlight text surrounded by double equals

I'm using vimwiki plugin with markdown. I'd like to highlight text using double equals, which isn't standard, but is quite useful. Ideally, this should replace background (for instance, yellow) and ...
0
votes
0answers
8 views

How to get highlight style used for the text under cursor? [duplicate]

There is some text under my cursor that specific highlight is used. I do not know which highlight is that. I can type :highlight and randomly guess which could that be. Is there a method to just place ...
0
votes
1answer
27 views

Persistent highlighting (not affected by cursor movement) of selected lines?

I would like to highlight or color certain lines to mark them visually, and then move around freely in the file without affecting the selection. Is there a way of doing this? I know I can do 'v' to ...
0
votes
0answers
63 views

Highlighting the matching pair of a character changes the foreground color of Cursor

I'm using Vim 8.2 on Fedora 32. I have the following lines in ~/.vimrc for highlighting the Cursor, lCursor, CursorLine, and MatchParen highlight groups: highlight Cursor guibg=Green guifg=Black ...
0
votes
0answers
172 views

Set Background for Lines after EOF

I am trying to get transparency on DWM to work by setting the background color in vim to NONE. highlight Normal guibg=NONE ctermbg=NONE This works fine unless I have files that contain not enough ...
1
vote
1answer
51 views

Turning the `match` command on and off

I found this useful setting form this post, which highlights trailing whitespaces : highlight ExtraWhitespace ctermbg=grey guibg=grey noremap <F10> :match ExtraWhitespace /\s\+$/<CR> This ...
1
vote
1answer
48 views

How to highlight text between two delimiters / tags?

How do I highlight the block of text between two delimiters / tags / "surroundings"? (e.g., between matching parentheses ()s, quotes "", html tags (div../div), etc.) (Or maybe how ...
4
votes
1answer
509 views

How to fix unreadable highlighted text during search?

This is an example of how highlighted text looks in my vim: In the color scheme I am using (/usr/share/vim/vim82/colors/peachpuff.vim) the color is defined like this: hi Search term=reverse ctermbg=3 ...
1
vote
1answer
112 views

How to perform an action on search matches?

How can I visually select all text highlighted by a search in order to run a command on it? And if it's possible, how can I capitalize the selection?
0
votes
1answer
71 views

incsearch not working as expected

So I have the following example text: ##1## many text and lines ##z## ##1## many text and lines ##z## ##2## more text ##z## And after doing :set incsearch, and running :g/^##1##\n.*/+,/##z##/- (which ...
2
votes
0answers
49 views

Is there some way to retrieve/redisplay :echon output?

I want to create a multi-color enabled debug-print command. As far I know, the only way to print multi-color messages in Vim is: echohl Macro | echon "Hi" | echohl Statement | \ echon &...
1
vote
1answer
30 views

Persistent tag highlights when changing between buffers

I've put following code in my vimrc. function ExtraHighlights() let list = taglist('.*') for item in list if item.kind == 's' || item.kind == 't' || item.kind == 'u' || item.kind == 'g'...
2
votes
0answers
165 views

Vimdiff : highlight line numbers differently

I use relative line numbers thanx to the following settings in my vimrc: set number set relativenumber Since I don't want to wrap lines in diff mode, it's sometimes hard to tell which line include a ...
1
vote
1answer
182 views

No highlighting for replacement text using conceal

I just discovered Vim's conceal feature. I've added the following to ~/.vim/after/syntax/haskell.vim: syntax match haskOperator "->" conceal cchar=→ syntax match haskOperator "<-" conceal ...
0
votes
1answer
24 views

How do I turn of the 'haze' when highlighting black?

I have put this in my .vimrc highlight IgnoreGroup ctermbg=Black ctermfg=White let m = matchadd("IgnoreGroup", '\\todo{.\{-}}') This gives me the following result: Note that the \todo{stuff} ...
0
votes
1answer
28 views

Highlight group in `.vim/after/ftplugin` not highlighting patterns

While highlight group in .vimrc highlights patterns just fine, highlight groups in .vim/after/ftplugin folder does not seem to do anything. Is it normal?
3
votes
1answer
33 views

Can't see tag “<>” braces due to highlight color same as braces in Windows terminal

I'm new to Vim and am having an issue with highlight color of matching braces in Vim. if I type: <html> and my cursor is at the one of the <> greater/less-than brace then I can't see the ...
1
vote
0answers
18 views

Change match highlights on CmdlineLeave

Vim uses two different highlight groups for matching patterns while searching in the command-line with / or :substitute for example. The incsearch group for the match under the cursor The search ...
1
vote
2answers
45 views

Defining a color to be the same color of comments

I'm using the indentLine plugin to display line indents with a continuos vertical line, and I'd like to set the color of that line to the same color of my comments. To get the foreground color of my ...
2
votes
1answer
206 views

Unwanted highlights on page scroll

I have a pretty similar problem as in this issue with some exceptions. Basically, after I scroll page down or up Ctrl+d / Ctrl+u all non-empty lines get highlight from the end of the line to the ...
2
votes
1answer
60 views

How to highlight multiple words that are unrelated

I need to highlight multiple words that are unrelated, eg: aaa bbb ccc ddd I would like to highlight aaa and ddd, and keep cursor at both of those words, so when I try to change the word for example ...
2
votes
2answers
327 views

Is it possible to make “???” a keyword that can be highlighted?

Is it possible to make ??? (3 question marks) a keyword, and highlight it? I have tried the following in a syntax file. Other strings on the line are highlighted, but not ???. \?\?\? does not work ...
1
vote
1answer
9 views

How to enable search highlight when I use `normal! n` in a function?

I've set hlsearch. When I type :normal! n, the target text is highlighted. But when I put normal! n in a function(Search) and call that function(:call Search()), the highlight doesn't take effect? ...
2
votes
1answer
169 views

Highlight group for signature help

I'm using Vim (v. 8.2) with YouCompleteMe as a code completion engine. I welcome the addition of signature help, but I'm not happy with the default colors: Does anyone know what highlight group is ...
0
votes
2answers
341 views

Highlight results of :grep while in quickfix window

To my .vimrc I added a hook which automates entering the quickfix after :grep processing: autocmd QuickFixCmdPost [^l]* nested cwindow 20 Another thing I care about but can't achieve is automation ...
1
vote
1answer
57 views

How to set colors for vim warnings about existing swap files

Is it possible to set color for the warning message "Swap file XXX already exists! ..."? I couldn't figure out which highlight group it belongs to.
1
vote
1answer
64 views

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

I have an auto command that changes some color scheme values so I can avoid forking them when all I need is small changes: augroup FixColorSchemes autocmd! autocmd ColorScheme * \ ...
1
vote
0answers
183 views

How to disable highlighting for custom group

I'm using a tip from this page of the vim wiki to highlight trailing spaces when I'm not in insert mode : highlight ExtraWhitespace ctermbg=red match ExtraWhitespace /\s\+$/ autocmd BufWinEnter * ...

1
2 3 4 5