Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding ~/.ssh/config parsing for host list and theme. #690

Merged
merged 13 commits into from

11 participants

Sébastien M-B Miguel Coquet jolan78 Joseph Caudle Shubham Bansal Chris Imbriano Nick Bugaiov Jan Ernsting Florian Pfitzer Marko Bauhardt Robby Russell
Sébastien M-B

Just a commit to add Hosts from ssh/config file in host completion for ssh.
I found the tip on a wiki (see commit message for url).

I also made my theme :)

Daniel Hahler blueyed referenced this pull request from a commit in blueyed/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.
ef002a8
Daniel Hahler blueyed referenced this pull request from a commit in blueyed/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

Conflicts:

	lib/completion.zsh
cabe82d
Miguel Coquet

Is this in line to make it into the main branch? I'd love to have this feature working

Robby Russell robbyrussell merged commit b6ea876 into from
Jan Ernsting

I guess, this was not supposed to be part of your pull request @essembeh

You are right. I don't know what I did wrong and how this commit is part of the pull request, sorry.

No problem ;) Just wanted to make sure, it did not end up there on purpose.

Marko Bauhardt

i miss the l alias

please but it back

What was the reason behind commenting this out. I can put it back in my local instance, but I would like to know if this was breaking anything or something else that I need to watch out for.

@sbansal: @essembeh confirmed that the commenting of alias l happened on accident.

please put it back :+1:

Just adding a voice. It'd be great to have l back.

Guys, there is a pull request submitted for this already #1802. Hopefully it would be accepted soon. Patience my friends :)

Actually, @sbansal, #1773 was submitted directly by @essembeh to undo this. I've closed #1802 in favor of the original pull request.

Sébastien M-B

Yes you can uncomment it in your local instance.
I don't know how this commit was par of my pull request, I just submitted #1773 to put the alias back.

Sébastien M-B essembeh referenced this pull request
Merged

Uncomment l alias #1773

jolan78

This breaks local users completion :
cd ~ro used to complete as cd ~root/
is this expected ? i was disapointed by this change.

I found the tip on http://www.nerux.org/wiki/OpenSSH#coupler_avec_zsh_completion
As a totally beginner with zsh, I just copied the lines.
I don't know why they turned off the users completion.
Removing line 46 does not seem to impact the ssh host completion, it could be removed.

opened an issue : #1857

Daniel Hahler blueyed referenced this pull request from a commit in blueyed/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
71d9420
apoh apoh referenced this pull request from a commit in apoh/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
0c73c41
Neil John D. Ortega neiljdo referenced this pull request from a commit in neiljdo/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
113c231
Wei w31 referenced this pull request from a commit in w31/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
6eb3511
Steven Leung stvleung referenced this pull request from a commit
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
39f54e5
Reed Koser bobtwinkles referenced this pull request from a commit in bobtwinkles/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
5c2ceae
Alan Accurso aaccurso referenced this pull request from a commit in aaccurso/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
997ab43
Alison Rowland arowla referenced this pull request from a commit in arowla/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
6987ab2
benjaoming benjaoming referenced this pull request from a commit in benjaoming/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
186ba11
Trynity Mirell trynity referenced this pull request from a commit in trynity/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
6dbd93a
Kenton Newby kenton referenced this pull request from a commit in kenton/oh-my-zsh
Daniel Hahler blueyed Use zsh's default for ':completion:*:hosts'
The manual configuration of ':completion:*:hosts' causes some problems
(e.g. issue #1337), and misses useful information (especially from
~/.ssh/known_hosts; issue #690 and issue #1009).

The best option appears to be using zsh's default configuration for
':completion:*:hosts'.

While rebasing this for a new pull request (#1498 got closed by accident
and then requests to re-open it got ignored), it also drops the `users
off` setting: completion of user names can be useful, and the commit
adding it (c4434d2) does not state why.
a1d9f09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 4, 2011
  1. Sébastien M-B

    Adding custom theme

    essembeh authored
  2. Sébastien M-B

    Update completion for SSH

    essembeh authored
    Add all hosts found in ~/.ssh/config.
    Tip found on: http://www.nerux.org/wiki/OpenSSH#coupler_avec_zsh_completion
Commits on Nov 16, 2011
  1. Sébastien M-B

    Update theme

    essembeh authored
    Use different colors in case of root or ssh connection for prompt.
Commits on Dec 8, 2011
  1. Sébastien M-B
Commits on Dec 15, 2011
  1. Sébastien M-B
Commits on Apr 12, 2012
  1. Sébastien M-B

    Merge remote branch 'upstream/master'

    essembeh authored
    Conflicts:
    	lib/completion.zsh
Commits on Jun 5, 2012
  1. Sébastien M-B
Commits on Jun 25, 2012
  1. Merge remote-tracking branch 'upstream/master'

    Sébastien authored
Commits on Jun 26, 2012
  1. Sébastien M-B

    Comment l alias

    essembeh authored
  2. Sébastien M-B
Commits on Feb 8, 2013
  1. Sébastien M-B

    Merge remote-tracking branch 'upstream/master'

    essembeh authored
    Conflicts:
    	lib/aliases.zsh
Commits on Feb 9, 2013
  1. Sébastien M-B
Commits on Mar 12, 2013
  1. Sébastien M-B
This page is out of date. Refresh to see the latest.
2  lib/aliases.zsh
View
@@ -17,7 +17,7 @@ alias history='fc -l 1'
# List direcory contents
alias lsa='ls -lah'
-alias l='ls -lA1'
+#alias l='ls -la'
alias ll='ls -l'
alias la='ls -lA'
alias sl=ls # often screw this up
3  lib/completion.zsh
View
@@ -34,8 +34,10 @@ cdpath=(.)
# use /etc/hosts and known_hosts for hostname completion
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_ssh_hosts=()
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
+[ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=(
+ "$_ssh_config[@]"
"$_global_ssh_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
@@ -43,6 +45,7 @@ hosts=(
localhost
)
zstyle ':completion:*:hosts' hosts $hosts
+zstyle ':completion:*' users off
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
31 themes/essembeh.zsh-theme
View
@@ -0,0 +1,31 @@
+# Theme with full path names and hostname
+# Handy if you work on different servers all the time;
+
+
+local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})"
+
+function my_git_prompt_info() {
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+ GIT_STATUS=$(git_prompt_status)
+ [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS"
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
+}
+
+# Colored prompt
+ZSH_THEME_COLOR_USER="green"
+ZSH_THEME_COLOR_HOST="green"
+ZSH_THEME_COLOR_PWD="yellow"
+test -n "$SSH_CONNECTION" && ZSH_THEME_COLOR_USER="red" && ZSH_THEME_COLOR_HOST="red"
+test `id -u` = 0 && ZSH_THEME_COLOR_USER="magenta" && ZSH_THEME_COLOR_HOST="magenta"
+PROMPT='%{$fg_bold[$ZSH_THEME_COLOR_USER]%}%n@%{$fg_bold[$ZSH_THEME_COLOR_HOST]%}%M%{$reset_color%}:%{$fg_bold[$ZSH_THEME_COLOR_PWD]%}%~%{$reset_color%} $(my_git_prompt_info)%(!.#.$) '
+RPS1="${return_code}"
+
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
+ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
+ZSH_THEME_GIT_PROMPT_ADDED="+"
+ZSH_THEME_GIT_PROMPT_MODIFIED="*"
+ZSH_THEME_GIT_PROMPT_RENAMED="~"
+ZSH_THEME_GIT_PROMPT_DELETED="!"
+ZSH_THEME_GIT_PROMPT_UNMERGED="?"
+
Something went wrong with that request. Please try again.