Use history search for UP/DOWN in Emacs term mode.
# Settings for readline.
#
# Tips:
# C-x C-r re-read ~/.inputrc
# 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
# 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
# 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
$endif
# Define my favorite Emacs key bindings.
"\C-@": set-mark
"\C-w": kill-region
"\M-w": copy-region-as-kill
# Ctrl+Left/Right to move by whole words.
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# Same with Shift pressed.
"\e[1;6C": forward-word
"\e[1;6D": backward-word
# Ctrl+Backspace/Delete to delete whole words.
"\e[3;5~": kill-word
"\C-_": 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
# Bind 'Shift+TAB' to complete as in Python TAB was need for another purpose.
"\e[Z": complete
$if Bash
# Use 'Control+TAB' for cycling possible completion in bash.
"\e[1;5I": menu-complete
$endif
# Local Variables:
# mode: shell-script
# fill-column: 78
# End: