Commit 26af88c
Eric Bower
·
2026-09-05 22:49:17 -0400 EDT
parent 3dbaf52
chore: bash + flyline
6 files changed,
+171,
-16
+149,
-0
1@@ -0,0 +1,149 @@
2+#
3+# ~/.bashrc
4+#
5+
6+# If not running interactively, don't do anything
7+[[ $- != *i* ]] && return
8+
9+# --- Shell options ---
10+shopt -s extglob globstar histappend
11+set -o vi
12+
13+# --- Environment & PATH ---
14+export PATH="$HOME/.local/bin:/usr/local/go/bin:$HOME/.cargo/bin:$HOME/.npm-packages/bin:$HOME/go/bin:$PATH"
15+
16+export LANG="en_US.UTF-8"
17+export EDITOR="kak"
18+export VISUAL="kak"
19+export PAGER="less"
20+export LESS="-FRX"
21+export GPG_TTY="$(tty 2>/dev/null || true)"
22+export XDG_CONFIG_HOME="$HOME/.config"
23+export VDIRSYNCER_CONFIG="$HOME/.config/vdirsyncer/config"
24+export MDIR="$HOME/mail"
25+export PA_LENGTH=20
26+export PA_PATTERN="A-Za-z0-9_-"
27+
28+# --- History ---
29+HISTCONTROL=ignoreboth
30+HISTSIZE=5000
31+HISTFILESIZE=10000
32+HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/bash/history"
33+[[ -d "${HISTFILE%/*}" ]] || mkdir -p "${HISTFILE%/*}"
34+
35+MAILCHECK=0
36+
37+# --- Colors & Aliases ---
38+if [[ "${COLORTERM:-}" = "truecolor" || "${COLORTERM:-}" = "24bit" ]] || \
39+ [[ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]]; then
40+ alias ls='ls --color=auto'
41+ alias grep='grep --color=auto'
42+fi
43+
44+alias pushall='git remote | xargs -I R git push R'
45+alias sway='XDG_CURRENT_DESKTOP=sway sway --unsupported-gpu'
46+alias tre='tree -CF --dirsfirst -L 2'
47+alias pp="PA_DIR=$HOME/dev/pico-pass pa"
48+alias logs='ssh pipe sub /pico/log-drain -k | jq -r'
49+alias ash='autossh -M 0 -q'
50+alias mdfmt='uvx --with=mdformat-gfm --with=mdformat-frontmatter --with=mdformat-gfm-alerts mdformat --wrap no'
51+alias cai='claude --dangerously-skip-permissions'
52+alias gai='agy --dangerously-skip-permissions'
53+
54+# --- Custom functions ---
55+pw() {
56+ tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 20; echo
57+}
58+
59+fcd() {
60+ local dir
61+ if command -v fd >/dev/null 2>&1; then
62+ dir="$(fd --max-depth 3 --type d --hidden --follow --exclude .git --exclude .jj . "${1:-.}" 2>/dev/null | fzf +m)" || return
63+ else
64+ dir="$(find "${1:-.}" -mindepth 1 -maxdepth 3 -path '*/.*' -prune -o -type d -print 2>/dev/null | fzf +m)" || return
65+ fi
66+ [[ -n "$dir" ]] && cd "$dir"
67+}
68+
69+# --- Terminal integrations & hooks ---
70+_zmx_env_hook() {
71+ if [[ -n "${ZMX_SESSION:-}" ]]; then
72+ eval "$(zmx print-env -s . 2>/dev/null || true)"
73+ fi
74+}
75+
76+_osc7_cwd() {
77+ if [[ -t 1 ]]; then
78+ local tmp="${PWD}" encoded="" cut c esc=$'\e'
79+ while [[ -n "$tmp" ]]; do
80+ cut="${tmp#?}"
81+ c="${tmp%"$cut"}"
82+ case "$c" in
83+ [-/:_.!\'\(\)~a-zA-Z0-9]) encoded="$encoded$c" ;;
84+ *) encoded="$encoded$(printf '%%%02X' "'$c")" ;;
85+ esac
86+ tmp="$cut"
87+ done
88+ printf '%s]7;file://%s%s%s\\' "$esc" "${HOSTNAME:-$(uname -n)}" "$encoded" "$esc"
89+ fi
90+}
91+
92+_build_prompt() {
93+ local exit_code="$1"
94+ local user_host_color="\[\e[32m\]" # green
95+ if [[ $EUID -eq 0 ]]; then
96+ user_host_color="\[\e[31m\]" # red for root
97+ elif [[ -n "${SSH_CONNECTION:-}" ]]; then
98+ user_host_color="\[\e[33m\]" # yellow for ssh
99+ fi
100+ local reset="\[\e[0m\]"
101+ local red="\[\e[31m\]"
102+
103+ local zmx_prefix=""
104+ if [[ -n "${ZMX_SESSION:-}" ]]; then
105+ zmx_prefix="[$ZMX_SESSION] "
106+ fi
107+
108+ local status_part=""
109+ if [[ $exit_code -ne 0 ]]; then
110+ status_part="${red}${exit_code}${reset} "
111+ fi
112+
113+ local shlvl_part=""
114+ if [[ ${SHLVL:-1} -gt 1 ]]; then
115+ shlvl_part="${SHLVL} "
116+ fi
117+
118+ PS1="${zmx_prefix}${user_host_color}\u@\h${reset} \W ${status_part}${shlvl_part}\$ "
119+}
120+
121+_prompt_command() {
122+ local last_status=$?
123+ _zmx_env_hook
124+ _osc7_cwd
125+ _build_prompt "$last_status"
126+}
127+PROMPT_COMMAND=('_prompt_command')
128+
129+# --- Direnv & Integrations ---
130+if command -v direnv >/dev/null 2>&1; then
131+ eval "$(direnv hook bash)"
132+fi
133+
134+if command -v zmx >/dev/null 2>&1; then
135+ eval "$(zmx completions bash)"
136+fi
137+
138+# --- Local overrides ---
139+if [[ -f "$HOME/.config/bash/local.sh" ]]; then
140+ . "$HOME/.config/bash/local.sh"
141+elif [[ -f "$HOME/.bashrc.local" ]]; then
142+ . "$HOME/.bashrc.local"
143+fi
144+
145+# --- Flyline ---
146+if [[ -f /usr/lib/bash/libflyline.so ]]; then
147+ enable -f /usr/lib/bash/libflyline.so flyline
148+ flyline mouse --mode disabled
149+ flyline key bind Ctrl+f inlineSuggestionAvailable=inlineSuggestionAccept
150+fi
+11,
-11
1@@ -33,17 +33,17 @@ map global user b ":buffer<space>" -docstring "buffer list"
2 map global user B ":delete-buffer-picker<ret>" -docstring "delete buffer"
3
4 define-command find -docstring "find files" -params 1 %{ edit %arg{1} }
5-# complete-command find shell-script-candidates %{ fd -t f }
6-complete-command find shell-script-candidates %{
7- find . -type d \
8- \( -name .git -o -name .jj \
9- -o -name .zig-cache -o -name zig-pkg -o -name zig-out \
10- -o -name node_modules \
11- -o -name __pycache__ -o -name .mypy_cache \
12- -o -name .pytest_cache -o -name .ruff_cache -o -name .venv \
13- \) -prune \
14- -o -type f -print | sed 's|^\./||'
15-}
16+complete-command find shell-script-candidates %{ fd -t f }
17+# complete-command find shell-script-candidates %{
18+# find . -type d \
19+# \( -name .git -o -name .jj \
20+# -o -name .zig-cache -o -name zig-pkg -o -name zig-out \
21+# -o -name node_modules \
22+# -o -name __pycache__ -o -name .mypy_cache \
23+# -o -name .pytest_cache -o -name .ruff_cache -o -name .venv \
24+# \) -prune \
25+# -o -type f -print | sed 's|^\./||'
26+# }
27
28 define-command dowrap %{ # soft-wrap command
29 add-highlighter buffer/ wrap -indent -word -marker "… "
1@@ -1,14 +1,15 @@
2 [Unit]
3 Description=Figbar Wayland status bar
4-PartOf=graphical-session.target
5-After=graphical-session.target
6-Requisite=graphical-session.target
7+PartOf=wayland-session.target
8+After=wayland-session.target
9+StartLimitIntervalSec=30s
10+StartLimitBurst=10
11
12 [Service]
13 Type=simple
14 ExecStart=/bin/sh -c 'python3 %h/.config/sway/figbar_status.py | %h/.local/bin/figbar -b -r -f "JetBrainsMono Nerd Font 10.5" -N 272822 -n f8f8f2 -S 66d9ef -s 272822'
15 Restart=always
16-RestartSec=1s
17+RestartSec=2s
18
19 [Install]
20 WantedBy=wayland-session.target
M
link.sh
+2,
-0
1@@ -13,6 +13,7 @@ TRACKED_FILES=(
2 dot/npmrc
3 dot/editorconfig
4 dot_config/vim/vimrc
5+ dot/bashrc
6 )
7
8 TRACKED_LOCATIONS=(
9@@ -28,6 +29,7 @@ TRACKED_LOCATIONS=(
10 ~/.npmrc
11 ~/.editorconfig
12 ~/.vim/vimrc
13+ ~/.bashrc
14 )
15
16 find_files() {
+2,
-1
1@@ -2,6 +2,7 @@ age
2 aspell-en
3 base
4 base-devel
5+bash-completion
6 bash-language-server
7 bat
8 bats
9@@ -10,7 +11,6 @@ blueprint-compiler
10 bluez
11 bluez-utils
12 brightnessctl
13-bun
14 cmake
15 difftastic
16 direnv
17@@ -21,6 +21,7 @@ docker-buildx
18 docker-compose
19 editorconfig-core-c
20 expect
21+fd
22 firefox
23 foot
24 fzf
+2,
-0
1@@ -4,6 +4,7 @@ aspell-en
2 autossh
3 base
4 base-devel
5+bash-completion
6 bat
7 bind
8 bluez
9@@ -15,6 +16,7 @@ cups-pdf
10 difftastic
11 direnv
12 efibootmgr
13+fd
14 firefox
15 foot
16 foot-terminfo