Tasty VIM Morsel
Sep 26, 2006 | Computers | By Shawn Parker
I just learned a nice little bit on using VIM and feel the need to share.
When using vim you can insert the contents of command line output by using the
:r! ls /etc/httpd
would insert the directory list of the
:r! cat file.txt
would insert the contents of
file.txt and insert it into the current file.
:r! man cd | col -b
would insert a clean verson of the MAN page for the
col -b is needed to strip special line breaks that man pages contain.
:r! php file.php
would insert the output of the PHP script into the current file.
I can probably stop providing examples now. Handy freakin’ dandy! I dig it.
Tagged as: command, insert, line, output, vim