Questions tagged [highlight]
Adding highlighting to the document other than syntax highlighting (such as hlsearch or :match)
262
questions
1
vote
2
answers
71
views
How do I set CurSearch from my vimrc?
patch-8.2.4724 added a new highlight group for the search match under the cursor, but it looks identical to the Search highlight group by default. I know I need to set it to a colour for it to make a ...
1
vote
1
answer
52
views
Highlighting lines containing fold-markers when fold is open
When Vim/Neovim is configured to use markers as foldmethod, it highlights the line containing the marker if the fold is closed. When the fold is opened, the lines containing the markers look the same ...
1
vote
1
answer
54
views
Unable to set custom colors for LSP errors
I have a custom color scheme and I've provided colors for LSPDiagnostics and Errors, but none of them are working.
As seen, errors should be red, but the errors I see are yellowish in color
Tried a ...
0
votes
2
answers
71
views
Revert Cursor Line Higlighting on Leaving Insert Mode
Apologies in advance if this is a RTFM case, but I have checked pretty thoroughly and I am still stumped. I am running Vim with the afterglow colorscheme on a vanilla Arch/Xmonad laptop. I cannot seem ...
0
votes
2
answers
71
views
Homebrew Vim not sourcing ~/.vimrc after iTerm, MacOS updates
I am using vim installed via homebrew:
> which vim
/opt/homebrew/bin/vim
> vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May 09 2024 07:15:02)
macOS version - arm64
Included ...
0
votes
1
answer
35
views
Can I make tagbar plugin highlighting the function my cursor is on?
I want this highlight appear on the tagbar plugin window.
Can I?
1
vote
0
answers
23
views
How to add a syntax rule to LaTeX filetype?
How can I colorize elements of the regex rule "\w\+:\w\+:\d\{4\}" in a LaTeX file ?
If I open a new document with no filetype and add the two following command :
syn match Bib3Dots '\w\+:\w\+...
1
vote
2
answers
262
views
Highlight the full text searched on vi editor?
We've only vi editor on servers (There are 100+ of them so installing vim in each of them is not really an option as that's not our servers as we're just providing a service to others).
No ...
1
vote
1
answer
422
views
How do I change the color of the deleted text on the left side of a vimdiff?
My colors currently look like this, with the text highlighted green on both sides:
I would like it to be red on the left, and green on the right.
I tried to change the DiffDelete highlight, but that ...
1
vote
3
answers
116
views
How to efficiently highlight a region given a START and END position expressed as line_nr, col_nr?
Say that I want to highlight a region expressed in terms of two coordinates of the form (line, column), e.g. C1 = (l1, c1) to C2 = (l2, c2).
I read :h matchaddpos() but it seems that you can only ...
0
votes
0
answers
24
views
autocmd to set hls after having manually :nohls doesn't turn search highlighing on
tl;dr
Why, after sourceing the following, moving the cursor doesn't result in the text matching the / being highlighted?
set hls
augroup AU_NAME
autocmd!
autocmd CursorMoved * set hls
augroup END
...
1
vote
2
answers
172
views
How do I check a buffer for words from a list?
I'm wondering how to:
Check the presence in the current buffer of words that are present in a given file and
Highlight them.
1
vote
1
answer
935
views
Syntax highlighting breaks with rust analyzer
I have been using neovim for several months with basically no issue and
enjoying it very much. I have recently started receiving a problem with
the syntax highlighting in Rust.
When the file first ...
1
vote
1
answer
63
views
Why does the cursor on my Vim appear in pairs when it encounters parentheses?
I don't know what to touch. When my cursor moves to the left of the parentheses, the right side of the parentheses is also covered by the cursor.
Is there any way to make my cursor only cover the left ...
0
votes
0
answers
51
views
How to highlight all the columns of a window?
Consider the following snippet:
vim9script
var winid = win_getid()
var winwidth = winwidth(winid)
var range = []
for lnum in range(10, 20)
add(range, [lnum, 0, winwidth(winid)])
endfor
var m = ...
3
votes
3
answers
844
views
How to automatically change the background color of the active split?
I use several splits (windows). To quickly identify the splits that has the focus I would like Vim to auromatically adapt the background color of the active split.
Is there a way to do so?
Is it ...
1
vote
1
answer
1k
views
In Neovim is there a way at nvim level to set priorities to control highlight resolution?
Background:
It's possible for multiple highlights to affect the same areas in the buffer and work correctly. For example syntax-related colors usually affect fg (foreground, text glyph) color, ...
1
vote
1
answer
149
views
Display pattern count when highlighting searched pattern
Running Neovim 0.9, I have this mapping:
nnoremap <silent> <leader>l :<c-u>let @/ = '\<'.expand('<cword>').'\>'\|set hlsearch<CR>wb
which is a shortcut to ...
9
votes
3
answers
10k
views
How to get the highlight group of the word under the cursor in Neovim with Treesitter installed?
Ok folks, I've tried all these duplicates:
How to know which highlighting group is used for the background of a word?
How to identify the highlight groups in use on a particular character?
How to ...
0
votes
2
answers
143
views
How can I check whether the user has defined a highlight group before Vim 8.2.3917
With this question I've learned of the existence of hlget and hlID, which I use in a plugin of mine like this:
if empty(hlget('SoftWrapHighlightGroup'))
" do stuff
endif
However, those ...
1
vote
2
answers
129
views
How do I let the user of my plugin customize a custom highlight group I define?
In this plugin for (soft-)wrapping only the current line, I have defined a highlight group, au ColorScheme * hi SoftWrapHighlightGroup ctermbg=NONE ctermfg=NONE, which I use here as an argument to a ...
1
vote
1
answer
30
views
How to turn off highlighting/colors for changes/current edits?
Recently (within the past year?) vim has started tracking changes as I edit, and highlighting those changes with a different color. I've given it a try, but I'd like to turn that specific feature off ...
3
votes
1
answer
109
views
How to call incremental forward/reverse search inside function in Neovim?
I'm trying to implement a search function that finds a pattern and jumps to it without overriding the current searched for & highlighted pattern.
Specifically, I want to be able to type out the ...
0
votes
1
answer
86
views
How to highlight missing comma in lua files?
I often forget the comma between embedded table entries in lua code.
t = {
a = { "str" },
b = {
{
"str3",
v = 1,
} <<-- missing comma
...
1
vote
1
answer
1k
views
Add a border to `:LspInfo` window in Neovim
I use a transparent colorscheme for my Neovim. Due to the transparency, the :LspInfo window is difficult to distinguish from the background. Can I add a border around the window?
2
votes
1
answer
1k
views
Is it possible to make neovim use single color for underline?
As title. With my current setup it looks like this:
But I only want it to use a single color. My current highlight setup:
:hi IndentBlanklineContextStart
IndentBlanklineContextStart xxx cterm=...
4
votes
2
answers
193
views
Follow group links in :highlight command
In :highlight command, colors of some groups are shown as this:
:hi vim9Comment
vim9Comment xxx links to Comment
I then have to invoke another :hi command, this time with the linked group as the ...
0
votes
0
answers
69
views
How can I maintain the status message after `zz` command?
I like to see the number of matches in a search on the bottom right
set shortmess-=S
But I also like to center the screen after I search
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
...
1
vote
0
answers
316
views
Live preview the result of running a :substitute command in a :global command in neovim
Assuming the following text
foo
bar pattern needle
pattern needle
I can enter the following command :g+pattern+s/needle/replacement to replace all the needles in lines that contain pattern.
With ...
0
votes
1
answer
49
views
Fedora 35: Suddenly vi screen started looking funny!
A few days ago, vi started loading files and applying some strange highlighting. I have done nothing (on purpose anyway) to edit colors (don't know how).
Can anyone explain how to fix this? Default ...
1
vote
1
answer
221
views
Color name or number not recognized with User1-9
When I run highlight User1 ctermbg=#505050 ctermfg=#d0d0d0 gui=italic, I get the following error.
E421: Color name or number not recognized: ctermbg=#505050 ctermfg=#d0d0d0 gui=italic
0
votes
1
answer
98
views
Different highlighting between foldtext and "the line number on the folded line"?
Can I control the highlighting of the foldtext separately from the color of the line number on a folded line?
I want the foldtext to be quite visible while keeping my chosen line number color
1
vote
0
answers
88
views
Highlight html/xml tags using only matchit and matchparen
I would like to highlight html and xml tags, but most plugins I find (e.g. vim-matchup) look like they do way more than I'd like, which I'd like to avoid. Is it possible to highlight the tags by using ...
1
vote
1
answer
82
views
Why are incsearch and hlsearch disabled when opening a .csv file?
I like the incsearch and hlsearch options in Vim, so early on in my .vimrc file, I have the following lines:
augroup allfiles
autocmd FileType * :set nocindent noexpandtab incsearch hlsearch
...
0
votes
0
answers
106
views
Can I stylize the current closed-fold line? If yes, how?
I like to have the current line highlighted (in terminal vim), but not as a punch in my eye, so what I have is this in my ~/.vimrc:
au ColorScheme *
\ hi CursorLine ctermbg=NONE ctermfg=NONE cterm=...
0
votes
0
answers
34
views
Is there a way to highlight text but not based on syntax?
I was thinking about writing a little file viewing plugin, similar to netrw but my own thing, and I'm not sure how to highlight the files differently if there's no syntactic difference between the ...
2
votes
1
answer
997
views
How to chain multiple script commands?
I have used this script to be able to highlight results from test reports: https://vim.fandom.com/wiki/Highlight_multiple_words
When using it in Vim, it works fine when I type :Highlight 1 FAILED (For ...
1
vote
1
answer
394
views
How to add commands from an external script to .vimrc?
I have used this script to be able to highlight results from test reports: https://vim.fandom.com/wiki/Highlight_multiple_words
When using it in Vim, it works fine when I type :Highlight 1 FAILED (For ...
0
votes
1
answer
145
views
Can't read my highlighted searches
In this display, what does the "xxx" mean?
:hi Search
Search xxx term=reverse ctermbg=11 guibg=Yellow
On my display (cygwin/xterm), Search displays as black on black.
If I do this, ...
1
vote
0
answers
152
views
Wrong column highlight on lines containing references or links
I've recently taken up nvim and came accross a weird issue.
I've turned on cursor position highlighting for both lines and columns (set cursorline and set cursorcolumn), and usually it works as ...
1
vote
1
answer
83
views
highlighting: match dot in group
I have several syntax match patterns, that logically belong together.
Currently I match them like this:
syntax match FOO /\v<(foo1|foo2|foo3)>/
What I actually want to match is .foo1, .foo2 and ....
1
vote
1
answer
1k
views
Setting font color and underline of `highlight SpellBad`
I want hi SpellBad to be red (167 or #fb4934) and underlined. What I have right now is this:
...in vimrc...
setlocal spell
set spelllang=en_gb
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<...
0
votes
1
answer
66
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 ...
2
votes
2
answers
550
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 <...
3
votes
1
answer
442
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
1
answer
170
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
0
answers
187
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
2
answers
183
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
1
answer
117
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
1
answer
422
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/...