blob: f12e8804ab6c6d9e316231bb224b2f41320d0030 (
plain)
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
|
Readline Incdec
===============
Readline bindings to increment and decrement numbers on the command line.
## Demo
The commands increment or decrement the closest number to the left of point. If
point is to the left of the first number in the line, the first number is
modified.

## Bindings
Default bindings are provided, but they can also be customised by adding them
manually. By default:
| Binding | Action |
|---------|-----------|
| `C-x a` | Increment |
| `C-x x` | Decrement |
## Install
Mac OS X users can install with Homebrew:
$ brew install teddywing/formulae/readline-incdec
On other platforms, download the `incdec.bash` and, if desired,
`incdec-bindings.bash` files.
Then source the script in your Bash RC file:
source /path/to/incdec.bash
To enable the default bindings, also add:
source /path/to/incdec-bindings.bash
Custom bindings can be added in place of the defaults. For example, this defines
bindings for `C-x -` and `C-x +`:
bind -x '"\C-x-": __readline_incdec_decrement'
bind -x '"\C-x+": __readline_incdec_increment'
## License
Copyright © 2021 Teddy Wing. Licensed under the GNU GPLv3+ (see the included
COPYING file).
|