mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 03:21:30 +01:00
functions: allow arguments in vimscratch
This commit is contained in:
parent
cff20cef16
commit
125a4e7aed
|
@ -1,12 +1,12 @@
|
||||||
# open vim with a scratch window that can be discarded on exit.
|
# open vim with a scratch window that can be discarded on exit.
|
||||||
vimscratch() {
|
vimscratch() {
|
||||||
|
set -x
|
||||||
local args
|
local args
|
||||||
# if running in a pipe, use stdin (-) as arg.
|
# if running in a pipe, use stdin (-) as arg.
|
||||||
# -t checks if the given FD is a terminal
|
# -t checks if the given FD is a terminal
|
||||||
if [ -t 0 ] ; then
|
if [ ! -t 0 ] ; then
|
||||||
args="$@"
|
stdin_arg="-"
|
||||||
else
|
|
||||||
args="-"
|
|
||||||
fi
|
fi
|
||||||
vim -c "set buftype=nofile" "$args"
|
vim -c "set buftype=nofile" $@ $stdin_arg
|
||||||
|
set +x
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user