Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al3xtjames/2d313b9f05325303ae20ad1faca297d3 to your computer and use it in GitHub Desktop.
Save al3xtjames/2d313b9f05325303ae20ad1faca297d3 to your computer and use it in GitHub Desktop.
From 0e8718ee00902ebcc5910ed953b45d67ed665cc5 Mon Sep 17 00:00:00 2001
From: Alex James <theracermaster@gmail.com>
Date: Sun, 14 Mar 2021 20:12:15 -0500
Subject: [PATCH] init: Fix shell prompts on Termux
Backport of https://github.com/sorin-ionescu/prezto/pull/1561
---
init.zsh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/init.zsh b/init.zsh
index ebae912..37d3339 100644
--- a/init.zsh
+++ b/init.zsh
@@ -76,7 +76,16 @@ function pmodload {
local -a locations
local pmodule
local pmodule_location
+
+ # For some reason, Termux fails to locate the "prompt" module when NO_CASE_GLOB
+ # is set, but simply setting CASE_GLOB messes up the prompt itself.
+ # This temporarily enables it for the two globs, then immediately resets it.
+ # Adapted from https://unix.stackexchange.com/a/42031
+ local case_glob_prefix=NO
+ [[ -o CASE_GLOB ]] && case_glob_prefix=
+ setopt CASE_GLOB
local pfunction_glob='^([_.]*|prompt_*_setup|README*|*~)(-.N:t)'
+ setopt ${case_glob_prefix}_CASE_GLOB
# Load in any additional directories and warn if they don't exist
zstyle -a ':prezto:load' pmodule-dirs 'user_pmodule_dirs'
@@ -96,7 +105,9 @@ function pmodload {
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
continue
else
+ setopt CASE_GLOB
locations=(${pmodule_dirs:+${^pmodule_dirs}/$pmodule(-/FN)})
+ setopt ${case_glob_prefix}_CASE_GLOB
if (( ${#locations} > 1 )); then
if ! zstyle -t ':prezto:load' pmodule-allow-overrides 'yes'; then
print "$0: conflicting module locations: $locations"
--
2.30.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment