81 lines
2.7 KiB
Plaintext
81 lines
2.7 KiB
Plaintext
########################################################################
|
|
#
|
|
# Personal sh stuff
|
|
#
|
|
########################################################################
|
|
|
|
bt() {
|
|
echo "powering on"
|
|
bluetoothctl power on
|
|
device=$1
|
|
echo "connecting to $device";
|
|
bluetoothctl devices | awk -v device="$device" '$0 ~ device {print $2}' | xargs -I{} bluetoothctl connect {}
|
|
}
|
|
|
|
grab() {
|
|
out=$1
|
|
echo "pasting clipboard to $out"
|
|
xclip -sel clipboard -t image/png -o > $out
|
|
}
|
|
|
|
# save a youtube video as audio file
|
|
yt() {
|
|
youtube-dl $1 -x --audio-format mp3
|
|
}
|
|
|
|
# tm - create new tmux session, or switch to existing one. Works from within tmux too.
|
|
# `tm` lists sessions via fzf, or prompts for a new session name when none exist.
|
|
# `tm irc` attaches to the irc session (creating it if needed).
|
|
tm() {
|
|
local change session sessions
|
|
[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session"
|
|
|
|
if [[ -n "$1" ]]; then
|
|
tmux $change -t "$1" 2>/dev/null || { tmux new-session -d -s "$1" && tmux $change -t "$1"; }
|
|
return
|
|
fi
|
|
|
|
sessions=$(tmux list-sessions -F "#{session_name}" 2>/dev/null)
|
|
if [[ -n "$sessions" ]]; then
|
|
session=$(echo "$sessions" | fzf --prompt="Select tmux session: " --height=40% --reverse --exit-0)
|
|
[[ -n "$session" ]] && tmux $change -t "$session"
|
|
else
|
|
read "session?Enter new session name: "
|
|
[[ -n "$session" ]] && tmux new-session -s "$session"
|
|
fi
|
|
}
|
|
|
|
|
|
########################################################################
|
|
#
|
|
# PATH additions
|
|
#
|
|
########################################################################
|
|
alias vi=nvim
|
|
export VISUAL=nvim
|
|
export EDITOR="$VISUAL"
|
|
export PLAN_BASE_PATH="$HOME/.plan"
|
|
|
|
# prepend: tools that should win over system equivalents
|
|
[[ -d /opt/homebrew/bin ]] && export PATH="/opt/homebrew/bin:$PATH"
|
|
[[ -d /opt/homebrew/opt/libpq/bin ]] && export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
|
|
|
|
# append: user-installed binaries
|
|
[[ -d "$HOME/.local/bin" ]] && export PATH="$PATH:$HOME/.local/bin"
|
|
[[ -d "$HOME/go/bin" ]] && export PATH="$PATH:$HOME/go/bin"
|
|
[[ -d "$HOME/.claude/local" ]] && export PATH="$PATH:$HOME/.claude/local"
|
|
[[ -d /usr/local/lib/nodejs/bin ]] && export PATH="$PATH:/usr/local/lib/nodejs/bin"
|
|
[[ -d /opt/nvim/bin ]] && export PATH="$PATH:/opt/nvim/bin"
|
|
|
|
# env sourcers
|
|
[[ -f "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
|
|
[[ -f "$HOME/.local/bin/env" ]] && source "$HOME/.local/bin/env"
|
|
|
|
# mise (runtime version manager) — must run after PATH so its shim wins
|
|
command -v mise >/dev/null && eval "$(mise activate zsh)"
|
|
|
|
# personal aliases (separate file)
|
|
[[ -f "$HOME/.aliases" ]] && source "$HOME/.aliases"
|
|
|
|
alias d="sudo docker"
|