Space under cursor in vim

I recently saw this demo. My question is: how can I show whitespace in vim under the cursor in the form of dots (for example, red).

+3
source share
2 answers

Highlight spaces before and after the cursor

highlight FooBar guibg = # 80a0ff
au CursorMoved *: match FooBar /\s*\%#.\s*/

This works as normal with gvim. To make it work in vim terminal, change guibg to ctermbg. If you want it also in insert mode, change au CursorMovedto

au CursorMoved, CursorMovedI, InsertEnter

, .

regex \%# . . , .

+1

, ; , . listchars, list. , :

set list
set listchars=trail:ยท

hl-SpecialKey; :

hi SpecialKey ctermfg=Red
+10

Source: https://habr.com/ru/post/1741836/


All Articles