/
.inputrc
179 lines (146 loc) · 4.92 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
# TURN ON VIM (E.G. FOR READLINE)
set editing-mode vi
# SHOW THE VIM MODE IN THE PROMPT (COMMAND OR INSERT)
set show-mode-in-prompt on
# SET THE MODE STRING AND CURSOR TO INDICATE THE VIM MODE
# FOR THE NUMBER AFTER `\e[`:
# 0: blinking block
# 1: blinking block (default)
# 2: steady block
# 3: blinking underline
# 4: steady underline
# 5: blinking bar (xterm)
# 6: steady bar (xterm)
# distinguish between command and insert mode
# Prepend I to indicate insert mode and have blinking bar
set vi-ins-mode-string "i"\1\e[5 q\2
# prepend C to indicate command mode and have a blinking block
set vi-cmd-mode-string "C"\1\e[1 q\2
set blink-matching-paren on
# sets the readline to display possible completions using different colors
# to indicate filetypes determined from env variable LC_COLORS
set colored-stats on
# Completions listed immediately instead of bell when completing word has more than one possible completion
set show-all-if-ambiguous on
set completion-ignore-case on
set menu-complete-display-prefix on
# Enables the display of only the first 5 unique characters from a group of file or directory name suggestions when you utilize tab-completion.
# If multiple entries share a long prefix, they will be condensed using ellipses, making it easier to locate and choose the desired item.
# Useful in directories containing many similarly named images or documents.
set completion-prefix-display-length 5
# Set the bell-style to be visible only i.e no audio played on command completion
# can also be set to none
set bell-style visible
$if mode=vi
#vi mode settings
set keymap vi-command
# go into insert mode, re run last command with !! and press enter
".": "i!!\r"
"|": "A | "
# delete rest of the line (vi "D" behavior)
"D": kill-line
# change line -> delete then go in insert mode
"C": "Da"
"dw": kill-word
"dd": kill-whole-line
"db": backward-kill-word
# delete and change line
"cc": "ddi"
# change word
"cw": "dwi"
# change backward word
"cb": "dbi"
# vi equivalent of delete all word i.e delete the current word entirely
"daw": "lbdW"
"yaw": "lbyW"
# change all word, delete and edit the current word
"caw": "lbcW"
# delete inner word (word under the cursor without the surrounding whitespaces)
"diw": "lbdw"
# yank inner word
"yiw": "lbyw"
# change inner word
"ciw": "lbcw"
# delete around double quoted string -> delete the text in double quoted strings and the quotes themselves
# F search backward for a double quote, then delete till first forward search of double quotes
"da\"": "lF\"df\""
# delete inside double quoted string -> delete the text inside the double quoted strings but not the quotes
"di\"": "lF\"lmtf\"d`t"
# change inside double quoted string basically delete inside double quoted string and go in insert mode
"ci\"": "di\"i"
# change around double quoted string
"ca\"": "da\"i"
# delete around single quoted string
"da'": "lF'df'"
"di'": "lF'lmtf'd`t"
"ci'": "di'i"
"ca'": "da'i"
# delete around tilde
"da`": "lF\`df\`"
"di`": "lF\`lmtf\`d`t"
"ci`": "di`i"
"ca`": "da`i"
# delete around 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 around 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 around 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 around 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 around forward slash
"da/": "lF/df/"
"di/": "lF/lmtf/d`t"
"ci/": "di/i"
"ca/": "da/i"
# delete around colon
"da:": "lF:df:"
"di:": "lF:lmtf:d`t"
"ci:": "di:i"
"ca:": "da:i"
# vim analogues of jumping to the start and end of a file
"gg": beginning-of-history
"G" : end-of-history
# backward history search on up arrow
"\e\e[A": history-search-backward
# forward history search on down arrow
"\e\e[B": history-search-forward
# settings to be changed in insert mode
set keymap vi-insert
";;": vi-movement-mode
# using ;; to easily move to command mode from insert mode instead of going to press Escape key each time
# ;; as I find it relatively easily on the home row and it doesnt interfere with typing in insert mode
# as commands to come by with ;; are rare?
TAB: menu-complete
# shift tab to menu complete backward
"\e[Z": menu-complete-backward
# end vi mode settings
$endif