Mark special characters

21 views
Skip to first unread message

Igor

unread,
May 22, 2024, 8:25:40 AMMay 22
to vim_use
Hi,
I use latest vim v9.1.0429 on Windows 11.

In the file I have received I was convinced there are spaces between words, but there were some special characters and so when I tried to execute the commands in my cmd I have got very strange syntax errors. Probably some special character has been copied from Microsoft Word.

I would like to distinguish normal spaces with characters that are in vim displayed as spaces, but are some non-space characters. Is there a way to display those characters so that I will spot them as special characters?

Regards

Christian Brabandt

unread,
May 22, 2024, 9:00:59 AMMay 22
to vim...@googlegroups.com
Someone shared the following on the list a few years ago
https://groups.google.com/g/vim_use/c/FuEGojGwKCM/m/V1K8VAWWKrEJ

and since then I have it in my .vimrc even so I should probably change
it to a WinEnter autocommand.

" Highlight special white space
hi def link WhiteSpaceError Error
match WhiteSpaceError /[\x0b\x0c\u00a0\u1680\u180e\u2000-\u200a\u2028\u202f\u205f\u3000]/

Thanks,
Christian
--
Almost anything derogatory you could say about today's software design
would be accurate.
-- K. E. Iverson

Marvin Renich

unread,
May 22, 2024, 11:14:55 AMMay 22
to vim...@googlegroups.com
* Christian Brabandt <cbl...@256bit.org> [240522 09:01]:
> On Mi, 22 Mai 2024, Igor wrote:
> > I would like to distinguish normal spaces with characters that are in
> > vim displayed as spaces, but are some non-space characters. Is there a
> > way to display those characters so that I will spot them as special
> > characters?
>
> Someone shared the following on the list a few years ago
> https://groups.google.com/g/vim_use/c/FuEGojGwKCM/m/V1K8VAWWKrEJ
>
> and since then I have it in my .vimrc even so I should probably change
> it to a WinEnter autocommand.

Why WinEnter? Won't that set this much more often than necessary?

> " Highlight special white space
> hi def link WhiteSpaceError Error
> match WhiteSpaceError /[\x0b\x0c\u00a0\u1680\u180e\u2000-\u200a\u2028\u202f\u205f\u3000]/
>
> Thanks,
> Christian
> --
> Almost anything derogatory you could say about today's software design
> would be accurate.
> -- K. E. Iverson
^^^^^^^^^^^^^
Are you an APL fan?

...Marvin

Reply all
Reply to author
Forward
0 new messages