2017-05-15 10:16:50 +00:00
|
|
|
#+TITLE: LanguageTool layer
|
|
|
|
|
2020-10-03 18:54:32 +00:00
|
|
|
#+TAGS: layer|uncategorized
|
|
|
|
|
2017-05-15 10:16:50 +00:00
|
|
|
[[file:img/languagetool.png]]
|
|
|
|
|
2020-10-03 18:54:32 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#features][Features:]]
|
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#layer][Layer]]
|
|
|
|
- [[#languagetool][LanguageTool]]
|
|
|
|
- [[#key-bindings][Key bindings]]
|
2017-05-15 10:16:50 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This layer adds grammar checking using [[https://www.languagetool.org/][LanguageTool]]. LanguageTool will use the
|
|
|
|
language set using ~SPC S d~ if the =spell-checking= layer is enabled.
|
|
|
|
|
2020-10-03 18:28:23 +00:00
|
|
|
** Features:
|
|
|
|
- Spelling and grammar checking
|
|
|
|
|
2017-05-15 10:16:50 +00:00
|
|
|
* Install
|
|
|
|
** 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~:
|
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((languagetool :variables
|
|
|
|
langtool-default-language "en-GB")))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
It's also possible to immediately show the error when jumping to errors with ~[
|
|
|
|
a~ and ~] a~ by setting ~languagetool-show-error-on-jump~:
|
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((languagetool :variables
|
|
|
|
languagetool-show-error-on-jump t)))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** 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 [[https://www.languagetool.org/][LanguageTool's website]]. You can tell the layer where
|
|
|
|
LanguageTool is installed by setting the =langtool-language-tool-jar= variable
|
2020-10-14 18:15:55 +00:00
|
|
|
to the location of =languagetool-commandline.jar=, by setting
|
|
|
|
=langtool-java-classpath=, or setting a host and port for a running server:
|
2017-05-15 10:16:50 +00:00
|
|
|
|
|
|
|
#+BEGIN_SRC elisp
|
|
|
|
;; Standalone installation
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((languagetool :variables
|
|
|
|
langtool-language-tool-jar "/home/username/languagetool/languagetool-commandline.jar")))
|
|
|
|
|
|
|
|
;; Classpath (e.g. after installing with `pacman -S languagetool')
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((languagetool :variables
|
|
|
|
langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*")))
|
2020-10-14 18:15:55 +00:00
|
|
|
|
|
|
|
;; Server running in background
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
'((languagetool :variables
|
|
|
|
langtool-http-server-host "localhost"
|
|
|
|
langtool-http-server-port 8081)))
|
2017-05-15 10:16:50 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Key bindings
|
|
|
|
|
2020-10-03 18:54:32 +00:00
|
|
|
| Key binding | Description |
|
2017-05-15 10:16:50 +00:00
|
|
|
|-------------+--------------------------------------------|
|
|
|
|
| ~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 |
|