New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab completion doesn't work for abbreviations #3233

Closed
willwhitney opened this Issue Jul 14, 2016 · 11 comments

Comments

Projects
None yet
7 participants
@willwhitney
Copy link

willwhitney commented Jul 14, 2016

When typing an abbreviation, it would be really nice if you could hit tab to complete that abbreviation. For example, I have an abbreviation devgpu that expands to ssh <my_server>, but when I type dev <tab> I don't get devgpu as a suggestion.

While it is a little weird to complete something that's not a real command, I still expected the completion to show up, and it would definitely make things quicker for me.

fish version installed (fish --version): 2.3.0

OS/terminal used: Mac OS 10.11, iTerm2 3.0.4

@krader1961 krader1961 added this to the fish-future milestone Jul 14, 2016

@krader1961

This comment has been minimized.

Copy link
Contributor

krader1961 commented Jul 14, 2016

Odd that I've never noticed that, but you're right. Abbreviations really should be part of the command completions. Patches welcomed. 😺

@floam

This comment has been minimized.

Copy link
Member

floam commented Jul 14, 2016

Would the completion expand it into the expected final, right-hand-side of an abbr definition when you've typed part of the (left hand) "before" side of the abbreviation? What would you see in the pager? How would that interact with completions that might already exist for one side or another we include, when the abbr transforms something that's a valid command into a different valid command?

Just adding complete's for one side or another isn't exactly enough, right?

@willwhitney

This comment has been minimized.

Copy link

willwhitney commented Jul 14, 2016

My expectation is that it would suggest the "before" part and it wouldn't expand until space or enter as usual.

@floam

This comment has been minimized.

Copy link
Member

floam commented Jul 14, 2016

Except on enter, what it actually does is expand and execute for a normal abbreviation. That's probably too much to have occur when the interactive experience might have prepared you for a different result where your command doesn't get swapped out like that.

@ThomasAH

This comment has been minimized.

Copy link

ThomasAH commented Sep 4, 2017

I experienced this today, too.
I wanted to use an abbreviation like an alias, in my case:
"backup-mt-eject" to "ssh backup sudo mt-eject"
and
"backup-bconsole" to "ssh -t backup bconsole".

So "bac<tab>" should have completed to "backup-"
and "backup-m<tab>" to "backup-mt-eject"

Only after pressing Enter (or Space) the abbreviation should transfer into the expanded result on the command line (as it currently already does). So the same thing that @willwhitney said.

I understand @floam's concerns, but as this is not different from what would happen if I had entered "backup-mt-eject<Enter>" myself, this is only as confusing as the current situation if you have abbreviations you don't know.

Edit: Protected < and > with backslashes so they are shown

@ridiculousfish

This comment has been minimized.

Copy link
Member

ridiculousfish commented Sep 5, 2017

@ThomasAH Do I correctly that your request is simply that tab-completions should expand abbreviations?

@ThomasAH

This comment has been minimized.

Copy link

ThomasAH commented Sep 5, 2017

@ridiculousfish No, tab-completion should complete abbreviations. Only Enter or Space should expand them.

@marcvangend

This comment has been minimized.

Copy link

marcvangend commented Oct 27, 2017

This enhancement would be very welcome. I have never written a line of C++ in my life but I'd be happy to help test patches/PR's.

@BarbzYHOOL

This comment has been minimized.

Copy link

BarbzYHOOL commented Oct 14, 2018

I stumbled upon this issue too when I made an abbreviation that is kind of lenghty (instead of a function/alias). Need it!!

@ridiculousfish

This comment has been minimized.

Copy link
Member

ridiculousfish commented Oct 16, 2018

Fixed in 202bf0b

@ridiculousfish ridiculousfish modified the milestones: fish-future, fish-3.0 Oct 16, 2018

@BarbzYHOOL

This comment has been minimized.

Copy link

BarbzYHOOL commented Oct 17, 2018

awesome @ridiculousfish

ridiculousfish added a commit to ridiculousfish/fish-shell that referenced this issue Nov 24, 2018

Tab complete abbreviations
This allows abbreviations to be expanded by tab completions.

Fixes fish-shell#3233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment