Browse Source

[zsh] Improve BSD compatibility

master
Lara 5 years ago
parent
commit
d4e82cf9cd
  1. 4
      aliases
  2. 23
      functions
  3. 9
      zshrc

4
aliases

@ -5,7 +5,7 @@
# Detect if we have GNU coreutils or BSD
if date --version > /dev/null 2>&1 ;then
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
alias diff='diff -u --color'
alias diff='diff --color'
alias less='less --quiet'
alias grep="grep --color"
alias rm='rm -I'
@ -13,6 +13,7 @@ if date --version > /dev/null 2>&1 ;then
alias ipa='ip route && echo && ip --brief address'
alias ipr='ip --brief address && echo && ip route'
else
alias ls='ls -FGh'
alias ipa='ip address'
alias ipa='ip route'
fi
@ -35,6 +36,7 @@ case $(uname -s) in
esac
alias ll='ls -lha'
alias df='df -h'
alias diff='diff -u'
alias du='du -h'
alias feh="feh -. --auto-rotate --action1 'dragon -x %F'"
alias which='which -a'

23
functions

@ -2,16 +2,19 @@
# Debugging #
#############
# Global counter that can be used to diagnose duplicated calls
printf "0" > /dev/shm/debug_counter
debug_counter_inc() {
count="$(cat /dev/shm/debug_counter)"
((count++))
printf "%d" "$count" > /dev/shm/debug_counter
}
debug_counter_print(){
printf "%d" "$(cat /dev/shm/debug_counter)"
}
# Detect if we have GNU coreutils or BSD
if date --version > /dev/null 2>&1 ;then
# Global counter that can be used to diagnose duplicated calls
printf "0" > /dev/shm/debug_counter
debug_counter_inc() {
count="$(cat /dev/shm/debug_counter)"
((count++))
printf "%d" "$count" > /dev/shm/debug_counter
}
debug_counter_print(){
printf "%d" "$(cat /dev/shm/debug_counter)"
}
fi
###################
# Update checking #

9
zshrc

@ -56,9 +56,12 @@ colors
. "$RC_PATH/functions"
. "$RC_PATH/aliases"
. "$RC_PATH/prompt"
# Setup colors for GNU ls
# TODO: check for GNU ls
eval "$(dircolors -b)"
# Detect if we have GNU coreutils or BSD
if date --version > /dev/null 2>&1 ;then
# Setup colors for GNU ls
eval "$(dircolors -b)"
fi
# Check for rc updates in the background
(check_rc_update&) 2> /dev/null

Loading…
Cancel
Save