summaryrefslogtreecommitdiffstats
path: root/Functions/Prompts
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-19 11:48:09 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-19 11:48:09 +0000
commit5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88 (patch)
treefd2efc6cf4f8bdd5607d920a1dc85d98ca5d16c5 /Functions/Prompts
parentzsh-workers/8683 (diff)
downloadzsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.tar
zsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.tar.gz
zsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.tar.bz2
zsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.tar.lz
zsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.tar.xz
zsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.tar.zst
zsh-5efc7525eceb8d3b5fd5f6d51396e6d58d84fa88.zip
manual/8684
Diffstat (limited to 'Functions/Prompts')
-rw-r--r--Functions/Prompts/prompt_off_setup3
-rw-r--r--Functions/Prompts/prompt_oliver_setup25
-rw-r--r--Functions/Prompts/prompt_redhat_setup3
-rw-r--r--Functions/Prompts/prompt_suse_setup3
-rw-r--r--Functions/Prompts/prompt_zefram_setup3
-rw-r--r--Functions/Prompts/promptinit6
6 files changed, 26 insertions, 17 deletions
diff --git a/Functions/Prompts/prompt_off_setup b/Functions/Prompts/prompt_off_setup
index c5820007e..4eef43e13 100644
--- a/Functions/Prompts/prompt_off_setup
+++ b/Functions/Prompts/prompt_off_setup
@@ -4,7 +4,8 @@ prompt_off_setup () {
PS1="%# "
PS2="> "
- precmd () { setopt promptsubst }
+ prompt_opts=( cr percent )
+ precmd () { }
preexec () { }
}
diff --git a/Functions/Prompts/prompt_oliver_setup b/Functions/Prompts/prompt_oliver_setup
index a1bce3da2..1d32dd49d 100644
--- a/Functions/Prompts/prompt_oliver_setup
+++ b/Functions/Prompts/prompt_oliver_setup
@@ -9,7 +9,8 @@ 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.
+to prompt. To specify colours, use English words like 'yellow',
+optionally preceded by 'bold'.
The hostname and username are also included unless they are in the
$normal_hosts or $normal_users array.
@@ -17,21 +18,23 @@ ENDHELP
}
prompt_oliver_setup() {
- prompt_opts=( percent )
+ prompt_opts=( cr subst percent )
[[ "${(t)pcolour}" != assoc* ]] && typeset -Ag pcolour
[[ "${(t)tcolour}" != assoc* ]] && typeset -Ag tcolour
- local pcol=$'\e['${1:-${pcolour[${HOST:=`hostname`}]:-33}}m
- local tcol=$'\e['${2:-${tcolour[$HOST]:-37}}m
+ local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-yellow}}
+ local pcolr=$fg[${pcol#bold}]
+ [[ $pcol = bold* ]] && pcolr=$bold_color$pcolr
+
+ local tcol=${2:-${tcolour[$HOST]:-white}}
+ local tcolr=$reset_color$fg[${tcol#bold}]
+ [[ $tcol = bold* ]] && tcolr=$tcolr$bold_color
+
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
+ [[ $HOST == (${(j(|))~normal_hosts}) ]] && host=""
+ [[ ${USER:-`whoami`} == (root|${(j(|))~normal_users}) ]] && user=""
- PS1="%{$pcol%}$user$host%~ [%h%0(?..:%?)]%# %{$tcol%}"
+ PS1="%{$pcolr%}$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%0(?..:%?)]%# %{$tcolr%}"
}
prompt_oliver_setup "$@"
diff --git a/Functions/Prompts/prompt_redhat_setup b/Functions/Prompts/prompt_redhat_setup
index 876797899..58e6bd698 100644
--- a/Functions/Prompts/prompt_redhat_setup
+++ b/Functions/Prompts/prompt_redhat_setup
@@ -6,7 +6,8 @@ prompt_redhat_setup () {
PS1="[%n@%m %1~]\\$ "
PS2="> "
- precmd () { setopt promptsubst }
+ prompt_opts=( cr percent )
+ precmd () { }
preexec () { }
}
diff --git a/Functions/Prompts/prompt_suse_setup b/Functions/Prompts/prompt_suse_setup
index 64fa410dc..9b937be07 100644
--- a/Functions/Prompts/prompt_suse_setup
+++ b/Functions/Prompts/prompt_suse_setup
@@ -6,7 +6,8 @@ prompt_suse_setup () {
PS1="%n@%m:%~/ > "
PS2="> "
- precmd () { setopt promptsubst }
+ prompt_opts=( cr percent )
+ precmd () { }
preexec () { }
}
diff --git a/Functions/Prompts/prompt_zefram_setup b/Functions/Prompts/prompt_zefram_setup
index 3e6d34840..99585edec 100644
--- a/Functions/Prompts/prompt_zefram_setup
+++ b/Functions/Prompts/prompt_zefram_setup
@@ -10,7 +10,8 @@ function prompt_zefram_setup {
PS1='[%(2L.%L/.)'$ZSH_VERSION']%(?..%B{%v}%b)%n%(2v.%B@%b.@)%m:%B%~%b%(!.#.>) '
PS2='%(4_:... :)%3_> '
- precmd () { prompt_zefram_precmd; setopt promptsubst }
+ prompt_opts=( cr subst percent )
+ precmd () { prompt_zefram_precmd }
preexec () { }
}
diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit
index cfab990df..faa73be21 100644
--- a/Functions/Prompts/promptinit
+++ b/Functions/Prompts/promptinit
@@ -8,12 +8,12 @@
prompt_themes=()
typeset -gU prompt_themes
-typeset -g prompt_theme
+typeset -g prompt_theme >/dev/null
promptinit () {
emulate -L zsh
setopt extendedglob
- local ppath='' name
+ local ppath='' name theme
# Autoload all prompt_*_setup functions in fpath
for theme in $^fpath/prompt_*_setup(N); do
@@ -170,6 +170,8 @@ prompt () {
(( $#prompt_opts )) &&
setopt noprompt{bang,cr,percent,subst} prompt${^prompt_opts[@]}
+
+ true
}
prompt_preview_theme () {