## -*- mode: sh -*- export RANGER_LOAD_DEFAULT_RC=FALSE ############################################################ ## Exports ############################################################ export EDITOR='vim' export PAGER='less' export BROWSER='qutebrowser' # Add dotnet tools # export PATH="$PATH:/home/sakhmatd/.dotnet/tools" ############################################################ ## Functions ############################################################ # Transfer files to transfer.sh transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } ############################################################ ## Aliases ############################################################ # neo- aliases if type nvim > /dev/null 2>&1; then alias vim='nvim' fi alias mutt='neomutt' # Quick Emacs alias qemacs='emacs -q -nw' alias sqemacs='sudo -q emacs -nw' # Priv escalation alias svim='sudo vim' alias zzz='sudo zzz' alias vm='sudo vm' alias dmesg='sudo dmesg' # Config files alias fstab="$EDITOR /etc/fstab" alias dwmconf="$EDITOR $DWM_CONF" alias zshrcl="$EDITOR ~/.zshrc.local" alias zshrc="$EDITOR ~/.zshrc" alias muttrc="$EDITOR ~/.neomuttrc" alias muttrcs="$EDITOR ~/.neomutt" alias xinitrc="$EDITOR ~/.xinitrc" # Convenience and helpers alias h="history" alias cd..="cd .." alias reloadzsh="source ~/.zshrc.local" alias rotatewacom='xsetwacom set "Wacom ISDv4 EC Pen stylus" Rotate' alias myip='dig TXT +short o-o.myaddr.l.google.com @ns1.google.com' alias watchsync='watch grep -e Dirty: -e Writeback: /proc/meminfo' alias ducks='du -cks -h * | sort -rn | head -11' alias speedtest='wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip' alias cls='echo -ne "\033c"' alias clearhistory='cat /dev/null > ~/.zsh_history && history -c && exit' alias sshfs_mount='sshfs -C -o allow_other' alias mountyadisk='sudo mount -t davfs https://webdav.yandex.ru /home/sakhmatd/mnt/yadisk' alias mountallsync='sudo mount -t davfs https://cloud.allsync.com /home/sakhmatd/mnt/allsync' ############################################################ # OS-Specific Modules ############################################################ # FreeBSD if [[ $(uname) == "FreeBSD" ]] then # Fix FreeBSD's backspace behavior. stty erase "^?" # Package management alias pkg='sudo pkg' # BSD config files alias bootloader.conf="sudo $EDITOR /boot/loader.conf" alias rc.conf="sudo $EDITOR /etc/rc.conf" alias sysctl.conf="sudo $EDITOR /etc/sysctl.conf" fi # Void Linux if xbps-install -V &> /dev/null; then alias xbps-install='sudo xbps-install' fi # ArchLinux if pacman -V &> /dev/null; then alias pacman='sudo pacman' fi # Slackware if [[ -e /etc/slackware-version ]]; then # Slackware doesn't add sysad tools to user path by default export PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin" # Priv escalation alias slapt-get='sudo slapt-get' alias slackpkg='sudo slackpkg' alias sbopkg='sudo sbopkg' alias installpkg='sudo installpkg' alias removepkg='sudo removepkg' alias pm-suspend='sudo pmsuspend' alias pm-hibernate='sudo pm-hibernate' fi