Skip to content
Open
Changes from all commits
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
14 changes: 8 additions & 6 deletions lib/core/smartcd
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ function _smartcd() {
local _old_ifs="$IFS"
IFS=$' \t\n'
if [[ -z $smartcd_skip_action ]]; then
_smartcd_skip_chpwd=1
if [[ -n $1 ]] || [[ -z ${1-_} ]]; then
if [[ -n $ZSH_VERSION ]]; then
${=action} "$@"
Expand All @@ -444,6 +445,7 @@ function _smartcd() {
else
eval $action
fi
unset _smartcd_skip_chpwd
fi
local rv=$?
IFS="$_old_ifs"
Expand Down Expand Up @@ -757,13 +759,13 @@ function _smartcd() {
}

function _smartcd_hook() {
local cwd="$(pwd)"

# Skip this if we already ran smartcd for this directory
if [[ "x$cwd" != "$_smartcd_last_run_for" ]]; then
local smartcd_skip_action=1
_smartcd true "$cwd"
# Skip this if we are being invoked from _smartcd.
if [[ -n "$_smartcd_skip_chpwd" ]]; then
return
fi

local smartcd_skip_action=1
_smartcd true $PWD
}

function _smartcd_prompt_hook() {
Expand Down