mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

vim-pipe (445B)


      1 #!/bin/bash
      2 
      3 # pipe a file into a script and edit it with vim
      4 # (meant to be used as $EDITOR)
      5 # $1 is the script through which we want to pipe
      6 # ${!#} is the file
      7 # $2 ... ${!#} are passed to vim
      8 # hence, setting "vim-pipe foo bar baz" as $EDITOR is really like
      9 # setting "vim bar baz" except that everything will get piped through
     10 # foo first
     11 
     12 set -v
     13 ls -l ${!#}
     14 echo "params are $*"
     15 cat ${!#} | $1 > ${!#}.tmp
     16 cp ${!#}.tmp ${!#}
     17 shift
     18 vim $*
     19