Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Store temp files in /tmp/vimclip/ (Close #5) #8

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions vimclip
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if [ "Darwin" = $(uname -s) ]; then
exit 1
fi

TMP=$(mktemp -t vimclip)
mkdir -p /tmp/vimclip
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the mac machine I tested, $TMPDIR is not /tmp. So this doesn't work.

mkdir -p $TMPDIR/vimclip
mktemp -t vimclip/vimclip

should work, but I don't know if we can assert $TMPDIR to be set. Probably we need to check it first and default to /tmp if it isn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a check for $TMPDIR and defaulted to /tmp if it's unset. Let me know if it works for you now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks. Looks like it should work -- I'll be able to test on MacOS tomorrow again. Could you do the same check for $TMPDIR on Linux?

TMP=$(mktemp -t vimclip/vimclip)
$EDITOR $TMP
pbcopy < $TMP
else
Expand All @@ -20,7 +21,8 @@ else
exit 1
fi

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