juliapath / evil-numbers

Increment and decrement numbers in Emacs
GNU General Public License v3.0
39 stars 6 forks source link

+TITLE: Evil Numbers

** Detected Literals

** Customization

** Key Bindings Example key bindings:

+BEGIN_SRC emacs-lisp

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

+END_SRC

or only in evil's =normal= & =visual= states:

+BEGIN_SRC emacs-lisp

 (evil-define-key '(normal visual) 'global (kbd "C-c +") 'evil-numbers/inc-at-pt)
 (evil-define-key '(normal visual) 'global (kbd "C-c -") 'evil-numbers/dec-at-pt)
 (evil-define-key '(normal visual) 'global (kbd "C-c C-+") 'evil-numbers/inc-at-pt-incremental)
 (evil-define-key '(normal visual) 'global (kbd "C-c C--") 'evil-numbers/dec-at-pt-incremental)

+END_SRC

Keypad =+= and =-= present an alternative that can be directly bound without shadowing the regular =+= and =-=:

+BEGIN_SRC emacs-lisp

 (evil-define-key '(normal visual) 'global (kbd "<kp-add>") 'evil-numbers/inc-at-pt)
 (evil-define-key '(normal visual) 'global (kbd "<kp-subtract>") 'evil-numbers/dec-at-pt)
 (evil-define-key '(normal visual) 'global (kbd "C-<kp-add>") 'evil-numbers/inc-at-pt-incremental)
 (evil-define-key '(normal visual) 'global (kbd "C-<kp-subtract>") 'evil-numbers/dec-at-pt-incremental)

+END_SRC

** Basic Installation Put in =load-path=, =(require 'evil-numbers)= and set key bindings.

** Use Package Assuming you have the =melpa= repository enabled, =use-package= can be used as follows.

+BEGIN_SRC emacs-lisp

 (use-package evil-numbers)

+END_SRC