Questions tagged [highlight]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
42 views

Highlight range for ex command

I'm trying to add more ex commands to my vim repertoire and I was wondering if there is setting or plugin that would allow to highlight the lines addressed by the command, if a range is give e.g., if ...
1
vote
1answer
41 views

Highlighting arbitrary text

When I'm writing, I often have 2-3 buffers open. My main body of text in the middle, and then supporting materials on the left and right. I often read a paragraph from one of the supporting buffers ...
1
vote
2answers
210 views

Automatically highlight all occurrences of the selected text in visual mode

In text editors like sublime text, atom and notepad++, when you select a word, all matches are highlighted automatically as shown in the following screenshot of my atom editor: I use v and select ...
1
vote
2answers
48 views

Highlight important words/lines permanently

I'm working on a plain text file. I'd like to highlight important words or lines so that they stand out. How can I change background color and/or text color for selected text or word under cursor? ...
1
vote
2answers
131 views

Change background color of git conflict marker sections

If git is performing a 3-way merge and has a conflict it can't resolve, it marks up that area of the file like this: No unresolvable conflicts here <<<<<<< HEAD xyz ||||||| ...
17
votes
7answers
13k views

How to automatically turn off “hlsearch” after I'm done searching?

I love the "hlsearch" setting, but after I'm done searching, I find it obnoxious. Especially if I search for something that has a lot of matches. I know that I can turn this off with :set nohlsearch ...
1
vote
0answers
47 views

neovim hlsearch not working

I'm testing neovim and for many thing it is working way faster than vim (I use many plugins ~80, and I can really tell the difference with neovim). All the same config files worked out of the box, but ...
1
vote
1answer
66 views

Vim is highlights everything after EOL in yellow upon scrolling

My vimrc: http://ge0rges.com/vimrc My environment is: Ubuntu 18.04 in WSL on Windows 10. VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41) Included patches: 1-1453 Modified by pkg-...
0
votes
2answers
47 views

Is it possible to reverse an existing highlighting group?

Is it possible to automatically create a highlight which is the reverse of an existing highlight? Example highlight Search guifg=Black guibg=Yellow, becomes highlight CustomHighlight guifg=Yellow ...
2
votes
1answer
36 views

ALE Error and warning highlighting gets disabled when termguicolors is enabled

I have the ALE extension installed, and would like it to highlight errors and warnings, however when :set termguicolors is enabled, the Here's a screenshot of the problem: set termguicolors ...
5
votes
2answers
373 views

How to make vim text bold?

In order to have my vim text always bold, I found this config in stackoverflow: :hi MyGroup cterm=bold :match MyGroup /./ But somehow, it has messed up search highlighting. It is no longer ...
2
votes
0answers
25 views

How to set syntax keywords dynamically

I'm trying to highlight the keywords for my c++ project. So what I've done is to create a file here: ~/.vim/after/syntax/cpp.vim and put some custom configuration into it. For example, putting the ...
1
vote
2answers
66 views

How to highlight class name of c++

I'm trying to configure the highlight to highlight keywords of my C++ project. Here is the content of ~/.vim/syntax/cpp.vim: syn match cCustomParen "?=(" contains=cParen,cCppParen syn match ...
2
votes
2answers
59 views

`.vimrc` unsuccessful in setting highlight style

1) To underline misspelled words, I can execute the following in an open buffer: :hi clear SpellBad :hi SpellBad cterm=underline :set spell 2) However, if I write in my .vimrc the first two lines, ...
0
votes
2answers
233 views

Highlighting a search capture group

By :set hl, the search result of a / expression is highlighted, for example: And if one wants to replace one substring distinguished by its surrounding, one can do so elegantly using regex capture ...
0
votes
1answer
72 views

Fold: Different highlight style for fold of each filetype

Extend of this question of fold: Fold: foldtext() for each filetype We have fold for each filetype now but each fold need different highlight style of color, because highlight is global I tried to ...
1
vote
2answers
448 views

How to set CursorLine highlight color for the gruvbox colorscheme

