# bashrc # # Sourced by `~/.bashrc` (which is executed by non-login interactive shells) [[ $- != *i* ]] && return # if not running interactively, stop function source_if_readable() { local f="${1:?file argument missing}" # shellcheck disable=1090 if [[ -r $f ]]; then source "$f"; fi } # The terminal consumes certain characters before the shell see them. This # disables them so Readline can bind them. # # `stty` settings live on the terminal device, not in the shell process. # # -ixon Ctrl+S and Ctrl+Q (output flow control) # werase undef Ctrl+W (erase word) stty -ixon werase undef # ** expands to all files and directories recursively # **/ expands to all directories recursively shopt -s globstar shopt -s extglob # extended pattern matching (like `?(a|b|c)`) alias r="fc -s" # See alias wl-copy="wl-copy --trim-newline" alias trash='gio trash' alias l='ls -l --human-readable' alias mv='mv --interactive' # Prompt before overwriting alias cp='cp --interactive' # Prompt before overwriting export INPUTRC="$HOME/.config/bash/inputrc" # Readline configuration export VISUAL=nvim EDITOR=nvim # used by various programs like `git`, `fc`, `man`, … export MANPAGER="nvim +Man!" MANWIDTH=120 # `nvim` as pager for `man` # Colors and prompt # The terminal emulator sets $TERM if [[ $TERM == +(xterm-256color|tmux-256color|foot) ]]; then eval "$(dircolors --bourne-shell)" # Set LS_COLORS which is used by other programs alias ls='ls --color=auto' alias grep='grep --color=auto' alias yay='yay --color auto' alias pacman='pacman --color auto' alias bat='bat --color=always' export LESS="--RAW-CONTROL-CHARS" # `less` display colors instead of the raw escape sequences source_if_readable "$HOME/.config/bash/prompt" fi # History shopt -s histappend # append to instead of overwriting HISTFILE export HISTSIZE=1000 # number of commands to save in history export HISTTIMEFORMAT='%F %T ' # history entry timesptamp format, also enables multi-line entries export HISTFILESIZE=-1 # don't truncate history export HISTCONTROL="ignoreboth" # don't save duplicate lines or lines starting with a space # Completion source_if_readable /usr/share/bash-completion/bash_completion # see https://github.com/scop/bash-completion/#bash-completion source_if_readable "$HOME/.config/fzf/fzf.bash" # fzf configuration source_if_readable "$HOME/.config/bash/localrc" # local configuration # vim: ft=bash