Is there an equivalent to whitespace-mode in emacs for vim?

Is there a way I can see spaces and tabs wonderfully visualized in vim, like I can in emacs by toggling whitespace-mode?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

:set list

This will show you whitespace characters like tabs and EoLs. It won’t show spaces, however; to my knowledge that’s not possible (except for non-breaking and trailing spaces), although in a monospace font any “space” that’s not a tab would obviously be a space.

You can change the characters vim uses with the listchars option; type :help listchars to learn more about how to use that and what your options are.

This is what I use in my .vimrc file:

" Set some nice character listings, then activate list
execute 'set listchars+=tab:\ ' . nr2char(187)
execute 'set listchars+=eol:' . nr2char(183)
set list

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply