blob: 765191c76b3362562a2781f827d25c6acaef8d30 (
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
51
52
53
54
55
56
57
58
|
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
Or with MacPorts, after [adding a custom repository source][teddywing ports
repository]:
$ sudo port install 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'
[teddywing ports repository]: https://github.com/teddywing/macports-ports#adding-this-repository-source
## License
Copyright © 2021–2022 Teddy Wing. Licensed under the GNU GPLv3+ (see the
included COPYING file).
|