I\'d like to use Vim in the middle of a pipe. This existing post looks like what I\'d like to do, except I was hoping to do it without Python\'s help -- only with bash. [It it
Take a look at vipe
which is part of moreutils. It allows you to use any editor as part of a pipe.
ls -al | vipe | less
To use it with vim
just make sure to set it as your default editor in your bashrc
or cshrc
or whatever shell you use.
EDITOR=vim
UPDATE: If you want a bash
only solution you could use a script like this
#!/bin/bash
# create temporary file
TMPFILE=`mktemp /tmp/vipe.bashXXXXXXXX`
cat > ${TMPFILE}
vim ${TMPFILE} < /dev/tty > /dev/tty
cat ${TMPFILE}
rm ${TMPFILE}
For a more portable version please replace
vim ${TMPFILE}
with
${EDITOR} ${TMPFILE}