Improve bash completions
This commit is contained in:
parent
8d3d6d8bcf
commit
83946ab63a
|
|
@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fish: not providing `cd` completions when there is a space in the path.
|
- Fish: not providing `cd` completions when there is a space in the path.
|
||||||
- Fish: providing `z` completions when the preceding argument starts with `z!`.
|
- Bash/Fish: providing `z` completions when the last argument starts with `z!`.
|
||||||
|
- Bash/Fish: attempting to `cd` when the last argument is `z!`.
|
||||||
|
|
||||||
## [0.9.0] - 2023-01-08
|
## [0.9.0] - 2023-01-08
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ function __zoxide_z() {
|
||||||
__zoxide_cd "${OLDPWD}"
|
__zoxide_cd "${OLDPWD}"
|
||||||
elif [[ $# -eq 1 && -d $1 ]]; then
|
elif [[ $# -eq 1 && -d $1 ]]; then
|
||||||
__zoxide_cd "$1"
|
__zoxide_cd "$1"
|
||||||
elif [[ ${@: -1} == "${__zoxide_z_prefix}"* ]]; then
|
elif [[ ${@: -1} == "${__zoxide_z_prefix}"?* ]]; then
|
||||||
# shellcheck disable=SC2124
|
# shellcheck disable=SC2124
|
||||||
\builtin local result="${@: -1}"
|
\builtin local result="${@: -1}"
|
||||||
__zoxide_cd "{{ "${result:${#__zoxide_z_prefix}}" }}"
|
__zoxide_cd "{{ "${result:${#__zoxide_z_prefix}}" }}"
|
||||||
|
|
@ -130,7 +130,7 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER
|
||||||
\builtin compgen -A directory -- "${COMP_WORDS[-1]}" || \builtin true
|
\builtin compgen -A directory -- "${COMP_WORDS[-1]}" || \builtin true
|
||||||
)
|
)
|
||||||
# If there is a space after the last word, use interactive selection.
|
# If there is a space after the last word, use interactive selection.
|
||||||
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
elif [[ -z ${COMP_WORDS[-1]} ]] && [[ ${COMP_WORDS[-2]} != "${__zoxide_z_prefix}"?* ]]; then
|
||||||
\builtin local result
|
\builtin local result
|
||||||
# shellcheck disable=SC2312
|
# shellcheck disable=SC2312
|
||||||
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -i -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" &&
|
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -i -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue