diff --git a/functions/vim.zsh b/functions/vim.zsh new file mode 100644 index 0000000..89e0328 --- /dev/null +++ b/functions/vim.zsh @@ -0,0 +1,12 @@ +# open vim with a scratch window that can be discarded on exit. +vimscratch() { + local args + # if running in a pipe, use stdin (-) as arg. + # -t checks if the given FD is a terminal + if [ -t 0 ] ; then + args="$@" + else + args="-" + fi + vim -c "set buftype=nofile" "$args" +}