1

Tried to find this answer, but could not.

I am new to zsh, and I like it a lot on my Mac. I am looking for an option to set it to autocomplete, but without putting the completion in the prompt until I hit enter.

For example, if I type:

cd Documents/

and then press tab, it will highlight the options but ALSO add them to the prompt, so I have to either tab a ton to get to the one I want, or delete back. Here is what I mean:

cd Documents/ (press tab)

it shows:

$ cd Documents/Apple

Apple         Banana       Durian
Orange        Starfruit    Tamarine

But I am going through the list to get to Tamarine--I want to see the options and be able to continue to tab through them, but not have them added to my current prompt until I hit Enter.

Is this possible?

unsetopt automenu

Gets me close, but then I cannot tab through the options.

Does that make sense?

Thanks!

0

One way to do this is to use a zsh framework. I recommend oh-my-zsh, as I am using it myself.

With it, hitting tab once will show all the possibilities, and hitting it once more will enter select mode, where the possibilities will show in your prompt and you can switch between them not only with tab, but also with arrow keys.

  • 2
    This is not the effect of using a framework. It's the effect of some options that are set with your particular setup using this particular version of this particular framework. This answer is not really useful without stating which options are responsible for the behavior. – Gilles Jul 2 '17 at 21:30
0

Make sure that the option MENU_COMPLETE is disabled:

setopt nomenucomplete

MENU_COMPLETE (-Y)

On an ambiguous completion, instead of listing possibilities or beeping, insert the first match immediately. Then when completion is requested again, remove the first match and insert the second match, etc. When there are no more matches, go back to the first one again. reverse-menu-complete may be used to loop through the list in the other direction. This option overrides AUTO_MENU.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.