Skip to content
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 · 14 comments
Closed

Tab completion doesn't work for abbreviations #3233

willwhitney opened this issue Jul 14, 2016 · 14 comments

Comments

@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
Copy link
Contributor

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

@floam
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
Copy link
Author

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

@floam
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
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
Copy link
Member

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

@ThomasAH
Copy link

ThomasAH commented Sep 5, 2017

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

@marcvangend
Copy link

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
Copy link

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

@ridiculousfish
Copy link
Member

Fixed in 202bf0b

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

awesome @ridiculousfish

ridiculousfish added a commit to ridiculousfish/fish-shell that referenced this issue Nov 24, 2018
This allows abbreviations to be expanded by tab completions.

Fixes fish-shell#3233
@c02y
Copy link

c02y commented Mar 7, 2019

Weird, tab doesn't complete any of my abbrs
fish, version 3.0.2 here

@ridiculousfish
Copy link
Member

@c02y can you share steps to reproduce - abbreviations that fail and what you try? Thanks

@c02y
Copy link

c02y commented Mar 18, 2019

It seems working again, sorry about that, maybe I just didn't restart fish.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants