开发者

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

开发者 https://www.devze.com 2023-03-11 19:46 出处:网络
Not开发者_JAVA技巧 looking for the help file, more for the motivation why would one use these commands?I don\'t recall ever using :list in over a dozen years of Vim use.

Not开发者_JAVA技巧 looking for the help file, more for the motivation why would one use these commands?


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.


I think those are simply old Ex commands, originating from the original vi. It’s useful if you use Ex mode often (see :help Ex-mode). But I use them very seldom.

0

精彩评论

暂无评论...
验证码 换一张
取 消