205 lines
4.8 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# vim: ft=zsh
_d() { true ; }
_f() { true ; }
_a() { true ; }
alias ls='ls --classify=auto --human-readable'
alias ll='ls -l'
alias la='ls --almost-all'
alias lla='ls -l --almost-all'
alias l.='ls --almost-all --ignore="*"'
alias ll.='ls -l --almost-all --ignore="*"'
if command -v eza &>/dev/null; then
alias eza='eza --classify=auto'
alias ls='eza'
alias ll='eza --long'
alias la='eza --all'
alias lla='eza --long --all'
alias l.='_d() ( cd "${1:-.}" && eza --list-dirs .* ; ); _d'
alias ll.='_d() ( cd "${1:-.}" && eza --long --all --list-dirs .* ; ); _d'
alias tree='eza --tree'
fi
GREP_OPTIONS=(
--color=auto
--binary-files=without-match
--exclude-dir=.git
--exclude-dir=.svn
)
alias grep='grep $GREP_OPTIONS'
alias g='noglob grep $GREP_OPTIONS --dereference-recursive --line-number'
alias f='_f() { find . -name "*${1}*" }; noglob _f'
alias _='sudo'
alias root='sudo --login TMOUT=450'
alias rm='rm --interactive=once --verbose --recursive --one-file-system'
alias mkdir='mkdir --parents --verbose'
alias md='mkdir --parents --verbose'
alias q='exit 0'
alias path='echo -e ${PATH//:/\\n}'
alias dh='dirs -v'
alias pd='popd'
# shorts
alias c='clear'
alias h='history -d -D 0'
alias j='jobs -l'
alias zshrc='source "${ZDOTDIR}/.zshrc" >/dev/null'
if command -v colordiff &>/dev/null; then
alias diff='colordiff'
fi
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man'
# time
alias now='date +"%T"'
alias nowdate='date +"%d-%m-%Y"'
alias cal='cal --monday'
alias beeptime='beep -D 400 -l 400 -r "$(date +%I)" -f 440 -n -D 1000 -l 0 -n -D 800 -l 200 -f 880 -r "$(($(date +%M)/15+1))"'
# vim
alias vi='nvim'
alias svi="sudo --preserve-env nvim"
# git
for al in s d di co col cob ds a u ps pl pr hs last lastd df amend br fuck
do
alias "g${al}"="git ${al}"
done
alias gcim="noglob git cim"
# net
alias ports='ss -tlnp'
alias wget='wget -c'
alias ip='ip -c'
alias fastping='ping -c 100 -i 0.1'
# starts web server
alias www='python3 -m http.server 8080'
# hardware
alias reboot='sudo /sbin/reboot'
alias poweroff='sudo /sbin/poweroff'
alias suspend='sudo systemctl suspend'
alias halt='sudo /sbin/halt'
alias shutdown='sudo /sbin/shutdown now'
alias meminfo='free -mlth'
# python
alias pipir='pip install -r requirements.txt'
alias pipar='pip list --not-required --format freeze | tee requirements.txt'
alias vd='deactivate'
# docker
alias dc='docker compose'
alias dcl='docker compose logs -f'
alias drmc='docker container prune'
alias drmi='docker image prune'
alias dpsa='docker ps -a'
# tmux
alias dt='tmux detach'
# x11
alias caps='xdotool key Caps_Lock'
alias CAPS='xdotool key Caps_Lock'
alias colors='for i in {0..255}; do printf "\x1b[38;5;${i}mcolor${i} - ██████████\n"; done'
alias paste.thek4n.ru='curl --data-binary @- https://paste.thek4n.ru/ 2>/dev/null'
alias pastewww='paste.thek4n.ru'
alias t='noglob t'
alias е='noglob t'
alias ta='t all'
alias еф='t all'
# clipboard
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
if [ -n "${DISPLAY}" ]; then
alias _copy='sed -z "$ s/\n$//" | xclip -selection clipboard -i'
alias paste='xclip -selection clipboard -o'
else
alias _copy='read -rd "EOF" TTYCLIPBOARD'
alias paste='echo "$TTYCLIPBOARD"'
fi
elif [[ "${OSTYPE}" == "linux-android"* ]]; then
alias _copy='termux-clipboard-set'
alias paste='termux-clipboard-get'
elif [[ "${OSTYPE}" == "darwin" ]]; then
alias _copy='pbcopy'
alias paste='pbpaste'
fi
alias copy='tee /dev/stderr | _copy'
alias ssh='TERM=xterm-256color ssh'
alias sshn='ssh -S none'
alias black='magick canvas:none PNG:- | feh -YF -'
# :)
alias PINK='beep -f 233 -l 440 -n -f 349 -l 440 -n -f 196 -l 440 -n -f 330 -l 650'
alias -g L='2>&1 | $PAGER'
alias -g H='| head'
alias -g T='| tail'
alias -g HL='| highlight -O ansi -S '
alias -g JSON='| json HL json'
alias -g DI='| diff'
alias -g ?='| grep -i'
alias -g G='| grep -i'
alias -g C='| wc -l'
alias -g CO='--color=always'
alias -g ...='../..'
alias -g ....='../../..'
alias -g .3='../../..'
alias -g .....='../../../..'
alias -g .4='../../../..'
alias -g ......='../../../../..'
alias -g .5='../../../../..'
alias -g D="DISPLAY=:0.0"
alias -g XT="TERM=xterm"
alias -g GP="GOPROXY=direct"
alias -g DN=">/dev/null"
alias -g 2DN="2>/dev/null"
alias -g ADN="&>/dev/null"
alias -g BG="&>/dev/null &" # background
alias -g RED='2> >(while read line; do printf "\033[0;31m${line}\033[0m\n"; done)'
alias -g BEEP='&& beep -f 800 -l 250 -n -f 1000 -l 500 || beep -f 800 -l 250 -n -f 500 -l 500'
if [[ "${OSTYPE}" == "linux-android"* ]]; then
alias -g BEEP='&& termux-notification --sound --vibrate 500,1000,200'
fi
alias -g WAKE='BEEP; notify-send --urgency normal Wake'
alias -g PROXY='http_proxy="socks5://${SOCKS5_SERVER:-localhost}"'