gvim not highlighting searched word where cursor is located - search

I just switched to vim 9.0 in Windows and I'm getting a behavior with text search highlighting that seems to be specific to version 9.0 (it wasn't there in 8.2). If I highlight a searched term in gvim, multiple instances of that term will show up highlighted, except for the instance where my cursor is.
In the following screengrab, the cursor is on the searched word in the first line, and its inverse red highlighting disappears:
.
When I move the cursor to the next line, the missing highlight switches to line 2:
.
This is very annoying. If I do a complicated search with wildcards, having the text highlighted where my cursor is shows an immediate visual indicator of whether the search is successful or not. Without this, I'd have to look for an error message at the bottom of the window.
How can I disable this weird behavior and have the highlight show up on the searched text where the cursor is currently at?

I'm searching fix for this issue too. For now I find, that trouble connected with colorscheme. Try :colorscheme . For me it fix this problem. But I doesn't found how to fix it without hand set.

Related

How do I enable highlight on the scroll bar displayihng the occurences of a search result in VIM?

When searching for a pattern within file/files in vim, I will like to show the match on the right hand scroll bar, so that I know the locations of the matches within the file and I could simply scroll with my mouse to the match location (similar to visual studio). Any advice on how to do this will be much appreciated.
I tried to google search on this, but answers are normally related to showing the search results at the bottom panel, but this is not what I am looking for.
The expected result should show highlights on the scroll bar on the right.
In the terminal, Vim does not provide a scrollbar (there is :set ruler and the statusline to provide orientation). In graphical GVIM, the default scrollbars provided by the operating system / window manager are used.
To give you orientation for searches, recent Vim 8.1 versions can give search statistics (e.g. [1/5]), enabled via :set shortmess-=S. Plugins like my SearchPosition plugin can give you much more detailed information:
1 match after cursor in this line, 8 following, 2 in previous lines; ~
total 10 within 11,42 for /\<SearchPosition\>/ ~

How can I enable a see-through block cursor in vim/my terminal?

While in command mode in vim, I can't see through my cursor.
For example, the gibberish text
nuhsantoheun renders as:
I can solve this by enabling a blinking cursor in my terminal emulator settings, however I'd like to find some sort of cursor that, rather than blinking, simply shows a highlighted or reverse-highlighted letter.
Solved this while writing the question, so figured I might as well leave it up here to help out someone else.
In your terminal editor, simply set your cursor color to be something other than your text color, which produces the desired behavior:

Vim spell check automatically splits the screen

I typed z= underneath a misspelled word, and vim split the screen horizontally, thereby keeping the misspelled word in context, but also providing a list words to change the misspelled word from. Usually, this latter screen replaces the former screen when I hit z=.
I like this behavior, but can not replicate it. I must have hit something before z= but I do not know what.
The behavior you saw accidentally happens when there are only a few suggestions and they don't fill the entire window.
You can force a maximum size for the suggestion list (example: 20 suggestions) with
set spellsuggest=best,20
Now, as long as your window exceeds 20 lines, you will see the misspelled word in context, and the bottom 20 lines of your window filled with the suggestion list
I can't say what caused the behavior you saw, maybe it is some plugin.
But here are two options to stay in the context with spellchecker:
1) Use CTRL-X s in insert mode:
In Insert mode, when the cursor is after a badly spelled word, you can use
CTRL-X s to find suggestions. This works like Insert mode completion. Use
CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s|
2) Use vimple plugin which turns few full-screen windows (including spell suggestions) into "overlays" (actually split windows where you can select the word you need).

vim editor error color

I am using Vim 7.3 on Ubuntu. Problem is - whenever I got some error in my code, that error is marked with white color. I can't see anything underneath that color. So if I have typo error (missing one brace) it will mark that brace with white, but I wont be able to see that mistake ( it is covered with color ). Sometimes it marks all line. I am using Molokai color scheme.
I tried to change color scheme, but nothing happens. I suppose that error color is coming from the vim native settings.
Any ideas how to fix this?
The
:hi
command lists all defined highlightings. Find the one with the white color (for errors, this should be Error), and change it (see :help :highlight) in your ~/.vimrc, e.g.:
:hi Error ctermfg=Red guifg=Red
If highlighting is the issue, then you can easily and quickly turn off all highlighting by typing ":noh" (without the quotes) from command mode. This will temporarily turn off highlighting. This also works for getting rid of highlighting after a search (which really annoys me because like your problem here, I can't read the text when it's highlighted).
If you haven't already, you should create a file in your home directory named ".vimrc", so pathing it out would be "~/.vimrc". This is the what #mtk is referring to (just in case you don't know that already. Some people at work use Vim but don't know about the .vimrc file).

VIM: Stay away from the edges on searches

I recently saw some VIM configuration where search matches would scroll to N lines past the match, so that there would be N lines below the search match instead of it being on the last line (to give context). I cannot find the page where this was mentioned, and apparently I do not know the right keywords to google for!
What is this feature called, and how could I have used the VIM manual to find it assuming that I don't know what it is called?
Thanks.
As far as I tell this can't be set just for search, but is a setting that will be used in all situations.
You are looking for scrolloff: Minimal number of screen lines to keep above and below the cursor. This will make some context visible around where you are working. sidescrolloff does the same thing but horizontally.
This is what I have in my .vimrc:
" When the page starts to scroll, keep the cursor 8 lines from the top and 8
" lines from the bottom and 15 lines on the left
set scrolloff=8
set sidescrolloff=15
set sidescroll=1

Resources