alias -s txt='vi'
alias -s xz='tar -xvf'
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'

alias cp='cp -i'
alias cl='clear'
alias ag='alias | grep'
alias hg='history | grep'

command_exists() { command -v "$@" >/dev/null 2>&1; }

if command_exists iptables; then
    alias ipl='sudo iptables -L -n'
    if [ -f "/etc/network/iptables-load" ]; then
        alias ipe='sudo vi /etc/network/iptables-load'
        alias ips='sudo /etc/network/iptables-load'
    elif [ -f "/etc/network/if-pre-up.d/iptables-load" ]; then
        alias ipe='sudo vi /etc/network/if-pre-up.d/iptables-load'
        alias ips='sudo /etc/network/if-pre-up.d/iptables-load'
    fi
fi

# To make more practice of vim
alias nano='vim' && alias dontwanttousevim='/usr/bin/nano'

command_exists trash-put && alias rm='trash-put' && alias rmrm='/bin/rm'
command_exists batcat && alias cat='batcat'
command_exists fdfind && alias fd='fdfind'

if command_exists eza; then
    alias e='eza -la'
    alias eb='eza -lab'
    alias et='eza -lT'
    alias ef='eza -lTa -BhHigSmu'
fi

if command_exists ipython3; then
    alias ipy='ipython3'
fi

if command_exists docker; then
    alias gost='docker run --rm -p 9443:9443 --cpus=0.2 --memory=256mb gogost/gost -L socks5://nano:QpuwAqcsP8Xp@:9443'
    alias gost-nopasswd='docker run --rm -p 9443:9443 --cpus=0.2 --memory=256mb gogost/gost -L socks5://:9443'
fi

command_exists proxychains4 && alias ps4='proxychains4 -f ~/.lazy/files/proxychains4.conf'

# functions from 20-function.zsh
alias ii='__zsh_get_ip'
alias hr='__zsh_history_remove'

# for Lazy
alias lazy='~/.lazy/run.sh'
