2018-06-15 13:43:04 +00:00
|
|
|
#!/usr/bin/env zsh
|
2018-02-23 09:38:24 +00:00
|
|
|
|
2019-05-01 13:33:39 +00:00
|
|
|
# this alias removes leading dollar sign (useful when copying code from Stackoverflow)
|
2018-03-09 07:45:40 +00:00
|
|
|
alias '$'=''
|
2020-07-18 19:48:25 +00:00
|
|
|
|
|
|
|
# the following aliases allow alias expansion in common programs which take
|
|
|
|
# commands as their arguments
|
2019-05-01 13:33:39 +00:00
|
|
|
alias sudo='sudo '
|
2020-07-18 19:48:25 +00:00
|
|
|
alias watch='watch '
|
|
|
|
alias xargs='xargs '
|
2018-03-09 07:45:40 +00:00
|
|
|
|
2019-09-24 19:34:15 +00:00
|
|
|
alias history='fc -i -l 1'
|
|
|
|
|
2019-05-20 05:39:00 +00:00
|
|
|
alias cdd='dirs -v'
|
|
|
|
|
2018-11-15 15:08:23 +00:00
|
|
|
alias grep='grep --color=auto'
|
2021-01-05 18:41:33 +00:00
|
|
|
alias diff='diff --color=auto --unified'
|
2019-06-15 13:39:07 +00:00
|
|
|
|
2018-11-15 15:08:23 +00:00
|
|
|
# exa is a modern replacement for ls - https://the.exa.website/
|
|
|
|
if command_exists exa; then
|
2019-10-03 20:36:20 +00:00
|
|
|
alias ls='exa --classify --group-directories-first'
|
|
|
|
alias lsa='ls --all'
|
|
|
|
alias l='ls --long --header --binary --group'
|
2019-12-09 17:49:50 +00:00
|
|
|
alias lt='l --tree'
|
2019-10-03 20:36:20 +00:00
|
|
|
alias la='l --all'
|
2019-12-09 17:49:50 +00:00
|
|
|
alias lat='la --tree'
|
2019-10-03 20:36:20 +00:00
|
|
|
alias tree='ls --tree'
|
2018-11-15 15:08:23 +00:00
|
|
|
else
|
2019-10-03 20:36:20 +00:00
|
|
|
alias ls='ls --classify --group-directories-first --color=auto'
|
|
|
|
alias lsa='ls --almost-all'
|
|
|
|
alias l='ls -l --human-readable'
|
|
|
|
alias la='l --almost-all'
|
2018-11-15 15:08:23 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# fd is a simple, fast and user-friendly alternative to find - https://github.com/sharkdp/fd
|
|
|
|
if command_exists fd; then
|
2019-10-03 20:36:20 +00:00
|
|
|
alias fda='fd --hidden --no-ignore'
|
2018-11-15 15:08:23 +00:00
|
|
|
fi
|
|
|
|
|
2020-09-05 12:54:12 +00:00
|
|
|
# some amendments to Oh My Zsh's git plugin
|
|
|
|
# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/git.plugin.zsh
|
|
|
|
alias glo="git log --decorate --abbrev-commit --date=relative --pretty='%C(auto)%h%C(reset)%C(auto)%d%C(reset) %s %C(green)- %an %C(blue)(%ad)%C(reset)'"
|
|
|
|
alias glog='glo --graph'
|
|
|
|
alias gloga='glog --all'
|
|
|
|
|
2018-11-15 15:08:23 +00:00
|
|
|
# git with hub
|
2019-09-24 19:34:15 +00:00
|
|
|
if command_exists hub; then
|
2019-10-03 20:36:20 +00:00
|
|
|
alias git='hub'
|
2020-09-05 12:54:12 +00:00
|
|
|
alias gw='git browse'
|
|
|
|
alias gci='git ci-status --verbose'
|
2019-09-24 19:34:15 +00:00
|
|
|
fi
|
2018-11-15 15:08:23 +00:00
|
|
|
|
|
|
|
# make these utils more verbose
|
|
|
|
alias cp='cp -iv'
|
|
|
|
alias mv='mv -iv'
|
|
|
|
alias rm='rm -iv'
|
2019-09-24 19:34:15 +00:00
|
|
|
alias rmdir='rmdir -v' rd='rmdir'
|
2018-11-15 15:08:23 +00:00
|
|
|
alias chmod='chmod -v'
|
|
|
|
alias chown='chown -v'
|
2019-07-31 19:43:35 +00:00
|
|
|
alias ln='ln -iv'
|
2019-09-24 19:34:15 +00:00
|
|
|
alias mkdir='mkdir -v' md='mkdir -p'
|
|
|
|
|
|
|
|
for n in {1..9}; do
|
|
|
|
alias "$n"="cd +$n"
|
|
|
|
done; unset n
|
|
|
|
|
2020-04-30 09:01:37 +00:00
|
|
|
alias ...='cd ../..'
|
|
|
|
alias ....='cd ../../..'
|
|
|
|
alias .....='cd ../../../..'
|
|
|
|
alias ......='cd ../../../../..'
|
2018-11-15 15:08:23 +00:00
|
|
|
|
|
|
|
# print file sizes in human readable format
|
|
|
|
alias du='du -h'
|
|
|
|
alias df='df -h'
|
2019-05-29 08:36:37 +00:00
|
|
|
alias free='free -h'
|
2019-05-09 15:58:25 +00:00
|
|
|
|
2021-02-14 00:09:05 +00:00
|
|
|
if command_exists apt && command_exists apt-get; then
|
|
|
|
apt_get_message="use 'apt' instead of 'apt-get'
|
|
|
|
if you really want to use 'apt-get', type '\\apt-get'"
|
|
|
|
alias apt-get="echo -E ${(qqq)apt_get_message} #"
|
|
|
|
unset apt_get_message
|
|
|
|
fi
|
2019-11-24 09:55:58 +00:00
|
|
|
|
|
|
|
# editor
|
|
|
|
alias edit="$EDITOR"
|
|
|
|
alias e="$EDITOR"
|
|
|
|
if [[ "$EDITOR" == *vim ]]; then
|
|
|
|
alias es="e -S"
|
|
|
|
fi
|
2020-08-23 08:57:34 +00:00
|
|
|
alias sue="sudo --edit"
|
2019-12-25 22:04:52 +00:00
|
|
|
|
2020-09-03 06:03:12 +00:00
|
|
|
alias rsync-backup='rsync --archive --compress --verbose --human-readable --partial --progress'
|
2020-10-21 11:27:42 +00:00
|
|
|
|
|
|
|
if command_exists ncdu; then
|
|
|
|
alias ncdu='ncdu --confirm-quit'
|
|
|
|
fi
|
2021-01-03 17:27:02 +00:00
|
|
|
|
|
|
|
alias bin-disassemble='objdump -M intel-mnemonics -d'
|
|
|
|
alias bin-list-symbols='nm'
|
|
|
|
alias bin-list-dylib-symbols='nm -gD'
|
|
|
|
|
|
|
|
# Duplicated as an alias to prevent autocorrection of the real "command" part.
|
|
|
|
# See also scripts/prime-run
|
|
|
|
alias prime-run='__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia '
|
2021-02-14 00:09:05 +00:00
|
|
|
|
|
|
|
if ! command_exists update-grub; then
|
|
|
|
# Doesn't exist on Arch by default. Probably implementing this command was
|
|
|
|
# left as a challenge to the documentation reader.
|
|
|
|
alias update-grub="grub-mkconfig -o /boot/grub/grub.cfg"
|
|
|
|
fi
|