Increment numbers in visual mode with Emacs and the multi-column feature
by Danny Willems
It often happens you must use the multi column feature in Emacs/vim to modify multiple lines at the same time on the same column. You may also need to increase on each line a number. You want to duplicate the line
let x1 = u1 * v1;
to become
let x1 = u1 * v1;
let x2 = u2 * v2;
let x3 = u3 * v3;
let x4 = u4 * v4;
evil-number provides a function called evil-numbers/inc-at-pt-incremental
.
- Go on the line you want to duplicate.
- Yank the line:
yy
- Paste 3 times the line:
3p
- Use
CTRL-v
on the number1
on the second line to select multiple columns with the numbers afterx
. - Use
M-x evil-numbers/inc-at-pt-incremental
- Repeat for
u
andv