functions: allow arguments in vimscratch

fix-ci
bretello 2023-09-25 12:39:24 +02:00
parent cff20cef16
commit 125a4e7aed
1 changed files with 5 additions and 5 deletions

View File

@ -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
}