Skip to content

Instantly share code, notes, and snippets.

@dwhenry
Created April 22, 2014 17:31
Show Gist options
  • Select an option

  • Save dwhenry/11187781 to your computer and use it in GitHub Desktop.

Select an option

Save dwhenry/11187781 to your computer and use it in GitHub Desktop.
zsh has to shorten branch name and make command line usage
commit f143e8dd0ffd018b59476dd885a9d922b6ca4dd6
Author: David Henry <dw_henry@yahoo.com.au>
Date: Tue Apr 22 18:30:47 2014 +0100
Hack on the command line for zsh
diff --git a/lib/history.zsh b/lib/history.zsh
index 6559451..04db917 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -12,4 +12,4 @@ setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
-setopt share_history # share command history data
+#setopt share_history # share command history data
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 608ec37..efcab41 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -34,7 +34,7 @@ EOF
launch session "Default Session"
set current_session to current session
tell current_session
- write text "${command}"
+ write text "cd dev"
end tell
end tell
end tell
diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme
index 2fc0663..7abfbc1 100644
--- a/themes/crunch.zsh-theme
+++ b/themes/crunch.zsh-theme
@@ -13,6 +13,17 @@
# Colors are at the top so you can mess with those separately if you like.
# For the most part I stuck with Dallas's.
+# hack to get a sub part of the branch in the prompt
+# DH: 2014-04-08
+my_git_prompt_info () {
+if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]
+then
+ ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
+ BRANCH="${ref#refs/heads/}"
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${BRANCH:0:20}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
+fi
+}
+
CRUNCH_BRACKET_COLOR="%{$fg[white]%}"
CRUNCH_TIME_COLOR="%{$fg[yellow]%}"
CRUNCH_RVM_COLOR="%{$fg[magenta]%}"
@@ -36,8 +47,8 @@ else
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
fi
fi
-CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
+CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(my_git_prompt_info) "
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
# Put it all together!
-PROMPT="$CRUNCH_TIME_$CRUNCH_RVM_$CRUNCH_DIR_$CRUNCH_PROMPT%{$reset_color%}"
+PROMPT="$CRUNCH_TIME_$CRUNCH_RVM_$CRUNCH_DIR_$CRUNCH_PROMPT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment