Skip to content

Commit

Permalink
sk-find-path で、ファイルパスをクオートで括るのではなくスペースをエスケープするように
Browse files Browse the repository at this point in the history
  • Loading branch information
yantene committed Feb 12, 2020
1 parent cb5da80 commit d46c81d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zsh/basic.zsh
Expand Up @@ -116,13 +116,14 @@ if [[ -x `which sk 2> /dev/null` ]]; then
function sk-find-path() {
local filepath="$( (test -x `which fd 2> /dev/null` && fd -Hc always . || find . 2> /dev/null) | sk)"
[[ -z "$filepath" ]] && return
escaped_filepath=`printf %q "$filepath"`
if [[ -n "$LBUFFER" ]]; then
BUFFER="$LBUFFER '$filepath'"
BUFFER="$LBUFFER $escaped_filepath"
else
if [[ -d "$filepath" ]]; then
BUFFER="cd '$filepath'"
elif [[ -f "$filepath" ]]; then
BUFFER="$EDITOR '$filepath'"
if [[ -f "$filepath" ]]; then
BUFFER="$EDITOR $escaped_filepath"
elif [[ -d "$filepath" ]]; then
BUFFER="cd $escaped_filepath"
fi
fi
CURSOR=$#BUFFER
Expand Down

0 comments on commit d46c81d

Please sign in to comment.