xref: /netbsd-src/external/gpl3/gdb/dist/readline/readline/examples/Inputrc (revision 8dffb485a119f39f727115fa0bcb569045caf7cb)
1*8dffb485Schristos# My ~/.inputrc file is in -*- text -*- for easy editing with Emacs.
2*8dffb485Schristos#
3*8dffb485Schristos# Notice the various bindings which are conditionalized depending
4*8dffb485Schristos# on which program is running, or what terminal is active.
5*8dffb485Schristos#
6*8dffb485Schristos
7*8dffb485Schristos#   Copyright (C) 1989-2009 Free Software Foundation, Inc.
8*8dffb485Schristos#
9*8dffb485Schristos#   This program is free software: you can redistribute it and/or modify
10*8dffb485Schristos#   it under the terms of the GNU General Public License as published by
11*8dffb485Schristos#   the Free Software Foundation, either version 3 of the License, or
12*8dffb485Schristos#   (at your option) any later version.
13*8dffb485Schristos#
14*8dffb485Schristos#   This program is distributed in the hope that it will be useful,
15*8dffb485Schristos#   but WITHOUT ANY WARRANTY; without even the implied warranty of
16*8dffb485Schristos#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*8dffb485Schristos#   GNU General Public License for more details.
18*8dffb485Schristos#
19*8dffb485Schristos#   You should have received a copy of the GNU General Public License
20*8dffb485Schristos#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
21*8dffb485Schristos#
22*8dffb485Schristos
23*8dffb485Schristos# In all programs, all terminals, make sure this is bound.
24*8dffb485Schristos"\C-x\C-r": re-read-init-file
25*8dffb485Schristos
26*8dffb485Schristos# Hp terminals (and some others) have ugly default behaviour for C-h.
27*8dffb485Schristos"\C-h": backward-delete-char
28*8dffb485Schristos"\e\C-h": backward-kill-word
29*8dffb485Schristos"\C-xd": dump-functions
30*8dffb485Schristos
31*8dffb485Schristos# In xterm windows, make the arrow keys do the right thing.
32*8dffb485Schristos$if TERM=xterm
33*8dffb485Schristos"\e[A": previous-history
34*8dffb485Schristos"\e[B": next-history
35*8dffb485Schristos"\e[C": forward-char
36*8dffb485Schristos"\e[D": backward-char
37*8dffb485Schristos
38*8dffb485Schristos# alternate arrow key prefix
39*8dffb485Schristos"\eOA": previous-history
40*8dffb485Schristos"\eOB": next-history
41*8dffb485Schristos"\eOC": forward-char
42*8dffb485Schristos"\eOD": backward-char
43*8dffb485Schristos
44*8dffb485Schristos# Under Xterm in Bash, we bind local Function keys to do something useful.
45*8dffb485Schristos$if Bash
46*8dffb485Schristos"\e[11~": "Function Key 1"
47*8dffb485Schristos"\e[12~": "Function Key 2"
48*8dffb485Schristos"\e[13~": "Function Key 3"
49*8dffb485Schristos"\e[14~": "Function Key 4"
50*8dffb485Schristos"\e[15~": "Function Key 5"
51*8dffb485Schristos
52*8dffb485Schristos# I know the following escape sequence numbers are 1 greater than
53*8dffb485Schristos# the function key.  Don't ask me why, I didn't design the xterm terminal.
54*8dffb485Schristos"\e[17~": "Function Key 6"
55*8dffb485Schristos"\e[18~": "Function Key 7"
56*8dffb485Schristos"\e[19~": "Function Key 8"
57*8dffb485Schristos"\e[20~": "Function Key 9"
58*8dffb485Schristos"\e[21~": "Function Key 10"
59*8dffb485Schristos$endif
60*8dffb485Schristos$endif
61*8dffb485Schristos
62*8dffb485Schristos# For Bash, all terminals, add some Bash specific hacks.
63*8dffb485Schristos$if Bash
64*8dffb485Schristos"\C-xv": show-bash-version
65*8dffb485Schristos"\C-x\C-e": shell-expand-line
66*8dffb485Schristos
67*8dffb485Schristos# Here is one for editing my path.
68*8dffb485Schristos"\C-xp": "$PATH\C-x\C-e\C-e\"\C-aPATH=\":\C-b"
69*8dffb485Schristos
70*8dffb485Schristos# Make C-x r read my mail in emacs.
71*8dffb485Schristos# "\C-xr": "emacs -f rmail\C-j"
72*8dffb485Schristos$endif
73*8dffb485Schristos
74*8dffb485Schristos# For FTP, different hacks:
75*8dffb485Schristos$if Ftp
76*8dffb485Schristos"\C-xg": "get \M-?"
77*8dffb485Schristos"\C-xt": "put \M-?"
78*8dffb485Schristos"\M-.": yank-last-arg
79*8dffb485Schristos$endif
80*8dffb485Schristos
81*8dffb485Schristos" ": self-insert
82