diff --git a/.config/readline/README.md b/.config/readline/README.md new file mode 100644 index 0000000..5dba45c --- /dev/null +++ b/.config/readline/README.md @@ -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). diff --git a/.config/readline/inputrc b/.config/readline/inputrc new file mode 100644 index 0000000..1491a7c --- /dev/null +++ b/.config/readline/inputrc @@ -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 diff --git a/.config/shell/env b/.config/shell/env index d6a75fd..0e30405 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -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"