forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.inputrc
195 lines (163 loc) · 5.28 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Make Tab autocomplete regardless of filename case
set completion-ignore-case on
# List all matches in case multiple possible completions are possible
set show-all-if-ambiguous on
# Immediately add a trailing slash when autocompleting symlinks to directories
set mark-symlinked-directories on
# Use the text that has already been typed as the prefix for searching through
# commands (i.e. more intelligent Up/Down behavior)
"\e[B": history-search-forward
"\e[A": history-search-backward
# Do not autocomplete hidden files unless the pattern explicitly begins with a dot
set match-hidden-files off
# Show all autocomplete results at once
set page-completions off
# If there are more than 200 possible completions for a word, ask to show them all
set completion-query-items 200
# Show extra file information when completing, like `ls -F` does
set visible-stats 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
# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456'
set input-meta on
set output-meta on
set convert-meta off
# Use Alt/Meta + Delete to delete the preceding word
"\e[3;3~": kill-word
# Poor man's zsh-style menu completion when combined with show-all-if-ambiguous
# https://unix.stackexchange.com/a/447638/191530
# Cycle through completions with TAB and shift-TAB
"\t": menu-complete
"\e[Z": menu-complete-backward
# Show the common prefix (and ring the bell) on first tab; then cycle
set menu-complete-display-prefix on
# Turn on vi mode; see:
# - Readline Cheat Sheet: https://readline.kablamo.org/vi.html
# - Vi experience in the shell: https://deut-erium.github.io/2024/01/28/inputrc.html
set editing-mode vi
# Show the vi mode in the prompt (command or insert)
set show-mode-in-prompt on
# Set the cursor to indicate the vi mode:
# - For the number after `\e[`:
# 0: Terminal default
# 1: Blinking block
# 2: Steady block
# 3: Blinking underline
# 4: Steady underline
# 5: Blinking bar (xterm)
# 6: Steady bar (xterm)
# Blinking bar for insert mode.
set vi-ins-mode-string "\1\e[5 q\2"
# Solid block for command mode.
set vi-cmd-mode-string "\1\e[2 q\2"
# Set keys for vi command mode.
set keymap vi-command
# I can't live without these emacs-style defaults.
"\C-a": beginning-of-line
"\C-e": end-of-line
"\C-x\C-r": re-read-init-file
# Or Mac-style option left/right.
"\eb": backward-word
"\ef": forward-word
# And backspace.
Rubout: backward-char
# Delete/change/yank with 'aw' and 'iw' motions.
"daw": "lbdW"
"yaw": "lbyW"
"caw": "lbcW"
"diw": "lbdw"
"yiw": "lbyw"
"ciw": "lbcw"
# Delete/change between pairs of characters. Note that these commands work
# with the cursor on the opening delimiter, but not the closing one.
# See http://www.usenix.org.uk/content/bash.html#input
# Delete around double quoted string:
# - Search backward for a double quote, then delete to the next double quote.
"da\"": "lF\"df\""
# Delete inside double quoted string:
# - Mark the character after the first quote, find the character before the
# last quote and delete back to the mark.
"di\"": "lF\"lmtf\"d`t"
# Change inside/around double quoted string:
# - Delete inside/around double quoted string and go into insert mode.
"ci\"": "di\"i"
"ca\"": "da\"i"
# Delete/change around/inside single quoted string
"da'": "lF'df'"
"di'": "lF'lmtf'd`t"
"ci'": "di'i"
"ca'": "da'i"
# Delete/change around/inside tilde
"da`": "lF\`df\`"
"di`": "lF\`lmtf\`d`t"
"ci`": "di`i"
"ca`": "da`i"
# Delete/change around/inside parenthesis
"da(": "lF(df)"
"di(": "lF(lmtf)d`t"
"ci(": "di(i"
"ca(": "da(i"
"da)": "lF(df)"
"di)": "lF(lmtf)d`t"
"ci)": "di(i"
"ca)": "da(i"
# Delete/change around/inside curly
"da{": "lF{df}"
"di{": "lF{lmtf}d`t"
"ci{": "di{i"
"ca{": "da{i"
"da}": "lF{df}"
"di}": "lF{lmtf}d`t"
"ci}": "di}i"
"ca}": "da}i"
# Delete/change around/inside square brackets
"da[": "lF[df]"
"di[": "lF[lmtf]d`t"
"ci[": "di[i"
"ca[": "da[i"
"da]": "lF[df]"
"di]": "lF[lmtf]d`t"
"ci]": "di]i"
"ca]": "da]i"
# Delete/change around/inside angled brackets
"da<": "lF<df>"
"di<": "lF<lmtf>d`t"
"ci<": "di<i"
"ca<": "da<i"
"da>": "lF<df>"
"di>": "lF<lmtf>d`t"
"ci>": "di>i"
"ca>": "da>i"
# Delete/change around/inside forward slash
"da/": "lF/df/"
"di/": "lF/lmtf/d`t"
"ci/": "di/i"
"ca/": "da/i"
# Delete/change around/inside colon
"da:": "lF:df:"
"di:": "lF:lmtf:d`t"
"ci:": "di:i"
"ca:": "da:i"
# Vi-inspired history navigation.
"gg": beginning-of-history
"G": end-of-history
"?": reverse-search-history
"/": forward-search-history
# Set keys for vi insert mode.
set keymap vi-insert
# I can't live without these emacs-style defaults.
"\C-a": beginning-of-line
"\C-e": end-of-line
"\C-k": kill-line
# Or Mac-style option left/right.
"\eb": backward-word
"\ef": forward-word
# Re-set some bindings for this keymap.
"\e[A": history-search-backward
"\e[B": history-search-forward
"\t": menu-complete
"\e[Z": menu-complete-backward