summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/clipboard.zsh8
-rw-r--r--lib/theme-and-appearance.zsh9
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
index b663800a4..2c93d1bb5 100644
--- a/lib/clipboard.zsh
+++ b/lib/clipboard.zsh
@@ -31,13 +31,13 @@ function clipcopy() {
cat $file > /dev/clipboard
fi
else
- if which xclip &>/dev/null; then
+ if (( $+commands[xclip] )); then
if [[ -z $file ]]; then
xclip -in -selection clipboard
else
xclip -in -selection clipboard $file
fi
- elif which xsel &>/dev/null; then
+ elif (( $+commands[xsel] )); then
if [[ -z $file ]]; then
xsel --clipboard --input
else
@@ -74,9 +74,9 @@ function clippaste() {
elif [[ $OSTYPE == cygwin* ]]; then
cat /dev/clipboard
else
- if which xclip &>/dev/null; then
+ if (( $+commands[xclip] )); then
xclip -out -selection clipboard
- elif which xsel &>/dev/null; then
+ elif (( $+commands[xsel] )); then
xsel --clipboard --output
else
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
index a3bb24677..467b770d6 100644
--- a/lib/theme-and-appearance.zsh
+++ b/lib/theme-and-appearance.zsh
@@ -6,17 +6,19 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
# Find the option for using colors in ls, depending on the version
- if [[ "$(uname -s)" == "NetBSD" ]]; then
+ if [[ "$OSTYPE" == netbsd* ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
- elif [[ "$(uname -s)" == "OpenBSD" ]]; then
+ elif [[ "$OSTYPE" == openbsd* ]]; then
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
# with color and multibyte support) are available from ports. "colorls"
# will be installed on purpose and can't be pulled in by installing
# coreutils, so prefer it to "gls".
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
colorls -G -d . &>/dev/null && alias ls='colorls -G'
+ elif [[ "$OSTYPE" == darwin* ]]; then
+ gls --color -d . &>/dev/null && alias ls='gls --color=tty' || alias ls='ls -G'
else
# For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
if [[ -z "$LS_COLORS" ]]; then
@@ -24,6 +26,9 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
fi
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || alias ls='ls -G'
+
+ # Take advantage of $LS_COLORS for completion as well.
+ zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
fi
fi