Skip to content

Instantly share code, notes, and snippets.

@mattn
Created February 17, 2015 07:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/6ee07f69983d7043d63d to your computer and use it in GitHub Desktop.
Save mattn/6ee07f69983d7043d63d to your computer and use it in GitHub Desktop.
#!/bin/bash
unset tmpfile
trap "[ -f $tmpfile ] && rm -f $tmpfile" 1 2 3 15
tmpfile=$(mktemp 2>/dev/null||mktemp -t tmp)
if [ "$#" -eq 0 ]; then
cat > $tmpfile
vim -c 'silent! normal! ggVG=ZZ' $tmpfile 2> /dev/null
else
vim -c 'silent! normal! ggVG=ZZ' $1 2> /dev/null
fi
rm -f $tmpfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment