Increment and decrement numbers in Emacs
Emacs Lisp
Switch branches/tags
Latest commit 6ea1c8c Oct 17, 2014 @cofi Use list for contributers.
Failed to load latest commit information.
.gitignore Initial commit. Sep 2, 2011
COPYING Fix license. Sep 2, 2011 Use list for contributers. Oct 17, 2014
evil-numbers.el Bump to 0.4 Jun 6, 2014

Evil Numbers

  • Increment / Decrement binary, octal, decimal and hex literals
  • works like C-a/C-x in vim, i.e. searches for number up to eol and then increments or decrements and keep zero padding up (unlike in vim)
  • When a region is active, as in evil’s visual mode, all the numbers within that region will be incremented/decremented (unlike in vim)

Detected Literals

  • binary, e.g. 0b0101, 0B0101
  • octal, e.g. 0o755, 0O700
  • hexadecimal, e.g. 0xDEADBEEF, 0XCAFE


Put in load-path, (require 'evil-numbers) and bind, for example:

(global-set-key (kbd "C-c +") 'evil-numbers/inc-at-pt)
(global-set-key (kbd "C-c -") 'evil-numbers/dec-at-pt)

or only in evil’s normal state:

(define-key evil-normal-state-map (kbd "C-c +") 'evil-numbers/inc-at-pt)
(define-key evil-normal-state-map (kbd "C-c -") 'evil-numbers/dec-at-pt)

For window system users the keypad + and - present an alternative that can be directly bound without shadowing the regular + and -:

(define-key evil-normal-state-map (kbd "<kp-add>") 'evil-numbers/inc-at-pt)
(define-key evil-normal-state-map (kbd "<kp-subtract>") 'evil-numbers/dec-at-pt)


Position cursor on literal and play with your numbers!

Known Bugs



  • Matthew Fidler <>
  • Michael Markert <>