Putting Shell Output In The Current Buffer

I’ve long used 【Meta+|】 to pipe a region to a shell command. I use it all the time to pipe troff input to groff and display the results with gxditview. Recently I learned that if you specify a prefix arg it will place the results in the current buffer. The easiest way to do that is simply to type 【Meta+1 Meta+|】. The same trick works with 【Meta+!】. For example, if I want to insert a directory listing into the current buffer I could type 【Meta+1 Meta+!ls.

Summary of Key Sequences

  • Meta+|
    Pipe the highlighted region to a shell command and place the output in a ∗Shell Command Output∗ buffer.
  • Meta+1 Meta+|
    Pipe the highlight region to a shell command and place the output in the current buffer.
  • Meta+!
    Run a shell command and place the output in a ∗Shell Command Output∗ buffer.
  • Meta+1 Meta+!
    Run a shell command and place the output in the current buffer.

Update: prefix tag → prefix arg

This entry was posted in General and tagged . Bookmark the permalink.