| 1 |
|
- |
# Code generated by zoxide. DO NOT EDIT. |
| 2 |
|
- |
|
| 3 |
|
- |
# ============================================================================= |
| 4 |
|
- |
# |
| 5 |
|
- |
# Hook configuration for zoxide. |
| 6 |
|
- |
# |
| 7 |
|
- |
|
| 8 |
|
- |
# Initialize hook to add new entries to the database. |
| 9 |
|
- |
$env.__zoxide_hooked = true |
| 10 |
|
- |
$env.config = ($env | default {} config).config |
| 11 |
|
- |
$env.config = ($env.config | default {} hooks) |
| 12 |
|
- |
$env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change)) |
| 13 |
|
- |
$env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD)) |
| 14 |
|
- |
$env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir| |
| 15 |
|
- |
zoxide add -- $dir |
| 16 |
|
- |
})) |
| 17 |
|
- |
|
| 18 |
|
- |
# ============================================================================= |
| 19 |
|
- |
# |
| 20 |
|
- |
# When using zoxide with --no-cmd, alias these internal functions as desired. |
| 21 |
|
- |
# |
| 22 |
|
- |
|
| 23 |
|
- |
# Jump to a directory using only keywords. |
| 24 |
|
- |
def --env --wrapped __zoxide_z [...rest:string] { |
| 25 |
|
- |
let arg0 = ($rest | append '~').0 |
| 26 |
|
- |
let arg0_is_dir = (try {$arg0 | path expand | path type}) == 'dir' |
| 27 |
|
- |
let path = if (($rest | length) <= 1) and ($arg0 == '-' or $arg0_is_dir) { |
| 28 |
|
- |
$arg0 |
| 29 |
|
- |
} else { |
| 30 |
|
- |
(zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n") |
| 31 |
|
- |
} |
| 32 |
|
- |
cd $path |
| 33 |
|
- |
} |
| 34 |
|
- |
|
| 35 |
|
- |
# Jump to a directory using interactive search. |
| 36 |
|
- |
def --env --wrapped __zoxide_zi [...rest:string] { |
| 37 |
|
- |
cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")' |
| 38 |
|
- |
} |
| 39 |
|
- |
|
| 40 |
|
- |
# ============================================================================= |
| 41 |
|
- |
# |
| 42 |
|
- |
# Commands for zoxide. Disable these using --no-cmd. |
| 43 |
|
- |
# |
| 44 |
|
- |
|
| 45 |
|
- |
alias z = __zoxide_z |
| 46 |
|
- |
alias zi = __zoxide_zi |
| 47 |
|
- |
|
| 48 |
|
- |
# ============================================================================= |
| 49 |
|
- |
# |
| 50 |
|
- |
# Add this to your env file (find it by running `$nu.env-path` in Nushell): |
| 51 |
|
- |
# |
| 52 |
|
- |
# zoxide init nushell | save -f ~/.zoxide.nu |
| 53 |
|
- |
# |
| 54 |
|
- |
# Now, add this to the end of your config file (find it by running |
| 55 |
|
- |
# `$nu.config-path` in Nushell): |
| 56 |
|
- |
# |
| 57 |
|
- |
# source ~/.zoxide.nu |
| 58 |
|
- |
# |
| 59 |
|
- |
# Note: zoxide only supports Nushell v0.89.0+. |