nixos/pkgs/pkgsets/emacs/flyspell.nix

30 lines
892 B
Nix

{ config, lib, ... }:
with lib;
mkIf (elem "emacs::flyspell" config.machine.pkgs) {
programs.emacs.init.usePackage.flyspell = {
enable = true;
diminish = [ "flyspell-mode" ];
command = [ "flyspell-mode" "flyspell-prog-mode" ];
hook = [];
bind = {
"C-M-<tab>" = "flyspell-switch-dictionary";
"C-c f" = "ispell-word";
};
config = ''
;; Make flyspell less verbose and disable annoying keybind
(setq flyspell-issue-message-flag nil
flyspell-issue-welcome-flag nil
flyspell-use-meta-tab nil)
(defun flyspell-switch-dictionary ()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "deutsch8") "english" "deutsch8")))
(ispell-change-dictionary change)
(message "Dictionary switched to %s" change)
))
'';
};
}