Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
Please describe the features you want. Not only because vim users may not be familiar with Emacs features, but also because there may be partial answers that cover some of the features of whitespace-mode. And there are in fact several whitespace-mode's floating around, so which one do you mean anyway? – Gilles Mar 31 '11 at 23:19
up vote 9 down vote accepted

: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
share|improve this answer
Woot! That's just like cat -vET trick that one of the old-timer UNIX guys uses at my work, but better, using Vim! – penguin359 Apr 1 '11 at 9:13
If you really want to visually indicate space characters, you could do this with syntax highlighting. – intuited Apr 1 '11 at 11:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.