Skip to content

Commit

Permalink
added hostname to prompt if connected via ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
heim committed Apr 8, 2012
1 parent ef3e573 commit 84203f1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions git_time_since_last_commit.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function time_since_last_commit() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
git log -1 --pretty=format:"%ar" | sed 's/\([0-9]*\) \(.\).*/\1\2/'
}
3 changes: 2 additions & 1 deletion heim.zsh-theme
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PROMPT='%m %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(time_since_last_commit)%{$fg_bold[blue]%}# % %{$reset_color%}'
PROMPT='%{$fg_no_bold[cyan]%}$(hostname_if_connected_via_ssh) %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(time_since_last_commit)%{$fg_bold[blue]%}# % %{$reset_color%}'

#who | grep -P '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
Expand Down
3 changes: 3 additions & 0 deletions hostname_if_connected_via_ssh.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hostname_if_connected_via_ssh() {
if [ -n "${SSH_CLIENT:+x}" ]; then hostname; fi;
}
4 changes: 0 additions & 4 deletions plugins/git_time_since_last_commit.zsh

This file was deleted.

2 changes: 1 addition & 1 deletion zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ZSH_THEME="heim"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git rvm brew osx vagrant)
plugins=(git brew osx vagrant)

source $ZSH/oh-my-zsh.sh

Expand Down

0 comments on commit 84203f1

Please sign in to comment.