aboutsummaryrefslogtreecommitdiffstats
path: root/zuwu.zsh
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-02-06 16:41:56 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-02-06 16:41:56 +0100
commit71385bcaa56690e1320a4b8b3f8af70a7d6938f2 (patch)
treea7e5711b15168c1378d33a4771e7b619bbdcda62 /zuwu.zsh
parent927e7e66d065d38bb8a891171945e6ecdb6a6abe (diff)
downloadzuwu-71385bcaa56690e1320a4b8b3f8af70a7d6938f2.tar.gz
zuwu-71385bcaa56690e1320a4b8b3f8af70a7d6938f2.tar.bz2
zuwu-71385bcaa56690e1320a4b8b3f8af70a7d6938f2.tar.lz
zuwu-71385bcaa56690e1320a4b8b3f8af70a7d6938f2.zip

feat!: add USE_COLOURED_LS_GREP, defaulted to true

When true, this command will, for ls & grep, add --color=auto, if no color= is present in the output of which for said commands.

Diffstat (limited to 'zuwu.zsh')
-rwxr-xr-xzuwu.zsh9
1 files changed, 9 insertions, 0 deletions
diff --git a/zuwu.zsh b/zuwu.zsh
index 3bb1bbf..2ca1cdf 100755
--- a/zuwu.zsh
+++ b/zuwu.zsh
@@ -121,6 +121,7 @@ reloadopt() {
noop "${DELETE_CHAR:=true}"
noop "${INSEND_MOVE_KEY:=true}"
noop "${BINDKEY_KIND:=e}"
+ noop "${USE_COLOURED_LS_GREP:=true}"
__opt() {
if "$1"; then
@@ -140,6 +141,14 @@ reloadopt() {
__opt "$DO_AUTOCD" autocd
__opt "$DO_ERR_BEEP" beep
__opt "$DO_EXTENDED_BLOB" extendedglob
+ if "$USE_COLOURED_LS_GREP"; then
+ if [[ "$(which ls 2>&1)" != *color=* ]]; then
+ alias ls="ls --color=auto";
+ fi
+ if [[ "$(which grep 2>&1)" != *color=* ]]; then
+ alias grep="grep --color=auto"
+ fi
+ fi
if "$LINE_OR_BEGIN_SEARCH_KEY"; then
_bkey() {
zle -N "$1"