about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Prompts/prompt_adam1_setup29
-rw-r--r--Functions/Prompts/prompt_redhat_setup1
-rw-r--r--Functions/Prompts/prompt_suse_setup1
-rw-r--r--Functions/Zftp/zfrglob17
-rw-r--r--Functions/Zftp/zftp_chpwd37
5 files changed, 56 insertions, 29 deletions
diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup
index 65d1b68c0..19b7737eb 100644
--- a/Functions/Prompts/prompt_adam1_setup
+++ b/Functions/Prompts/prompt_adam1_setup
@@ -1,7 +1,30 @@
 # adam1 prompt theme
 
+prompt_adam1_help () {
+  cat <<'EOF'
+This prompt is color-scheme-able.  You can invoke it thus:
+
+  prompt adam1 [<color1> [<color2> [<color3>]]]
+
+where the colors are for the user@host background, current working
+directory, and current working directory if the prompt is split over
+two lines respectively.  The default colors are blue, cyan and green.
+This theme works best with a dark background.
+
+Recommended fonts for this theme: nexus or vga or similar.  If you
+don't have any of these, then specify the `plain' option to use 7-bit
+replacements for the 8-bit characters.
+
+And you probably thought adam1 was overkill.
+EOF
+}
+
 prompt_adam1_setup () {
-  base_prompt="%{$bg_no_bold_blue%}%n@%m%{$reset_color%} "
+  prompt_adam1_color1=${1:-'blue'}
+  prompt_adam1_color2=${2:-'cyan'}
+  prompt_adam1_color3=${3:-'green'}
+
+  base_prompt="%{$bg_no_bold[$prompt_adam1_color1]%}%n@%m%{$reset_color%} "
   post_prompt="%{$reset_color%}"
 
   base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%{.*?%}//g")
@@ -20,10 +43,10 @@ prompt_adam1_precmd () {
   base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~")
   prompt_length=${#base_prompt_etc}
   if [[ $prompt_length -lt 40 ]]; then
-    path_prompt="%{$fg_bold_cyan%}%(4~|...|)%3~%{$fg_bold_white%}"
+    path_prompt="%{$fg_bold[$prompt_adam1_color2]%}%(4~|...|)%3~%{$fg_bold[white]%}"
   else
     space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 ))
-    path_prompt="%{$fg_bold_green%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
+    path_prompt="%{$fg_bold[$prompt_adam1_color3]%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
   fi
   PS1="$base_prompt$path_prompt %# $post_prompt"
   PS2="$base_prompt$path_prompt %_> $post_prompt"
diff --git a/Functions/Prompts/prompt_redhat_setup b/Functions/Prompts/prompt_redhat_setup
index 2605545fe..58e6bd698 100644
--- a/Functions/Prompts/prompt_redhat_setup
+++ b/Functions/Prompts/prompt_redhat_setup
@@ -6,6 +6,7 @@ prompt_redhat_setup () {
   PS1="[%n@%m %1~]\\$ "
   PS2="> "
 
+  prompt_opts=( cr percent )
   precmd () { }
   preexec () { }
 }
diff --git a/Functions/Prompts/prompt_suse_setup b/Functions/Prompts/prompt_suse_setup
index 8bb9ac38f..9b937be07 100644
--- a/Functions/Prompts/prompt_suse_setup
+++ b/Functions/Prompts/prompt_suse_setup
@@ -6,6 +6,7 @@ prompt_suse_setup () {
   PS1="%n@%m:%~/ > "
   PS2="> "
 
+  prompt_opts=( cr percent )
   precmd () { }
   preexec () { }
 }
diff --git a/Functions/Zftp/zfrglob b/Functions/Zftp/zfrglob
index f9d67b3f2..1fb8d761a 100644
--- a/Functions/Zftp/zfrglob
+++ b/Functions/Zftp/zfrglob
@@ -9,7 +9,8 @@
 #      stick with a single directory.  This is the default.
 #  (2) Use remote globbing, i.e. pass it to ls at the site.
 #      Faster, but only works with UNIX, and only basic globbing.
-#      We do this if $zfrglob is non-null.
+#      We do this if the remote-glob style (or $zfrglob for
+#      backward compatibility) is set.
 
 # There is only one argument, the variable containing the
 # pattern to be globbed.  We set this back to an array containing
@@ -18,7 +19,9 @@
 emulate -L zsh
 setopt extendedglob
 
-local pat dir nondir files i
+local pat dir nondir files i zfrglob
+
+zstyle -t "$curcontext" remote-glob && zfrglob=1
 
 eval pat=\$$1
 
@@ -52,14 +55,10 @@ else
     rm -f $tmpf
   else
     # we just have to do an ls and hope that's right
+    local fcache_name
+    zffcache
     nondir=$pat
-    if (( $#zftp_fcache == 0 )); then
-      # Why does `zftp_fcache=($(zftp ls))' sometimes not work?
-      zftp ls >$tmpf
-      zftp_fcache=($(<$tmpf))
-      rm -f $tmpf
-    fi
-    files=($zftp_fcache)
+    files=(${(P)fcache_name})
   fi
   # now we want to see which of the $files match $nondir:
   # ${...:/foo} deletes occurrences of foo matching a complete word,
diff --git a/Functions/Zftp/zftp_chpwd b/Functions/Zftp/zftp_chpwd
index 0df199cfb..f661fa3ee 100644
--- a/Functions/Zftp/zftp_chpwd
+++ b/Functions/Zftp/zftp_chpwd
@@ -1,13 +1,16 @@
 # function zftp_chpwd {
 # You may want to alter chpwd to call this when $ZFTP_USER is set.
 
-# Cancel the filename cache for the current directory.
-zftp_fcache=()
-# ...and also empty the stored directory listing cache.
-# As this function is called when we close the connection, this
-# is the only place we need to do these two things.
-[[ -n $zfcurdir && -f $zfcurdir ]] && rm -f $zfcurdir
-zfotherargs=
+# If the directory really changed...
+if [[ $ZFTP_PWD != $zfconfig[lastdir_$ZFTP_SESSION] ]]; then
+  # ...and also empty the stored directory listing cache.
+  # As this function is called when we close the connection, this
+  # is the only place we need to do these two things.
+  local curdir=$zfconfig[curdir_$ZFTP_SESSION]
+  [[ -n $curdir && -f $curdir ]] && rm -f $curdir
+  zfconfig[otherargs_$ZFTP_SESSION]=
+  zffcache -d
+fi
 
 if [[ -z $ZFTP_USER ]]; then
   # last call, after an FTP logout
@@ -15,23 +18,23 @@ if [[ -z $ZFTP_USER ]]; then
   # delete the non-current cached directory
   [[ -n $zfotherdir && -f $zfotherdir ]] && rm -f $zfotherdir
 
-  # don't keep zflastdir between opens (do keep zflastsession)
-  zflastdir=
+  # don't keep lastdir between opens (do keep lastloc)
+  zfconfig[lastdir_$ZFTP_SESSION]=
 
   # return the display to standard
-  # uncomment the following line if you have a chpwd which shows directories
-  # chpwd
+  zstyle -t ":zftp$curcontext" chpwd && chpwd
 else
-  [[ -n $ZFTP_PWD ]] && zflastdir=$ZFTP_PWD
-  zflastsession="$ZFTP_HOST:$ZFTP_PWD"
+  [[ -n $ZFTP_PWD ]] && zfconfig[lastdir_$ZFTP_SESSION]=$ZFTP_PWD
+  zfconfig[lastloc_$ZFTP_SESSION]="$ZFTP_HOST:$ZFTP_PWD"
+  zfconfig[lastuser_$ZFTP_SESSION]="$ZFTP_USER"
   local args
-  if [[ -t 1 && -t 2 ]]; then
-    local str=$zflastsession
+  if [[ -t 1 && -t 2 ]] && zstyle -t ":zftp$curcontext" titlebar; then
+    local str=$zfconfig[lastloc_$ZFTP_SESSION]
     [[ ${#str} -lt 70 ]] && str="%m: %~  $str"
     case $TERM in
-      sun-cmd) print -n -P "\033]l$str\033\\"
+      sun-cmd) print -Pn "\033]l$str\033\\"
 	       ;;
-      xterm) print -n -P "\033]2;$str\a"
+      *xterm*|rxvt|dtterm|Eterm|kterm) print -Pn "\033]2;$str\a"
 	     ;;
     esac
   fi