From 0179eebc614a5668048b510cb7a0776354c16dc3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 27 Feb 2024 21:47:56 -0500 Subject: make it possible to load shell config fragments --- bash/.bashrc | 10 ++++------ sh/.config/sh/aliases | 35 ----------------------------------- sh/.config/sh/env | 19 ------------------- sh/.config/sh/rc.d/aliases | 35 +++++++++++++++++++++++++++++++++++ sh/.config/sh/rc.d/env | 19 +++++++++++++++++++ zsh/.zshrc | 10 ++++------ 6 files changed, 62 insertions(+), 66 deletions(-) delete mode 100644 sh/.config/sh/aliases delete mode 100644 sh/.config/sh/env create mode 100644 sh/.config/sh/rc.d/aliases create mode 100644 sh/.config/sh/rc.d/env diff --git a/bash/.bashrc b/bash/.bashrc index 74ac5cf..0700cf3 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -4,8 +4,6 @@ test -d "$HOME/.cargo/bin" && export PATH="$HOME/.cargo/bin:$PATH" # environment {{{ PATH="${HOME}/.bin/local:${HOME}/.bin/$(hostname):${HOME}/.bin:$PATH" export PATH -# shellcheck source=sh/.config/sh/env -[ -f "$HOME/.config/sh/env" ] && source "$HOME"/.config/sh/env # }}} # Test for an interactive shell. {{{ # There is no need to set anything past this point for scp and rcp, and it's @@ -16,10 +14,10 @@ if [[ $- != *i* ]] ; then fi [ -z "$PS1" ] && return # }}} -# aliases {{{ -# shellcheck source=sh/.config/sh/aliases -[ -f "$HOME/.config/sh/aliases" ] && source "$HOME"/.config/sh/aliases -# }}} +for file in ~/.config/sh/rc.d/*; do + # shellcheck disable=SC1090 + source "$file" +done # completion {{{ #shellcheck disable=SC1091 [ -f /etc/bash_completion ] && source /etc/bash_completion diff --git a/sh/.config/sh/aliases b/sh/.config/sh/aliases deleted file mode 100644 index c5b716f..0000000 --- a/sh/.config/sh/aliases +++ /dev/null @@ -1,35 +0,0 @@ -# improvements to common commands {{{ -alias ls="exa --group-directories-first --time-style=long-iso --git --color-scale" -alias ll="ls -l" -alias grep="grep --color=auto" -alias rm="rm -i" -alias cp="cp -i" -alias mv="mv -i" -alias bc="bc -lq" -alias hx="helix" -type tput >/dev/null 2>&1 && alias reset="tput reset" -# }}} -# games {{{ -alias nao="ssh nethack@alt.org" -alias cao="env TERM=screen-256color /usr/bin/ssh -C -i \$HOME/.ssh/cao_key joshua@crawl.akrasiac.org" -alias cdo="ssh -C -i \$HOME/.ssh/cao_key crawl@crawl.develz.org" -# }}} -# tmux sessions {{{ -alias main='tmux new -As main' -alias chat='tmux new -As chat' -alias work='tmux new -As work' -alias docs='tmux new -As docs' -alias misc='tmux new -As misc' -# }}} -# other {{{ -alias utc="env TZ=UTC date" -alias pc="p | xclip -l 1" -alias wifi="sudo systemctl restart iwd" -alias debian="podman run --rm -itv "${HOME}:${HOME}" docker.io/debian:stable bash" -alias ubuntu="podman run --rm -itv "${HOME}:${HOME}" docker.io/ubuntu:latest bash" -alias alpine="podman run --rm -itv "${HOME}:${HOME}" docker.io/alpine:latest sh" -alias arch="podman run --rm -itv "${HOME}:${HOME}" docker.io/archlinux:latest sh" -alias cdu="cd \"\$(git root)\"" -# }}} - -# vim:ft=sh:fdm=marker diff --git a/sh/.config/sh/env b/sh/.config/sh/env deleted file mode 100644 index a715fdb..0000000 --- a/sh/.config/sh/env +++ /dev/null @@ -1,19 +0,0 @@ -export MANPAGER="$HOME/.bin/vimmanpager" -export PERLDOC_PAGER="$HOME/.bin/vimmanpager" -EDITOR=$(command -v helix) -export EDITOR -ssh="${HOME}/.bin/$(hostname)/ssh" -if [ -x "$ssh" ]; then - export GIT_SSH="$ssh" - export RSYNC_RSH="$ssh" -fi -if type sudo-askpass >/dev/null 2>&1; then - SUDO_ASKPASS=$(command -v sudo-askpass) - export SUDO_ASKPASS -fi -export TEXINPUTS=".:$HOME/.config/tex:" -export LESS='-QR' -export FZF_DEFAULT_OPTS="--reverse --inline-info --bind=tab:down,shift-tab:up,change:top,ctrl-space:toggle" -export FZF_DEFAULT_COMMAND="rg --hidden -l ." - -# vim:ft=sh: diff --git a/sh/.config/sh/rc.d/aliases b/sh/.config/sh/rc.d/aliases new file mode 100644 index 0000000..c5b716f --- /dev/null +++ b/sh/.config/sh/rc.d/aliases @@ -0,0 +1,35 @@ +# improvements to common commands {{{ +alias ls="exa --group-directories-first --time-style=long-iso --git --color-scale" +alias ll="ls -l" +alias grep="grep --color=auto" +alias rm="rm -i" +alias cp="cp -i" +alias mv="mv -i" +alias bc="bc -lq" +alias hx="helix" +type tput >/dev/null 2>&1 && alias reset="tput reset" +# }}} +# games {{{ +alias nao="ssh nethack@alt.org" +alias cao="env TERM=screen-256color /usr/bin/ssh -C -i \$HOME/.ssh/cao_key joshua@crawl.akrasiac.org" +alias cdo="ssh -C -i \$HOME/.ssh/cao_key crawl@crawl.develz.org" +# }}} +# tmux sessions {{{ +alias main='tmux new -As main' +alias chat='tmux new -As chat' +alias work='tmux new -As work' +alias docs='tmux new -As docs' +alias misc='tmux new -As misc' +# }}} +# other {{{ +alias utc="env TZ=UTC date" +alias pc="p | xclip -l 1" +alias wifi="sudo systemctl restart iwd" +alias debian="podman run --rm -itv "${HOME}:${HOME}" docker.io/debian:stable bash" +alias ubuntu="podman run --rm -itv "${HOME}:${HOME}" docker.io/ubuntu:latest bash" +alias alpine="podman run --rm -itv "${HOME}:${HOME}" docker.io/alpine:latest sh" +alias arch="podman run --rm -itv "${HOME}:${HOME}" docker.io/archlinux:latest sh" +alias cdu="cd \"\$(git root)\"" +# }}} + +# vim:ft=sh:fdm=marker diff --git a/sh/.config/sh/rc.d/env b/sh/.config/sh/rc.d/env new file mode 100644 index 0000000..a715fdb --- /dev/null +++ b/sh/.config/sh/rc.d/env @@ -0,0 +1,19 @@ +export MANPAGER="$HOME/.bin/vimmanpager" +export PERLDOC_PAGER="$HOME/.bin/vimmanpager" +EDITOR=$(command -v helix) +export EDITOR +ssh="${HOME}/.bin/$(hostname)/ssh" +if [ -x "$ssh" ]; then + export GIT_SSH="$ssh" + export RSYNC_RSH="$ssh" +fi +if type sudo-askpass >/dev/null 2>&1; then + SUDO_ASKPASS=$(command -v sudo-askpass) + export SUDO_ASKPASS +fi +export TEXINPUTS=".:$HOME/.config/tex:" +export LESS='-QR' +export FZF_DEFAULT_OPTS="--reverse --inline-info --bind=tab:down,shift-tab:up,change:top,ctrl-space:toggle" +export FZF_DEFAULT_COMMAND="rg --hidden -l ." + +# vim:ft=sh: diff --git a/zsh/.zshrc b/zsh/.zshrc index d6a4292..c60e8d7 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -6,13 +6,11 @@ test -d "$HOME/.cargo/bin" && export PATH="$HOME/.cargo/bin:$PATH" # tends to hard-set $PATH and such PATH="${HOME}/.bin/local:${HOME}/.bin/$(hostname):${HOME}/.bin:$PATH" export PATH -# shellcheck source=sh/.config/sh/env -[ -f "$HOME/.config/sh/env" ] && source "$HOME/.config/sh/env" -# }}} -# aliases {{{ -# shellcheck source=sh/.config/sh/aliases -[ -f "$HOME/.config/sh/aliases" ] && source "$HOME/.config/sh/aliases" # }}} +for file in ~/.config/sh/rc.d/*; do + # shellcheck disable=SC1090 + source "$file" +done # completion {{{ # shellcheck disable=SC2206 fpath=( \ -- cgit v1.2.3-54-g00ecf