diff --git a/CHANGELOG.md b/CHANGELOG.md index a904bc1..e178221 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Manpages: moved to `man/man1/*.1`. - Fzf: added `--keep-right` option by default, upgraded minimum version to v0.21.0. - Bash: only enable completions on 4.4+. +- Nushell: upgrade minimum supported version to v0.59.0. ### Fixed diff --git a/README.md b/README.md index 2a4de7a..2e61d54 100644 --- a/README.md +++ b/README.md @@ -190,10 +190,17 @@ zoxide init fish | source
Nushell -Add this to your configuration (find it by running `$nu.config-path` in +First, generate the Nushell initialization script (you may need to do this +whenever you update Nushell): + +```sh +zoxide init nushell --hook prompt | save ~/.zoxide.nu +``` + +Now, add this to your configuration (find it by running `$nu.config-path` in Nushell): -```text +```sh zoxide init nushell --hook prompt | save ~/.zoxide.nu source ~/.zoxide.nu ``` diff --git a/man/man1/zoxide-init.1 b/man/man1/zoxide-init.1 index 335553e..2881994 100644 --- a/man/man1/zoxide-init.1 +++ b/man/man1/zoxide-init.1 @@ -30,7 +30,14 @@ Add this to your configuration (usually \fB~/.config/fish/config.fish\fR): .fi .TP .B nushell -Add this to your configuration (find it by running \fB$nu.config-path\fR in +First, generate the Nushell initialization script (you may need to do this +whenever you update Nushell): +.sp +.nf + \fBzoxide init nushell --hook prompt | save ~/.zoxide.nu\fR +.fi +.sp +Now, add this to your configuration (find it by running \fB$nu.config-path\fR in Nushell): .sp .nf diff --git a/templates/nushell.txt b/templates/nushell.txt index ed5814b..c88a0fe 100644 --- a/templates/nushell.txt +++ b/templates/nushell.txt @@ -25,7 +25,7 @@ let-env __zoxide_oldprompt = (if '__zoxide_oldprompt' in (env).name { # Hook to add new entries to the database. def __zoxide_hook [] { - zoxide add -- $nu.cwd + zoxide add -- $env.PWD } # Initialize hook. @@ -51,11 +51,11 @@ def-env __zoxide_z [...rest:string] { let path = if ($rest | length) <= 1 && ($arg0 | path expand | path type) == dir { $arg0 } else { - (zoxide query --exclude $nu.cwd -- $rest | str trim -r -c (char newline)) + (zoxide query --exclude $env.PWD -- $rest | str trim -r -c (char newline)) } cd $path {%- if echo %} - echo $nu.cwd + echo $env.PWD {%- endif %} } @@ -63,7 +63,7 @@ def-env __zoxide_z [...rest:string] { def-env __zoxide_zi [...rest:string] { cd $'(zoxide query -i -- $rest | str trim -r -c (char newline))' {%- if echo %} - echo $nu.cwd + echo $env.PWD {%- endif %} } @@ -84,8 +84,13 @@ alias {{cmd}}i = __zoxide_zi {%- endmatch %} {{ section }} -# To initialize zoxide, add this to your configuration (find it by running -# `$nu.config-path` in Nushell): +# To initialize zoxide, first generate the Nushell initialization script (you +# may need to do this whenever you update Nushell): +# +# zoxide init nushell --hook prompt | save ~/.zoxide.nu +# +# Now, add this to your configuration (find it by running `$nu.config-path` in +# Nushell): # # zoxide init nushell --hook prompt | save ~/.zoxide.nu # source ~/.zoxide.nu