Skip to content

Commit

Permalink
Add support for $TMPDIR on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbassi committed Feb 4, 2019
1 parent 8b07d50 commit f1886b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions vimclip
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ if ! [ -x "$(command -v $EDITOR)" ]; then
exit 1
fi

if [ -z $TMPDIR ]; then
TMPDIR=/tmp
fi
mkdir -p $TMPDIR/vimclip

if [ "Darwin" = $(uname -s) ]; then
if ! [ -x "$(command -v pbcopy)" ]; then
echo 'Error: pbcopy is not available.' >&2
exit 1
fi

if [ -z $TMPDIR ]; then
TMPDIR=/tmp
fi
mkdir -p $TMPDIR/vimclip
TMP=$(mktemp -t vimclip/vimclip)
$EDITOR $TMP
pbcopy < $TMP
Expand All @@ -24,7 +25,6 @@ else
exit 1
fi

mkdir -p /tmp/vimclip
TMP=$(mktemp -p /tmp/vimclip -t vimclip.XXXXXXXX)
$EDITOR $TMP
xsel -i -b < $TMP
Expand Down

0 comments on commit f1886b5

Please sign in to comment.