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
RFE: support a variant of _ZO_ECHO
that only echoes if zoxide logic kicked in
#765
Comments
zoxide is designed to be hackable. It's fairly easy to build something like this by replacing the underlying command - you inspect the result of For example, for zsh: function __zoxide_z() {
# shellcheck disable=SC2199
if [[ "$#" -eq 0 ]]; then
__zoxide_cd ~
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
__zoxide_cd "$1"
else
\builtin local result
# shellcheck disable=SC2312
- result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" && __zoxide_cd "${result}"
+ result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" && \
+ echo "{result}" && \
+ __zoxide_cd "${result}"
fi
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using
--cmd cd
to make zoxide take over mycd
.It would be helpful when navigating around to more easily tell when zoxide jumped to a directory rather than just having passed a valid path to
cd
into.E.g. if I
cd foo
, if there actually is afoo
directory, then don't echo. If there isn't but one was found in the database, then do echo. By only printing in the latter case, it makes it easier to tell when zoxide logic kicked in and whether that matched my expectation. For example, if I typo'ed a local directory, I would be surprised to see the echo and realized what had happened more easily.The text was updated successfully, but these errors were encountered: