diff options
-rw-r--r-- | .config/zsh/utils.zsh | 59 |
1 files changed, 16 insertions, 43 deletions
diff --git a/.config/zsh/utils.zsh b/.config/zsh/utils.zsh index 2d292ea..cfd9094 100644 --- a/.config/zsh/utils.zsh +++ b/.config/zsh/utils.zsh @@ -5,56 +5,29 @@ function has () { command -v "$@" &> /dev/null } -# cat -has bat && alias cat='bat --plain --paging=never' -# should consider another alias for --show-all (and --number on base cat) but it's not a good default - -# diff -alias diff='diff --color' - -# grep -grep_opts="--color=auto --exclude-dir=.git" -alias grep="grep $grep_opts" -alias egrep="egrep $grep_opts" -alias fgrep="fgrep $grep_opts" -unset grep_opts +alias dd="dd status=progress oflag=direct,sync" +alias grep="grep -E --color=auto --exclude-dir=.git" # one day i will try ag or rg +alias mkdir='mkdir -p' -# ls -if has eza; then - alias ls='eza' - alias ll='eza --long --header --all' -elif ls --almost-all &> /dev/null; then +if [[ $OSTYPE =~ 'linux' ]]; then + # probably breaks for busybox but i don't run alpine anywhere at the moment + alias df="df -TH --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=udev" + alias diff='diff --color' alias ls='ls --color=auto' alias ll='ls -l --almost-all --no-group --human-readable --color=auto' -else - # bsd/mac ls +elif [[ $OSTYPE =~ 'darwin' ]]; then + alias df="df -YH -T noautofs,devfs,tmpfs,squashfs" alias ls='ls -G' alias ll='ls -hoAG' +elif [[ $OSTYPE == 'cygwin' ]]; then + alias sudo='cygstart --action=runas' fi -# tree -has tree && alias tree='tree -C' - -# mkdir -alias mkdir='mkdir -p' - -# dd -alias dd="dd status=progress oflag=direct,sync" - -## df -if df --exclude-type=tmpfs &> /dev/null; then - alias df="df -TH --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=udev" -else - # bsd/mac df - alias df="df -YH -T noautofs,devfs,tmpfs,squashfs" +if has eza; then + alias ls='eza' + alias ll='eza --long --header --all' fi -# gpg +has bat && alias cat='bat --plain --paging=never' # another for --show-all (and --number on base cat)? has gpg2 && alias gpg='gpg2' - -# cygwin-specific -if [[ "$OSTYPE" == 'cygwin' ]]; then - alias sudo='cygstart --action=runas' -fi - -unfunction has +has tree && alias tree='tree -C' |