diff --git a/src/.config/nushell/.gitignore b/src/.config/nushell/.gitignore new file mode 100644 index 0000000..922f26c --- /dev/null +++ b/src/.config/nushell/.gitignore @@ -0,0 +1 @@ +zoxide.nu diff --git a/src/.config/nushell/config.nu b/src/.config/nushell/config.nu index 20ec37d..2962b97 100644 --- a/src/.config/nushell/config.nu +++ b/src/.config/nushell/config.nu @@ -713,4 +713,5 @@ $env.config = { ] } -source ~/.config/nushell/zoxide.nu +const zoxide_conf = "~/.config/nushell/zoxide.nu" +source $zoxide_conf diff --git a/src/.config/nushell/env.nu b/src/.config/nushell/env.nu index b0eec0b..1bf6750 100644 --- a/src/.config/nushell/env.nu +++ b/src/.config/nushell/env.nu @@ -95,4 +95,6 @@ $env.NU_PLUGIN_DIRS = [ # To load from a custom file you can use: # source ($nu.default-config-dir | path join 'custom.nu') -zoxide init nushell | save -f ~/.config/nushell/zoxide.nu +if (which zoxide | length) > 0 { + zoxide init nushell | save -f ~/.config/nushell/zoxide.nu +} diff --git a/src/.config/nushell/zoxide.nu b/src/.config/nushell/zoxide.nu new file mode 100644 index 0000000..ab9b439 --- /dev/null +++ b/src/.config/nushell/zoxide.nu @@ -0,0 +1,6 @@ +# DUMMY FILE for systems that do not have zoxide installed + +# nu doesn't like sourcing files conditionally, so we can't just have it ignore if zoxide.nu does not exist +# watch issue: https://github.com/nushell/nushell/issues/8214 + +# zoxide will overwrite this if it exists