Skip to content

fish-like abbreviations #5597

@TyPR124

Description

@TyPR124

Describe the solution you'd like

Fish shell has a feature/command I really like called abbr.

abbr works very similar to an alias in practice, except that when invoked it expands it's text to the full version.

Example behavior:

User enters abbr gc = git checkout to register the abbreviation "gc". From now on, when the user types "gc " (the space is important) the text "gc" is replaced with "git checkout" and the user can continue typing as normal.

I would love to see something similar in Nushell.

Describe alternatives you've considered

Functionally, this is not so different from alias, but I'd say it is objectively superior for a few reasons:

  • Expanded text makes it very clear what will be run - aliases can be ambiguous
  • Expanded text reinforces the real version of commands (which can be useful if/when you don't have your normal shell/aliases for any reason) - aliases only reinforce a command that is not portable
  • You can edit the expanded text if needed before running it - not possible with an alias

Additional context and details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:aliasIssues around support for command aliases, touches parser and name resolutionA:line-editorIssues related to reedlinecategory:enhancementNew feature or requestdelightthis feature would delight users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions