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 0cb0795
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 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,8 +25,7 @@ else
exit 1
fi

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

0 comments on commit 0cb0795

Please sign in to comment.