You can also run shell commands from within vi. The :r! command works like :r, but instead of reading a file, it inserts the output of the given command into the buffer at the current cursor location. For example, if you use the command
you'll end up with
You can also ``shell out'' of vi, in other words, run a command from within vi, and return to the editor when you're done. For example, if you use the command
the ls -F command will be executed, and the results displayed on the screen, but not inserted into the file which you're editing. If you use the command
vi will start an instance of the shell, allowing you to temporarily put vi ``on hold'' while you execute other commands. Just logout of the shell (using the exit command) to return to vi.