Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow control-E to complete a command #932
At the moment, fish's command completion appears to work like this: If, e.g., I've recently typed:
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.)
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.
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?