-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Allow control-E to complete a command #932
Comments
fish allows you to change your keyboard bindings: |
I'm afraid that doesn't do what I want. First of all, going forward by a word of completed text is not the same as going to the end of the completion text if that text is more than one word. Second, and more seriously, control-E normally moves the cursor to the end of the line, and rebinding it destroys that behavior. Currently, |
Sorry, I meant |
I observe that, in reader.cpp, the code corresponding to the
I also observe the code corresponding to R_FORWARD_WORD and R_END_OF_LINE. The fix appears straightforward. This is what I did to the R_END_OF_LINE case in reader.cpp:
Doing this and recompiling fish does exactly what I want. Will this be accepted? Should I submit a diff or something to make it easier for project administrators? |
#91 even. |
Yes, I see a trail of previous issues. #91 seems to be on essentially the same issue. Should I comment there rather than here? |
Either is fine. A diff would be good, or even a pull request. Change looks good though. |
Diff provided (see other thread). |
No objection from this fish. Merge or not as you see fit, zanchey. |
I'm fine with this change too. I don't use CTRL+E, but it doesn't look like this change will break anything (except for using CTRL+E when it would do nothing anyway). |
(Closes #91, #932) Currently, control-E is bound to `end-of-line`. This patch modifes the `end-of-line` procedure so that, if it is invoked when the cursor is at the end of a command and there is pending completion text, it will accept the completion text and move to the end. The behavior of `end-of-line` will not otherwise be altered.
fixed on master with e3ea953 Thanks! |
Excellent! Glad to have helped. |
At the moment, fish's command completion appears to work like this: If, e.g., I've recently typed:
sudo port selfupdate; port echo outdated
then, if I type
sudo port se
, the letterslfupdate; port echo outdated
appear highlighted in yellow. At this point, I can use either control-F or the right arrow to accept the completion text, making it as though I had typed it myself.I'd like to be able to use control-E to do this too. I find it easier to type control-E than control-F in this circumstance (I use the Dvorak keyboard), and it is logically permissible because control-E has rightward-cursor-moving semantics.
To be precise: if control-E is used when the cursor is at the end of a (partially) typed command, and if there is completion text, then control-E should accept the completion text and move the cursor to the end of the (now larger) command. control-E should not be otherwise changed. (Consequently, if you type a partial command, then move the cursor left, it would take two control-E's to accept the completion.)
The text was updated successfully, but these errors were encountered: