You can use :w !cmd to write the current buffer in stdin of an external command. From :help :w_c :
: [range] w [rite] [++ opt]! {cmd}
Execute {cmd} using the [range] lines as standard input (note the space in front of '!' ). {cmd} is executed as with ":!{cmd}" , any '!' replaced by the previous command |:!| .
Associated command :%!cmd , which does the same and then replaces the current buffer with the output of the command. Therefore :%!sort will call an external sort command to sort the current buffer.
John Kugelman Oct 23 '11 at 16:22 2011-10-23 16:22
source share