mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-12-28 20:12:38 +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`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Rename `_z` completion function to avoid conflicts with other shell plugins.
|
||||
|
||||
## [0.8.0] - 2021-12-25
|
||||
|
||||
### Added
|
||||
|
@ -241,7 +241,7 @@ eval "$(zoxide init zsh)"
|
||||
```
|
||||
|
||||
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>
|
||||
|
||||
|
@ -123,7 +123,7 @@ if [[ ${BASH_VERSINFO:-0} -ge 4 && :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} !
|
||||
# Use `printf '\e[5n'` to redraw line after fzf closes.
|
||||
\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.
|
||||
[[ {{ "${#COMP_WORDS[@]}" }} -eq $((COMP_CWORD + 1)) ]] || return
|
||||
|
||||
@ -140,7 +140,7 @@ if [[ ${BASH_VERSINFO:-0} -ge 4 && :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} !
|
||||
fi
|
||||
}
|
||||
|
||||
\builtin complete -F _{{cmd}} -o nospace -- {{cmd}}
|
||||
\builtin complete -F __zoxide_z_complete -o nospace -- {{cmd}}
|
||||
fi
|
||||
|
||||
{%- when None %}
|
||||
|
@ -109,8 +109,8 @@ function {{cmd}}i() {
|
||||
}
|
||||
|
||||
if [[ -o zle ]]; then
|
||||
__zoxide_unset _{{cmd}}
|
||||
function _{{cmd}}() {
|
||||
__zoxide_unset __zoxide_z_complete
|
||||
function __zoxide_z_complete() {
|
||||
# Only show completions when the cursor is at the end of the line.
|
||||
# shellcheck disable=SC2154
|
||||
[[ "{{ "${#words[@]}" }}" -eq "${CURRENT}" ]] || return
|
||||
@ -129,19 +129,19 @@ if [[ -o zle ]]; then
|
||||
fi
|
||||
}
|
||||
|
||||
__zoxide_unset _{{cmd}}_helper
|
||||
function _{{cmd}}_helper() {
|
||||
__zoxide_unset __zoxide_z_complete_helper
|
||||
function __zoxide_z_complete_helper() {
|
||||
\builtin local result="${__zoxide_z_prefix}${__zoxide_result}"
|
||||
# shellcheck disable=SC2296
|
||||
[[ -n "${__zoxide_result}" ]] && LBUFFER="${LBUFFER}${(q-)result}"
|
||||
\builtin zle reset-prompt
|
||||
}
|
||||
|
||||
\builtin zle -N _{{cmd}}_helper
|
||||
\builtin bindkey "\e[0n" _{{cmd}}_helper
|
||||
\builtin zle -N __zoxide_z_complete_helper
|
||||
\builtin bindkey "\e[0n" __zoxide_z_complete_helper
|
||||
if [[ "${+functions[compdef]}" -ne 0 ]]; then
|
||||
\compdef -d {{cmd}}
|
||||
\compdef _{{cmd}} {{cmd}}
|
||||
\compdef __zoxide_z_complete {{cmd}}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user