nushell

How to remove/mutate things (shells, aliases) in nushell


I'm using shells and enter to manage a "dirstack". I want to "popd" to remove dirs I've added.

I also have some aliases that I no longer want in my session. How do I delete the aliases?

I've tried things like drop but if the dirs and aliases are possibly immutable, how do I change them (without starting a new session)? Feels like there should be commands like leave (or unenter vs enter) and unalias (vs alias).


Solution

  • You can "Hide definitions in the current scope" with the hide command.

    alias ll = ls -al
    hide ll
    ll
    
    Error: nu::shell::external_command
    
      × External command failed
       ╭─[entry #49:1:1]
     1 │ ll
       · ─┬
       ·  ╰── did you mean 'all'?
       ╰────
      help: No such file or directory (os error 2)
    

    As for the pushd/popd equivalency (see the docs), you can enter a new shell with enter, and exit it with dexit. You can inspect the table with shells or g, and activate the next or previous directory with n and p.