2

The default completion of the curl and open commands tries to fill in URLs. For example, typing curl <TAB> gives

file:    ftp://    gopher://    http://    https://

alongside any files in the current directory.

I never want to autocomplete URLs, so these suggestions are just visual noise mixed in with the filenames etc. that I’m actually interested in. How can I prevent zsh from offering URL completion for a particular command? How can I prevent it from offering this for any command?

  • Take a Look at this: unix.stackexchange.com/questions/469320/… – ss_iwe Sep 19 '19 at 6:16
  • @ss_iwe I don’t believe that applies in my case… Zsh doesn’t think those things are directories; it knows they’re URLs. (And I don’t have CDABLE_VARS set anyway.) – bdesham Sep 19 '19 at 15:20
0

I found an answer in a 2011 post by Mikael Magnusson to the zsh users mailing list.

To prevent zsh from ever trying to autocomplete URLs for the open command, run

zstyle ':completion:*:open:argument*' tag-order - '! urls'

I believe you can do this for all commands, not just open, by saying

zstyle ':completion:*:*:argument*' tag-order - '! urls'

If you want to disable URL autocompletion most of the time, but allow it when the current directory is empty, run

zstyle ':completion:*:open:argument*' tag-order '! urls'
|improve this answer|||||

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.