diff --git a/templates/bash.txt b/templates/bash.txt index 5aa15ea..7f042b5 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -8,16 +8,16 @@ # pwd based on the value of _ZO_RESOLVE_SYMLINKS. function __zoxide_pwd() { {%- if resolve_symlinks %} - pwd -P + \builtin pwd -P {%- else %} - pwd -L + \builtin pwd -L {%- endif %} } # cd + custom logic based on the value of _ZO_ECHO. function __zoxide_cd() { # shellcheck disable=SC2164 - cd "$@" {%- if echo %} && __zoxide_pwd {%- endif %} + \builtin cd "$@" {%- if echo %} && __zoxide_pwd {%- endif %} } {{ SECTION }} @@ -36,7 +36,7 @@ function __zoxide_hook() { {%- when Hook::Pwd %} function __zoxide_hook() { - local -r __zoxide_pwd_tmp="$(__zoxide_pwd)" + \builtin local -r __zoxide_pwd_tmp="$(__zoxide_pwd)" if [ -z "${__zoxide_pwd_old}" ]; then __zoxide_pwd_old="${__zoxide_pwd_tmp}" elif [ "${__zoxide_pwd_old}" != "${__zoxide_pwd_tmp}" ]; then @@ -72,20 +72,20 @@ function __zoxide_z() { __zoxide_cd "${OLDPWD}" else # shellcheck disable=SC2016 - echo 'zoxide: $OLDPWD is not set' + \builtin echo 'zoxide: $OLDPWD is not set' return 1 fi elif [ "$#" -eq 1 ] && [ -d "$1" ]; then __zoxide_cd "$1" else - local __zoxide_result + \builtin local __zoxide_result __zoxide_result="$(zoxide query -- "$@")" && __zoxide_cd "${__zoxide_result}" fi } # Jump to a directory using interactive search. function __zoxide_zi() { - local __zoxide_result + \builtin local __zoxide_result __zoxide_result="$(zoxide query -i -- "$@")" && __zoxide_cd "${__zoxide_result}" } @@ -124,9 +124,9 @@ function __zoxide_zri() { # Remove definitions. function __zoxide_unset() { # shellcheck disable=SC1001 - \unset -f "$@" &>{{ Opts::DEVNULL }} + \builtin unset -f "$@" &>{{ Opts::DEVNULL }} # shellcheck disable=SC1001 - \unset -v "$@" &>{{ Opts::DEVNULL }} + \builtin unset -v "$@" &>{{ Opts::DEVNULL }} } __zoxide_unset '{{cmd}}' diff --git a/templates/posix.txt b/templates/posix.txt index 815f770..9789818 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -2,7 +2,7 @@ {%- let NOT_CONFIGURED = "# -- not configured --" -%} {%- if hook == Hook::Pwd -%} -echo "\ +\echo "\ zoxide: PWD hooks are not supported on POSIX shells. Use '--hook prompt' when initializing zoxide." @@ -15,16 +15,16 @@ zoxide: PWD hooks are not supported on POSIX shells. # pwd based on the value of _ZO_RESOLVE_SYMLINKS. __zoxide_pwd() { {%- if resolve_symlinks %} - pwd -P + \pwd -P {%- else %} - pwd -L + \pwd -L {%- endif %} } # cd + custom logic based on the value of _ZO_ECHO. __zoxide_cd() { # shellcheck disable=SC2164 - cd "$@" {%- if echo %} && __zoxide_pwd {%- endif %} + \cd "$@" {%- if echo %} && __zoxide_pwd {%- endif %} } {{ SECTION }} @@ -76,7 +76,7 @@ __zoxide_z() { __zoxide_cd "${OLDPWD}" else # shellcheck disable=SC2016 - echo 'zoxide: $OLDPWD is not set' + \echo 'zoxide: $OLDPWD is not set' return 1 fi elif [ "$#" -eq 1 ] && [ -d "$1" ]; then diff --git a/templates/zsh.txt b/templates/zsh.txt index 97c5d76..7d9fbe6 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -8,15 +8,15 @@ # pwd based on the value of _ZO_RESOLVE_SYMLINKS. function __zoxide_pwd() { {%- if resolve_symlinks %} - pwd -P + \builtin pwd -P {%- else %} - pwd -L + \builtin pwd -L {%- endif %} } # cd + custom logic based on the value of _ZO_ECHO. function __zoxide_cd() { - cd "$@" {%- if echo %} && __zoxide_pwd {%- endif %} + \builtin cd "$@" {%- if echo %} && __zoxide_pwd {%- endif %} } {{ SECTION }} @@ -56,20 +56,20 @@ function __zoxide_z() { if [ -n "$OLDPWD" ]; then __zoxide_cd "$OLDPWD" else - echo "zoxide: \\$OLDPWD is not set" + \builtin echo 'zoxide: \$OLDPWD is not set' return 1 fi elif [ "$#" -eq 1 ] && [ -d "$1" ]; then __zoxide_cd "$1" else - local __zoxide_result + \builtin local __zoxide_result __zoxide_result="$(zoxide query -- "$@")" && __zoxide_cd "$__zoxide_result" fi } # Jump to a directory using interactive search. function __zoxide_zi() { - local __zoxide_result + \builtin local __zoxide_result __zoxide_result="$(zoxide query -i -- "$@")" && __zoxide_cd "$__zoxide_result" } @@ -107,9 +107,9 @@ function __zoxide_zri() { # Remove definitions. function __zoxide_unset() { - \unalias "$@" &>{{ Opts::DEVNULL }} - \unfunction "$@" &>{{ Opts::DEVNULL }} - \unset "$@" &>{{ Opts::DEVNULL }} + \builtin unalias "$@" &>{{ Opts::DEVNULL }} + \builtin unfunction "$@" &>{{ Opts::DEVNULL }} + \builtin unset "$@" &>{{ Opts::DEVNULL }} } __zoxide_unset '{{cmd}}'