-
Notifications
You must be signed in to change notification settings - Fork 7
/
.inputrc
96 lines (75 loc) · 3.06 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
# inputrc configures line editing functionality provided by the readline
# library, used by many interactive programs such as the bash shell. See:
# info '(bash)Readline Init File Syntax'
# https://www.gnu.org/software/bash/manual/html_node/Readline-Init-File-Syntax.html
#
# BSDs and macOS use editline, with a readline compatibility layer at least in
# the case of macOS. See `man editrc` and `man editline`.
# Filetype colors in completion lists
set colored-stats on
# Case-insensitive filesystems be damned
set completion-ignore-case on
# Hyphen can be used to complete underscores
set completion-map-case on
# With multiple matches, only show the remaining part.
# Unsupported in editline >:-(
set completion-prefix-display-length 2
# Try to avoid accidental multi-line pastes being interpreted as commands
set enable-bracketed-paste on
# Completion when in middle of word doesn't duplicate existing input.
# Like many useful GNU things, seems unsupported in editline.
set skip-completed-text On
# Automatically complete directory symlinks with ending /
# Also offers them for `complete -d` like cd & pushd
set mark-symlinked-directories on
# Don't mutate history entries, leaving things you never executed
set revert-all-at-newline on
# Show completions immediately if multiple matches
set show-all-if-ambiguous on
set show-all-if-unmodified on
# -- Key Bindings -------------------------------------------------------------
# Symbolic keynames like Esc-j appear unsupported by editline.
"\C-x\C-r": re-read-init-file
# Cycle through available completions
"\ej": menu-complete
# "\ek": menu-complete-backward
# For OS X / bash < 4 :-/
"\ek": "\e-1\ej"
# Default Ctrl-w to stop at punctuation
"\C-w": unix-filename-rubout
"\C-x\C-w": unix-word-rubout
# Ctrl-p/n will use history search for what's typed so far.
# Up/Down still cycle dumbly. (previous-history / next-history)
"\C-p": history-search-backward
"\C-n": history-search-forward
# Need to kill -9 a thing that didn't die? Grep directory when you forgot -r?
# Hat tip: http://www.ukuug.org/events/linux2003/papers/bash_tips/
"\eo": "\C-p\C-a\ef "
# Using Esc-i as a prefix that's more comfortable to me than the commonly used
# Ctrl-x (on qwerty with left Option as Esc in iTerm). Other Ctrl combinations
# have useful or unusable bindings. (mnemonic: "input")
# Pairs; C-v (quoted-insert) avoids recursion when auto-pairs are in effect
"\ei\"": "\C-v\"\C-v\"\C-b"
"\ei\'": "\C-v\'\C-v\'\C-b"
"\ei(": "\C-v()\C-b"
"\ei9": "\ei("
# Quote current or previous word
"\eiq": "\eb\C-v\"\ef\C-v\""
$if Bash
# Alias for C-xC-e that matches fish
"\ee": edit-and-execute-command
# Append pager, fish-inspired
"\ep": "\C-e | less"
# Auto-pairs -- let's try if this is more convenient than annoying...
"\"": "\C-v\"\C-v\"\C-b"
"\'": "\C-v\'\C-v\'\C-b"
"(": "\C-v()\C-b"
# Surround current line with $()
"\ei$": "\C-a$\C-v(\C-e)"
$endif
# Call method in IRB. See .irbrc
$if Ruby
"\C-x\C-p": "toggle_object_complete\n"
"\C-x\C-h": "Hirb::View.toggle_formatter\n"
"\C-x\C-l": "toggle_db_logging\n"
$endif