diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-26 16:57:37 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-26 16:57:37 -0600 |
| commit | 7d490453085ae084ce0e3875952eae1d3ad7b1ab (patch) | |
| tree | d6f76ded02d541107271dc2b04cac34435c81a26 /dotfiles/system/.bashrc | |
| parent | feb8dfaae9b0172c9d24e7e0d115754a467b4627 (diff) | |
refactor(shell): reorganize shell config for proper separation
Restructure shell configuration to follow standard conventions:
- .profile: Environment variables only (POSIX compatible)
- .bash_profile: NEW - sources .profile and .bashrc for login shells
- .bashrc: Bash-specific settings, sources .bashrc.d/
- .zshrc: Zsh-specific settings, sources .zshrc.d/
New modular directories:
- .bashrc.d/: aliases, emacs, fzf, git, media, utilities
- .zshrc.d/: same as bashrc.d plus arch-downgrade (zsh-only)
- .profile.d/: reduced to env-only files (display, framework, auto-tmux)
Fixes:
- Remove duplicate .profile sourcing in .bashrc
- Remove broken XDG_CURRENT_DESKTOP=GNOME line from display.sh
- Move aliases/functions from .profile to appropriate .d/ directories
- Shell-specific init (zoxide, fzf) now in .bashrc/.zshrc directly
- FreeBSD bindkey fix now in .zshrc directly
Also adds CLAUDE.md session context file.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'dotfiles/system/.bashrc')
| -rw-r--r-- | dotfiles/system/.bashrc | 99 |
1 files changed, 58 insertions, 41 deletions
diff --git a/dotfiles/system/.bashrc b/dotfiles/system/.bashrc index b5290cd..b2177d9 100644 --- a/dotfiles/system/.bashrc +++ b/dotfiles/system/.bashrc @@ -1,59 +1,76 @@ #!/bin/bash -# cjennings .bashrc - -# tells shellcheck not to follow references to other files -# shellcheck source=/dev/null +# .bashrc +# Craig Jennings <c@cjennings.net> +# +# Bash-specific interactive shell settings. +# Aliases, functions, prompt, completions, shell options. # If not running interactively, don't do anything case $- in - *i*) ;; - *) return;; + *i*) ;; + *) return;; esac -# env variables, aliases, and functions that are not bash specific -source "$HOME"/.profile - -# don't put duplicate lines or lines starting with space in the history. -HISTCONTROL=ignoreboth - -# infinite history -HISTSIZE=HISTFILESIZE= - -# append and reload the history after each command -PROMPT_COMMAND="history -a; history -n" +# ============================================================================= +# Environment Variables (from .profile) +# ============================================================================= +# Source .profile for env vars (needed for non-login interactive shells) +[ -f "$HOME/.profile" ] && . "$HOME/.profile" -# ignore the following commands from the history -HISTIGNORE="ls:ll:cd:pwd:bg:fg:history" +# ============================================================================= +# Shell Options +# ============================================================================= +shopt -s histappend # append to history file, don't overwrite +shopt -s checkwinsize # update LINES and COLUMNS after each command +shopt -s autocd # cd to directory by typing its name +shopt -s cdspell # correct minor spelling errors in cd +shopt -s dirspell # correct spelling errors during tab-completion -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +# ============================================================================= +# History +# ============================================================================= +HISTCONTROL=ignoreboth # ignore duplicates and lines starting with space HISTSIZE=100000 HISTFILESIZE=10000000 +HISTIGNORE="ls:ll:cd:pwd:bg:fg:history:exit" +PROMPT_COMMAND="history -a; history -n" # append and reload after each command -# append to the history file, don't overwrite it -shopt -s histappend +# ============================================================================= +# Prompt +# ============================================================================= +PS1='[\d, \t] \u@\H:\w \n$ ' -# cd to directory by typing its name -shopt -s autocd - -# check window size after each command + update LINES and COLUMNS values. -shopt -s checkwinsize - -# enable programmable completion features +# ============================================================================= +# Completions +# ============================================================================= if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi fi -if [ -f /etc/bash_completion ]; then - . /etc/bash_completion + +# ============================================================================= +# Source modular bash configs from .bashrc.d/ +# ============================================================================= +if [ -d "$HOME/.bashrc.d" ]; then + for file in "$HOME/.bashrc.d"/*.sh; do + [ -r "$file" ] && . "$file" + done + unset file fi -export PS1="[\d, \t] \u@\H:\w \n$ " +# ============================================================================= +# Tool-specific initialization +# ============================================================================= +# FZF +[ -f "$HOME/.fzf.bash" ] && . "$HOME/.fzf.bash" -source "$HOME"/.profile +# Deno +[ -f "$HOME/.deno/env" ] && . "$HOME/.deno/env" +[ -f "$HOME/.local/share/bash-completion/completions/deno.bash" ] && \ + . "$HOME/.local/share/bash-completion/completions/deno.bash" -[ -f "$HOME"/.fzf.bash ] && source "$HOME"/.fzf.bash -. "/home/cjennings/.deno/env" -source /home/cjennings/.local/share/bash-completion/completions/deno.bash
\ No newline at end of file +# Zoxide (smart cd) +command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init bash)" |
