dotfiles/files/inputrc

263 lines
12 KiB
Text

##############
# Options
##############
# List and descriptions from: https://www.man7.org/linux/man-pages/man3/readline.3.html
# Controls what happens when readline wants to ring the terminal bell. If set
# to none, readline never rings the bell. If set to visible, readline uses a
# visible bell if one is available. If set to audible, readline attempts to
# ring the terminal's bell.
# set bell-style (audible)
# If set to On (the default), readline attempts to bind the control characters
# treated specially by the kernel's terminal driver to their readline
# equivalents.
# set bind-tty-special-chars (On)
# If set to On, readline attempts to briefly move the cursor to an opening
# parenthesis when a closing parenthesis is inserted.
set blink-matching-paren on
# If set to On, when listing completions, readline displays the common prefix
# of the set of possible completions using a different color. The color
# definitions are taken from the value of the LS_COLORS environment variable.
set colored-completion-prefix on
# If set to On, readline displays possible completions using different colors
# to indicate their file type. The color definitions are taken from the value
# of the LS_COLORS environment variable.
set colored-stats on
# The string that is inserted in vi mode when the insert-comment command is
# executed. This command is bound to M-# in emacs mode and to # in vi command
# mode.
# set comment-begin (``#'')
# The number of screen columns used to display possible matches when performing
# completion. The value is ignored if it is less than 0 or greater than the
# terminal screen width. A value of 0 will cause matches to be displayed one
# per line. The default value is -1.
# set completion-display-width (-1)
# If set to On, readline performs filename matching and completion in a
# case-insensitive fashion.
set completion-ignore-case on
# If set to On, and completion-ignore-case is enabled, readline treats hyphens
# (-) and underscores (_) as equivalent when performing case-insensitive
# filename matching and completion.
# set completion-map-case (Off)
# The length in characters of the common prefix of a list of possible
# completions that is displayed without modification. When set to a value
# greater than zero, common prefixes longer than this value are replaced with
# an ellipsis when displaying possible completions.
# set completion-prefix-display-length(0)
# This determines when the user is queried about viewing the number of possible
# completions generated by the possible-completions command. It may be set to
# any integer value greater than or equal to zero. If the number of possible
# completions is greater than or equal to the value of this variable, the user
# is asked whether or not he wishes to view them; otherwise they are simply
# listed on the terminal. A negative value causes readline to never ask.
set completion-query-items 200
# If set to On, readline will convert characters with the eighth bit set to an
# ASCII key sequence by stripping the eighth bit and prefixing it with an
# escape character (in effect, using escape as the meta prefix). The default
# is On, but readline will set it to Off if the locale contains eight-bit
# characters.
set convert-meta off
# If set to On, readline will inhibit word completion. Completion characters
# will be inserted into the line as if they had been mapped to self-insert.
# set disable-completion (Off)
# When set to On, on operating systems that indicate they support it, readline
# echoes a character corresponding to a signal generated from the keyboard.
# set echo-control-characters (On)
# Controls whether readline begins with a set of key bindings similar to Emacs
# or vi. editing-mode can be set to either emacs or vi.
set editing-mode vi
# If the show-mode-in-prompt variable is enabled, this string is displayed
# immediately before the last line of the primary prompt when emacs editing
# mode is active. The value is expanded like a key binding, so the standard
# set of meta- and control prefixes and backslash escape sequences is
# available. Use the \1 and \2 escapes to begin and end sequences of non-
# printing characters, which can be used to embed a terminal control sequence
# into the mode string.
# set emacs-mode-string (@)
# When set to On, readline will configure the terminal in a way that will
# enable it to insert each paste into the editing buffer as a single string of
# characters, instead of treating each character as if it had been read from
# the keyboard. This can prevent pasted characters from being interpreted as
# editing commands.
# set enable-bracketed-paste (Off)
# When set to On, readline will try to enable the application keypad when it is
# called. Some systems need this to enable the arrow keys.
# set enable-keypad (Off)
# When set to On, readline will try to enable any meta modifier key the
# terminal claims to support when it is called. On many terminals, the meta
# key is used to send eight-bit characters.
# set enable-meta-key (On)
# If set to On, tilde expansion is performed when readline attempts word
# completion.
# set expand-tilde (Off)
# If set to On, the history code attempts to place point at the same location
# on each history line retrieved with previous- history or next-history.
# set history-preserve-point (Off)
# Set the maximum number of history entries saved in the history list. If set
# to zero, any existing history entries are deleted and no new entries are
# saved. If set to a value less than zero, the number of history entries is
# not limited. By default, the number of history entries is not limited. If
# an attempt is made to set history-size to a non-numeric value, the maximum
# number of history entries will be set to 500.
# set history-size (unset)
# When set to On, makes readline use a single line for display, scrolling the
# input horizontally on a single screen line when it becomes longer than the
# screen width rather than wrapping to a new line.
# set horizontal-scroll-mode (Off)
# If set to On, readline will enable eight-bit input (that is, it will not
# clear the eighth bit in the characters it reads), regardless of what the
# terminal claims it can support. The name meta-flag is a synonym for this
# variable. The default is Off, but readline will set it to On if the locale
# contains eight-bit characters.
set input-meta on
# The string of characters that should terminate an incremental search without
# subsequently executing the character as a command. If this variable has not
# been given a value, the characters ESC and C-J will terminate an incremental
# search.
# set isearch-terminators (``C-[ C-J'')
# Set the current readline keymap. The set of legal keymap names is emacs,
# emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and
# vi-insert. vi is equivalent to vi- command; emacs is equivalent to
# emacs-standard. The default value is emacs. The value of editing-mode also
# affects the default keymap.
# set keymap (emacs)
# Specifies the duration readline will wait for a character when reading an
# ambiguous key sequence (one that can form a complete key sequence using the
# input read so far, or can take additional input to complete a longer key
# sequence). If no input is received within the timeout, readline will use the
# shorter but complete key sequence. The value is specified in milliseconds,
# so a value of 1000 means that readline will wait one second for additional
# input. If this variable is set to a value less than or equal to zero, or to
# a non-numeric value, readline will wait until another key is pressed to
# decide which key sequence to complete.
set keyseq-timeout 100
# If set to On, completed directory names have a slash appended.
set mark-directories on
# If set to On, history lines that have been modified are displayed with a
# preceding asterisk (*).
# set mark-modified-lines (Off)
# If set to On, completed names which are symbolic links to directories have a
# slash appended (subject to the value of mark-directories).
set mark-symlinked-directories on
# This variable, when set to On, causes readline to match files whose names
# begin with a `.' (hidden files) when performing filename completion. If set
# to Off, the leading `.' must be supplied by the user in the filename to be
# completed.
set match-hidden-files on
# If set to On, menu completion displays the common prefix of the list of
# possible completions (which may be empty) before cycling through the list.
# set menu-complete-display-prefix (Off)
# If set to On, readline will display characters with the eighth bit set
# directly rather than as a meta-prefixed escape sequence. The default is Off,
# but readline will set it to On if the locale contains eight-bit characters.
set output-meta on
# If set to On, readline uses an internal more-like pager to display a
# screenful of possible completions at a time.
set page-completions on
# If set to On, readline will display completions with matches sorted
# horizontally in alphabetical order, rather than down the screen.
# set print-completions-horizontally (Off)
# If set to On, readline will undo all changes to history lines before
# returning when accept-line is executed. By default, history lines may be
# modified and retain individual undo lists across calls to readline.
# set revert-all-at-newline (Off)
# This alters the default behavior of the completion functions. If set to On,
# words which have more than one possible completion cause the matches to be
# listed immediately instead of ringing the bell.
set show-all-if-ambiguous on
# This alters the default behavior of the completion functions in a fashion
# similar to show-all-if-ambiguous. If set to On, words which have more than
# one possible completion without any possible partial completion (the possible
# completions don't share a common prefix) cause the matches to be listed
# immediately instead of ringing the bell.
# set show-all-if-unmodified (Off)
# If set to On, add a string to the beginning of the prompt indicating the
# editing mode: emacs, vi command, or vi insertion. The mode strings are
# user-settable (e.g., emacs-mode-string).
set show-mode-in-prompt on
# If set to On, this alters the default completion behavior when inserting a
# single match into the line. It's only active when performing completion in
# the middle of a word. If enabled, readline does not insert characters from
# the completion that match characters after point in the word being completed,
# so portions of the word following the cursor are not duplicated.
# set skip-completed-text (Off)
# If the show-mode-in-prompt variable is enabled, this string is displayed
# immediately before the last line of the primary prompt when vi editing mode
# is active and in command mode. The value is expanded like a key binding, so
# the standard set of meta- and control prefixes and backslash escape sequences
# is available. Use the \1 and \2 escapes to begin and end sequences of
# non-printing characters, which can be used to embed a terminal control
# sequence into the mode string.
set vi-cmd-mode-string "\1\e[1;31m\2: \1\e[0m\2"
# If the show-mode-in-prompt variable is enabled, this string is displayed
# immediately before the last line of the primary prompt when vi editing mode
# is active and in insertion mode. The value is expanded like a key binding, so
# the standard set of meta- and control prefixes and backslash escape sequences
# is available. Use the \1 and \2 escapes to begin and end sequences of
# non-printing characters, which can be used to embed a terminal control
# sequence into the mode string.
set vi-ins-mode-string "\1\e[0m\2"
# If set to On, a character denoting a file's type as reported by stat(2) is
# appended to the filename when listing possible completions.
# set visible-stats (Off)
####################
# Key Bindings
####################
# Exit normal/command mode by typing 'jk' or 'kj'
"jk":"\e"
"kj":"\e"
# Use typed text as the prefix for searching through commands
Control-j: history-search-forward
Control-k: history-search-backward
# Restore these behaviors from emacs mode
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line