Skip to content

Commit

Permalink
Add "zg" and "zG" bindings
Browse files Browse the repository at this point in the history
Implements evil-ispell-mark-word-as-good and evil-ispell-mark-word-as-locally-good
  • Loading branch information
condy0919 committed Jul 9, 2021
1 parent b237462 commit 3f4fcd7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,27 @@ and jump to the corresponding one."
(when ov
(goto-char (overlay-start ov))))))))

(defun evil-ispell-mark-word-as-good (word)
"Add WORD under the cursor as a good word to the Ispell dictionary."
(interactive (list (thing-at-point 'word)))
(ispell-send-string (concat "*" word "\n"))
;; dictionary modified!
(setq ispell-pdict-modified-p '(t))
(ispell-pdict-save ispell-silently-savep)
(when-let ((flyspell-mode)
(start (car (bounds-of-thing-at-point 'word))))
(flyspell-unhighlight-at start))
(message "Word '%s' added to dictionary" (upcase word)))

(defun evil-ispell-mark-word-as-locally-good (word)
"Add WORD under the cursor to the local word list."
(interactive (list (thing-at-point 'word)))
(ispell-add-per-file-word-list word)
(when-let ((flyspell-mode)
(start (car (bounds-of-thing-at-point 'word))))
(flyspell-unhighlight-at start))
(message "Word '%s' added to local word list" (upcase word)))

(evil-define-motion evil-next-flyspell-error (count)
"Go to the COUNT'th spelling mistake after point."
(interactive "p")
Expand Down
2 changes: 2 additions & 0 deletions evil-maps.el
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
(define-key evil-normal-state-map "za" 'evil-toggle-fold)
(define-key evil-normal-state-map "zr" 'evil-open-folds)
(define-key evil-normal-state-map "zm" 'evil-close-folds)
(define-key evil-normal-state-map "zg" 'evil-ispell-mark-word-as-good)
(define-key evil-normal-state-map "zG" 'evil-ispell-mark-word-as-locally-good)
(define-key evil-normal-state-map "z=" 'ispell-word)
(define-key evil-normal-state-map "\C-n" 'evil-paste-pop-next)
(define-key evil-normal-state-map "\C-p" 'evil-paste-pop)
Expand Down

0 comments on commit 3f4fcd7

Please sign in to comment.