Completion based on history.
# Settings for readline.
#
# Tips:
# * Re-read ~/.inputrc: C-x C-r
# * Dump PTY codes on a key release: showkey -a
# I like this!
set editing-mode emacs
# Don't strip characters to 7 bits when reading.
set input-meta on
# Allow iso-latin1 characters to be inserted rather than converted to
# prefix-meta sequences.
set convert-meta off
# Display characters with the eighth bit set directly rather than as
# meta-prefixed characters.
set output-meta on
# Terminal driver rebound some keys. See output 'stty -a'. I like original
# control codes (to set 'C-w', etc).
set bind-tty-special-chars off
# Ignore hidden files.
set match-hidden-files off
# Ignore case (on/off).
set completion-ignore-case on
set completion-query-items 100
# First tab suggests ambiguous variants.
set show-all-if-ambiguous on
# Replace common prefix with ...
set completion-prefix-display-length 1
# Do not duplicate completion if we in the middle of the word.
set skip-completed-text on
# If set to 'on', completed directory names have a slash appended. The default is 'on'.
set mark-directories on
set mark-symlinked-directories on
# If set to 'on', a character denoting a file's type is appended to the
# filename when listing possible completions. The default is 'off'.
set visible-stats on
$if Bash
set colored-stats on
$endif
# I like beep (audible/visible/none).
set bell-style audible
# 'quoted-insert' binded to C-q or C-v by default, but C-q usually not worked
# because it handled by terminal driver before readline.
C-v: quoted-insert
# Setting it to 'on' means that the text of the lines being edited will scroll
# horizontally on a single screen line when they are longer than the width of
# the screen, instead of wrapping onto a new screen line. By default, this
# variable is set to 'off'.
set horizontal-scroll-mode off
# This variable, when set to `on', causes Readline to display an asterisk
# ('*') at the start of history lines which have been modified. This variable
# is 'off' by default.
set mark-modified-lines off
$if Bash
# Invoke an editor on the current command line, and execute the result as
# shell commands. Bash attempts to invoke $FCEDIT, $EDITOR, and emacs as the
# editor, in that order.
"\C-x\C-e": edit-and-execute-command
# magic-space expand sequence referring to the command history in place, so you have a chance to review before executing.
Space: magic-space
$endif
# Define my favorite Emacs key bindings.
"\C-@": set-mark
"\e ": set-mark
"\C-w": kill-region
"\ew": copy-region-as-kill
# Below paragraph are default settings.
"\C-_": undo
"\C-]": character-search
"\e\C-]": character-search-backward
"\er": revert-line
# Ctrl+Left/Right to move by whole words. XTerm/Mintty.
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# Same with Shift pressed.
"\e[1;6C": forward-word
"\e[1;6D": backward-word
# Same but in Putty.
"\eOC": forward-word
"\eOD": backward-word
# Ctrl+Backspace/Delete to delete whole words. XTerm/Mintty.
"\e[3;5~": kill-word
# Alt+DEL delete word forward. Putty.
"\e\e[3~": kill-word
# Alt+DEL delete word forward. XTerm, Mintty.
"\e[3;3~": kill-word
# Alt+BACKSPACE delete word backward. Putty.
"\e\d": backward-kill-word
# UP/DOWN filter history by typed string as prefix.
"\e[A": history-search-backward
"\C-p": history-search-backward
"\eOA": history-search-backward
"\e[B": history-search-forward
"\C-n": history-search-forward
"\eOB": history-search-forward
"\e/" complete-filename
# Bind 'Shift+TAB' to complete as in Python TAB was need for another purpose.
"\e[Z": complete
# Cycling possible completion forward and backward in place.
"\e[1;3C": menu-complete # M-Right
"\e[1;3D": menu-complete-backward # M-Left
"\e[1;5I": menu-complete # C-TAB
# Completion based on history.
"\e\C-i": dynamic-complete-history
# Local Variables:
# mode: shell-script
# fill-column: 78
# End: