Neovim
Our Neovim integration is powered by harper-ls .
Required Setup
Make sure you have harper-ls installed and available on your global or Neovim's PATH. You can do this using mason.nvim or via any of our other supported installation methods .
Though Neovim supports language servers out-of-the-box , for ease of use, we suggest using harper-ls through nvim-lspconfig .
Once you have harper-ls and nvim-lspconfig installed, you need to add this to your init.lua:
require('lspconfig').harper_ls.setup {} Optional Configuration
Additionally, you can also configure things like which linters to use or how you want code actions to appear. Below is an example config where everything is set to their default values:
require('lspconfig').harper_ls.setup {
settings = {
["harper-ls"] = {
userDictPath = "",
workspaceDictPath = "",
fileDictPath = "",
linters = {
SpellCheck = true,
SpelledNumbers = false,
AnA = true,
SentenceCapitalization = true,
UnclosedQuotes = true,
WrongQuotes = false,
LongSentences = true,
RepeatedWords = true,
Spaces = true,
Matcher = true,
CorrectNumberSuffix = true
},
codeActions = {
ForceStable = false
},
markdown = {
IgnoreLinkTitle = false
},
diagnosticSeverity = "hint",
isolateEnglish = false,
dialect = "American",
maxFileLength = 120000,
ignoredLintsPath = "",
excludePatterns = {}
}
}
} This example only contains some of the available linters, check out our rules page to view the full list.
For more information on what each of these configs do, you can head over to the configuration section of our harper-ls documentation.
Common Config Changes
Programmers often find certain rules have too much of a hair-trigger. The below config is a simple cut-and-paste that gives you much fewer false-positives.
require('lspconfig').harper_ls.setup {
settings = {
["harper-ls"] = {
linters = {
SentenceCapitalization = false,
SpellCheck = false
}
}
}
} Native Neovim LSP Config
Neovim supports language servers natively , and therefore, Neovim supports Harper natively. To set up, first make sure that harper-ls is available on your system path. Next, add the following lines to your init.lua file:
-- General LSP setup
vim.lsp.config['*'] = {
capabilities = { textDocument = { semanticTokens = { multilineTokenSupport = true } } },
root_markers = { '.git' },
}
vim.diagnostic.config({ virtual_lines = true })
-- Harper specific setup
vim.lsp.config['harper'] = {
cmd = { 'harper-ls', '--stdio' },
filetypes = { 'markdown', 'text', 'tex', 'typst' }
}
vim.lsp.enable('harper') And that is it! Run :help gra in Neovim for more information on code action support.