When filling out of text input, I often wish to accept the autocompletion provided. This requires hitting the down arrow to select the suggestion and then hitting enter to accept the completion. I don't like having to use arrow keys and I found myself doing this quite often, so I made a keyboard shortcut for accepting an autocompletion.
Using Karabiner made this remap straightforward. First, I remapped my right option key to a control key, since I use control key shortcuts frequently and my Macbook keyboard doesn't have a right control key.
I then added a remapping for control-s remap to my
<item> <name>Control s to down and submit</name> <identifier>private.control_s_to_submit</identifier> <autogen>__KeyToKey__ KeyCode::S, ModifierFlag::CONTROL_R, KeyCode::CURSOR_DOWN, KeyCode::ENTER </autogen> </item>
Now, whenever I want to choose the first autocomplete option, I simply hit ⌥S.
I'm a huge fan of
fish autosuggestions, but having to use the right arrow key is similarly troublesome to using the down arrow. To allow the same keyboard shortcut to use
fish completions as well, I modified the key remap to press the right arrow key first. This doesn't mess with conventional inputs since the cursor is already all the way to the right, and now ⌥S works in my shell as well.
<item> <name>Control s to right, down and submit</name> <identifier>private.control_s_to_right_submit</identifier> <autogen>__KeyToKey__ KeyCode::S, ModifierFlag::CONTROL_R,
KeyCode::CURSOR_DOWN, KeyCode::ENTER </autogen> </item>
Here I type
py and then ⌥S to run the suggested command.
You can find my full set of keyboard remaps at https://github.com/razzius/personal/blob/master/key_remaps/private.xml.