Ben Grande a7d2876bb4
fix: standardize shell escape character to octal
URxvt requires octal for keysym while others do not and querying a
single one is easier.
2025-01-22 17:42:01 +01:00

163 lines
3.4 KiB
Plaintext

# inputrc
## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
##
## SPDX-License-Identifier: AGPL-3.0-or-later
$include /etc/inputrc
## Options
set bell-style none
set enable-bracketed-paste on
set show-all-if-ambiguous on
set colored-stats on
set visible-stats on
set mark-symlinked-directories on
set colored-completion-prefix on
set menu-complete-display-prefix on
set skip-completed-text
set editing-mode emacs
set show-mode-in-prompt on
$if term=linux
set emacs-mode-string "\1\033[?0c\2"
set vi-ins-mode-string "\1\033[?0c\2"
set vi-cmd-mode-string "\1\033[?8c\2"
$else
set emacs-mode-string "\1\033[5 q\2"
set vi-ins-mode-string "\1\033[5 q\2"
set vi-cmd-mode-string "\1\033[2 q\2"
$endif
$if term=''
set enable-bracketed-paste off
set show-mode-in-prompt off
set colored-stats off
set colored-completion-prefix off
$endif
$if term=dumb
set enable-bracketed-paste off
set show-mode-in-prompt off
set colored-stats off
set colored-completion-prefix off
$endif
$if term=vt100
set enable-bracketed-paste off
set show-mode-in-prompt off
set colored-stats off
set colored-completion-prefix off
$endif
$if term=vt220
set enable-bracketed-paste off
set show-mode-in-prompt off
set colored-stats off
set colored-completion-prefix off
$endif
## Mode
$if mode=emacs
set keymap emacs-ctlx
v: vi-editing-mode
Control-v: "\C-xv\033"
Esc: "\C-xv\033"
set keymap emacs
$else
set keymap vi-insert
Control-a: beginning-of-line
Control-b: backward-char
Control-d: delete-char
Control-e: end-of-line
Control-f: forward-char
Control-j: accept-line
Control-k: kill-line
Control-l: clear-screen
Control-m: accept-line
Control-n: next-history
Control-p: previous-history
Control-r: reverse-search-history
Control-s: forward-search-history
Control-t: transpose-chars
Control-u: unix-line-discard
Control-v: quoted-insert
Control-w: backward-kill-word
Control-y: yank
Control-[: vi-movement-mode
Control-_: undo
Control-?: backward-delete-char
Space: self-insert
set keymap vi-command
Control-d: vi-eof-maybe
Control-h: backward-char
Control-j: accept-line
Control-k: kill-line
Control-l: clear-screen
Control-m: accept-line
Control-n: next-history
Control-p: previous-history
Control-q: quoted-insert
Control-r: vi-redo
Control-t: transpose-chars
Control-u: unix-line-discard
Control-v: quoted-insert
Control-w: backward-kill-word
Control-y: yank
Control-u: vi-undo
Control-?: backward-delete-char
Space: forward-char
$endif
## Application
$if Bash
Control-w: backward-kill-word
$endif
## Home
"\033[1~": beginning-of-line
"\033[H": beginning-of-line
"\033OH": beginning-of-line
## End
"\033[4~": end-of-line
"\033[F": end-of-line
"\033OF": end-of-line
## Delete
"\033[3~": delete-char
"\033[P": delete-char
"\033OP": delete-char
## Insert
"\033[2~": quoted-insert
"\033[L": quoted-insert
## PgUp
"\033[5~": beginning-of-history
"\033[I": beginning-of-history
## PgDown
"\033[6~": end-of-history
"\033[G": end-of-history
## Ctrl+RighArrow
"\033[1;5C": forward-word
"\033[5C": forward-word
"\033\033[C": forward-word
## Ctrl+LeftArrow
"\033[1;5D": backward-word
"\033[5D": backward-word
"\033\033[D": backward-word
## Terminal
$if term=rxvt
"\033[7~": beginning-of-line
"\033[8~": end-of-line
"\033Oc": forward-word
"\033Od": backward-word
$endif