Write Better in Neovim With Languagetool
Sophia Brandt

Sophia Brandt @sophiabrandt

About: former tax officer turned programmer

Location:
Ruhr area, Germany
Joined:
Sep 1, 2018

Write Better in Neovim With Languagetool

Publish Date: Oct 26 '22
5 2

LanguageTool is a grammar tool and spell checker with an open-source core.

I have used grammarly for a while, but the browser extension was crap.

A colleague recommended LanguageTool (LT), and I’ve been a happy user of the browser extension ever since.

LT has superior support for other languages than English. It also features decent suggestions for improving your grammar. The free tier of LT has been a better experience for me than grammarly.

Did you know that you can use LT as a language server for NeoVim and other editors?

Install ltex-ls

LT has no direct support for the language server protocol, but fear not – a clever programmer has included the LT server in his LSP implementation.

The tool is called ltex-ls, and it’s free software.

You can find the installation instructions on the ltex-ls website.

For macOS, you can use homebrew:



brew install ltex-ls


Enter fullscreen mode Exit fullscreen mode

The command installs the server as ltex-ls in your standard homebrew location and thus adds it to your $PATH.

If you manually install the program, make sure to add the binary to your $PATH, for example with fish_add_path.

Integration With nvim-lsp

Check the recommended configuration on the nvim-lsp GitHub and add the following configuration:



require('lspconfig')['ltex']({
 on_attach = on_attach,
 cmd = { "ltex-ls" },
 filetypes = { "markdown", "text" },
 flags = { debounce_text_changes = 300 },
})



Enter fullscreen mode Exit fullscreen mode

You should add the server command into the cmd section. On macOS, ltex-ls worked fine for me.

Here you can see how the tool points out possible errors in my text:

neovim languagetool example

Other Editors

I originally found the instructions for using ltex-lsp on a blog about the Helix Editor: Note talking with Helix, Tp-Note and LanguageTool.

Here is the the content of ~/.config/helix/languages.toml:



[[language]]
file-types = ["md", "txt"]
indent = { tab-width = 2, unit = " " }
injection-regex = "md|markdown"
language-server = { command = "ltex-ls" }
name = "markdown"
roots = [".git"]
scope = "source.md"



Enter fullscreen mode Exit fullscreen mode

If you use VS Code, you can use the extension vscode-ltex.

Links

Comments 2 total

  • Rajasegar Chandran
    Rajasegar ChandranJul 28, 2023

    Thanks for this post, LanguageTool is awesome

  • Immo Junghärtchen
    Immo JunghärtchenJul 12, 2025

    Thank you for this helpful post! I am new to Neovim and am trying to set it up for use with Languagetool. I realized that with the update to Neovim 0.11, a lot has changed regarding Language Server Protocols. There are two new APIs, namely

    vim.lsp.config.
    vim.lsp.enable()
    
    Enter fullscreen mode Exit fullscreen mode

    Did you already make the switch to the new version, and would you be willing to share your new setup for ltex-ls integration?

Add comment