sponsor Vim development Vim logo Vim Book Ad

LanguageTool : Grammar checker for English, French, German (etc.) in Vim

 script karma  Rating 310/120, Downloaded by 16231  Comments, bugs, improvements  Vim wiki

created by
Dominique PellÚ
script type
This plugin integrates the LanguageTool grammar checker into Vim.
Current version of LanguageTool can check grammar in many languages
See the list of supported languages: http://www.languagetool.org/languages/
or http://www.languagetool.org/ or more information about LanguageTool.

The script defines 2 commands:

* Use  :LanguageToolCheck  to check grammar in current buffer.
  This will check for grammar mistakes in text of current buffer
  and highlight the errors. It also opens a new scratch window with the
  list of grammar errors with further explanations for each error.
  Pressing <Enter> in scratch buffer will jump to that error. The
  location list for the buffer being checked is also populated.
  So you can use location commands such as :lopen to open the location
  list window, :lne to jump to the next error, etc.

* Use  :LanguageToolClear  to remove highlighting of grammar mistakes,
  close the scratch window containing the list of errors, clear and
  close the location list.

See screenshots of grammar checking in English and French at:

See  :help LanguageTool  for more details.

  The VIM LICENSE applies to LanguageTool.vim plugin
  (see ":help copyright" except use "LanguageTool.vim" instead of Vim").
install details
Install the plugin with:

  $ mkdir ~/.vim
  $ cd ~/.vim
  $ unzip /path-to/LanguageTool.zip
  $ vim -c 'helptags ~/.vim/doc'

To use this plugin, you need to install the Java LanguageTool program. You
can choose to:

* download stand-alone version of LanguageTool (LanguageTool-*.zip) from:
  http://www.languagetool.org/ using the orange button labeled
  "LanguageTool for standalone for your desktop". The standalone version of
  Vim not only does grammar checking but also contains Hunspell dictionaries
  for spell checking.
* or download a nightly build LanguageTool-.*-snapshot.zip from
  http://www.languagetool.org/download/snapshots/. It contains a more
  recent version than the stable version but it is not as well tested.
* or checkout and build the latest LanguageTool from sources in git

See ":help languagetool-installation" for more details about installing LanguageTool.

After installing LanguageTool, you must specify the location of the file
languagetool-commandline.jar in your $HOME/.vimrc file. Example:

  let g:languagetool_jar='$HOME/languagetool/languagetool-standalone/target/LanguageTool-3.3-SNAPSHOT/LanguageTool-3.3-SNAPSHOT/languagetool-commandline.jar'

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
LanguageTool.zip 1.30 2016-10-06 7.0 Dominique PellÚ - fixed several bugs
LanguageTool.zip 1.29 2016-01-17 7.0 Dominique PellÚ - highlighting text could be wrong when text contained tabs
LanguageTool.zip 1.28 2014-02-20 7.0 Dominique PellÚ - updated help file to reflect the change in LanguageTool:
   LanguageTool.jar file was renamed into
LanguageTool.zip 1.27 2013-12-07 7.0 Dominique PellÚ - print stderr output of LanguageTool command line if somehow it fails to help diagnose problems.
LanguageTool.zip 1.26 2013-09-11 7.0 Dominique PellÚ - updated doc to describe how to download and install LanguageTool
LanguageTool.zip 1.25 2013-02-08 7.0 Dominique PellÚ - minor doc updates
LanguageTool.zip 1.24 2013-02-08 7.0 Dominique PellÚ - updated doc to explain how to build LanguageTool after LanguageTool moved from Ant to Maven
- German spelling mistakes were highlighted as grammar errors
- if no language is specified, use 'en-US' as default rather than 'en' so spelling mistakes are signalled.
LanguageTool.zip 1.23 2012-09-24 7.0 Dominique PellÚ - added items in menu of gvim: Plugin->LanguageTool->{Check,Clear}
LanguageTool.zip 1.22 2012-09-21 7.0 Dominique PellÚ - fixed xml parsing which was broken with latest LanguageTool nightly build (soon to become LanguageTool-1.9)
- use norm! rather than norm to be more robust
LanguageTool.zip 1.21 2012-07-01 7.0 Dominique PellÚ - fixed bug reported by Alexey Radkov: plugin set invalid language for LanguageTool when 'spelllang' contained multiple languages (such as: ru_ru,en_us).
- LanguageTool-1.8 is not required to be able to use language regions such as en-US, de-DE, etc.
LanguageTool.zip 1.20 2012-06-26 7.0 Dominique PellÚ - different highlighting for spelling error rules HUNSPELL_NO_SUGGEST_RULE and MORFOLOGIK_RULE_* than for grammar errors
- automatically find the language region from spelllang
LanguageTool.zip 1.19 2012-06-17 7.0 Dominique PellÚ - oops, last version fixed a highlighting bug with multi-byte, and introduced another bug. Correctly fixed now.
LanguageTool.zip 1.18 2012-06-12 7.0 Dominique PellÚ - added g:languagetool_lang configuration variable to override 'spelllang'.
- use different colors for grammar mistakes and spelling errors given by new HUNSPELL_RULE rule in LanguageTool-1.8.
- fixed bug with utf-8 when highlighting errors
LanguageTool.zip 1.17 2012-05-30 7.0 Dominique PellÚ - Unescape XML special char (ampersand...) before showing the URL
LanguageTool.zip 1.16 2012-05-30 7.0 Dominique PellÚ - added support for <url> (new in LanguageTool-1.8) which can show a URL with more detailed information about a grammatical error.
- added link to screencast in doc.
LanguageTool.zip 1.15 2012-03-07 7.0 Dominique PellÚ Wrong portion of text could be highlighted when text near error contained quotes.
LanguageTool.zip 1.14 2011-03-27 7.0 Dominique PellÚ - display subid in XML output of LanguageTool (introduced in LanguageTool-1.1)
- updated doc now the LanguageTool project uses svn rather than cvs
- removed handling of mouse (it was more annoying than useful to grab the mouse)
LanguageTool.zip 1.13 2010-09-20 7.0 Dominique PellÚ - cope with small changes in XML output of LanguageTool-1-1-beta.
- Plugin can still parse output of LanguageTool-1.0.
LanguageTool.zip 1.12 2010-09-07 7.0 Dominique PellÚ - (bug) fixed incorrect handling of multibyte causing missing highlighting
LanguageTool.zip 1.11 2010-09-04 7.0 Dominique PellÚ - (bug) regex to parse rules from LanguageTool output did not accept rule with dash
- (improvement) don't waste a line displaying "Correction:" in scratch buffer when error has no suggested correction
LanguageTool.zip 1.10 2010-09-03 7.0 Dominique PellÚ - avoid spurious highlighting when text of error appears multiple times in line.
LanguageTool.zip 1.9 2010-09-02 7.0 Dominique PellÚ - improved handling of LeftMouse event (used when clicking on error to jump to its location)
LanguageTool.zip 1.8 2010-08-30 7.0 Dominique PellÚ - (bug) fixed syntax error
- fixed broken links in help page
LanguageTool.zip 1.7 2010-08-30 7.0 Dominique PellÚ - :LanguageToolCheck command now accepts a range
- (bug) more fixes to properly handle XML characters such as &
LanguageTool.zip 1.6 2010-08-30 7.0 Dominique PellÚ - created a Vim help page  (:help LanguageTool)
LanguageTool.vim 1.5 2010-08-30 7.0 Dominique PellÚ - (bug) XML code such as " < (etc) had to be replaced in " & (etc)
- (bug) escaping \ and ' in regex was not right
- improved comment explaining how to install LanguageTool
LanguageTool.vim 1.4 2010-08-29 7.0 Dominique PellÚ - (bug) substitute things like "e; into " from input XML.
LanguageTool.vim 1.3 2010-08-29 7.0 Dominique PellÚ - populate location list (can now use commands :lopen, :lne, ...)
LanguageTool.vim 1.2 2010-08-29 7.0 Dominique PellÚ - check whether running language tool succeeded + a few other fixes
LanguageTool.vim 1.1 2010-08-29 7.0 Dominique PellÚ - (bug) fall back to 'enc' encoding when 'fenc' is not set
- (new) can now click on error in scratch buffer to jump to them (if mouse is enabled)
LanguageTool.vim 1.0 2010-08-29 7.0 Dominique PellÚ - added escape() and nomagic in a regex to avoid errors
LanguageTool.vim 0.9 2010-08-29 7.0 Dominique PellÚ - pressing <Enter> on an error in scratch buffer now jumps to that error
LanguageTool.vim 0.8 2010-08-28 7.0 Dominique PellÚ Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.