You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.9 KiB
Plaintext
60 lines
1.9 KiB
Plaintext
2 years ago
|
# Code generated by zoxide. DO NOT EDIT.
|
||
|
|
||
|
# =============================================================================
|
||
|
#
|
||
|
# Hook configuration for zoxide.
|
||
|
#
|
||
|
|
||
|
# Initialize hook to add new entries to the database.
|
||
|
let-env config = ($env | default {} config).config
|
||
|
let-env config = ($env.config | default {} hooks)
|
||
|
let-env config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
|
||
|
let-env config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
|
||
|
let-env config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir|
|
||
|
zoxide add -- $dir
|
||
|
}))
|
||
|
|
||
|
# =============================================================================
|
||
|
#
|
||
|
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||
|
#
|
||
|
|
||
|
# Jump to a directory using only keywords.
|
||
|
def-env __zoxide_z [...rest:string] {
|
||
|
# `z -` does not work yet, see https://github.com/nushell/nushell/issues/4769
|
||
|
let arg0 = ($rest | append '~').0
|
||
|
let path = if (($rest | length) <= 1) && ($arg0 == '-' || ($arg0 | path expand | path type) == dir) {
|
||
|
$arg0
|
||
|
} else {
|
||
|
(zoxide query --exclude $env.PWD -- $rest | str trim -r -c "\n")
|
||
|
}
|
||
|
cd $path
|
||
|
}
|
||
|
|
||
|
# Jump to a directory using interactive search.
|
||
|
def-env __zoxide_zi [...rest:string] {
|
||
|
cd $'(zoxide query -i -- $rest | str trim -r -c "\n")'
|
||
|
}
|
||
|
|
||
|
# =============================================================================
|
||
|
#
|
||
|
# Commands for zoxide. Disable these using --no-cmd.
|
||
|
#
|
||
|
|
||
|
# alias z = __zoxide_z
|
||
|
alias cd = __zoxide_z
|
||
|
alias zi = __zoxide_zi
|
||
|
|
||
|
# =============================================================================
|
||
|
#
|
||
|
# Add this to your env file (find it by running `$nu.env-path` in Nushell):
|
||
|
#
|
||
|
# zoxide init nushell --hook prompt | save ~/.zoxide.nu
|
||
|
#
|
||
|
# Now, add this to the end of your config file (find it by running
|
||
|
# `$nu.config-path` in Nushell):
|
||
|
#
|
||
|
# source ~/.zoxide.nu
|
||
|
#
|
||
|
# Note: zoxide only supports Nushell v0.63.0 and above.
|