-
-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I get autocomplete of hosts to work for an alias or function? #4101
Comments
Could you stick that code sample in triple-backquotes so we can see the exact string and it doesn't get interpreted as Markdown formatting? Some stars in there are turning things in to italics.
|
|
I just took the line from the common-aliases.plugin.zsh which I believe provides tab completion for ssh, and added my alias "wl" to the list of commands. But that doesn't seem to actually work. |
Short answer: that To tell
If only one of your function's arguments takes hosts, then you may want to define your own Long answer: see the Completion System section of the Zsh Reference Manual for all the details of defining completion. |
Perfect! Thank you very much!!! |
I have a custom function which takes in a hostname argument. I would like to be able to tab-complete the hostname just like I can with ssh/rsync/scp/etc... I've tried adding the short alias to my function "wl" to the the line in the common-aliases.plugin.zsh:
zstyle -e ':completion::(ssh|scp|sftp|rsh|rsync|wl):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]_}//,/ })'
And tried doing the same in my .zshrc. But neither seems to work.
How can I apply the hosts completion to an arbitrary function or alias?
The text was updated successfully, but these errors were encountered: