Table of Contents

LanguageTool layer

Table of ContentsClose

languagetool.png

1. Description

This layer adds grammar checking using LanguageTool. LanguageTool will use the language set using SPC S d if the spell-checking layer is enabled.

1.1. Features:

  • Spelling and grammar checking

2. Install

2.1. Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add languagetool to the existing dotspacemacs-configuration-layers list in this file. You can set the default language by setting langtool-default-language. This value will be used when no custom language has been set using SPC S d (or via variables ispell-local-dictionary and ispell-dictionary):

(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              langtool-default-language "en-GB")))

It's also possible to immediately show the error when jumping to errors with [ a and ] a by setting languagetool-show-error-on-jump:

(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              languagetool-show-error-on-jump t)))

2.2. LanguageTool

LanguageTool and JRE 8+ are required to use this layer. You can install LanguageTool using your system's package manager or by extracting the standalone archive found on LanguageTool's website.

If there is no executable standalone launcher languagetool in your PATH (provided by some distributions, e.g., ArchLinux and Gentoo), setting is required. You can choose one of the following methods:

;; Standalone installation
(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              langtool-language-tool-jar "/home/username/languagetool/languagetool-commandline.jar")))

;; Classpath (e.g. ArchLinux)
(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*")))

;; Executable standalone launcher (e.g. ArchLinux, Gentoo)
(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              langtool-bin "/usr/bin/languagetool")))

;; Standalone installation (run server in background)
;; This is very fast after listen server, but has security risk if there are multiple user on a same host.
(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              ;; You can change HTTP server port number like following.
                              ;; langtool-server-user-arguments '("-p" "8081")
                              langtool-language-tool-server-jar "/path/to/languagetool-server.jar")))

;; Running HTTP LanguageTool server instance on any machine
(setq-default dotspacemacs-configuration-layers
              '((languagetool :variables
                              langtool-http-server-host "localhost"
                              langtool-http-server-port 8081)))

3. Key bindings

Key binding Description
SPC S l Toggle LanguageTool for the current buffer
SPC S L Perform corrections in the current buffer
[ a Jump to the previous LanguageTool error
] a Jump to the next LanguageTool error

Author: root

Created: 2026-01-15 Thu 21:25

Validate