In my pursuit to migrate from Vim to Emacs, I have stumbled on yet another roadblock.
When working with files that contain special whitespace characters, Vim/Neovim would automatically highlight these. This saved me a lot of time during debugging or data analysis, and is a functionality that I struggled to get to work on more modern IDEs.
However, this does not work out-of-the-box neither on vanilla Emacs nor Doom Emacs. I am unable to find any working solutions online. I assumed whitespace-mode
would have handled this, but it is not the case.
It would be really helpful if the community here can help solve my problem as I deal with such characters on a daily basis. Until then, I have to pause my pursuit and stick with the trusty Neovim.
U+200B in Neovim
Notice Neovim highlighting the character as <200B>
.
U+200B in Doom Emacs
Notice the think cursor between "hello" and "world".
Thanks to the suggestion by @nmtake@lemm.ee, glyphless-display-mode
allows me to view the characters. But it still doesn't play well with vim motions on Emacs.
Here is a demonstration, and below are the keystrokes.
C-v
to enable VISUAL-BLOCK
mode.
9j
to select all 9 occurrences.
d
to delete the selection.
The above vim-motion works on Neovim but not on Emacs with evil-mode.
If anyone wants to try out here is the text I am playing with:
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
Thanks again! I already have shell scripts to take care of such characters for me, which operate on entire files. Having a function like this would help for certain regions of a file. :-)
However, it does bug me a bit that some vim motions do not work exactly as intended. Going in, I knew evil-mode would have some gaps. But I assumed those would be some esoteric operations, and not something that I use daily.