When I use the colorscheme gruvbox (installed with vim-plug), it overrides my configuration of the Cursorline highlight, eg set cursorline hi CursorLine cterm=NONE ctermbg=black with the same color ...
2
votes
1answer
10 views

Register CursorMoved on certain key press and disable when move to new line

I'm trying to write a function that will highlight searches performed with the f and F keys. I currently have a solution here thanks to @filbranden, but would like to further improve it to only ...
61
votes
10answers
60k views

How can I clear word highlighting in the current document (e.g. such as after searching for a word)?

When you search for a word in a file with something like /console.log, all of the instances of console.log are highlighted. When you're no longer interested in these, the highlighting can be ...
19
votes
6answers
4k views

Set cursor colour different when on a highlighted word

With the current colourscheme I have been using, it is hard to find where the cursor is positioned when navigating through search results. The highlighting colour and the cursor colour are blending in ...
3
votes
3answers
225 views

Is there anything like matchaddpos() but stick the highlight with the character instead of grid?

Assume we have this text: baaa matchaddpos("Error", [[1,2]]) highlights the second character (the first 'a') as "Error" group. baaa ^ highlighted When I insert a 'b' at the beginning, it becomes ...
1
vote
0answers
85 views

How can I still see underscores with cursorline?

Background and problem I've just discovered how to make the cursor a vertical line in insert mode. This works well with cursorline; even with the thinner cursor, I can still easily find my position. ...
0
votes
1answer
48 views

How to disable margin (+/!)?

Currently I installed vim addons for python. http://fisadev.github.io/fisa-vim-config/ However, I don't like the +/-/! on the margin. Does anyone know how to disable all of them? Thanks,
0
votes
2answers
35 views

Fade Rows Far From Center

I am currently using a vertical monitor for my vim setup. I absolutely love being able to view 100+ lines of code at once. My eyes can scan longer and more complicated blocks of code. However, I have ...
1
vote
0answers
32 views

How do you remap keys in :history or :highlight?

I use Colemak hnei for nav in normal mode, but my keys default to hjkl when when I'm viewing :history and :highlight. How do I remap these keys? My guess is that the program may be switching to more....
0
votes
1answer
34 views

How to use vim as an error checker?

I'm transitioning to vim and I love the feature other IDEs provided in which when I wrote something with a syntax error it accuses me through a red underlining. I don't know what this type of feature ...
0
votes
1answer
56 views

Highlighting screen positions, or `:set colorcolumn` only for the 2 bottom and top lines visible on the screen

The option colorcolumn is really useful. I would like a similar result to what it yields but only for the two lines that are at the top and the bottom of the screen (not the document, but the screen). ...
0
votes
0answers
87 views

Highlight specific line numbers in the gutter

Can you target a spesific line number in the gutter? Let's say I want line 20 in the gutter te be red for some reason. Possible? Like CursorLineNr, but defining the line number yourself. In short I'm ...
2
votes
2answers
106 views

Can I use a different color for the selected match than for other matches

In the screencast below I searched statusline and then cycle through the results with n. Is it possible to highlight the selected match with a different color than the other matches, instead of ...
2
votes
1answer
237 views

Highlighting tabs, trailing space and non-breaking space by colors, not chars

Currently I highlight these with: set listchars=tab:▶—,trail:␣,nbsp:⍽ But the drawback is I cannot usefully copy-paste from the terminal where vim resides to another one: e.g. suppose I'm editing a ...
2
votes
1answer
76 views

Why are two <cr> characters required when executing this highlighting toggle command?

I use this keymapping toggle to highlighting on and off, but when I originally found it, the author did not list two <cr> at the end of the command. I found that if I didn't have two <cr> ...
2
votes
1answer
81 views

How to know which highlighting group is used for the background of a word?

