In Neovim, C-a and C-x will increment/decrement a number under the cursor in Normal mode
Also works in Vim. Thought this was neat. Wanted to share. Thanks @spicyq. It turns out Emacs does have this feature built-in (via Org-mode) with the commands org-increase-number-at-point and...
Also works in Vim.
Thought this was neat. Wanted to share.
Thanks @spicyq. It turns out Emacs does have this feature built-in (via Org-mode) with the commands org-increase-number-at-point
and org-decrease-number-at-point
.
The commands:
- Work in any mode, not just
org-mode
- Support prefix arguments with
C-u
- Do not have a default keybind
I bound the commands to C-z <up>
and C-z <down>
, since I had previously unbound suspend-frame
from C-z
:
(keymap-global-unset "C-z" 'remove) ; suspend-frame
Keep in mind you can repeat your last executed command with C-x z
(and then just keep pressing z
to repeat the command however many times you want).
Of course, now that I've got this far, I'm realizing that typing out either C-u 10 C-z <up>
or C-z <up> C-x z
+ z
* 9 is probably a lot more keystrokes than just changing the number myself. (At least for a single number at a single point in the buffer.)
I don't think there is a built-in Emacs feature that does the same thing. You can find several custom Emacs Lisp solutions by searching online though.