about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-19 19:57:39 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-19 19:57:39 +0000
commitb3791f90db0ef20b0f371b8797d043fc1dd4bd1f (patch)
tree7b61c2aa92a7c4ec18e88107b45c48e832a6918a /Functions
parent2285f015f4ad4102a20a0f68382bf8b76579522b (diff)
downloadzsh-b3791f90db0ef20b0f371b8797d043fc1dd4bd1f.tar.gz
zsh-b3791f90db0ef20b0f371b8797d043fc1dd4bd1f.tar.xz
zsh-b3791f90db0ef20b0f371b8797d043fc1dd4bd1f.zip
Initial revision
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Prompts/prompt_oliver_setup35
1 files changed, 35 insertions, 0 deletions
diff --git a/Functions/Prompts/prompt_oliver_setup b/Functions/Prompts/prompt_oliver_setup
new file mode 100644
index 000000000..1f4e598fc
--- /dev/null
+++ b/Functions/Prompts/prompt_oliver_setup
@@ -0,0 +1,35 @@
+# oliver prompt theme
+
+prompt_oliver_help() {
+  cat - <<ENDHELP
+With this prompt theme, the prompt contains the current directory,
+history number and the previous command\'s exit code (if non-zero)
+and a final character which depends on priviledges.
+
+The colour of the prompt depends on two associative arrays -
+\$pcolour and $\tcolour. Each array is indexed by the name of the
+local host. Alternatively, the colour can be set with parameters
+to prompt.
+
+The hostname and username are also included unless they are in the
+\$normal_hosts or \$normal_users array.
+ENDHELP
+}
+
+prompt_oliver_setup() {
+  prompt_opts=( percent set )
+  
+  local pcol=$'\e['${1:-${pcolour[${HOST:=`hostname`}]:-33}}m
+  local tcol=$'\e['${2:-${tcolour[$HOST]:-37}}m
+  local a host="%M:" user="%n "
+  for a in $normal_hosts; do
+    [[ $HOST == $a ]] && host=""
+  done
+  for a in root $normal_users; do
+    [[ ${USER:-`whoami`} == $a ]] && user=""
+  done
+
+  PS1="%{$pcol%}$user$host%~ [%h%0(?..:%?)]%# %{$tcol%}"
+}
+
+prompt_oliver_setup "$@"