Created
December 11, 2019 22:50
-
-
Save morganestes/724e451fddc3c2ddfd3cc849534ba7a7 to your computer and use it in GitHub Desktop.
Configure zsh ssh-add plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Configure ssh-agent plugin prior to loading it. | |
| zstyle :omz:plugins:ssh-agent agent-forwarding on | |
| # Get all the keys that are in the user's .ssh directory and add them to the ssh-agent. | |
| SSH_IDENTITIES=($(find ${HOME}/.ssh -name '*.pub' -type f -exec sh -c 'echo $(basename "${0%\.pub}")' {} \;)) | |
| zstyle :omz:plugins:ssh-agent identities "${SSH_IDENTITIES[@]}" | |
| # Make zsh know about hosts already accessed by SSH | |
| zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment