Add configuration for readline

This commit is contained in:
Alexander Hess 2026-08-20 21:43:32 +02:00
commit 988ce4975d
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
3 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# `readline`-related Configurations
This folder contains
the [`inputrc`](./inputrc)
for [`readline`](https://tiswww.case.edu/php/chet/readline/rltop.html),
found via `$INPUTRC` set in [`~/.config/shell/env`](../shell/env).

44
.config/readline/inputrc Normal file
View file

@ -0,0 +1,44 @@
# Enable `vi`-style line editing for all readline apps
set editing-mode vi
# Indicate the current mode via the cursor shape
set show-mode-in-prompt on
set vi-cmd-mode-string "\1\e[2 q\2" # steady block
set vi-ins-mode-string "\1\e[5 q\2" # blinking bar
set keyseq-timeout 100
# Completion
# Never require a second tab
set completion-query-items 200 # Ask before listing only above this count
set page-completions off # No internal pager on long lists
set show-all-if-ambiguous on # List matches instead of beeping
set show-all-if-unmodified on # List even if no common prefix can be added
# Case handling
set completion-ignore-case on
set completion-map-case on # Treat "-" and "_" as equivalent
# Readability and correctness
set colored-completion-prefix on # Highlight the common prefix
set colored-stats on # Colorize matches by file type
set mark-directories on # Append "/" to directories
set mark-symlinked-directories on # Append "/" to symlinked directories
set menu-complete-display-prefix on # Insert common prefix before cycling
set skip-completed-text on # Avoid duplicating text after the cursor
set visible-stats on # Append type indicators "/", "*", and "@"
# Tab cycles through candidates while Shift-Tab goes back
"\t": menu-complete
"\e[Z": menu-complete-backward
# Ctrl-L clears the screen in command mode only
# => Bind in insert mode as well
set keymap vi-insert
"\C-l": clear-screen
set keymap vi

View file

@ -61,6 +61,7 @@ unset _bat
# Move common tools' config and cache files into XDG directories
export BAT_CONFIG_PATH="$XDG_CONFIG_HOME/bat/config"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export LESSHISTFILE="$XDG_STATE_HOME/less/history"
export PSQLRC="$XDG_CONFIG_HOME/psql/psqlrc"
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"