Modified ZSH aliases

This commit is contained in:
Christian Baer 2020-06-09 21:17:38 +02:00
parent 5582912d54
commit 526615326b

View File

@ -1,32 +1,34 @@
_exists() { (( $+commands[$1] )) } _exists() { (( $+commands[$1] )) }
_exists vim && export EDITOR=vim _exists less && export PAGER=less
_exists less && export PAGER=less _exists sudo && alias doas='sudo'
if _exists vim; then if _exists vim; then
alias vim="vim -p" export EDITOR=vim
alias vi="vim" alias vim="vim -p"
fi fi
unfunction _exists unfunction _exists
alias ls='ls --color=always -h' alias ls='ls --color=always -h'
alias ll='ls -la' alias ll='ls -lah'
alias mkdir='mkdir -p'
alias htop='doas htop'
alias ...='cd ../..' alias ...='cd ../..'
alias foldersize='du -sh' alias foldersize='du -sh'
alias duf='du -sk * | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done' alias duf='du -sk * | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done'
alias google='ping -c 10240000 google.com' alias google='ping -c 10240000 google.com'
alias sulast='doas $(history -p !-1)'
case `uname` in case `uname` in
Darwin) Darwin)
# commands for OS X go here # commands for OS X go here
alias flushdns='dscacheutil -flushcache && killall -HUP mDNSResponder' alias flushdns='dscacheutil -flushcache && killall -HUP mDNSResponder'
alias htop='sudo htop'
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
alias r='open -a' alias r='open -a'
alias sulast='sudo $(history -p !-1)'
alias ydl="youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'" alias ydl="youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'"
alias nmap_localnet='nmap -sP 10.0.3.0/24' alias nmap_localnet='nmap -sP 10.0.3.0/24'
alias fetch='curl -O'
;; ;;
Linux) Linux)
# commands for Linux go here # commands for Linux go here