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

Partial completion #920

Closed
mlopes opened this issue Jul 19, 2013 · 8 comments
Closed

Partial completion #920

mlopes opened this issue Jul 19, 2013 · 8 comments
Milestone

Comments

@mlopes
Copy link

mlopes commented Jul 19, 2013

Hi,

I would like to suggest the following enhancement to the auto-completion process.
When there's a multi word completion suggestion, based on history, frequently one needs part of the command and more often than not, the end part needs to be replaced.

My suggestion consists in adding an extra auto-complete shortcut that only completes until the next white space:

Ex:

when typing "l" I get the following suggestion:

ls -lha /var/www

pressing the new shortcut key would produce "ls" and keep the remainder as a suggestion, pressing it again wound produce "ls -lha" and keep the remainder as a suggestion.

Cheers,
Marco Lopes

@KamilaBorowska
Copy link
Contributor

Sounds interesting, but also difficult to implement properly, especially considering you could mean something else. What if you actually wanted -la, and not -lha, or less, not ls?

@mlopes
Copy link
Author

mlopes commented Jul 19, 2013

Currently, with ctrl-f or right cursor it would complete immediately to "ls -lha /var/www", so when I mean "less" I'll type "le", it will suggest "less" and then press right cursor. My suggestions is to have the exact same rules that apply to the ctrl-f/right cursor completion, but have another shortcut that only completes 1 word at the time, thus allowing to repeat commands with slight differences.

Let's assume the part inside the [] is the suggested part that is still not completed
let's says that I typed "gi", and that will cause ctrl-f to do the following:
gi[t push -u origin feature1]
press ctrl-f (this is what already happens)
git push -u origin feature1

Pressing this new shortcut (let's for examples sake use ctrl-w):
pressing ctrl-w once:
git [push -u origin feature1]
twice:
git push [-u origin feature1]
three times:
git push -u [origin feature1]

And so on.

At any time, pressing ctrl-f would have the exact same effect it does now

Cheers,
Marco Lopes

@siteshwar
Copy link
Contributor

You can press ALT - Right Arrow for partial completions.

@ridiculousfish
Copy link
Member

As siteshwar says, this is already available!

@mlopes
Copy link
Author

mlopes commented Jul 21, 2013

Thanks, but with fish 2.0.0 installed from homebrew on iTerm ALT-right arrow only produces this output [1;9C

EDIT: Just found out the fix for this, on iTerm, go to preferences->profiles->keys and set alt-right arrow to send the following hex codes: 0x1b 0x1b 0x5b 0x43

@ridiculousfish
Copy link
Member

Maybe we can support iTerm's default key bindings.

@wwwjfy
Copy link
Contributor

wwwjfy commented Aug 4, 2013

if @mlopes means iTerm2, maybe the better configuration is to have opt-right mapped to opt-f, and opt-left to opt-b

@ridiculousfish
Copy link
Member

23ba7b5 adds support for iTerm2's default escapes (opt-right-arrow and opt-left-arrow). Thanks for reporting this!

haarts pushed a commit to haarts/fish-shell that referenced this issue Nov 1, 2013
@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants