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

Comments

Projects
None yet
5 participants
@mlopes

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

@xfix

This comment has been minimized.

Show comment
Hide comment
@xfix

xfix Jul 19, 2013

Member

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?

Member

xfix commented Jul 19, 2013

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

This comment has been minimized.

Show comment
Hide comment
@mlopes

mlopes 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

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

This comment has been minimized.

Show comment
Hide comment
@siteshwar

siteshwar Jul 19, 2013

Member

You can press ALT - Right Arrow for partial completions.

Member

siteshwar commented Jul 19, 2013

You can press ALT - Right Arrow for partial completions.

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Jul 21, 2013

Member

As siteshwar says, this is already available!

Member

ridiculousfish commented Jul 21, 2013

As siteshwar says, this is already available!

@mlopes

This comment has been minimized.

Show comment
Hide comment
@mlopes

mlopes 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

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

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Jul 21, 2013

Member

Maybe we can support iTerm's default key bindings.

Member

ridiculousfish commented Jul 21, 2013

Maybe we can support iTerm's default key bindings.

@wwwjfy

This comment has been minimized.

Show comment
Hide comment
@wwwjfy

wwwjfy Aug 4, 2013

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Aug 31, 2013

Member

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

Member

ridiculousfish commented Aug 31, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment