Skip to content

Commit

Permalink
fix: temp dir creation was corrupted (#146)
Browse files Browse the repository at this point in the history
When `ZVM_TMPDIR` is unset or has no trailing slash, it will introduce some issue.
  • Loading branch information
pschmitt authored Dec 2, 2021
1 parent 95e791c commit 007db23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zsh-vi-mode.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
# the editor to edit your command line (default is $EDITOR)
#
# ZVM_TMPDIR
# the temporary directory (default is $TMPDIR, otherwise it's /tmp/)
# the temporary directory (default is $TMPDIR, otherwise it's /tmp)
#
# ZVM_TERM
# the term for handling terminal sequences, it's important for some
Expand Down Expand Up @@ -312,7 +312,7 @@ fi
: ${ZVM_VI_HIGHLIGHT_FOREGROUND:=#eeeeee}
: ${ZVM_VI_HIGHLIGHT_EXTRASTYLE:=default}
: ${ZVM_VI_EDITOR:=${EDITOR:-vim}}
: ${ZVM_TMPDIR:=${TMPDIR:-/tmp/}}
: ${ZVM_TMPDIR:=${TMPDIR:-/tmp}}

# Set the term for handling terminal sequences, it's important for some
# terminal emulators to show cursor properly (default is $TERM)
Expand Down Expand Up @@ -1747,7 +1747,7 @@ function zvm_range_handler() {
# Edit command line in EDITOR
function zvm_vi_edit_command_line() {
# Create a temporary file and save the BUFFER to it
local tmp_file=$(mktemp ${ZVM_TMPDIR}zshXXXXXX)
local tmp_file=$(mktemp ${ZVM_TMPDIR}/zshXXXXXX)

# Some users may config the noclobber option to prevent from
# overwriting existing files with the > operator, we should
Expand Down

0 comments on commit 007db23

Please sign in to comment.