What is the purpose of the ‘:list’ and ‘:print’ commands in Vim?

I don't recall ever using :list in over a dozen years of Vim use.

:print I use often in this form:

:g/re/p

Where re is a regular expression. Handy for seeing where a string appears in a file without having to move through it.

:list looks neat, though. Perhaps I should :s/p/l/ in the previous command. :-)


I use :print occasionally when I want to print only a chunk of code. If you have a block of text being visually selected, the command will operate only on what is selected.

The :list command does the same thing, but makes an effort to output things like control characters in a more readable fashion.

Tags:

Vim