From 125a4e7aed80528443b5a3424b6135e923a2b939 Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 25 Sep 2023 12:39:24 +0200 Subject: [PATCH] functions: allow arguments in vimscratch --- functions/vim.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/vim.zsh b/functions/vim.zsh index 89e0328..4726f96 100644 --- a/functions/vim.zsh +++ b/functions/vim.zsh @@ -1,12 +1,12 @@ # open vim with a scratch window that can be discarded on exit. vimscratch() { + set -x 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="-" + if [ ! -t 0 ] ; then + stdin_arg="-" fi - vim -c "set buftype=nofile" "$args" + vim -c "set buftype=nofile" $@ $stdin_arg + set +x }