Dotfiles/zsh/.zshrc.local

148 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

2019-11-05 21:11:48 +02:00
## -*- mode: sh -*-
export RANGER_LOAD_DEFAULT_RC=FALSE
############################################################
## Exports
############################################################
2019-11-26 18:28:45 +02:00
export EDITOR='vim'
2019-11-05 21:11:48 +02:00
export PAGER='less'
export BROWSER='qutebrowser'
############################################################
## 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;
}
2020-03-16 03:16:46 +02:00
# Format a file close to suckless.org guidelines
indent_suckless()
{
indent $1 -brs \
-nprs \
-npcs \
-i8 \
-fc1 \
-br \
2023-06-21 18:49:00 +03:00
-blf \
2020-03-16 03:16:46 +02:00
-saf \
-sai \
-saw \
-ncs \
-nfca \
-il0 \
-ce \
-nss \
-c0 \
-cd0 \
-ut \
-o $2
}
2019-11-05 21:11:48 +02:00
############################################################
## Aliases
############################################################
# neo- aliases
2019-11-26 18:28:45 +02:00
if type nvim > /dev/null 2>&1; then
alias vim='nvim'
fi
2019-11-05 21:11:48 +02:00
alias mutt='neomutt'
2019-11-26 18:28:45 +02:00
# Quick Emacs
2019-11-05 21:11:48 +02:00
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
2019-11-26 18:28:45 +02:00
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
2019-11-05 21:11:48 +02:00
alias slapt-get='sudo slapt-get'
alias slackpkg='sudo slackpkg'
2019-11-26 18:28:45 +02:00
alias sbopkg='sudo sbopkg'
alias installpkg='sudo installpkg'
alias removepkg='sudo removepkg'
alias pm-suspend='sudo pmsuspend'
alias pm-hibernate='sudo pm-hibernate'
2019-11-05 21:11:48 +02:00
fi