Created
June 14, 2011 17:03
-
-
Save scottstanfield/1025341 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Includes current git branch in tcsh prompt. | |
# | |
# EXAMPLE | |
# | |
# Your prompt can look like this: | |
# | |
# [myhost.com ~/repos/foo (master)] | |
# | |
# USAGE: | |
# | |
# 1) Save this script as ~/bin/setprompt | |
# 2) In .cshrc, include this line: | |
# | |
# alias precmd "source ~/bin/setprompt" | |
# | |
# AUTHOR | |
# | |
# Original from http://acts.as.streeteasy.com/archives/2007/12/19/git_in_your_prompt/ | |
# Modified for tcsh by Geoffrey Grosenbach http://peepcode.com | |
switch ( `uname` ) | |
case Darwin: | |
set ptail = "»"; breaksw; | |
case Linux: | |
set ptail = "ϕ"; breaksw; | |
default: | |
set ptail = "%"; breaksw; | |
endsw | |
set color_blue="%{\033[0;34m%}" | |
set color_gray="%{\033[1;36m%}" | |
set color_normal="%{\033[0m%}" | |
setenv GIT_PROMPT "git status |& git-prompt.awk" | |
set p1="%B%m%b:%B$color_blue%~${color_normal}%b" | |
#set p1="%B%m%b:%B$color_blue%c${color_normal}%b" | |
set prompt="${p1}${color_gray}`$GIT_PROMPT`${color_normal} ${ptail} " | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stick this in your .cshrc (for a /bin/tcsh shell) and it should all work:
alias precmd "source ~/bin/setprompt"