if [ -f ~/.wal_alias ]; then . ~/.wal_alias fi [ -f ~/.fzf.bash ] && source ~/.fzf.bash # Cargo config [ -f ~/.cargo ] && source "$HOME/.cargo/env" CAT_PATH=$(which cat --skip-alias) if [ -f ~/.cache/wal/sequences ]; then $CAT_PATH ~/.cache/wal/sequences fi export EDITOR=$(which vim) BPYTOP_PATH=$(which bpytop) if [ ! -z "$BPYTOP_PATH" ]; then alias htop="bpytop -b \"cpu mem net proc\"" fi EXA_PATH=$(which exa) if [ ! -z "$EXA_PATH" ]; then alias ls="$EXA_PATH" alias ll="$EXA_PATH -lahg" alias lg="$EXA_PATH -lahg --git" fi BAT_PATH=$(which bat) if [ ! -z "$BAT_PATH" ]; then export MANPAGER="$BAT_PATH --color never" alias cat="$BAT_PATH --color never" fi # Platform agnostic aliases export TMUX_PATH=$(which tmux --skip-alias) alias tmuxn="$TMUX_PATH new -s $1" alias tmuxa="$TMUX_PATH attach -t $1" alias tmuxl="$TMUX_PATH ls" alias tmuxq="echo $TMUX" alias httpserver="python -m SimpleHTTPServer" if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] then PATH="$HOME/.local/bin:$HOME/bin:$PATH" fi export PATH # HN Helper functions # Pull up comments for number export HN_PATH=$(which hn) hnc() { if [ ! -z "$HN_PATH" ]; then hn view -c $1 | less -r else echo "hn not in path" fi } export HIMALAYA_PATH=$(which himalaya) if [ ! -z $HIMALAYA_PATH ]; then . ~/Repos/dotfiles/himalaya/himalaya_shell_ui.sh fi # GPG Decrypt wrapper export GPG_PATH=$(which gpg) if [ ! -z $GPG_PATH ]; then function encrypt() { if [ -z $1 ]; then echo "Must pass path to this function" return 1 fi gpg -c --armor --cipher-algo AES256 --no-symkey-cache --output $1.asc $1 } function decrypt() { if [ -z $1 ]; then echo "Must pass path to this function" return 1 fi gpg --no-symkey-cache -d $1 } fi alias open-ssh="ps aux | awk '{if (\$11 ~ /ssh$/) { print substr(\$0, index(\$0,\$9)) }}'" alias reload="source ~/.bashrc" pb () { curl -F "file=@-" http://chate.io:669 } ckgit () { if [ ! -z $1 ]; then DIR=$1 else DIR="$HOME/Repos" fi GIT_PATH=$(which git); for dirp in $($EXA_PATH -d $DIR/*/); do if [[ -d "$dirp/.git" ]]; then RET=$($GIT_PATH -C $dirp status --porcelain) if [[ ! -z "$RET" ]]; then echo "* $dirp" echo "$RET" echo "" fi fi done } # For use with emacs vterm # See: https://github.com/akermu/emacs-libvterm vterm_printf(){ if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then # Tell tmux to pass the escape sequences through printf "\ePtmux;\e\e]%s\007\e\\" "$1" elif [ "${TERM%%-*}" = "screen" ]; then # GNU screen (screen, screen-256color, screen-256color-bce) printf "\eP\e]%s\007\e\\" "$1" else printf "\e]%s\e\\" "$1" fi } if [[ "$INSIDE_EMACS" = 'vterm' ]]; then function clear(){ vterm_printf "51;Evterm-clear-scrollback"; tput clear; } fi alias spesktv='mpv http://chate.io:55555' # Case defines platform specific configs # Platform agnostic configs above case $(hostname) in Simons-MacBook-Pro.local) export PS1="\w λ > \[$(tput sgr0)\]" # Mac aliases alias shorten-ps1="PS1='λ > '" alias default-ps1='PS1="\w λ > \[$(tput sgr0)\]"' alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs" # PATH setups PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/swatson/.fzf/bin:/Users/swatson/Library/Python/3.8/bin' default-ps1 clear echo "Loaded MacM1 config" ;; swatson-casana) export TERM=xterm-256color # This fixes some vim issues export PS1="\[\033[36m\]\w\[\033[m\] λ " # function to set terminal title function set-title() { if [[ -z "$ORIG" ]]; then ORIG=$PS1 fi TITLE="\[\e]2;$*\a\]" PS1=${ORIG}${TITLE} } alias ssh-old="ssh -oKexAlgorithms=+diffie-hellman-group1-sha1" alias sleep-open="sudo zzz && slock" alias ssh-aws="ssh -i ~/.ssh/aws_key" tmux_init () { $TMUX_PATH new -s services -d $TMUX_PATH new -s admin -d $TMUX_PATH new -s personal -d $TMUX_PATH new -s music -d $TMUX_PATH new -s lisp-koans -d $TMUX_PATH new -s emacs -d } # Load non tracked aliases for work specific things source ~/Work/secure_shell_aliases echo "Loaded Void Work Config" ;; void) export PS1="\[\033[36m\]\w\[\033[m\] λ " alias shorten-ps1="PS1='λ > '" echo "Loaded Void config" esac