Skip to content

Instantly share code, notes, and snippets.

@robin-a-meade
Created October 15, 2025 18:42
Show Gist options
  • Save robin-a-meade/bef67e898b37909dca81630f2129f419 to your computer and use it in GitHub Desktop.
Save robin-a-meade/bef67e898b37909dca81630f2129f419 to your computer and use it in GitHub Desktop.
Minimal bashrc with TAB:menu-complete and prefix history search using UP and DOWN arrow keys
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
# Return immediately if not an interactive shell
if [[ $- != *i* ]]; then return; fi
# Support multi-line history entries well
# https://stackoverflow.com/a/17194155
# https://unix.stackexchange.com/a/109035
shopt -s lithist
shopt -s cmdhist
# Configure TAB key to cycle through completion candidates
# https://lists.gnu.org/archive/html/help-bash/2014-06/msg00002.html
bind 'TAB:menu-complete'
# Enable prefix history search using UP and DOWN arrow keys
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Disable XON/XOFF flow control to free up Ctrl-S for forward-history-search
stty -ixon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment