summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2011-03-07 11:18:01 +0100
committerTobias Klauser <tklauser@distanz.ch>2011-03-07 11:18:01 +0100
commit8a36bdfe9a31442e642b70bf0e40706cf55e13bd (patch)
treef8c1315b8003599d653cf3357c6ee6456c4f09e5
parente505f702aa9cbd10a7a52ce68a8515c5435838c5 (diff)
Add custom prompt
l---------.zsh/.zshrc1
-rw-r--r--.zsh/zshrc/00_colours26
-rw-r--r--.zsh/zshrc/80_prompt28
3 files changed, 55 insertions, 0 deletions
diff --git a/.zsh/.zshrc b/.zsh/.zshrc
new file mode 120000
index 0000000..301876b
--- /dev/null
+++ b/.zsh/.zshrc
@@ -0,0 +1 @@
+zstub \ No newline at end of file
diff --git a/.zsh/zshrc/00_colours b/.zsh/zshrc/00_colours
new file mode 100644
index 0000000..9710888
--- /dev/null
+++ b/.zsh/zshrc/00_colours
@@ -0,0 +1,26 @@
+# zshrc/00_colours
+#
+# Colours
+#
+# Copyright © 2011 Tobias Klauser <tklauser@distanz.ch>
+#
+# Source repository: git://git.distanz.ch/dotfiles/zsh.git
+#
+# Based on the zsh setup by martin f. krafft which can be found at:
+# git://git.madduck.net/etc/zsh.git
+
+if autoload colors && colors 2>/dev/null ; then
+ BLUE="%{${fg[blue]}%}"
+ RED="%{${fg_bold[red]}%}"
+ GREEN="%{${fg[green]}%}"
+ CYAN="%{${fg[cyan]}%}"
+ WHITE="%{${fg_bold[white]}%}"
+ NO_COLOUR="%{${reset_color}%}"
+else
+ BLUE=$'%{\e[1;34m%}'
+ RED=$'%{\e[1;31m%}'
+ GREEN=$'%{\e[1;32m%}'
+ CYAN=$'%{\e[1;36m%}'
+ WHITE=$'%{\e[1;37m%}'
+ NO_COLOUR=$'%{\e[0m%}'
+fi
diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/80_prompt
new file mode 100644
index 0000000..4980d42
--- /dev/null
+++ b/.zsh/zshrc/80_prompt
@@ -0,0 +1,28 @@
+# zshrc/80_prompt
+#
+# Formats the shell prompt
+#
+# Copyright © 2011 Tobias Klauser <tklauser@distanz.ch>
+#
+# Source repository: git://git.distanz.ch/dotfiles/zsh.git
+#
+# Based on the zsh setup by martin f. krafft which can be found at:
+# git://git.madduck.net/etc/zsh.git
+
+EXITCODE="%(?..%?%1v )"
+
+# set variable debian_chroot if running in a chroot with /etc/debian_chroot
+if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
+ debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# don't use colors on dumb terminals
+if [[ "$TERM" == dumb ]] ; then
+ PROMPT="${EXITCODE}${debian_chroot:+($debian_chroot)}%n@%m%40<...<%B%~%b%<< %# "
+else
+ if (( EUID != 0 )); then
+ PROMPT="${RED}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%n${WHITE}@%m${NO_COLOUR}:%40<...<%B%~%b%<< %# " # primary prompt string
+ else
+ PROMPT="${BLUE}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%n${NO_COLOUR}@%m%40<...<%B%~%b%<< %# " # primary prompt string
+ fi
+fi