Commit 643b832
Eric Bower
·
2026-09-08 21:49:58 -0400 EDT
parent 7a51d43
chore: delete bashrc i like yash better
1 files changed,
+0,
-149
+0,
-149
| ... | ... | @@ -1,149 +0,0 @@ | |
| 1 | - | # | |
| 2 | - | # ~/.bashrc | |
| 3 | - | # | |
| 4 | - | ||
| 5 | - | # If not running interactively, don't do anything | |
| 6 | - | [[ $- != *i* ]] && return | |
| 7 | - | ||
| 8 | - | # --- Shell options --- | |
| 9 | - | shopt -s extglob globstar histappend | |
| 10 | - | set -o vi | |
| 11 | - | ||
| 12 | - | # --- Environment & PATH --- | |
| 13 | - | export PATH="$HOME/.local/bin:/usr/local/go/bin:$HOME/.cargo/bin:$HOME/.npm-packages/bin:$HOME/go/bin:$PATH" | |
| 14 | - | ||
| 15 | - | export LANG="en_US.UTF-8" | |
| 16 | - | export EDITOR="kak" | |
| 17 | - | export VISUAL="kak" | |
| 18 | - | export PAGER="less" | |
| 19 | - | export LESS="-FRX" | |
| 20 | - | export GPG_TTY="$(tty 2>/dev/null || true)" | |
| 21 | - | export XDG_CONFIG_HOME="$HOME/.config" | |
| 22 | - | export VDIRSYNCER_CONFIG="$HOME/.config/vdirsyncer/config" | |
| 23 | - | export MDIR="$HOME/mail" | |
| 24 | - | export PA_LENGTH=20 | |
| 25 | - | export PA_PATTERN="A-Za-z0-9_-" | |
| 26 | - | ||
| 27 | - | # --- History --- | |
| 28 | - | HISTCONTROL=ignoreboth | |
| 29 | - | HISTSIZE=5000 | |
| 30 | - | HISTFILESIZE=10000 | |
| 31 | - | HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/bash/history" | |
| 32 | - | [[ -d "${HISTFILE%/*}" ]] || mkdir -p "${HISTFILE%/*}" | |
| 33 | - | ||
| 34 | - | MAILCHECK=0 | |
| 35 | - | ||
| 36 | - | # --- Colors & Aliases --- | |
| 37 | - | if [[ "${COLORTERM:-}" = "truecolor" || "${COLORTERM:-}" = "24bit" ]] || \ | |
| 38 | - | [[ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]]; then | |
| 39 | - | alias ls='ls --color=auto' | |
| 40 | - | alias grep='grep --color=auto' | |
| 41 | - | fi | |
| 42 | - | ||
| 43 | - | alias pushall='git remote | xargs -I R git push R' | |
| 44 | - | alias sway='XDG_CURRENT_DESKTOP=sway sway --unsupported-gpu' | |
| 45 | - | alias tre='tree -CF --dirsfirst -L 2' | |
| 46 | - | alias pp="PA_DIR=$HOME/dev/pico-pass pa" | |
| 47 | - | alias logs='ssh pipe sub /pico/log-drain -k | jq -r' | |
| 48 | - | alias ash='autossh -M 0 -q' | |
| 49 | - | alias mdfmt='uvx --with=mdformat-gfm --with=mdformat-frontmatter --with=mdformat-gfm-alerts mdformat --wrap no' | |
| 50 | - | alias cai='claude --dangerously-skip-permissions' | |
| 51 | - | alias gai='agy --dangerously-skip-permissions' | |
| 52 | - | ||
| 53 | - | # --- Custom functions --- | |
| 54 | - | pw() { | |
| 55 | - | tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 20; echo | |
| 56 | - | } | |
| 57 | - | ||
| 58 | - | fcd() { | |
| 59 | - | local dir | |
| 60 | - | if command -v fd >/dev/null 2>&1; then | |
| 61 | - | dir="$(fd --max-depth 3 --type d --hidden --follow --exclude .git --exclude .jj . "${1:-.}" 2>/dev/null | fzf +m)" || return | |
| 62 | - | else | |
| 63 | - | dir="$(find "${1:-.}" -mindepth 1 -maxdepth 3 -path '*/.*' -prune -o -type d -print 2>/dev/null | fzf +m)" || return | |
| 64 | - | fi | |
| 65 | - | [[ -n "$dir" ]] && cd "$dir" | |
| 66 | - | } | |
| 67 | - | ||
| 68 | - | # --- Terminal integrations & hooks --- | |
| 69 | - | _zmx_env_hook() { | |
| 70 | - | if [[ -n "${ZMX_SESSION:-}" ]]; then | |
| 71 | - | eval "$(zmx print-env -s . 2>/dev/null || true)" | |
| 72 | - | fi | |
| 73 | - | } | |
| 74 | - | ||
| 75 | - | _osc7_cwd() { | |
| 76 | - | if [[ -t 1 ]]; then | |
| 77 | - | local tmp="${PWD}" encoded="" cut c esc=$'\e' | |
| 78 | - | while [[ -n "$tmp" ]]; do | |
| 79 | - | cut="${tmp#?}" | |
| 80 | - | c="${tmp%"$cut"}" | |
| 81 | - | case "$c" in | |
| 82 | - | [-/:_.!\'\(\)~a-zA-Z0-9]) encoded="$encoded$c" ;; | |
| 83 | - | *) encoded="$encoded$(printf '%%%02X' "'$c")" ;; | |
| 84 | - | esac | |
| 85 | - | tmp="$cut" | |
| 86 | - | done | |
| 87 | - | printf '%s]7;file://%s%s%s\\' "$esc" "${HOSTNAME:-$(uname -n)}" "$encoded" "$esc" | |
| 88 | - | fi | |
| 89 | - | } | |
| 90 | - | ||
| 91 | - | _build_prompt() { | |
| 92 | - | local exit_code="$1" | |
| 93 | - | local user_host_color="\[\e[32m\]" # green | |
| 94 | - | if [[ $EUID -eq 0 ]]; then | |
| 95 | - | user_host_color="\[\e[31m\]" # red for root | |
| 96 | - | elif [[ -n "${SSH_CONNECTION:-}" ]]; then | |
| 97 | - | user_host_color="\[\e[33m\]" # yellow for ssh | |
| 98 | - | fi | |
| 99 | - | local reset="\[\e[0m\]" | |
| 100 | - | local red="\[\e[31m\]" | |
| 101 | - | ||
| 102 | - | local zmx_prefix="" | |
| 103 | - | if [[ -n "${ZMX_SESSION:-}" ]]; then | |
| 104 | - | zmx_prefix="[$ZMX_SESSION] " | |
| 105 | - | fi | |
| 106 | - | ||
| 107 | - | local status_part="" | |
| 108 | - | if [[ $exit_code -ne 0 ]]; then | |
| 109 | - | status_part="${red}${exit_code}${reset} " | |
| 110 | - | fi | |
| 111 | - | ||
| 112 | - | local shlvl_part="" | |
| 113 | - | if [[ ${SHLVL:-1} -gt 1 ]]; then | |
| 114 | - | shlvl_part="${SHLVL} " | |
| 115 | - | fi | |
| 116 | - | ||
| 117 | - | PS1="${zmx_prefix}${user_host_color}\u@\h${reset} \W ${status_part}${shlvl_part}\$ " | |
| 118 | - | } | |
| 119 | - | ||
| 120 | - | _prompt_command() { | |
| 121 | - | local last_status=$? | |
| 122 | - | _zmx_env_hook | |
| 123 | - | _osc7_cwd | |
| 124 | - | _build_prompt "$last_status" | |
| 125 | - | } | |
| 126 | - | PROMPT_COMMAND=('_prompt_command') | |
| 127 | - | ||
| 128 | - | # --- Direnv & Integrations --- | |
| 129 | - | if command -v direnv >/dev/null 2>&1; then | |
| 130 | - | eval "$(direnv hook bash)" | |
| 131 | - | fi | |
| 132 | - | ||
| 133 | - | if command -v zmx >/dev/null 2>&1; then | |
| 134 | - | eval "$(zmx completions bash)" | |
| 135 | - | fi | |
| 136 | - | ||
| 137 | - | # --- Local overrides --- | |
| 138 | - | if [[ -f "$HOME/.config/bash/local.sh" ]]; then | |
| 139 | - | . "$HOME/.config/bash/local.sh" | |
| 140 | - | elif [[ -f "$HOME/.bashrc.local" ]]; then | |
| 141 | - | . "$HOME/.bashrc.local" | |
| 142 | - | fi | |
| 143 | - | ||
| 144 | - | # --- Flyline --- | |
| 145 | - | if [[ -f /usr/lib/bash/libflyline.so ]]; then | |
| 146 | - | enable -f /usr/lib/bash/libflyline.so flyline | |
| 147 | - | flyline mouse --mode disabled | |
| 148 | - | flyline key bind Ctrl+f inlineSuggestionAvailable=inlineSuggestionAccept | |
| 149 | - | fi |