Skip to content
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

ssh-config hosts sections for autocompletion #2702

Closed
wants to merge 2 commits into from
Closed

ssh-config hosts sections for autocompletion #2702

wants to merge 2 commits into from

Conversation

elias5000
Copy link
Contributor

Autocompletion plugin for people who like to make extensive use of ssh-config.
Autocompletion for clouds tool (https://github.com/cristim/clouds).

@@ -0,0 +1,39 @@
############################################################
# Take all host sections in .ssh/config and offer them for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this doing something more than the default Zsh hosts completion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zsh completion does offer hosts that are in the known_hosts file but not hosts from the ssh-config.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just confirmed that completion from ~/.ssh/config is working with a vanilla Zsh install (Ubuntu package version 4.3.17, without OMZ installed of course). Can you confirm that Zsh does not complete from ~/.ssh/config on your machine, and share your configuration?

I just browsed quickly through Zsh completion code, and I could not find where this is done, but ~/.ssh/config is definitely parsed for ssh completion. Will look into it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using zsh 5.0.2 (x86_64-apple-darwin13.0) on Mavericks and can confirm that /etc/hosts and known_hosts are completed but ssh-config host sections are not offered for completion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ncanceill: I think you want the _ssh completion function, and specifically its _ssh_hosts helper function which is where it reads the ssh-config file.

I'm also running zsh 5.0.2 on Mavericks, and entries from ssh-config host section names are offered for completion... in some cases. Maybe we should look a bit closely at the default and target behavior before merging this in.

Switching over to #2707 for further comments.

@ncanceill
Copy link
Contributor

Since you have two separate plugins, maybe you should also have two separate PRs?

@elias5000
Copy link
Contributor Author

Sorry for the mixed PR. It basically is my second PR and I gave up on trying to find out how to cherry-pick the change to put into the PR.

@elias5000 elias5000 closed this Apr 9, 2014
@elias5000
Copy link
Contributor Author

I closed the PR and will open two separate ones for the plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants