Welcome to my Zshrc. This configuration does not use any package managers or frameworks. This literate configuration is available online on my GitHub Pages. If you appreciate my work, please consider making a donation.
- Theme
- Preferences
- Conditional Aliases
- Login Shell Functions
- GUI Terminal Functions
- Global Functions
- tbef
- tbem
- pf
- t
- y
- XBPS-Src Helper Functions
- j
- l
- trybg
- vf
- yz
- wb
- Backup Website
- Twitch
- Make a Video with Audio
- Mount External Encrypted Drive
- Unmount External Encrypted Drive
- SSH Agent
- Raspberry Pi Copy
- Create GitHub Gist
- Create GitHub Issue
- Fork GitHub Repo
- Cheat.sh Lookup
- Cheat.sh Learn
- Fix PulseAudio Sink
- Aliases
- Plugins
- Environment Variables
- Tricks
This first block of code sets the $PATH environment variable, and sources my $LS_COLORS script from this project. I have a cross-compiler installed, and
that’s what those other variables are for.
# __
# ____ _____/ /_ __________
# /_ / / ___/ __ \/ ___/ ___/
# / /_(__ ) / / / / / /__
# /___/____/_/ /_/_/ \___/
export PATH=/sbin:$HOME/bin:$HOME/.emacs.d/bin:/usr/local/bin:$HOME/.local/bin:$HOME/.cargo/bin:/usr/local/go/bin:/usr/local/i386elfgcc/bin:$HOME/.zsh/forgit/bin:$PATH
export PREFIX="/usr/local/i386elfgcc"
export TARGET=i386-elf
export VOIDPKG="/home/babkock/git/void-packages"
source "$HOME/.ssh/zsh/secrets.zsh"
VIVID_THEME="alabaster_dark"
if [ -v $TERM ]; then
if [[ ${TERM} = "st-256color" || ${TERM} = "rxvt-unicode" || ${TERM} = "xterm-256color" || ${TERM} = "foot" || ${TERM} = "kitty" || ${TERM} = "alacritty" ]]; then
export LS_COLORS="$(vivid generate $VIVID_THEME)"
else
export LS_COLORS="$(vivid -m 8-bit generate $VIVID_THEME)"
fi
else
export LS_COLORS="$(vivid -m 8-bit generate $VIVID_THEME)"
fi
export LSCOLORS=$LS_COLORS
export ZLS_COLORS=$LS_COLORSThese are my styles for the various TAB-completion menus that appear in ZSH themes.
zstyle ':completion:*:*:kill:*' list-colors '=(#b) #([0-9]#)*( *[a-z])*=34=31=33'
zstyle ':completion:*' use-cache on
zstyle ':completion:' cache-path "$HOME/.cache/zsh/.zcompcache"
zstyle ':completion:*:parameters' list-colors '=*=1;35'
zstyle ':completion:*:builtins' list-colors '=*=1;34'
zstyle ':completion:*:aliases' list-colors '=*=1;33'
zstyle ':completion:*:*:*:*:descriptions' format '%F{yellow}%d %f'
zstyle ':completion:*:warnings' format ' %F{red}no matches found %f'
zstyle ':completion:*:options' list-colors '=^(-- *)=34'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} "ma=4;37"
zstyle ':completion:*:*:-command-:*:*' group-order alias functions builtins commands
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'Set some preferences. Auto CD, and no duplicates in history.
export LANG=en_US.UTF-8
source <(fzf --zsh)
setopt autocd
setopt appendhistory
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_find_no_dups
setopt hist_ignore_dupsDetermine if the shell is being loaded locally, or over SSH, and set aliases accordingly. The reason I do this is so I don’t strain the SSH connection with too many colors or icons. The shell should behave and feel differently.
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
alias d="fd"
alias c="/usr/bin/cat"
alias cat="/usr/bin/cat"
alias grep="/usr/bin/grep --color=auto"
alias g="/usr/bin/grep --color=auto"
alias gy="/usr/bin/grep --color=auto --context=4"
alias xx="echo Can not reboot from SSH > /dev/stderr"
alias reboot="echo Can not reboot from SSH > /dev/stderr"
alias shutdown="echo Can not shutdown from SSH > /dev/stderr"
else
alias c="bat"
alias cat="bat"
alias d="fd"
alias grep="rg"
alias g="rg"
alias gy="rg --context=4"
alias reboot="loginctl reboot"
alias shutdown="sudo /usr/bin/shutdown -h now"
alias xx="loginctl reboot"These functions are only available when you are logged into the TTY.
# functions only for login shells
if [[ "$TERM" == "linux" ]]; then
function pu() {
hydroxide imap &> /dev/null &
hydroxide smtp &> /dev/null &
tmux new-session "neomutt -F $HOME/.muttrc" \; split-window -v "BROWSER='lynx -accept_all_cookies -nomargins -nostatus' newsraft -c $HOME/.config/newsraft/config"
fg
pkill -x hydroxide
true
}
function pn() {
pkill -x pipewire
env PULSE_LATENCY_MSEC=60 pipewire &> /dev/null &
sleep 1
tmux new-session "/usr/bin/zsh -c \"EDITOR=vim lf -command 'set icons false; set drawbox false;'\"" \; split-window -v "ncmpcpp --host '$MPD_PASS' --port 6602"
fg
pkill -x pipewire
true
}function shy() {
#export WLR_RENDERER="vulkan"
export WLR_DRM_NO_ATOMIC=1
export GTK_THEME="Vimix-dark-ruby"
export GDK_BACKEND="wayland"
export SDL_VIDEODRIVER="wayland"
export XDG_CURRENT_DESKTOP="Hyprland"
export XDG_SESSION_DESKTOP="Hyprland"
export XDG_SESSION_TYPE="wayland"
export QT_QPA_PLATFORM="wayland-egl"
export QT_QPA_PLATFORMTHEME="qt6ct"
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export XCURSOR_THEME="Adwaita"
export XCURSOR_SIZE=32
export MOZ_ENABLE_WAYLAND=1
export MOZ_WEBRENDER=1
export WLR_DRM_NO_MODIFIERS=1
export AQ_DRM_DEVICES="/dev/dri/card0:/dev/dri/renderD128"
export PULSE_LATENCY_MSEC=80
pgrep mpdas | xargs kill 2> /dev/null
pgrep pipewire | xargs kill 2> /dev/null
pgrep pulseaudio | xargs kill 2> /dev/null
echo -e '\e[1;31m'
banner "Starting"
sleep 1
pkill -x pipewire
pkill -x pipewire-pul
echo -e '\e[1;32m'
figlet -W -f ivrit "dnalrpyH"
gsettings set org.gnome.desktop.interface color-scheme prefer-dark &> /dev/null
gsettings set org.gnome.desktop.interface gtk-theme Vimix-dark-ruby &> /dev/null
gsettings set org.gnome.desktop.interface cursor-theme Adwaita &> /dev/null
gsettings set org.gnome.desktop.interface cursor-size 32 &> /dev/null
dbus-launch --exit-with-session Hyprland &> /dev/null
pgrep hypridle | xargs kill 2> /dev/null
pgrep stash | xargs kill 2> /dev/null
pgrep mako | xargs kill 2> /dev/null
pgrep emacs | xargs kill 2> /dev/null
pgrep hydroxide | xargs kill 2> /dev/null
pkill -x hydroxide
pgrep mpdas | xargs kill 2> /dev/null
pkill -x mpdas
true
}function swa() {
export WLR_RENDERER="vulkan"
export WLR_DRM_NO_ATOMIC=1
export GTK_THEME="Vimix-dark-ruby"
export GDK_BACKEND="wayland"
export SDL_VIDEODRIVER="wayland"
export XDG_CURRENT_DESKTOP="sway"
export XDG_SESSION_DESKTOP="sway"
export XDG_SESSION_TYPE="wayland"
export QT_QPA_PLATFORM="wayland-egl"
export QT_QPA_PLATFORMTHEME="qt6ct"
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export XCURSOR_THEME="Adwaita"
export XCURSOR_SIZE=32
export MOZ_ENABLE_WAYLAND=1
export MOZ_WEBRENDER=1
export PULSE_LATENCY_MSEC=80
pgrep mpdas | xargs kill 2> /dev/null
pgrep pipewire | xargs kill 2> /dev/null
pgrep pulseaudio | xargs kill 2> /dev/null
echo -e '\e[1;31m'
banner "Starting"
sleep 1
pkill -x pipewire
pkill -x pipewire-pul
echo -e '\e[1;33m'
figlet -W -f ivrit "yawS"
gsettings set org.gnome.desktop.interface color-scheme prefer-dark &> /dev/null
gsettings set org.gnome.desktop.interface gtk-theme Vimix-dark-ruby &> /dev/null
gsettings set org.gnome.desktop.interface cursor-theme Adwaita &> /dev/null
gsettings set org.gnome.desktop.interface cursor-size 32 &> /dev/null
dbus-launch --exit-with-session sway &> /dev/null
pkill -x eww
pgrep emacs | xargs kill 2> /dev/null
pgrep stash | xargs kill 2> /dev/null
pgrep hydroxide | xargs kill 2> /dev/null
pkill -x hydroxide
pgrep mpdas | xargs kill 2> /dev/null
pkill -x mpdas
true
}function swf() {
export GTK_THEME="Vimix-dark-ruby"
export GDK_BACKEND="wayland"
export SDL_VIDEODRIVER="wayland"
export XDG_CURRENT_DESKTOP="sway"
export XDG_SESSION_DESKTOP="sway"
export XDG_SESSION_TYPE="wayland"
export QT_QPA_PLATFORM="wayland-egl"
export QT_QPA_PLATFORMTHEME="qt6ct"
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export XCURSOR_THEME="Adwaita"
export XCURSOR_SIZE=32
export MOZ_ENABLE_WAYLAND=1
export MOZ_WEBRENDER=1
export PULSE_LATENCY_MSEC=80
pgrep mpdas | xargs kill 2> /dev/null
pgrep pipewire | xargs kill 2> /dev/null
pgrep pulseaudio | xargs kill 2> /dev/null
echo -e '\e[1;31m'
banner "Starting"
sleep 1
echo -e '\e[1;35m'
figlet -W -f ivrit "erifyaW"
gsettings set org.gnome.desktop.interface color-scheme prefer-dark &> /dev/null
gsettings set org.gnome.desktop.interface gtk-theme Vimix-dark-ruby &> /dev/null
gsettings set org.gnome.desktop.interface cursor-theme Adwaita &> /dev/null
gsettings set org.gnome.desktop.interface cursor-size 32 &> /dev/null
dbus-launch --exit-with-session wayfire &> /dev/null
pkill -x eww
pgrep emacs | xargs kill 2> /dev/null
pgrep stash | xargs kill 2> /dev/null
pgrep hydroxide | xargs kill 2> /dev/null
pkill -x hydroxide
pgrep mpdas | xargs kill 2> /dev/null
pkill -x mpdas
true
}function sni() {
export WLR_RENDERER="vulkan"
export WLR_DRM_NO_ATOMIC=1
export GTK_THEME="Vimix-dark-ruby"
export GDK_BACKEND="wayland"
export SDL_VIDEODRIVER="wayland"
export XDG_CURRENT_DESKTOP="niri"
export XDG_SESSION_DESKTOP="niri"
export XDG_SESSION_TYPE="wayland"
export QT_QPA_PLATFORM="wayland-egl"
export QT_QPA_PLATFORMTHEME="qt6ct"
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export XCURSOR_THEME="Adwaita"
export XCURSOR_SIZE=32
export MOZ_ENABLE_WAYLAND=1
export MOZ_WEBRENDER=1
export PULSE_LATENCY_MSEC=80
pgrep mpdas | xargs kill 2> /dev/null
pgrep pipewire | xargs kill 2> /dev/null
pgrep pulseaudio | xargs kill 2> /dev/null
echo -e '\e[1;31m'
banner "Starting"
sleep 1
pkill -x pipewire
pkill -x pipewire-pul
echo -e '\e[1;34m'
figlet -W -f ivrit "iriN"
dbus-launch --exit-with-session niri --session &> /dev/null
pkill -x eww
pgrep emacs | xargs kill 2> /dev/null
pgrep stash | xargs kill 2> /dev/null
pgrep hydroxide | xargs kill 2> /dev/null
pkill -x hydroxide
pgrep mpdas | xargs kill 2> /dev/null
true
}These functions will only be available if you are logged in to a GUI terminal.
else
# Doom Emacs init
function ec() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mCould not start Emacs daemon"
exit 1
fi
sleep 1
;;
1)
echo -e "\e[1;33mEditing Doom Emacs init.org with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.doom.d/init.org" &
}# Doom Emacs config
function ed() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mCould not start Emacs daemon"
exit 1
fi
sleep 1
;;
1)
echo -e "\e[1;33mEditing Doom Emacs config.org with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.doom.d/config.org" &
}# Foot config
function ef() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
sleep 1
;;
1)
echo -e "\e[1;33mEditing Foot foot.org with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.config/foot/foot.org" &
}# Qutebrowser config
function eq() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mCould not start Emacs daemon"
exit 1
fi
sleep 1
;;
1)
echo -e "\e[1;33mEditing Qutebrowser config with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.config/qutebrowser/config.org" &
}# Waybar style
function es() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mCould not start Emacs daemon"
exit 1
fi
sleep 1
;;
1)
echo -e "\e[1;33mEditing Waybar style with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.config/waybar/style.org" &
}# Waybar config
function ew() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mCould not start Emacs daemon"
exit 1
fi
sleep 1
;;
1)
echo -e "\e[1;33mEditing Waybar config with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.config/waybar/config.org" &
} # Zshrc
function ez() {
case "$(pidof emacs | wc -w)" in
0)
echo -e "\e[1;33mStarting Daemon $(emacs --version | head -1)..."
emacs --daemon &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mCould not start Emacs daemon"
exit 1
fi
sleep 1
;;
1)
echo -e "\e[1;33mEditing .Zshrc with Daemon $(pidof emacs)..."
;;
esac
swaymsg "workspace 4" &> /dev/null
hyprctl dispatch workspace 4 &> /dev/null
emacsclient -c -a 'emacs' -q -r "$HOME/.zsh.org" &
}
fi
fiAll of these ls commands have flags to show directories first, show human-readable file sizes, and show file symbols. All of the exa commands show icons and group directories first, also.
| Command | In Terminal | In TTY |
|---|---|---|
ls | Regular Eza listing | Regular LS listing |
l | Regular Eza listing | Regular LS listing |
la | Long listing with total directory sizes, all files | LS long listing, all files |
ll | Eza Long listing with total sizes, all files | LS long listing, all files |
lc | Eza Long listing with total sizes | N/A |
lct | Eza Long listing with total sizes and tree | N/A |
lctl | Eza Long listing with total sizes and tree | N/A |
lsl | Long listing, all files | LS long listing, all files |
lsa | Long listing, all files | LS long listing, all files |
lsla | Long listing with total sizes, all files | LS long listing, all files |
lst | Eza listing with tree | N/A |
lstl | Eza long listing with tree | N/A |
ltl | Eza long listing with total sizes and tree | N/A |
a | Run YT-DLP on the given URL | N/A |
al | Eza long listing, all files | Same, without icons |
e | Opens new Emacs window | Opens Emacs in Console |
eb | Edit bspwm.org in new Emacs window | Edit bspwm.org in Console |
ep | Edit Polybar config in new Emacs window | Edit Polybar in Console |
egp | Run Magit Push on repository inside Emacs | Run Magit Push in Console |
egs | Run Magit Status on repository inside Emacs | Run Magit Status in Console |
ei | Run Magit Log on repository inside Emacs | Run Magit Log in Console |
egl | Run Magit Log on repository inside Emacs | Run Magit Log in Console |
ee | Open current directory in Dired in Emacs | Open current directory in Console |
er | Open Elfeed in Emacs | N/A |
j | Open NNN file browser | N/A |
me | Open webcam image in MPV in Wayland | N/A |
mx | Open webcam image in MPV in X.org | N/A |
if [ -v TERM ]; then
if [[ ${TERM} = "st-256color" || ${TERM} = "rxvt-unicode" || ${TERM} = "xterm-256color" || ${TERM} = "foot" || ${TERM} = "alacritty" || ${TERM} = "kitty" ]]; then
# graphical terminal
alias ls="eza --icons --group-directories-first --no-quotes -X -F"
#alias l="eza --icons --group-directories-first --no-quotes -X -F"
alias lsla="eza --icons --group-directories-first --no-quotes -X -F -l -A --git --git-repos --time-style=relative -S"
alias la="eza --icons --group-directories-first --no-quotes -X -F -A"
alias ll="eza --icons --group-directories-first --no-quotes -X -F -l --git --git-repos --time-style=relative -S"
alias lsl="eza --icons --group-directories-first --no-quotes -X -F -l --git --git-repos --time-style=relative -S"
alias lsa="eza --icons --group-directories-first --no-quotes -X -F -l -A --git --git-repos --time-style=relative -S"
alias lst="eza --icons --group-directories-first --no-quotes -X -F -l -A --git --git-repos --time-style=relative -S -T --level 3"
alias lstl="eza --icons --group-directories-first --no-quotes -X -F -l -A --git --git-repos --time-style=relative -S -T --level 3"
alias ltl="eza --icons --group-directories-first --no-quotes -X -F -l -A --git --git-repos --time-style=relative -S -T --level 3"
alias lc="eza --icons --group-directories-first --no-quotes -X -F -l -A --total-size --git --git-repos --time-style=relative -S"
alias lct="eza --icons --group-directories-first --no-quotes -X -F -l -A --total-size --git --git-repos --time-style=relative -S -T --level 3"
alias lctl="eza --icons --group-directories-first --no-quotes -X -F -l -A --total-size --git --git-repos --time-style=relative -S -T --level 3"
alias a="yt-dlp -k -f 'bv*[ext=mp4][height<=1080]+ba[ext=m4a]' --remux-video 'mkv' --embed-metadata --embed-subs --embed-chapters --sleep-requests 2 --limit-rate 9M --exec '/home/babkock/bin/ytdone'"
alias al="eza --icons --group-directories-first --no-quotes -X -F -l --git --git-repos --time-style=relative -S"
alias e="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q"
alias ee="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r . &"
#alias ea="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r \"$HOME/.config/alacritty/config.org\" &"
alias egp="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r --eval \"(magit-push)\" > /dev/null &"
alias egs="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r --eval \"(magit-status)\" > /dev/null &"
alias ei="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r --eval \"(magit-log-all)\" > /dev/null &"
alias egl="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r --eval \"(magit-log-all)\" > /dev/null &"
alias er="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r --eval \"(elfeed)\" > /dev/null &"
alias eo="swaymsg \"workspace 4\" 2> /dev/null; hyprctl dispatch workspace 4 &> /dev/null; emacsclient -c -a 'emacs' -q -r \"$HOME/.config/eww/eww.org\" &"
alias mx="mpv av://v4l2:/dev/video0 --vo=gpu --hwdec=vaapi --untimed --profile=low-latency --no-osc --ontop --cache=no"
alias mo="mpv av://v4l2:/dev/video2 --vo=gpu --hwdec=vaapi --untimed --profile=low-latency --no-osc --ontop --cache=no"
alias me="mpv av://v4l2:/dev/video2 --untimed --profile=low-latency --no-osc --ontop --cache=no --demuxer-lavf-format=video4linux2 --demuxer-lavf-o=video_size=960x720,input_format=mjpeg,framerate=30 --window-scale=0.5"
alias mj="mpv av://v4l2:/dev/video0 --untimed --profile=low-latency --no-osc --ontop --cache=no --demuxer-lavf-format=video4linux2 --demuxer-lavf-o=video_size=1920x1080,input_format=mjpeg,framerate=30 --window-scale=0.55"
else
# login shell or SSH
alias ls="ls --group-directories-first -F --color=auto"
alias lsla="ls -l -A -h --group-directories-first -F --color=auto"
alias l="ls --group-directories-first -F --color=auto"
alias lsl="ls -l -A -h --group-directories-first -F --color=auto"
alias la="ls -l -A -h --group-directories-first -F --color=auto"
alias ll="ls -l -A -h --group-directories-first -F --color=auto"
alias e="emacsclient -c -a 'emacs' -nw"
alias ee="emacsclient -c -a 'emacs' -nw ."
alias ez="emacsclient -c -a 'emacs' -nw \"$HOME/.zsh.org\""
alias eb="emacsclient -c -a 'emacs' -nw \"$HOME/.config/bspwm/bspwm.org\""
alias ep="emacsclient -c -a 'emacs' -nw \"$HOME/.config/polybar/config.org\""
alias eq="emacsclient -c -a 'emacs' -nw \"$HOME/.config/qutebrowser/config.org\""
alias ec="emacsclient -c -a 'emacs' -nw \"$HOME/.doom.d/init.org\""
alias ed="emacsclient -c -a 'emacs' -nw \"$HOME/.doom.d/config.org\""
alias ew="emacsclient -c -a 'emacs' -nw \"$HOME/.config/waybar/config.org\""
alias es="emacsclient -c -a 'emacs' -nw \"$HOME/.config/waybar/style.org\""
alias ef="emacsclient -c -a 'emacs' -nw \"$HOME/.config/foot/foot.org\""
alias ea="emacsclient -c -a 'emacs' -nw \"$HOME/.config/alacritty/config.org\""
alias eo="emacsclient -c -a 'emacs' -nw \"$HOME/.config/eww/eww.org\""
alias egp="emacsclient -c -a 'emacs' -nw --eval \"(magit-push)\""
alias egs="emacsclient -c -a 'emacs' -nw --eval \"(magit-status)\""
alias ei="emacsclient -c -a 'emacs' -nw --eval \"(magit-log-all)\""
alias egl="emacsclient -c -a 'emacs' -nw --eval \"(magit-log-all)\""
fi
fi“TBcom Edit Film”
function tbef() {
if [ -z "$1" ]; then
printf "Must specify the name of a film file to edit\n" > /dev/stderr
false
elif [ -z "$2" ]; then
vim -n -T alacritty "$HOME/TBcom/resources/op/film/$1.html"
pushd "$HOME/TBcom/resources/op" > /dev/null
git add film
popd > /dev/null
true
else
vim -n -T alacritty "$HOME/TBcom/resources/op/film/$1.html"
vim -n -T alacritty "$HOME/TBcom/resources/op/film/$2.html"
pushd "$HOME/TBcom/resources/op" > /dev/null
git add film
popd > /dev/null
true
fi
}“TBcom Edit Music”
function tbem() {
if [ -z "$1" ]; then
printf "Must specify the name of an artist file to edit\n" > /dev/stderr
false
elif [ -z "$2" ]; then
vim -n -T alacritty "$HOME/TBcom/resources/op/music/$1.html"
pushd "$HOME/TBcom/resources/op" > /dev/null
git add music
popd > /dev/null
true
else
vim -n -T alacritty "$HOME/TBcom/resources/op/music/$1.html"
vim -n -T alacritty "$HOME/TBcom/resources/op/music/$2.html"
pushd "$HOME/TBcom/resources/op" > /dev/null
git add music
popd > /dev/null
true
fi
}This function searches the list of running processes provided with ps and returns a match.
function pf() {
if [ -z "$1" ]; then
printf "pf needs a process name to search for\n" > /dev/stderr
false
else
ps -aux | rg "$1"
fi
}This function, when given no arguments, simply starts the tremc Transmission client. If it is given a single argument, it is assumed it is a torrent file: it gives it to Transmission, then deletes it, and starts tremc.
If it is given a second argument, it interprets that as the preferred download speed in kB/s.
function t() {
if [ -z "$1" ]; then
tremc --ssl -X -r -c "$TRANS_CREDENTIALS" 2> /dev/null
true
elif [ -z "$2" ]; then
printf "Starting %s...\n" "$1"
tremc --ssl -c "$TRANS_CREDENTIALS" "$1" > /dev/null
rm "$1" 2> /dev/null
tremc --ssl -X -r -c "$TRANS_CREDENTIALS" 2> /dev/null
true
elif [ -z "$3" ]; then
printf "Starting %s with speed %s kbps...\n" "$1" "$2"
tremc --ssl -c "$1" > /dev/null
transmission-remote --auth="$TRANS_PASS" -asd "$2"
rm "$1" 2> /dev/null
tremc --ssl -X -r -c "$TRANS_CREDENTIALS" 2> /dev/null
true
else
printf "Too many arguments\n" > /dev/stderr
false
fi
}Open a file with mupdf.
function y() {
if [ -z "$1" ]; then
printf "Please specify file to read\n" > /dev/stderr
false
else
mupdf -I "$1"
true
fi
}function xs() {
if [ -z "$1" ]; then
printf "Please specify package name\n" > /dev/stderr
false
else
pushd $VOIDPKG > /dev/null
./xbps-src show "$1"
popd > /dev/null
true
fi
}function xb() {
if [ -z "$1" ]; then
printf "Please specify package name\n" > /dev/stderr
false
else
pushd $VOIDPKG > /dev/null
./xbps-src build -C -f -j 4 "$1"
popd > /dev/null
true
fi
}function xp() {
if [ -z "$1" ]; then
printf "Please specify package name\n" > /dev/stderr
false
else
pushd $VOIDPKG > /dev/null
./xbps-src pkg -C -f -Q -j 4 "$1"
popd > /dev/null
true
fi
}function xxr() {
if [ -z "$1" ]; then
printf "Please specify package name\n" > /dev/stderr
false
elif [ -z "$2" ]; then
pushd $VOIDPKG > /dev/null
./xbps-src remove "$1"
popd > /dev/null
true
elif [ -z "$3" ]; then
pushd $VOIDPKG > /dev/null
./xbps-src remove "$1" "$2"
popd > /dev/null
true
elif [ -z "$4" ]; then
pushd $VOIDPKG > /dev/null
./xbps-src remove "$1" "$2" "$3"
popd > /dev/null
true
fi
}A wrapper function for nnn that changes the current directory when it exits.
function j()
{
if [[ ${TERM} = "screen-256color" ]]; then
\nnn -d -i -l 2 -HGURQD -x -e -P preview-tui & ~/.config/nnn/plugins/preview-tui; fg
return
fi
# Block nesting of nnn in subshells
if [[ "${NNNLVL:-0}" -ge 1 ]]; then
echo "nnn is already running"
return
fi
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
\nnn -d -i -l 2 -GUHRQD -x -e "$@"
if [ -f "$NNN_TMPFILE" ]; then
. "$NNN_TMPFILE"
rm -f "$NNN_TMPFILE" > /dev/null
fi
}function l()
{
export EDITOR="vim"
cd "$(lf -print-last-dir)"
}function trybg() {
swaybg -o eDP-1 -i "$1" -o HDMI-A-2 -i "$2" -o DP-1 -i "$3" &
}Check it out! Choose a file with fzf, then open it in vim. Works with multiple files (use tab to select).
function vf()
{
fzf -i --walker=file,dir,follow,hidden --walker-skip=.git,node_modules --header="Select a file to edit" --input-label="Filename" --preview-label="Edit this file:" --preview="bat --color=always --style=plain,changes,numbers {}" --preview-window="border:rounded" --border=double --scroll-off=3 --prompt="$ " --pointer="->" --layout=reverse --multi=3 > /tmp/fzf.txt
xargs -r -o -a /tmp/fzf.txt vim -n -T alacritty -o
}function yz()
{
yazi --cwd-file=/tmp/yazi.txt
cd "$(cat /tmp/yazi.txt)"
}Set the wallpaper with two images, one for the left, and one for the right.
function wb() {
swaybg -o eDP-1 -i "$1" -o HDMI-A-2 -i "$2"
}This shell function backs up my website. It takes one argument, the output directory to store the backup in.
function backup() {
if [ -z "$1" ]; then
printf "Please specify directory to store backup in\n" > /dev/stderr
false
else
sudo rsync -Pa -e "ssh -p 2222 -i $HOME/.ssh/tbcom_ssh" "$WEBSITE_ADDRESS:$RSYNC_PATH" "$1"
true
fi
}function twitch() {
/home/babkock/git/twitch-chat-cli/cli.js connect babkock
}function record() {
if [[ -z "$1" && -z "$2" ]]; then
printf "USAGE: %s [display] [output file]\n" "$0" > /dev/stderr
false
elif [ -z "$2" ]; then
wf-recorder --audio=alsa_input.pci-0000_00_1f.3.analog-stereo -o HDMI-A-2 -c libx264rgb -r 60 -f "$1"
true
else
wf-recorder --audio=alsa_input.pci-0000_00_1f.3.analog-stereo -o "$1" -c libx264rgb -r 60 -f "$2"
true
fi
}My external encrypted hard drive is automatically mounted on boot, but this is how to mount it manually.
function mm() {
sudo cryptsetup luksOpen /dev/sda mega
sudo mount -o rw,users /dev/mapper/mega /mnt/mega
sudo chown -R babkock:babkock /mnt/mega
sudo chown babkock:audio /mnt/mega
sudo chown -R babkock:audio /mnt/mega/Music
echo "sda Mounted"
}This is how to unmount that drive.
function um() {
sudo umount /mnt/mega
sudo cryptsetup luksClose mega
echo "sda Unmounted"
}I have to do this every time I use Git, or log in to my website.
function b() {
pkill -x ssh-agent
eval $(ssh-agent) > /dev/null 2>&1
printf "SSH identities loaded\n"
ssh-add "$HOME/.ssh/gitlab_new" &> /dev/null
ssh-add "$HOME/.ssh/github_rsa" &> /dev/null
ssh-add "$HOME/.ssh/tbcom_ssh" &> /dev/null
ssh-add "$HOME/.ssh/codeberg" &> /dev/null
}function pcp() {
if [[ -z "$1" ]]; then
printf "No file specified\n" > /dev/stderr
false
elif [[ -z "$2" ]]; then
scp -i "$HOME/.ssh/comp2pinew" "$1" pi@192.168.0.13:~
true
else
scp -i "$HOME/.ssh/comp2pinew" "$1" "$2" pi@192.168.0.13:~
true
fi
}function gst() {
if [[ -z "$1" ]]; then
printf "USAGE: $0 [file to upload] [description]\n" > /dev/stderr
false
elif [[ -z "$2" ]]; then
printf "USAGE: $0 '$1' [description]\n" > /dev/stderr
false
else
gh gist create "$1" -d "$2" -p -w
true
fi
}function gic() {
if [[ -z "$1" ]]; then
printf "USAGE: $0 [title] [body]\n" > /dev/stderr
false
elif [[ -z "$2" ]]; then
gh issue create --title "$1"
true
else
gh issue create --title "$1" --body "$2"
true
fi
}function gfk() {
if [[ -z "$1" ]]; then
printf "USAGE: $0 'OWNER/REPO'\n" > /dev/stderr
false
else
gh repo fork "$1"
true
fi
}function ch() {
if [[ -z "$1" ]]; then
printf "No command to look up\n" > /dev/stderr
false
elif [[ -z "$2" ]]; then
curl "https://cht.sh/$1"
true
else
curl "https://cht.sh/$1/$2"
true
fi
}function chp() {
if [[ -z "$1" ]]; then
printf "Enter a programming language to learn\n" > /dev/stderr
false
else
curl "https://cht.sh/$1/:learn"
true
fi
}function chl() {
if [[ -z "$1" ]]; then
printf "Enter a programming language to list topics for\n" > /dev/stderr
false
else
curl "https://cht.sh/$1/:list"
true
fi
}function pv() {
pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
pactl set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo
}function uu() {
BROWSER="qutebrowser --qt-arg stylesheet '/home/babkock/.local/share/qutebrowser/fix-tooltips.qss' --qt-wrapper PyQt6 --backend webengine --qt-flag enable-features=WebRTCPipeWireCapturer --qt-flag ozone-platform-hint=wayland --qt-flag enable-accelerated-video --qt-flag enable-gpu --qt-flag enable-native-gpu-memory-buffers --qt-flag enable-zero-copy --qt-flag enable-gpu-rasterization" newsraft
}This is my collection of aliases. Each letter of the alphabet should have its own command, to make the overall way of life easier.
This was apparent before, but I use a number of tools written in Rust that serve as faster and better-looking versions of standard
commands, like duf for df, lsd for ls, and ripgrep for grep. These commands look different, but behave exactly the same as
the GNU coreutils they’re modeled after. These projects are worth checking out.
| Command | Arguments | What It Does |
|---|---|---|
ba | N/A | Snow 5-day forecast in Denver |
bb | N/A | Run neofetch with fancy bars |
c | File name | Run Bat on given files |
ca | File name | Run Bat on given files |
cb | N/A | Cargo build –release |
co | N/A | Run btm task manager |
ct | N/A | Cargo test –release |
d | N/A | Run fd Find |
dcr | File name | Decrypt given file with GNUPG |
df | N/A | Run duf |
e | File name or directory | Open given file or directory in Emacs |
f | N/A | A file picker with preview pane |
g | Pattern, file name | Run Ripgrep with given pattern on file |
ga | File name | Add given file to staging area |
gb | N/A | Run onefetch with fancy colors |
gc | Branch | Check out branch on Git repository |
gd | File name | Run Git diff on given file |
ge | N/A | Git Fetch All |
gf | File name | Check out given file from HEAD, reverting changes |
ggo | N/A | Returns URL for repo’s origin |
ggu | N/A | Returns URL for repo’s upstream |
gh | Pattern, file name | Run Ripgrep with context with given pattern on file |
gl | N/A | Run Git log with nice formatting |
gm | File name, file name | Move or rename file and add to staging area |
gn | Repository URL | Git clone |
gnn | Repository URL | Git clone –depth 2 |
gp | Options | GNUPG |
gpull | N/A | Git Pull Origin master |
gpulm | N/A | Git Pull Origin main |
gpush | N/A | Git Push Origin master |
gpusm | N/A | Git Push Origin main |
gpash | N/A | Git Push All master |
gpasm | N/A | Git Push All main |
gr | File name | Delete file from staging area |
grc | File name | Delete file from staging area |
gs | N/A | Run Git Status |
gso | URL | Set URL for repo’s origin |
gsu | URL | Set URL for repo’s upstream |
h | N/A | Run Htop |
i | N/A | Run Tig Git client |
k | N/A | Make |
kc | N/A | Make clean |
km | N/A | Meson Setup Build |
kn | N/A | Ninja -j4 |
m | File name | Open given file in MPV |
mb | N/A | Mount Baby blue drive |
md | N/A | Mount External SSD |
mi | File name | Open given file in MPV, muted |
mn | Man page | Man |
mt | File name | Open given file in MPV, with sound sent to TV |
n | N/A | Run Ncmpcpp |
nb | N/A | Nix Build |
ncr | File name | Encrypt given file with GNUPG |
ne | N/A | Run Ncmpcpp with Ueberzug |
nfi | N/A | Nix Flake Init |
nfm | N/A | Nix Flake Metadata |
npi | Package name | Nix Profile Install |
npl | N/A | Nix Profile List |
npr | Package number | Nix Profile Remove |
o | Process name | Kill the given process |
oa | N/A | Eww Active Windows |
oc | Eww window | Eww Close Window |
oi | N/A | Eww Inspector |
ol | N/A | Eww List Windows |
oo | Eww window | Eww Open Window |
or | N/A | Eww Reload |
p | N/A | Run Flowtop |
po | N/A | Run Gotop |
q | File name | Open given file in Swayimg |
qg | File name | Open given file in GIMP |
qw | N/A | Open current directory in Swayimg |
r | Directory | Run Ranger on given or current directory |
s | N/A | Log in to my website via SSH |
sb | N/A | Restart Bluetooth Daemons |
se | N/A | Restart Emacs Server |
sf | N/A | Restart Waybar for Wayfire |
skn | N/A | Log in to K’s new Mac |
sko | N/A | Log in to K’s old Mac |
sp | N/A | Restart Pipewire |
spi | N/A | Log in to Raspberry Pi via SSH |
sw | N/A | Restart Waybar for Sway |
sy | N/A | Restart Waybar for Hyprland |
sz | N/A | Kill wpa_supplicant and restart with Ethernet |
ta | File name | Extract given Tar archive |
td | Output file, files | Compress files into given output Tar archive |
ti | N/A | List Transmission torrents |
tr | Options | Transmission-remote |
ts | N/A | Transmission Information |
tt | N/A | Transmission Statistics |
u | N/A | Open Neomutt |
ub | N/A | Unmount Baby blue drive |
ud | N/A | Unmount External SSD |
v | File name | Open given file in Vim |
vm | N/A | Run Virt-Manager |
wh | Command/alias/function | Which |
x | N/A | Start Zsh as Root |
xl | N/A | List installed packages |
xu | N/A | Update system with XBPS |
xx | N/A | Reboot system immediately |
y | File name | Open given file in MuPDF |
z | N/A | Start Bluetoothctl |
# show weather in Denver today
alias ba="ansiweather -l '$CITY' -u imperial -H true -h false -p false -i false -s true"
# neofetch
alias bb="fastfetch -s 'Title:OS:Host:Kernel:Packages:Uptime:Break:WM:Shell:Terminal:Break:CPU:GPU:CPUUsage:Memory:Swap:Break:Display:Disk:Break:Colors' --color-keys blue"
alias cb="cargo build --release"
alias co="btm"
alias c="bat" # like cat
alias ci="cargo init"
alias ct="cargo test --release"
alias df="duf -hide-mp \"/run/systemd,/boot/efi,/run,/run/user,/sys/fs/cgroup,/dev/shm\"" # like df
# fzf file picker with preview
alias f="fzf --preview=\"bat --color=always --style=plain {}\" --preview-window=\"border:rounded\" --border=rounded --prompt=\"$ \" --pointer=\"->\""
alias fp="ftp -t -v '$FTP_ADDRESS'"
alias i="tig"
alias h="htop"
# encrypt file with GPG
alias ncr="gpg --encrypt --armor -r Tanner"
# decrypt file and output (use > direct)
alias dcr="gpg --decrypt"
alias g="rg"
alias gz="ug -I --depth=2 --exclude-dir='node_modules' --exclude-dir='vendor' --exclude-dir='.git'"
alias gy="rg --context=4"
alias gb="onefetch --no-color-palette -d head dependencies --text-colors 7 9 1 10 1 4"
alias gp="gpg"
alias gs="git status -sb"
alias ga="git add"
alias ge="git fetch --all"
alias gf="git checkout HEAD --"
alias gcm="git commit -m"
alias gca="git commit --allow-empty-message -m ''"
alias gc="git checkout"
alias gcb="git checkout -b"
alias gd="git diff"
alias gdt="git diff-tree"
alias gdz="git diff HEAD^"
alias gdy="git diff HEAD^^"
# git log with special formatting
alias gl="git log --date=relative --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %C(yellow)(%cr) %C(bold blue) %an%Creset'"
alias gw="git show"
alias gr="git rm"
alias grc="git rm --cached"
alias gm="git mv"
alias gn="git clone"
alias gnn="git clone --depth 2"
alias ggo="git remote get-url origin"
alias gso="git remote set-url origin"
alias ggu="git remote get-url upstream"
alias gsu="git remote set-url upstream"
# use these if branch is 'master'
alias gpush="git push origin master"
alias gpull="git pull origin master"
# use these if branch is 'main'
alias gpusm="git push origin main"
alias gpulm="git pull origin main"
# push 'master' to multiple remotes
alias gpash="git push all master; git pull origin master; git pull upstream master"
# push 'main' to multiple remotes
alias gpasm="git push all main; git pull origin main; git pull upstream main"
alias gstl="gh gist list"
alias gste="gh gist edit"
alias gstd="gh gist delete"
alias gpr="gh pr co"
alias gprc="gh pr create --web"
alias gpu="gh pr update-branch"
alias gpl="gh pr list --limit 20"
alias gil="gh issue list --limit 20"
alias v="vim -n -T alacritty"
alias vh="vim -n -T alacritty -o"
alias vv="vim -n -T alacritty -O"
alias vim="vim -n -T alacritty"
alias vm="virt-manager"
alias lb="lsblk --paths --fs --perms"
alias r="ranger"
alias m="env PULSE_LATENCY_MSEC=60 mpv"
alias mb="mount /mnt/Baby; echo 'sdb Mounted'"
alias md="mount /mnt/drive; echo 'sdb Mounted'"
alias mi="env PULSE_LATENCY_MSEC=60 mpv --mute=yes"
alias mt="mpv --audio-device=alsa/hdmi:CARD=PCH,DEV=1"
alias mn="man"
alias tl="tldr"
alias n="rmpc -c '$HOME/.config/rmpc/config.ron'"
alias npi="nix profile install"
alias npl="nix profile list"
alias npr="nix profile remove"
alias nb="nix build --extra-experimental-features nix-command --extra-experimental-features flakes"
alias nfi="nix flake --extra-experimental-features nix-command --extra-experimental-features flakes init"
alias nfm="nix flake --extra-experimental-features nix-command --extra-experimental-features flakes metadata"
alias nfc="nix show-config --extra-experimental-features nix-command"
alias nsh="nix-shell"
alias nr="nix repl"
alias o="pkill -x"
alias oa="eww active-windows"
alias oc="eww close"
alias of="eww open waymem; eww open waycalendar"
alias oi="eww inspector"
alias ol="eww list-windows"
alias oo="eww open"
alias or="eww reload"
alias ow="eww open mem; eww open calendar"
alias u="neomutt -F '$HOME/.muttrc'"
alias spi="TERM=xterm-256color ssh -i '$HOME/.ssh/comp2pinew' pi@192.168.0.13"
alias sk="ssh -i '$HOME/.ssh/me2newmac' kristinowens@192.168.0.17"
alias po="gotop"
alias p="sudo flowtop -46UTDISs -t 2"
alias q="swayimg"
alias qw="swayimg -g -r -w 1920,1080 -p 0,0"
alias qi="identify"
alias qg="gimp"
alias s="ssh $WEBSITE_ADDRESS -p 2222 -i '$HOME/.ssh/tbcom_ssh'"
alias sb="sudo sv restart bluez-alsa; sudo sv restart bluetoothd"
alias se="pkill -x emacs; emacs --daemon"
alias sw="pkill -x waybar; env PULSE_LATENCY_MSEC=80 waybar -c '$HOME/.config/waybar/sway.json' -s '$HOME/.config/waybar/sway.css' -l off &"
alias sf="pkill -x waybar; env PULSE_LATENCY_MSEC=80 waybar -c '$HOME/.config/waybar/wayfire.json' -s '$HOME/.config/waybar/wayfire.css' -l off &"
alias so="pkill -x eww"
alias sy="pkill -x waybar; env PULSE_LATENCY_MSEC=80 waybar -c '$HOME/.config/waybar/hyprland.json' -s '$HOME/.config/waybar/hyprland.css' -l off &"
alias sn="pkill -x waybar; env PULSE_LATENCY_MSEC=80 waybar -c '$HOME/.config/waybar/niri.json' -s '$HOME/.config/waybar/niri.css' -l off &"
alias sp="pkill -x pipewire; pkill -x pulseaudio; pkill -x pipewire; env PULSE_LATENCY_MSEC=60 pipewire &"
alias sz="sudo pkill -x wpa_supplicant; sudo wpa_supplicant -B -Dwired -ienp0s31f6 -c/etc/wpa_supplicant/wpa_supplicant.conf"
alias svi="sudo vim -n -T alacritty"
alias ta="tar xvf"
alias td="tar czf"
alias ti="transmission-remote --auth='$TRANS_PASS' -l"
alias ts="transmission-remote --auth='$TRANS_PASS' -si"
alias tt="transmission-remote --auth='$TRANS_PASS' -st"
alias tr="transmission-remote --auth='$TRANS_PASS'"
alias ub="sudo umount /mnt/Baby; echo Unmounted"
alias ud="sudo umount /mnt/drive; echo Unmounted"
alias k="make"
alias kc="make clean"
alias ki="sudo make install"
alias km="meson setup build --buildtype=release --prefix=/usr"
alias kn="ninja -j4"
alias wh="which"
alias x="sudo zsh"
alias xxb="cd $VOIDPKG; ./xbps-src binary-bootstrap; cd $OLDPWD"
alias xz="cd $VOIDPKG; ./xbps-src zap; cd $OLDPWD"
alias xi="sudo xbps-install -S"
alias xl="sudo xbps-query -l"
alias xr="sudo xbps-remove"
alias xo="sudo xbps-query -O"
alias xu="sudo xbps-install -Su"
#alias xb="./xbps-src build -C -f -j 4"
#alias xp="./xbps-src pkg -C -f -Q -j 4"
#alias xxr="./xbps-src remove"
alias xxu="cd $VOIDPKG; ./xbps-src update-sys; cd $OLDPWD"
alias xxl="cd $VOIDPKG; ./xbps-src list; cd $OLDPWD"
#alias xs="./xbps-src show"
alias xlu="cd $VOIDPKG; ./xbps-src show-local-updates; cd $OLDPWD"
alias xsu="cd $VOIDPKG; ./xbps-src show-sys-updates; cd $OLDPWD"
#alias yz="yazi"
alias z="bluetoothctl"I use the following shell plug-ins, which are loaded from the ~/.zsh directory.
- Typewritten theme
- zsh-syntax-highlighting
- zsh-history-substring-search
- zsh-autosuggestions
- zsh-completions
- zsh-fzf-history-search
- zsh-nix-shell
- nix-zsh-completions
- you-should-use
fpath+=$HOME/.zsh/typewritten
fpath+=$HOME/.zsh/nix-zsh-completions
fpath+=$HOME/.zsh/zsh-completions/src
autoload -U compinit; compinit
autoload -U promptinit; promptinit
prompt typewritten
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=""
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND=""
export GH_BROWSER="qutebrowser --qt-arg stylesheet '/home/babkock/.local/share/qutebrowser/fix-tooltips.qss' --qt-wrapper PyQt6 --backend webengine --qt-flag enable-features=WebRTCPipeWireCapturer --qt-flag enable-features=UseOzonePlatform --qt-flag ozone-platform-hint=wayland --qt-flag enable-accelerated-video --qt-flag enable-gpu --qt-flag enable-accelerated-mjpeg-decode --qt-flag enable-native-gpu-memory-buffers --qt-flag ignore-gpu-blacklist --qt-flag enable-zero-copy --qt-flag enable-gpu-rasterization"
export GH_EDITOR="vim -n -T alacritty"
source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source $HOME/.zsh/zsh-autopair/autopair.zsh
source $HOME/.zsh/zsh-fzf-history-search/zsh-fzf-history-search.zsh
source $HOME/.zsh/zsh-nix-shell/nix-shell.plugin.zsh
source $HOME/.zsh/you-should-use/you-should-use.plugin.zsh
source $HOME/.zsh/completion.zsh
source $HOME/.zsh/nix-zsh-completions/nix-zsh-completions.plugin.zsh
source $HOME/.zsh/correction.zsh
source $HOME/.zsh/history.zsh
source $HOME/.zsh/colored-man-pages.plugin.zsh
source $HOME/.zsh/niri.zshAdd more keybindings to the completion menu, history substring search on up and down arrows, and undo/redo functionality.
bindkey -M menuselect '^[[Z' reverse-menu-complete # Shift+Tab
bindkey -M menuselect '^@' reverse-menu-complete
bindkey -M menuselect '^[[27;2;13~' accept-and-hold # Shift+Enter
bindkey -M menuselect '^{' clear-screen # Escape
bindkey -M menuselect '^[[A' vi-up-line-or-history
bindkey -M menuselect '^[[B' vi-down-line-or-history
bindkey -M menuselect '^[[D' vi-backward-char
bindkey -M menuselect '^[[C' vi-forward-char
bindkey -M menuselect '^[[1;2D' beginning-of-buffer-or-history # Shift+Left Arrow
bindkey -M menuselect '^[[1;2C' end-of-buffer-or-history # Shift+Right Arrow
bindkey -M main '^[[A' history-substring-search-up
bindkey -M main '^[[B' history-substring-search-down
bindkey -M main '^Z' undo # Control+Z
bindkey -M main '^Y' redo # Control+YThese next lines accomplish a few things. They let me use directory-changers like nnn and Zoxide, and configure the programs bat, fzf, and wob.
export GPG_TTY=$(tty)
gpgconf --launch gpg-agent
export GREP_COLORS="fn=bh:ln=gh:mt=rh:cx=y"
export EDITOR=vim
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#555555"
export NNN_FIFO=/tmp/nnn.fifo
export NNN_PLUG="p:-preview-tui;v:imgview;g:!tig*;v:!vim"
export NNN_COLORS="2365"
export BAT_STYLE="header,header-filesize,header-filename,changes"
export FZF_DEFAULT_OPTS="--border=horizontal --color=bg+:black,fg+:bright-green:italic,gutter:-1,hl:blue,hl+:bright-blue,query:bright-yellow,prompt:bright-yellow,pointer:black:dim,info:magenta,preview-bg:black,border:black:dim"
export WOBSOCK="$HOME/.wob.sock"prompt_nix_shell_setup "$@"
export PULSE_LATENCY_MSEC=60
random=$(shuf -i 1-3 -n 1)
if [[ ${TERM} = "st-256color" || ${TERM} = "rxvt-unicode" || ${TERM} = "xterm-256color" || ${TERM} = "foot" || ${TERM} = "kitty" || ${TERM} = "alacritty" ]]; then
if [[ "$random" == "1" ]]; then
pokemon-colorscripts --no-title -r 1-3
elif [[ "$random" == "2" ]]; then
pokemon-colorscripts --no-title -s -r 1-3
else
echo -e '\e[5;31m'
colorscript -r
fi
else
colorscript -r
fi
random=$(shuf -i 1-35 -n 1)
if [[ ${TERM} = "st-256color" || ${TERM} = "rxvt-unicode" || ${TERM} = "xterm-256color" || ${TERM} = "foot" || ${TERM} = "kitty" || ${TERM} = "alacritty" ]]; then
if [[ "$random" == "1" ]]; then
echo -e '\e[5;30m'
fortune anarchism | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "2" ]]; then
echo -e '\e[5;30m'
fortune drugs | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "3" ]]; then
echo -e '\e[5;30m'
fortune linux | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "4" ]]; then
echo -e '\e[5;30m'
fortune void | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "5" ]]; then
echo -e '\e[5;30m'
fortune computers | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "6" ]]; then
echo -e '\e[5;30m'
fortune paradoxum | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "7" ]]; then
echo -e '\e[5;30m'
fortune men-women | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "8" ]]; then
echo -e '\e[5;30m'
fortune linux | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "9" ]]; then
echo -e '\e[5;30m'
fortune magic | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "10" ]]; then
echo -e '\e[5;30m'
fortune linuxcookie | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "11" ]]; then
echo -e '\e[5;30m'
fortune wisdom | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "12" ]]; then
echo -e '\e[5;30m'
fortune ethnic | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "13" ]]; then
echo -e '\e[5;30m'
fortune literature | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "14" ]]; then
echo -e '\e[5;30m'
fortune art | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "15" ]]; then
echo -e '\e[5;30m'
fortune platitudes | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "16" ]]; then
echo -e '\e[5;30m'
fortune pets | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "17" ]]; then
echo -e '\e[5;30m'
fortune computers | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "18" ]]; then
echo -e '\e[5;30m'
fortune law | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "19" ]]; then
fortune ascii-art | lolcat --random -b -v 0.3
elif [[ "$random" == "20" ]]; then
echo -e '\e[5;30m'
fortune cookie | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "21" ]]; then
echo -e '\e[5;30m'
fortune definitions | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "22" ]]; then
echo -e '\e[5;30m'
fortune miscellaneous | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "23" ]]; then
echo -e '\e[5;30m'
fortune goedel | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "24" ]]; then
echo -e '\e[5;30m'
fortune news | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "25" ]]; then
echo -e '\e[5;30m'
fortune people | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "26" ]]; then
echo -e '\e[5;30m'
fortune science | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "27" ]]; then
echo -e '\e[5;30m'
fortune art | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "28" ]]; then
echo -e '\e[5;30m'
fortune perl | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "29" ]]; then
echo -e '\e[5;30m'
fortune songs-poems | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "30" ]]; then
echo -e '\e[5;30m'
fortune fortunes | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "31" ]]; then
echo -e '\e[5;30m'
fortune knghtbrd | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "32" ]]; then
echo -e '\e[5;30m'
fortune zippy | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "33" ]]; then
echo -e '\e[5;30m'
fortune love | cowsay -w | lolcat --random -b -v 0.2
elif [[ "$random" == "34" ]]; then
echo -e '\e[5;30m'
fortune work | cowsay -w | lolcat --random -b -v 0.2
else
echo -e '\e[5;30m'
fortune humorists | cowsay -w | lolcat --random -b -v 0.2
fi
else
if [[ "$random" == "1" ]]; then
fortune anarchism | cowsay -w | lolcat --random -x
elif [[ "$random" == "2" ]]; then
fortune linux | cowsay -w | lolcat --random -x
elif [[ "$random" == "3" ]]; then
fortune drugs | cowsay -w | lolcat --random -x
elif [[ "$random" == "4" ]]; then
fortune void | cowsay -w | lolcat --random -x
elif [[ "$random" == "5" ]]; then
fortune computers | cowsay -w | lolcat --random -x
elif [[ "$random" == "6" ]]; then
fortune linuxcookie | cowsay -w | lolcat --random -x
elif [[ "$random" == "7" ]]; then
fortune paradoxum | cowsay -w | lolcat --random -x
elif [[ "$random" == "8" ]]; then
fortune men-women | cowsay -w | lolcat --random -x
elif [[ "$random" == "9" ]]; then
fortune wisdom | cowsay -w | lolcat --random -x
elif [[ "$random" == "10" ]]; then
fortune magic | cowsay -w | lolcat --random -x
elif [[ "$random" == "11" ]]; then
fortune humorists | cowsay -w | lolcat --random -x
elif [[ "$random" == "12" ]]; then
fortune ethnic | cowsay -w | lolcat --random -x
elif [[ "$random" == "13" ]]; then
fortune void | cowsay -w | lolcat --random -x
elif [[ "$random" == "14" ]]; then
fortune law | cowsay -w | lolcat --random -x
elif [[ "$random" == "15" ]]; then
fortune literature | cowsay -w | lolcat --random -x
elif [[ "$random" == "16" ]]; then
fortune cookie | cowsay -w | lolcat --random -x
elif [[ "$random" == "17" ]]; then
fortune politics | cowsay -w | lolcat --random -x
elif [[ "$random" == "18" ]]; then
fortune linux | cowsay -w | lolcat --random -x
elif [[ "$random" == "19" ]]; then
fortune law | cowsay -w | lolcat --random -x
elif [[ "$random" == "20" ]]; then
fortune art | cowsay -w | lolcat --random -x
elif [[ "$random" == "21" ]]; then
fortune people | cowsay -w | lolcat --random -x
elif [[ "$random" == "22" ]]; then
fortune fortunes | cowsay -w | lolcat --random -x
elif [[ "$random" == "23" ]]; then
fortune knghtbrd | cowsay -w | lolcat --random -x
elif [[ "$random" == "24" ]]; then
fortune zippy | cowsay -w | lolcat --random -x
elif [[ "$random" == "25" ]]; then
fortune science | cowsay -w | lolcat --random -x
elif [[ "$random" == "26" ]]; then
fortune news | cowsay -w | lolcat --random -x
elif [[ "$random" == "27" ]]; then
fortune miscellaneous | cowsay -w | lolcat --random -x
elif [[ "$random" == "28" ]]; then
fortune perl | cowsay -w | lolcat --random -x
elif [[ "$random" == "29" ]]; then
fortune goedel | cowsay -w | lolcat --random -x
elif [[ "$random" == "30" ]]; then
fortune love | cowsay -w | lolcat --random -x
elif [[ "$random" == "31" ]]; then
fortune definitions | cowsay -w | lolcat --random -x
elif [[ "$random" == "32" ]]; then
fortune platitudes | cowsay -w | lolcat --random -x
elif [[ "$random" == "33" ]]; then
fortune work | cowsay -w | lolcat --random -x
elif [[ "$random" == "34" ]]; then
fortune pets | cowsay -w | lolcat --random -x
else
fortune ascii-art | lolcat --random -x
fi
fi>