]> arthur.barton.de Git - ax-zsh.git/blobdiff - ax.zsh
Don't load themes and ext. plugins on "dumb" terminals
[ax-zsh.git] / ax.zsh
diff --git a/ax.zsh b/ax.zsh
index c5ffeab120dd739f790d565978176188231c0a75..0071767967b2a04e6a8f363b2c1d437cb48e7468 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -70,7 +70,22 @@ function axzsh_load_plugin {
                # Read plugin ...
                [[ -n "$AXZSH_DEBUG" ]] \
                        && echo "   - $plugin ($type) ..."
-               source "$fname"
+
+               # Note for "external" ("repo/*") plugins and "dumb" terminals:
+               # These (modern?) plugins most probably don't expect such an
+               # unusual old terminal configuration and don't behave well
+               # (echo color sequences, for example). Therefore we DON'T load
+               # any external plugins at all when running on such a terminal:
+               # this results in reduced/disabled functionality, but hopefully
+               # in readable output ...
+
+               case "$fname" in
+                       *"/repos/"*)
+                               axzsh_is_dumb_terminal || source "$fname"
+                               ;;
+                       *)
+                               source "$fname"
+               esac
 
                if [[ -n "$cache_file" ]]; then
                        # Add plugin data to cache
@@ -78,7 +93,7 @@ function axzsh_load_plugin {
                        case "$fname" in
                                *"/repos/"*)
                                        echo "[[ -n \"\$AXZSH_DEBUG\" ]] && echo '     - $plugin ($type): \"$fname\" ...'" >>$cache_file
-                                       echo "source '$fname'" >>$cache_file
+                                       echo "axzsh_is_dumb_terminal || source '$fname'" >>$cache_file
                                        ;;
                                *)
                                        echo "[[ -n \"\$AXZSH_DEBUG\" ]] && echo '     - $plugin ($type, cached) ...'" >>$cache_file