GithubHelp home page GithubHelp logo

Comments (4)

ajeetdsouza avatar ajeetdsouza commented on July 30, 2024

You may need to upgrade zoxide - Nushell has not reached v1.0 yet, and makes a lot of backward-incompatible changes every release.

Also, you appear to be generating the source file manually, unlike the instructions in the README. If you update zoxide, the Nushell script may change, causing your config to break.

from zoxide.

mrjackphil avatar mrjackphil commented on July 30, 2024

@IlyaVassyutovich I had the same issue. Zoxide generates init nu-script which doesn't work.

Tested in nushell 0.92.2

To make it work I:

  1. Commented the line zoxide init nushell | save -f ~/.zoxide.nu in nu-env file to prevent script regeneration.
  2. Changed ~/zoxide.nu to
# Code generated by zoxide. DO NOT EDIT.

# =============================================================================
#
# Hook configuration for zoxide.
#

# Initialize hook to add new entries to the database.
if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) {
  $env.__zoxide_hooked = true
  $env.config = ($env | default {} config).config
  $env.config = ($env.config | default {} hooks)
  $env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
  $env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
  $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 --wrapped __zoxide_z [...rest:string] {
  let arg0 = ($rest | append '~').0
  let path = if (($rest | length) <= 1) and ($arg0 == '-' or ($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 --wrapped  __zoxide_zi  [...rest:string] {
  cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
}

# =============================================================================
#
# Commands for zoxide. Disable these using --no-cmd.
#

alias cd = __zoxide_z
alias cdi = __zoxide_zi

# =============================================================================
#
# Add this to your env file (find it by running `$nu.env-path` in Nushell):
#
#   zoxide init nushell | save -f ~/.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.73.0 and above.
  1. ???
  2. PROFIT

So, mainly changes were:

  1. Changing def-env to def --env --wrapped
  2. Adding spread to $rest variable
  3. I've made alias to cd and cdi - you may don't want to do that.

from zoxide.

ajeetdsouza avatar ajeetdsouza commented on July 30, 2024

@mrjackphil did you try upgrading zoxide?

from zoxide.

mrjackphil avatar mrjackphil commented on July 30, 2024

I just today installed the zoxide and tried to run it. So I was sure that I'm using the latest version.
But...

I installed it using chocolatey. Current version of zoxide in there is 0.9.2. Latest is 0.9.4.
I've updated zoxide manually and it seems to resolve the problem.

So, thank you @ajeetdsouza for reply and sorry for oversight.

from zoxide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.