How can I prevent zsh from autocompleting ssh hosts with the hosts file?

In `bash` you am able to export a variable to prevent `/etc/hosts` from being used with autocompletion of the `ssh` command:

export COMP_KNOWN_HOSTS_WITH_HOSTFILE=””

You can try that setting that in `zsh` but it won’t work. If you’ve tried searching in the `zsh-completions` directory but couldn’t find anything similar, it’s because it’s not there.

How can I prevent zsh from autocompleting ssh hosts with the hosts file?

So, how can you prevent `zsh` from autocompleting ssh hosts with the `/etc/hosts` file?

Add this to your `~/.zshrc` file:

zstyle ‘:completion:*’ hosts off

Related Posts:

  • No Related Posts
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *