Updated some templates (bash,fish,zsh) to include command zw with the --workingdir flag

This commit is contained in:
Priyanshu Verma 2022-10-03 22:12:30 +05:30
parent 3c3b2bad01
commit 8fe450def4
3 changed files with 34 additions and 0 deletions

View File

@ -93,6 +93,12 @@ function __zoxide_zi() {
result="$(\command zoxide query -i -- "$@")" && __zoxide_cd "${result}"
}
# Jump to sub directories of current directory.
function __zoxide_zw() {
\builtin local result
result="$(\command zoxide query --workingdir --exclude "$(__zoxide_pwd)" -- "$@")" && __zoxide_cd "${result}"
}
{{ section }}
# Commands for zoxide. Disable these using --no-cmd.
#
@ -110,6 +116,11 @@ function {{cmd}}i() {
__zoxide_zi "$@"
}
\builtin unalias {{cmd}}w &>/dev/null || \builtin true
function {{cmd}}w() {
__zoxide_zw "$@"
}
# Load completions.
# - Bash 4.4+ is required to use `@Q`.
# - Completions require line editing. Since Bash supports only two modes of

View File

@ -106,6 +106,12 @@ function __zoxide_zi
and __zoxide_cd $result
end
# Jump to sub directories of current directory.
function __zoxide_zw
set -l result (command zoxide query --workingdir -- $argv)
and __zoxide_cd $result
end
{{ section }}
# Commands for zoxide. Disable these using --no-cmd.
#
@ -126,6 +132,12 @@ function {{cmd}}i
__zoxide_zi $argv
end
abbr --erase {{cmd}}w &>/dev/null
complete --command {{cmd}}w --erase
function {{cmd}}w
__zoxide_zw $argv
end
{%- when None %}
{{ not_configured }}

View File

@ -79,6 +79,12 @@ function __zoxide_zi() {
result="$(\command zoxide query -i -- "$@")" && __zoxide_cd "${result}"
}
# Jump to sub directories of current directory.
function __zoxide_zw() {
\builtin local result
result="$(\command zoxide query --workingdir -- "$@")" && __zoxide_cd "${result}"
}
{{ section }}
# Commands for zoxide. Disable these using --no-cmd.
#
@ -96,6 +102,11 @@ function {{cmd}}i() {
__zoxide_zi "$@"
}
\builtin unalias {{cmd}}w &>/dev/null || \builtin true
function {{cmd}}w() {
__zoxide_zw "$@"
}
if [[ -o zle ]]; then
function __zoxide_z_complete() {
# Only show completions when the cursor is at the end of the line.