mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-25 14:07:35 +00:00
Rename _z function (#324)
This commit is contained in:
parent
cf8dc69dda
commit
d106f4e358
@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- manpages: moved to `man/man1/*.1`.
|
- manpages: moved to `man/man1/*.1`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Rename `_z` completion function to avoid conflicts with other shell plugins.
|
||||||
|
|
||||||
## [0.8.0] - 2021-12-25
|
## [0.8.0] - 2021-12-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -241,7 +241,7 @@ eval "$(zoxide init zsh)"
|
|||||||
```
|
```
|
||||||
|
|
||||||
For completions to work, the above line must be added _after_ `compinit` is
|
For completions to work, the above line must be added _after_ `compinit` is
|
||||||
called.
|
called. You may have to rebuild your cache by running `rm ~/.zcompdump*; compinit`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ if [[ ${BASH_VERSINFO:-0} -ge 4 && :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} !
|
|||||||
# Use `printf '\e[5n'` to redraw line after fzf closes.
|
# Use `printf '\e[5n'` to redraw line after fzf closes.
|
||||||
\builtin bind '"\e[0n": redraw-current-line' &>/dev/null
|
\builtin bind '"\e[0n": redraw-current-line' &>/dev/null
|
||||||
|
|
||||||
function _{{cmd}}() {
|
function __zoxide_z_complete() {
|
||||||
# Only show completions when the cursor is at the end of the line.
|
# Only show completions when the cursor is at the end of the line.
|
||||||
[[ {{ "${#COMP_WORDS[@]}" }} -eq $((COMP_CWORD + 1)) ]] || return
|
[[ {{ "${#COMP_WORDS[@]}" }} -eq $((COMP_CWORD + 1)) ]] || return
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ if [[ ${BASH_VERSINFO:-0} -ge 4 && :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} !
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
\builtin complete -F _{{cmd}} -o nospace -- {{cmd}}
|
\builtin complete -F __zoxide_z_complete -o nospace -- {{cmd}}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{%- when None %}
|
{%- when None %}
|
||||||
|
@ -109,8 +109,8 @@ function {{cmd}}i() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [[ -o zle ]]; then
|
if [[ -o zle ]]; then
|
||||||
__zoxide_unset _{{cmd}}
|
__zoxide_unset __zoxide_z_complete
|
||||||
function _{{cmd}}() {
|
function __zoxide_z_complete() {
|
||||||
# Only show completions when the cursor is at the end of the line.
|
# Only show completions when the cursor is at the end of the line.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
[[ "{{ "${#words[@]}" }}" -eq "${CURRENT}" ]] || return
|
[[ "{{ "${#words[@]}" }}" -eq "${CURRENT}" ]] || return
|
||||||
@ -129,19 +129,19 @@ if [[ -o zle ]]; then
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__zoxide_unset _{{cmd}}_helper
|
__zoxide_unset __zoxide_z_complete_helper
|
||||||
function _{{cmd}}_helper() {
|
function __zoxide_z_complete_helper() {
|
||||||
\builtin local result="${__zoxide_z_prefix}${__zoxide_result}"
|
\builtin local result="${__zoxide_z_prefix}${__zoxide_result}"
|
||||||
# shellcheck disable=SC2296
|
# shellcheck disable=SC2296
|
||||||
[[ -n "${__zoxide_result}" ]] && LBUFFER="${LBUFFER}${(q-)result}"
|
[[ -n "${__zoxide_result}" ]] && LBUFFER="${LBUFFER}${(q-)result}"
|
||||||
\builtin zle reset-prompt
|
\builtin zle reset-prompt
|
||||||
}
|
}
|
||||||
|
|
||||||
\builtin zle -N _{{cmd}}_helper
|
\builtin zle -N __zoxide_z_complete_helper
|
||||||
\builtin bindkey "\e[0n" _{{cmd}}_helper
|
\builtin bindkey "\e[0n" __zoxide_z_complete_helper
|
||||||
if [[ "${+functions[compdef]}" -ne 0 ]]; then
|
if [[ "${+functions[compdef]}" -ne 0 ]]; then
|
||||||
\compdef -d {{cmd}}
|
\compdef -d {{cmd}}
|
||||||
\compdef _{{cmd}} {{cmd}}
|
\compdef __zoxide_z_complete {{cmd}}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user