Conversation
Implemented the Command trait for the newtype, and all required methods (based off of the alias command)
… alias and abbrevaition
|
If the implementation is that similar to |
|
That's a great question, I was just using fish as a reference point, which has two separate commands. Alias is syntax sugar for a one-line function more or less, while abbreviation exhibits a more feature set which allows you to be as precise as you'd like to be for when it's actually triggered. The approach that nushell could take is that alias is overloaded to support "inline replacement", and then bring in the rest of these advanced matching arguments? I could see that as being useful as more idiomatic command builder, where you could define an alias that replaces different things based on the host system for example? But maybe that's a pattern we don't want? |
|
@NotTheDr01ds reminded me that if you're looking for abbreviation expansion, nushell can do already that if setup properly. |
|
Of course it can! Nushell is very robust, and can emulate a lot with some tinkering, including the emulation of a number of other builtins; So I don't think it's a reason to not move forward. |
|
I'm struggling to understand the value with this command and that's not a criticism of your hard work here. I know fish has abbr's and aliases, but I never really used abbr's much. Why is this an important feature that nushell should have? |
|
Abbreviations are not something you would ever refer to as "important" -- they're just important at breaking down a sometimes-problematic layer of abstraction. Like if I define an alias for ls with some custom flags, I lose the ability to query the --help without the ^ operator. For especially long aliases, I also can't modify-on-the-fly in a way I could with abbreviations.
I think the best place they fit in, when pursuing simplicity, would be to add a "--expand" or similar flag to the alias builitin. This is just a PR to implement "fish-style", but hearing these considerations has pushed me to recognize that it could make plenty of sense to just expand the scope of alias?
Thoughts?
▰▰▰▰▰
Miles Wirht 🙃
… From: Darren Schroeder ***@***.***>
Sent: 05 December 2025 09:56
To: nushell/nushell ***@***.***>
Cc: Miles Wirht ***@***.***>, Author ***@***.***>
Subject: Re: [nushell/nushell] Addition of the Abbreviation (PR #16960)
fdncred left a comment (nushell/nushell#16960)
I'm struggling to understand the value with this command and that's not a criticism of your hard work here. I know fish has abbr's and aliases, but I never really used abbr's much. Why is this an important feature that nushell should have?
--
Reply to this email directly or view it on GitHub:
#16960 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
|
I'd personally push for these type of changes built into aliases. Aliases need some work (jus search the issues) and it would be nice to clean them up a bit too. Maybe that's something you can help with while adding the abbr features to alias? |
Thanks for the blog link, @fdncred . Do you happen to know how |
|
you could try setting the modifier to none i think |
$env.config.keybindings ++= [{
name: abbr
modifier: none
keycode: space
mode: [emacs, vi_insert]
event: [
{ send: menu name: abbr_menu }
{ edit: insertchar, value: ' '}
]
}]Added this to the config file, but it's still not similar to |
|
No one said it worked like fish. If you use the aliases in nu_scripts you'll see what gcm is there. |
|
@fdncred I didn't actually try it with
Basically, I don't need the aliases to mean the same thing as in fish. I just want Space to expand the aliases I define instead of needing a modifier. EDIT: I think it'd be better not to pollute the PR so I will move my question to a Discussion. Thanks for your help. |
Release notes summary - What our users need to know
MY NOTES:
Tasks after submitting