-
Notifications
You must be signed in to change notification settings - Fork 1
/
.inputrc
145 lines (117 loc) · 4.45 KB
/
.inputrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright (C) 2014-2024 Serghei Iakovlev <gnu@serghei.pl>
#
# This file is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <https://www.gnu.org/licenses/>.
# This file controls the behaviour of line input editing for programs
# that use the GNU Readline library. Existing programs include FTP,
# Bash, and GDB.
#
# You can re-read the inputrc file with C-x C-r. Lines beginning with
# '#' are comments.
#
# For the reference see terminfo(5). Alo see:
# - showkey -a
# - xmodmap
# - infocmp -cL
# First, include any system-wide bindings and variable assignments
# from /etc/inputrc (fails silently if file doesn't exist)
$include /etc/inputrc
set editing-mode emacs
# Two escapes clear command line.
"\e\e": "\C-a\C-k"
# These bindings manually map the ANSI escape sequences for arrow
# keys. Some terminal emulators, older systems, or misconfigured
# $TERM values can cause Bash to misinterpret or ignore arrow key
# input. By explicitly binding these sequences, you ensure reliable
# cursor movement and history navigation in edge cases where default
# handling breaks down. This can be particularly useful in SSH
# sessions, weird terminal setups, or when dealing with stripped-down
# systems where the termcap/terminfo database is incomplete or buggy.
"\M-[D": backward-char # Left arrow
"\M-[C": forward-char # Right arrow
"\M-[A": previous-history # Up arrow
"\M-[B": next-history # Down arrow
# History search. Start writing coomand and then press arrow up.
"\e[A": history-search-backward
"\e[B": history-search-forward
# File rename helper.
#
# Example:
# $ mv a-long-file-name.txt <M-m>
#
# gives:
# $ mv a-long-file-name.txt a-long-file-name.txt
"\em": "\C-w\C-y\C-y"
# Save the region as if killed, but don’t kill it.
#
# Example:
# $ abc<C-Spc><C-a><M-w> def <C-y>
#
# gives:
# $ abc def abc
"\ew": copy-region-as-kill
# Macros that are convenient for shell interaction
$if Bash
# From the readline documentation (info "rluserman") Macros that are
# convenient for shell interaction edit the path
"\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
# prepare to type a quoted word -- insert open and close double
# quotes and move to just after the open quote
"\C-x\"": "\"\"\C-b"
# insert a backslash (testing backslash escapes
# in sequences and macros)
"\C-x\\": "\\"
# Quote the current or previous word
"\C-xq": "\eb\"\ef\""
# Add a binding to refresh the line, which is unbound
"\C-xr": redraw-current-line
# Edit variable on current line.
"\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
$endif
# Completed dir names have a slash appended
set mark-directories on
# Completed names which are symlinks to dirs have a slash appended
set mark-symlinked-directories on
# Show extra information when completing (like `ls -F`)
set visible-stats on
set colored-completion-prefix on
# Displays possible completions using different colors to indicate
# their file type
set colored-stats on
# Don't strip characters to 7 bits when reading
set input-meta on
# Cycle through ambiguous completions instead of list
"\C-i": menu-complete
# Assigning \C-j to any functions causes a slow startup for mc. See:
# https://midnight-commander.org/ticket/3580#comment:9
# "\C-j": menu-complete-backward
# Do not use bell at all
set bell-style none
# List possible completions instead of ringing bell
set show-all-if-ambiguous on
# Be more intelligent when autocompleting by also looking at the text
# after the cursor. For example, when the current line is "cd
# ~/src/mozil", and the cursor is on the "z", pressing Tab will not
# autocomplete it to "cd ~/src/mozillail", but to "cd
# ~/src/mozilla". (This is supported by the Readline used by Bash 4.)
set skip-completed-text on
# Show all completions at once
set page-completions off
# if there are more than 150 possible completions for a word, ask the
# user if he wants to see all of them
set completion-query-items 150
# Local Variables:
# mode: sh
# indent-tabs-mode: nil
# tab-width: 2
# End: