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?

2
  • Take a Look at this: unix.stackexchange.com/questions/469320/…
    – ss_iwe
    Sep 19, 2019 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, 2019 at 15:20

1 Answer 1

1

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'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .