Prior to version 8.1.0271, in order to preview searches in this way you have to adjust your workflow slightly.
First, set up your regular expression by using a normal search, during which highlighting will be active:
Then, you can re-use the regular expression from your search command by leaving the field blank in your substitute ...
This is done by setting just two options: set is hls (incremental search and highlight all matches).
Make sure you've also read the appropriate help topics, excerpted below: :h 'is'
While typing a search command, show where the pattern, as it was typed
so far, matches. The matched string is highlighted. If the pattern
is invalid or not found, ...
You can try hiding it using
hi! VertSplit guifg=black guibg=black ctermfg=black ctermbg=black
Instead of black use color of your terminal or colorscheme background (not sure about various fancy terminals out there)
NOTE: vert:\ the space at the end.
It also works with windows terminal (preview):
(you have to set fillchars, though)
While you have fixed VertSplit highlighting I don't see anywhere here the replacement of the actual vert 'fillchar' value. We know removing it doesn't help as it will fall back to a default value but this seems to me to be a sufficient workaround:
:set fillchars=vert:\ ,..the rest..
(That's an escaped Space char.)
it seems like its impossible to completely remove the fillchars
You can't really remove it, but you can make it invisible:
" must be before setting your colorscheme
augroup nosplit | au!
autocmd ColorScheme * hi VertSplit ctermfg=bg guifg=bg
This is happening because Vim's HTML syntax will use style htmlHead to the text within the <head> block and it will link it to syntax group PreProc. (The PreProc group is meant for pre-processor directives, such as #include or #define in C/C++.)
The slate colorscheme uses a white background (guibg=white) for the PreProc group, so it ends up styling ...
As far as I know, this isn’t possible. However, I found this neat mini-plugin in Paul Irish’s vimrc which does something close to what you’re looking for. As it stands, it highlights occurrences of the current word but I’m sure it could be updated to highlight a given string. Just add it to your vimrc and hit 1-6 to highlight the word under cursor in various ...
I wrote a little plugin many years ago, and still use it.
Previous versions used :syntax but the last iteration uses :match so it might bug you if you wanted to use :match yourself.
When you land on a word it will highlight other occurrences of that word. But if you move the cursor and are still on the same word, it will ...
:h :highlight is used to define highlight group. What you want is the :h :match , :h matchadd() families.
This is how I will do it.
Highlight arbitary area without staying in visual mode, all wise type should be supported.
How to do it
The job can be split into three main parts:
Select arbitary area:
There are two ways to select arbitary area in ...
Finding an "easy" way.
The idea is to drop to linewise Visual mode and then get back restoring the command-line contents.
" some regex magic to match a range pattern:
" . or $ or % or number or mark or /pat/ or ?pat? or \/ or \? or \&
" optionally followed by ++/--number
let s:pat = '([.$%]|\d+|''[[:alnum:]''\[\]]|/.*/|\?.*\?|\[/?&])?([+-]+\d*)?'
It's a bit complicated, I'll try to explain it in different abstraction levels.
our goal is simple:
update command range highlight after entering command line
update command range highlight while typing in command line
clear command range highlight when leaving command line
We will use :h CmdlineEnter , :h CmdlineChanged , and :h ...
My SearchHighlighting plugin is one of those "visual star" plugins that @D.BenKnoble mentions in his answer; it also has a command that does exactly what you're asking for: