Skip to content

Missing essential features + other suggestions #14822

Open
@tmillr

Description

I've been messing around with this shell lately and I really like it, but it's still lacking a couple essential features that are keeping me from switching my login shell to Nushell. I'd like to jot them down here if that is ok along with some other suggestions.

The most annoying thing for me currently is the inability to suspend and resume just a single interactive process (such as an editor) that is running in Nushell. I don't even need jobs to run in the background or full-fledged job control, but just to be able to ctrl-z out of my editor and then re-enter later with fg. Opening extra tabs/windows is a nuisance, running a terminal within vim is not pleasant, and tmux would only add additional overhead + complexity + dependencies while also being overkill for this use-case.


Here are some other things that I've encountered:

  • Unable to stop/suspend a single interactive process (explained above)
  • Unable to stop/suspend (interactive) Nushell itself with ctrl-z? (nvm, seems bash doesn't either)

Keybindings/Reedline

  • Pressing Esc with menu open both closes the menu and enters vi normal mode (IMO, it should only do the former when a menu is open)
  • Unable to remap certain keys, like Esc, in vi edit mode...user keymaps should always take precedence.
  • No keybinding event to close/exit menu?
  • No dedicated keybinding event to select/change vi mode? (e.g. while a menu is open)
  • / in vi normal mode should probably activate history search (like in bash)
  • ...while CTRL-R should be Redo
  • Cursor in vi-normal mode should never go past final char of line.

Bugs

  • return cmd1 | cmd2 runs and returns only cmd1 it seems, and does not produce a compiler error. This should either be a syntax error or an allowed shorthand similar to how let bindings are parsed and processed. IMO, I'd prefer the latter behavior, while also having the parser error if it finds any commands following (?m)return.*; (regex pattern) within any block/scope.
  • fix(cli): completion in nested blocks #14856

Would be nice to have

  • Improved regex
    • str replace also accepts a closure (computed replacements), and/or
    • a str matches cmd which returns a list of all matches along with indices, and/or
    • a regex cmd/object which can be called with e.g. regex $index $str and returns { match: $stringOrStringList, index: $integer } if/for the next match
  • Improved LSP support
    • Completions mainly, and fuller documentation for completion items. Completing command args/flags. Maybe the ability to hook into external completer as well (just like in the shell).
    • Support hover for more items/locations (e.g. parameters in signatures)
  • Simple code formatter (wrapping long single-line pipelines/blocks/lists/records, reducing multiple empty lines or spaces to 1, indentation, etc.)
  • Dedicated commands to assert type of value (assertions and predicates for each type)
  • str is ascii command, and maybe add ascii field to str stats record?
  • An ad-hoc way to ignore/redirect the output of print commands.
  • An easier/better way of interpolating variables at the prompt (e.g. instead of having to type cmd $'($env.somedir)/foo' or cmd ($env.somedir + /foo)). I suppose a custom mapping or hook could be used as a workaround however, but when it comes to the prompt, the less typing the better.
  • Make file paths in error messages clickable links (unsure if miette supports this directly?)
    • Imagine getting an error then simply clinking on the printed filename to instantly view the source in your editor.
  • A way to unset/delete variables in repl (perhaps not very useful, but there's no way to do this currently).
    • Use case would be sanitizing the scope, or perhaps freeing memory up at the repl.
  • A way to delete overlays
    • Similar to above: to free up memory/scope and previously used overlay names
  • Another overlay is created just before repl is entered atop zero, so that it's possible to start "clean" again without exiting the shell. A helper command for resetting this 2nd overlay to empty (without popping it) could also be useful.
    • Although I realize just now that this would be essentially equivalent to doing exec nu (on unix).
  • A command to list all of the items in an overlay
  • A |= operator, where lhs |= rhs simply expands to lhs = lhs | rhs (e.g. during parsing)
  • Since mut variables are rare, and for better ergonomics, support let myvar |= ..., let myvar += ..., etc. with behavior equivalent to let myvar = $myvar OP ...
  • Truly custom completion
  • Optional autocompletion (completion menu always active and starts with nothing selected)
  • feat(def): add examples to custom commands #14865

Metadata

Assignees

No one assigned

    Labels

    delightthis feature would delight usersmeta-issueAn issue that tracks other issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions