zsh: Update
authorStefan Huber <shuber@sthu.org>
Wed, 10 Feb 2021 20:57:40 +0000 (21:57 +0100)
committerStefan Huber <shuber@sthu.org>
Wed, 10 Feb 2021 20:57:40 +0000 (21:57 +0100)
dotfiles/shell/.zshrc

index 291c4ab2469f39ef41d3cf4f95a159b3cc1418c4..1b74f6d744e6eae18087b4cdba35707f374e5e39 100644 (file)
@@ -24,9 +24,6 @@ zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
 zstyle ':completion:*' menu select
 zmodload -i zsh/complist
 
 zstyle ':completion:*' menu select
 zmodload -i zsh/complist
 
-#TERM=xterm-256color
-
-
 # bind special keys according to readline configuration
 #eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"
 
 # bind special keys according to readline configuration
 #eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"
 
@@ -67,18 +64,11 @@ setopt \
        NO_HUP
 
 
        NO_HUP
 
 
-for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
-       eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
-       eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
-done
-PR_BOLD="%{$terminfo[bold]%}"
-PR_NO_COLOUR="%{$terminfo[sgr0]%}"
-
 HISTFILE=~/.zsh_history
 HISTSIZE=50000
 SAVEHIST=50000
 REPORTTIME=5
 HISTFILE=~/.zsh_history
 HISTSIZE=50000
 SAVEHIST=50000
 REPORTTIME=5
-TIMEFMT="$fg[magenta]%J  %U user  %S sys  %P cpu  %*E total  %M kB max$terminfo[sgr0]"
+TIMEFMT="$fg[magenta]%J  %U user  %S sys  %P cpu  %*E total  %M MB RSS max$terminfo[sgr0]"
 
 autoload -Uz vcs_info && vcs_info
 zstyle ':vcs_info:*' enable git cvs svn hg
 
 autoload -Uz vcs_info && vcs_info
 zstyle ':vcs_info:*' enable git cvs svn hg
@@ -101,19 +91,36 @@ $PR_EXIT%# '
 setprompt
 
 # Obtain the autofs mountpoints
 setprompt
 
 # Obtain the autofs mountpoints
-autofs_mp=""
-[ -r /etc/auto.master ] && autofs_mp=$(/bin/grep -e "^/" /etc/auto.master)
+autofs_mp=()
+[ -r /etc/auto.master ] && autofs_mp=($(/bin/grep -e "^/" /etc/auto.master | cut -f1))
 
 function precmd ()
 {
        PR_EXIT="%{$fg_bold[red]%}%(?..[%?] )%{$reset_color%}"
 
 
 function precmd ()
 {
        PR_EXIT="%{$fg_bold[red]%}%(?..[%?] )%{$reset_color%}"
 
-       # autofs always complains not being able to mount .hg/ and the like
-       if echo "$autofs_mp" | /bin/grep -qe "^$PWD\s"; then
-               vcs_info_msg_0_="[autofs]"
-       else
+    # Check whether current directory is a subdirectory of an autofs mountpoint
+    local parent="0"
+    vcs_info_msg_0_=""
+    for mp in ${autofs_mp}; do
+        # A parent directory is an autofs mount point
+        if echo "$PWD" | /bin/grep -q $mp; then
+            parent="1"
+            # Even equal!
+            if echo "$mp" | /bin/grep -q $PWD; then
+                       vcs_info_msg_0_=" [autofs]"
+            fi
+            break;
+        fi
+    done
+    if [ -z "$vcs_info_msg_0_" ]; then
+        if [ "$parent" = "1" ]; then
+            # svn and hg cause complaints of autofs that .svn and .hg is no mount point
+            zstyle ':vcs_info:*' enable git cvs
+        else
+            zstyle ':vcs_info:*' enable git cvs svn hg
+        fi
                vcs_info
                vcs_info
-       fi
+    fi
 
        PR_SCREEN=""
        if [[ -n "${WINDOW}" ]]; then
 
        PR_SCREEN=""
        if [[ -n "${WINDOW}" ]]; then