Like a lot of zsh users, I have completion configured so that when I am at a command prompt and I invoke completion, a menu appears that can be navigated with the directional arrow keys. i.e. in my
autoload -Uz compinit
zstyle ':completion:*' menu yes select
zstyle ':completion:*:*:cd:*' menu yes select
If I want to delete the directory
/var/log/nginx/somewebsite, I will start the command using completion like:
ubuntu% sudo rm -rf /var/l<TAB>
lib/ local/ lock@ log/
I navigate the items with the directional arrow keys, which are inserted into the command line as the cursor moves over them; once on the desired selection, hit ENTER basically to exit the menu widget and return the cursor back to the command line.
The problem is ENTER is used for both accepting the item from the completion menu and also executing the command, and I keep hitting ENTER thinking I am accepting completion when I am actually executing these partially complete commands!
Can I remap zsh's "accept completion suggestion and exit widget" command to something other than ENTER?
e.g. TAB or even Ctrl + y (same as vim's accept completion keymap)