commit 52af23245b3b8656a65a818c1cbac351b2574143 parent 9a5116dc7b45aa631dfe11e1df6ddcea2aeefdd0 Author: Antoine Amarilli <a3nm@a3nm.net> Date: Tue, 13 Apr 2021 22:19:29 +0200 vim-pipe Diffstat:
vim-pipe | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/vim-pipe b/vim-pipe @@ -0,0 +1,19 @@ +#!/bin/bash + +# pipe a file into a script and edit it with vim +# (meant to be used as $EDITOR) +# $1 is the script through which we want to pipe +# ${!#} is the file +# $2 ... ${!#} are passed to vim +# hence, setting "vim-pipe foo bar baz" as $EDITOR is really like +# setting "vim bar baz" except that everything will get piped through +# foo first + +set -v +ls -l ${!#} +echo "params are $*" +cat ${!#} | $1 > ${!#}.tmp +cp ${!#}.tmp ${!#} +shift +vim $* +