Vim highlights the background of certain words (e.g. when doing spellchecking) in a way that I would like to change (because the background and the word itself are almost of the same color, which ...
0
votes
1answer
302 views

Why doesn't undercurl use underline in my terminal?

:help undercurl states: "undercurl" is a curly underline. When "undercurl" is not possible then "underline" is used. In general "undercurl" and "strikethrough" is only available in the GUI. But if ...
-1
votes
1answer
129 views

Automatic highlighting non ASCII character when loading 'vim' filetype buffer

I want to include a new highlight group and autocommand that will automatically highlight non-ASCIIs as soon as either a vimscript or a Python file is loaded in buffer (i.e. any file with filetype '...
0
votes
1answer
409 views

Change working directory color in NERDTree

Is there any ways to change the font color and background of the working directory as seen in Sublime text? Sublime Text Neovim with NERDTree
3
votes
1answer
105 views

Get immediate feedback about a search string with no matches in vim

Is there a way to immediately get feedback about a search string with no matches? At the moment I have to press Enter first to get Pattern not found. I'd like if the background (of the search line or ...
0
votes
1answer
121 views

Fold: highlight folded text only

I expected the folded text highlighted as below picture (ignore red rectangle): Like above picture, I'd like to have something to recognize that red region of a fold and highlight it only, donot have ...
1
vote
1answer
174 views

Vim highlighting in textfiles

I am a relative new user to vim. I started using it along with a newly set up arch installation. So when I created different netctl profiles in vim, it highlighted the parameters like shown in the ...
3
votes
4answers
2k views

How to show illegal whitespace (such as unbreakable space) in source code?

I sometimes type (by accident) shift-space, inserting unbreakable space into code. With c++, I get this: error: stray ‘\302’ in program error: stray ‘\240’ in program while in other formats (like ...
6
votes
4answers
1k views

How to highlight/match (but not search!) the word under cursor

I am searching some pattern, navigate between search results, and at the same time I want some other pattern to be highlighted. For example, I jump between invocations of some function in my project, ...
3
votes
1answer
58 views

Highlighting only in a certain file

At every opening of a special file I want vim to automatically highlight all the lines, where the 7th character is a 1. How do I do that?
1
vote
1answer
339 views

Does `hi link XXX Normal` provide any benefits?

Does hi link XXX Normal provide any benefits? For example the syntax file included by default syntax/vim.vim includes the line: hi def link vimUserFunc Normal This often conflicts with CursorLine ...
0
votes
2answers
240 views

Priority highlighting

In my code, something like #include <whatever> is highlighted: #include (which belongs to the group 'cInclude') in pink; and <whatever> (belonging to the group 'cIncluded') in red. (Edit:...
1
vote
1answer
369 views

How can I change the colors used for highlight search matches?

When I do a search within VIM the found text is highlighted in yellow with white letters. For my eyes it is impossible to distinguish the text highlighted. I am looking for the way to change those ...
1
vote
0answers
25 views

Highlight semicolmns when editting lua files [duplicate]

I program in both C and Lua and therefore sometimes add a semicolmn in my Lua files. This is allowed by the standard, but my company's guidelines forbid semicolmns in lua code. Therefore, I would like ...
1
vote
0answers
349 views

CursorLineNR highlight not working

I have a vim configuration file (~/.vimrc) with the following settings: colo delek syntax on highlight clear CursorLine highlight clear CursorLineNR highlight clear LineNR highlight LineNR cterm=...
0
votes
1answer
51 views

How to apply a custom highlight file?

I'm playing with Vim highlight, so I made the following (syntax.vim): hi Comment ctermfg=DarkGray hi LineNR ctermfg=DarkGray hi CursorLineNR ctermfg=Red hi String ctermfg=Gray hi PreProc ctermfg=...
1
vote
1answer
406 views

How to change Operator highlight color in Vim?

I just switched to iTerm2 on macOS and found some of its options go to Vim as well. That's the case for fonts, I was able to select a Vim font that I like from iTerm options. It seems iTerm color ...
1
vote
2answers
530 views

Turn off syntax hilighting for TODO items

I want to turn off the syntax highlighting for TODO items, like TODO and FIXME. How can I achieve this?
5
votes
2answers
1k views

Vim lost custom highlight settings after recovering from sessions

I defined some highlights in the vimrc file and it works well in gvim. However after I mksession and sourced it back, I found that some (maybe all) of the custom highlights were lost and vim used the ...