123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- # -*- shell-script-mode -*-
- 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
- BPYTOP_PATH=$(which bpytop 2> /dev/null)
- BTOP_PATH=$(which btop)
- if [ ! -z "$BPYTOP_PATH" ] && [ -z $BTOP_PATH ]; then
- alias htop="bpytop -b \"cpu mem net proc\""
- elif [ ! -z "$BTOP_PATH" ] && [ -z $BPYTOP_PATH ]; then
- alias htop="btop"
- elif [ ! -z "$BTOP_PATH" ] && [ ! -z $BPYTOP_PATH ]; then
- alias htop="btop"
- 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"
- # Include .local/bin
- if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
- then
- PATH="$HOME/.local/bin:$HOME/bin:$PATH"
- fi
- export PATH
- # Include roswell
- if ! [[ "$PATH" =~ "$HOME/.roswell/bin" ]];
- then
- if [[ -d "$HOME/.roswell/bin" ]];
- then
- PATH="$HOME/.roswell/bin:$PATH"
- fi
- fi
- # Stop myself from opening vim when I mean to open emacs on the term
- vim()
- {
- if [[ "$(ps aux | grep -v grep | grep emacs)" ]];
- then
- # using anemic term/color/etc as it's faster in emacs
- TERM=xterm-color emacsclient $1 &
- export EDITOR="emacsclient -c"
- else
- VIM_PATH=$(which vim)
- $VIM_PATH $1
- export EDITOR=$VIM_PATH
- fi
- }
- # HN Helper functions
- # Pull up comments for number
- export HN_PATH=$(which hn 2> /dev/null)
- hnc() {
- if [ ! -z "$HN_PATH" ]; then
- hn view -c $1 | less -r
- else
- echo "hn not in path"
- fi
- }
- export HIMALAYA_PATH=$(which himalaya 2> /dev/null)
- 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 $(cat /etc/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
- # Since moving to KDE, my default shell session starts me in / ?
- cd
-
- echo "Loaded Void Work Config"
- ;;
- void)
- export PS1="\[\033[36m\]\w\[\033[m\] λ "
- alias shorten-ps1="PS1='λ > '"
- echo "Loaded Void config"
- ;;
- m1nix)
- export PS1="\[\033[36m\]\w\[\033[m\] λ "
- alias shorten-ps1="PS1='λ > '"
- echo "Loaded m1nix config"
-
- esac
|