Improve zsh completions
This commit is contained in:
parent
a39154e349
commit
85f4928f9b
|
|
@ -18,8 +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.
|
||||||
- Bash/Fish: providing `z` completions when the last argument starts with `z!`.
|
- Bash/Fish/Zsh: providing `z` completions when the last argument starts with `z!`.
|
||||||
- Bash/Fish: attempting to `cd` when the last argument is `z!`.
|
- Bash/Fish/Zsh: attempting to `cd` when the last argument is `z!`.
|
||||||
|
|
||||||
## [0.9.0] - 2023-01-08
|
## [0.9.0] - 2023-01-08
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ function __zoxide_z() {
|
||||||
__zoxide_cd ~
|
__zoxide_cd ~
|
||||||
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
|
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; 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}}" }}"
|
||||||
|
|
@ -88,10 +88,10 @@ if [[ -o zle ]]; then
|
||||||
|
|
||||||
if [[ "{{ "${#words[@]}" }}" -eq 2 ]]; then
|
if [[ "{{ "${#words[@]}" }}" -eq 2 ]]; then
|
||||||
_files -/
|
_files -/
|
||||||
elif [[ "${words[-1]}" == '' ]]; then
|
elif [[ "${words[-1]}" == '' ]] && [[ "${words[-2]}" != "${__zoxide_z_prefix}"?* ]]; then
|
||||||
\builtin local result
|
\builtin local result
|
||||||
# shellcheck disable=SC2086,SC2312
|
# shellcheck disable=SC2086,SC2312
|
||||||
if result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -i -- ${words[2,-1]})"; then
|
if result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- ${words[2,-1]})"; then
|
||||||
result="${__zoxide_z_prefix}${result}"
|
result="${__zoxide_z_prefix}${result}"
|
||||||
# shellcheck disable=SC2296
|
# shellcheck disable=SC2296
|
||||||
compadd -Q "${(q-)result}"
|
compadd -Q "${(q-)result}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue