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
1answer
39 views

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

For each filename, Vim generates (relatively) unique filename for it's swap cache directory. Let's say I would like to store some information for each file (like swap files do), e.g. with : silent ...
1
vote
2answers
42 views

How to do no higlight search in a mapping?

I want to write some mappings so I can move faster between the code. The problem is that I have hlsearch on(and i don't want it off) so I did it like this: au BufNewFile,BufRead *.py nnoremap <...
2
votes
1answer
44 views

Stop vim from highlighting "note" in yellow inside SQL comments

I am using vim under Ubuntu under the windows WLS. When I edit SQL files, only inside comments - the word "note" is always highlighted with a background yellow color. This includes, for ...
1
vote
1answer
32 views

How to change the directory highlight in the terminal buffer?

I have a theme which is great apart from some minor things. I could already change the LineNr highlight and some others, but can't seem to change the directory highlight in the terminal buffer, which ...
0
votes
0answers
20 views

How can I highlight Doxygen comments in italics, in C?

Currently in my .vimrc is: " C specifics autocmd BufRead,BufNewFile *.h,*.c set filetype=c.doxygen " italic comments highlight Comment cterm=italic This results in italic highlighting for ...
0
votes
0answers
26 views

Regex multiple lines search, matched, but highlighted only what initially is on screen

Let's say I have the following fantasy code // a long definition of a structure struct long_struct { ... }; There are tons of multiple lines inside such block of code. It cannot be displayed ...
2
votes
2answers
41 views

Search from vim function

I am trying to use a vim function to search whether :noh has been set or not This is similar to question found here except that question does not take :noh into account One way to search from a ...
1
vote
1answer
45 views

Scroll results of :hi

When I type :hi to see all the highlight groups, I only see as much as can fill the screen. How do I scroll through them? :hi[ghlight] List all the current highlight groups that have ...
0
votes
1answer
35 views

How to colorize words in a buffer, using type data and position data?

I am writing a plugin for Neovim using Lua. If I have a text and some predefined arbitrary types, for example: chita wolf grizzly types: dog(green), cat(blue), bear(yellow) And I know positions/...
1
vote
1answer
35 views

Conceal HTML span and highlight content

I am currently writing some Anki cards in NeoVim. Anki supports HTML and I can therefore write cards in the following format. Forumlate the <span class="highlight">Central Limit ...
1
vote
1answer
29 views

Disabling spellchecker highlight

When activating the spellchecker (with :set spell spelllang=en_us for example), all incorrect words are highlighted. I'd prefer if they'd not be highlighted, but the spell checker to continue to work (...
1
vote
1answer
33 views

Have to hit "Enter" after searching or I lose the pattern

If I am searching for a word inside a file, if I do not hit ENTER after the search pattern, my vi loses the current match and jumps back to where it was. I have set hlsearch set incsearch in .vimrc. ...
0
votes
1answer
39 views

Signature popup has unreadable colors in YCM for Rust

I'm using Vim 8.2 with rust highlighter and YCM plugin for auto-completion and signature help. Everything works except method signature: It has same color for both color text and bg in parts like ...
0
votes
1answer
47 views

Toggle specific highlight group

Is it possible to temporarily disable the text highlight under cursor? The current highlight group can be obtained by synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name'). How to clear it to ...
0
votes
1answer
40 views

vim/vim-latex: spell-check highlighting breaks after occurrences of \end{center}, \end{enumerate}, \end{itemize}

The highlighting of misspelled words in my LaTeX documents breaks, when I open a .tex file and jump to the bottom instead of scrolling through the whole document. Only .tex files seem to be affected, ...
0
votes
0answers
124 views

How do I make sure terminal vim has syntax highlighting with 'cursorline' and 'termguicolors'?

I searched this issue on the web to no avail and it's most likely not here too. The issue I'm facing goes like this I am trying to switch to vim since I find it cool. I was writing my vimrc and ...
0
votes
0answers
47 views

How to change color of tabbar of neovim

How can I change the color of tabbar background (which is green in below screenshot)
0
votes
1answer
68 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
52 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
28 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
63 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
23 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
27 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
46 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
31 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
132 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
271 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
573 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
28 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
332 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
58 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
36 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
63 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
65 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
347 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
72 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
535 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
85 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
40 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
96 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
10 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
34 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
102 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 ...
1
vote
1answer
62 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
77 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
741 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
179 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
125 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
51 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'...

1
2 3 4 5