flyspell-correct | ||
flyspell-correct-ivy | ||
flyspell-correct-helm | ||
flyspell-correct-popup |
Correcting words with flyspell via custom interface.
This package provides functionality for correcting words via custom interfaces. There are several functions for this:
flyspell-correct-wrapper- a beefed wrapper forflyspell-correct-previousandflyspell-correct-nextallowing one to correct many words at once (rapid mode) and change correction direction.flyspell-correct-at-point- to correct word at point.flyspell-correct-previousto correct any visible word before the point.flyspell-correct-nextto correct any visible word after the point.
In most cases the last function is the most convenient, so don’t forget to bind it.
(define-key flyspell-mode-map (kbd "C-;") #'flyspell-correct-wrapper)When invoked, it will show the list of corrections suggested by Flyspell.
Most interfaces also allow you to save the new word to your dictionary, accept this spelling in current buffer or for a whole session, or even skip this word (useful in a rapid flow).
Default interface is implemented using completing-read, but it’s highly
advised to use flyspell-correct-ido (which comes bundled with this package) or
any other interface provided by the following packages: flyspell-correct-ivy,
flyspell-correct-helm and flyspell-correct-popup.
Rapid mode means that you can correct many words in a single invocation of
flyspell-correct-wrapper following current direction (usually, backwards). In
order to enable it, one should call flyspell-correct-wrapper with universal
argument - C-u. For example, C-u C-; will do it.
Unfortunately, following functions are renamed and their original name is being deprecated and will be removed in the future (summer 2019).
flyspell-correct-next-word-generic->flyspell-correct-nextflyspell-correct-previous-word-generic->flyspell-correct-previousflyspell-correct-word-generic->flyspell-correct-at-point
Please make sure to update to new names.
In order to use flyspell-correct-dummy interface you have to install
flyspell-correct package in any preferred way and then add following snippet
to relevant part of your init.el file.
(require 'flyspell-correct)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)This interface does not allow to save or accept current spelling.
Or via use-package.
(use-package flyspell-correct
:bind ("C-M-;" . flyspell-correct-wrapper))In order to use flyspell-correct-ivy interface you have to install
flyspell-correct-ivy package in any preferred way and then add following snippet
to relevant part of your init.el file.
(require 'flyspell-correct-ivy)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)Or via use-package.
(use-package flyspell-correct-ivy
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-ivy))Note that in order to access actions in ivy interface you need to press M-o.
More on ivy mini buffer key bindings you can read in official documentation.
In order to use flyspell-correct-avy-menu interface you have to install
flyspell-correct-avy-menu package in any preferred way and then add following
snippet to relevant part of your init.el file.
(require 'flyspell-correct-avy-menu)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)Or via use-package.
(use-package flyspell-correct-avy-menu
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-avy-menu))In order to use flyspell-correct-ido interface you have to install
flyspell-correct package in any preferred way and then add following snippet
to relevant part of your init.el file.
(require 'flyspell-correct-ido)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)Or via use-package.
(use-package flyspell-correct-ido
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-ido))In order to use flyspell-correct-helm interface you have to install
flyspell-correct-helm package in any preferred way and then add following snippet
to relevant part of your init.el file.
(require 'flyspell-correct-helm)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)Or via use-package.
(use-package flyspell-correct-helm
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-helm))In order to use flyspell-correct-popup interface you have to install
flyspell-correct-popup package in any preferred way and then add following snippet
to relevant part of your init.el file.
(require 'flyspell-correct-popup)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)Or via use-package.
(use-package flyspell-correct-popup
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-popup))There are some cool usability suggestions by @alphapapa shared in d12frosted/flyspell-correct#30 that you might want to use. Enjoy!
One can easily implement custom interface for flyspell-correct-at-point (which
is used by other correct functions). It has to be a function that takes two
arguments - candidates and incorrect word. It has to return either replacement
word or (command, word) tuple, where command can be one of the following:
skip- meaning that no action is required for current incorrectword;save- meaning that thewordmust be saved in a dictionary;session- meaning that thewordmust be saved for the current session;buffer- meaning that thewordmust be saved for the current buffer.
Check flyspell-correct-popup for example of interface that uses this feature.
/Take my advice and don’t use this functionality unless you find
flyspell-correct-wrapper function useless for your purposes. Seriously, just
try named function for completion. You can find more info in this comment./
This package also provides auto correction minor mode called
flyspell-correct-auto-mode. When enabled it will automatically invoke
flyspell-correct-previous-word-generic after certain delay configured by
flyspell-correct-auto-delay when there is at least one incorrect word.
(add-hook 'flyspell-mode-hook #'flyspell-correct-auto-mode)
One can also configure interface specially for
flyspell-correct-previous-word-generic called by flyspell-correct-auto-mode by
setting value of flyspell-correct-auto-mode-interface.
There are already packages like helm-flyspell and flyspell-popup. So why
would anyone create yet another similar package? The reason is simple - to
support another interface or completion system. flyspell-correct started
because ivy was missing similar to helm-flyspell package. But I didn’t want
to create a package just for ivy. The reasoning is simple - all those packages
should have similar functionality but different interface. Adding something new
to one of these packages ideally should be reflected in all others. So I decided
to create generic package that works with any interfaces. It’s not about one
package containing all possible interfaces, but about a package giving you
functionality with an interface of your choice.
TBD
This package is available thanks to these people:
- Andrzej Pronobis for inspiration and helm-flyspell
- xuchunyang for flyspell-popup
- Oleh Krehel for swiper and all the help
Additional thanks to all contributors:




