Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

Not looking for the help file, more for the motivation why would one use these commands?

like image 806
Matt Briggs Avatar asked Jun 09 '11 00:06

Matt Briggs


2 Answers

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. :-)

like image 130
Johnsyweb Avatar answered Sep 23 '22 07:09

Johnsyweb


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.

like image 42
Andrew Harrison Avatar answered Sep 26 '22 07:09

Andrew Harrison