cofi / evil-numbers

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

Suggestion for doc: combine evil-numbers and speeddating #14

Open schoettl opened 4 years ago

schoettl commented 4 years ago

Cool thing! Coming from vim, I'm used to having the functionality of evil-numbers and speeddating combined in one key mapping.

I achieved it like this:

(defun my-increment-at-pt nil
  "Increment number or date (speeddating) at point"
  (interactive)
  (condition-case nil
    (speeddating-increase 1)
    (error (evil-numbers/inc-at-pt 1))))
(defun my-decrease-at-pt nil
  "Decrease number or date (speeddating) at point"
  (interactive)
  (condition-case nil
    (speeddating-decrease 1)
    (error (evil-numbers/dec-at-pt 1))))
(evil-define-key 'normal 'global "C-c +" 'my-increment-at-pt)
(evil-define-key 'normal 'global "C-c -" 'my-decrease-at-pt)

Maybe you want to add the snippet to the README (or even integrate this combination in the source, if that dependency on speeddating makes sense?).