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?

bdesham
  • 1,327
  • 2
  • 12
  • 22
  • Take a Look at this: https://unix.stackexchange.com/questions/469320/remove-zsh-autocomplete-suggestion – ss_iwe Sep 19 '19 at 06: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

1 Answers1

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'
bdesham
  • 1,327
  • 2
  • 12
  • 22