Before setting up your editor, see Project setup
on how to configure clj-kondo for your project. TL;DR: this involves creating
a .clj-kondo directory in the root of your project.
For integrating with Emacs, see flycheck-clj-kondo.
For Spacemacs, check here or get flymake-kondor if you are using flymake.
Emacs has the lsp-mode where you can configure multiple LSP servers for different programming languages.
To use clj-kondo as an LSP server, you can configure the lsp-mode server command to point to the clj-kondo lsp-server jar. Note that the LSP server does not provide features other than diagnostics.
For Spacemacs, see the clj-kondo via LSP article, which includes the use of an external script as the custom lsp command.
For Emacs, use the instructions below.
Download the latest clj-kondo LSP server jar to your system. Go to the
Github releases and look
for clj-kondo-lsp-server-<version>-standalone.jar. The jar is provided
since version 2019.11.23.
Configure your lsp-mode pointing to the clj-kondo lsp server jar that you downloaded, like the example below:
(use-package lsp-mode
:ensure t
:hook ((clojure-mode . lsp))
:commands lsp
:custom
((lsp-clojure-server-command '("java" "-jar" "/home/user/clj-kondo/clj-kondo-lsp-server.jar")))
:config
(dolist (m '(clojure-mode
clojurescript-mode))
(add-to-list 'lsp-language-id-configuration `(,m . "clojure"))))
Install the clj-kondo extension. It requires no additional installation (except Java).
The clj-kondo extension will also be installed together with Calva.
If you do not have Java installed you can still get clj-kondo linting using the Clojure Lint extension, by @marcomorain, which uses the clj-kondo standalone executable.
Atom requires clj-kondo to be on your $PATH. In Atom, there are a few ways to install:
apm install linter-kondo linter linter-ui-default intentions busy-signalThis section is for Vim 8+ or Neovim.
Install ALE using your favorite plugin manager. This already has in-built support for clj-kondo.
In your .vimrc, add:
let g:ale_linters = {'clojure': ['clj-kondo']}
to only have clj-kondo as the linter.
To enable both clj-kondo and joker, add:
let g:ale_linters = {'clojure': ['clj-kondo', 'joker']}
Reload your .vimrc and it should start working.
Follow instructions to install COC.NVIM https://github.com/neoclide/coc.nvim
Follow instructions to install coc diagnostic https://github.com/iamcco/coc-diagnostic
Add the diagnostic-languageserver.linter and the
diagnostic-languageserver.filetypes to the coc-settings.json. CocConfig
command can be used to open the coc-settings.json file.
{
"diagnostic-languageserver.linters": {
"clj_kondo_lint": {
"command": "clj-kondo",
"debounce": 100,
"args": [ "--lint", "%filepath"],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "clj-kondo",
"formatLines": 1,
"formatPattern": [
"^[^:]+:(\\d+):(\\d+):\\s+([^:]+):\\s+(.*)$",
{
"line": 1,
"column": 2,
"message": 4,
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning",
"note": "info"
}
}
},
"diagnostic-languageserver.filetypes": {"clojure":"clj_kondo_lint"}
}
Neomake has built-in support for clj-kondo. It will be enabled automatically when using neomake, no configuration required.
Create this file in ~/.config/nvim/compiler/clj-kondo.vim or ~/.vim/compiler/clj-kondo.vim.
if exists("current_compiler")
finish
endif
let current_compiler="clj-kondo"
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%f:%l:%c:\ Parse\ %t%*[^:]:\ %m,%f:%l:%c:\ %t%*[^:]:\ %m
CompilerSet makeprg=clj-kondo\ --lint\ %
You can populate the quickfix list like so:
:compiler clj-kondo
:make
See romainl's vanilla linting for how to automatically execute linting and automatically open the quickfix.
If you have vim-dispatch installed, you can use this command to be both async and more convenient:
:Dispatch -compiler=clj-kondo
Currently there are two ways to get clj-kondo integration in IntelliJ. Both methods work well and have equivalent features. Select your preferred plugin/version management preference between:
The clj-kondo LSP server provides diagnostics via the LSP protocol. To get it working in IntelliJ follow these steps:
Download the latest clj-kondo LSP server jar to your system. Go to the
Github releases and look
for clj-kondo-lsp-server-<version>-standalone.jar. The jar is provided
since version 2019.11.23.
Install the LSP Support plugin by gtache, either from the marketplace of via a zipfile downloaded from the a Github release. Version 1.6.0 or later is required.
Configure the LSP Support plugin.
Raw command.Extension field enter clj;cljs;cljc;edn.java -jar <path> where <path> matches the downloaded
jar file,
e.g. /Users/clj-kondo/clj-kondo-lsp-server-2019.11.23-standalone.jar.Now, when editing a Clojure file, you should get linting feedback.
Requires a syntax aware plugin such as Cursive or ClojureKit installed for best results.
Install the File Watchers plugin. This plugin is available for installation in the Community Edition, even though it is bundled in Ultimate, you don't need Ultimate to install it.
Repeat the below steps for the file types Clojure (.clj), ClojureScript (.cljs)
and CLJC (.cljc)1.
+ and choose the <custom>
templateclj-kondo <filetype> (where <filetype> is one of
Clojure, ClojureScript or CLJC)Current fileclj-kondo--lint $FilePath$--lint $FilePath$ --config "{:lint-as {manifold.deferred/let-flow clojure.core/let}}"$FileDir$Create output file from stdoutNever$FILE_PATH$:$LINE$:$COLUMN$: $MESSAGE$

clj-kondo is active for all future projects
1 See Reader Conditionals for more information on the .cljc extension.
CLJX (.cljx) is an extension that was used prior to CLJC but is no longer in wide use.
Ensure that:
syntax-checking is present in dotspacemacs-configuration-layers.clj-kondo is available on PATH.In the .spacemacs file:
When using the stable master branch:
In dotspacemacs-additional-packages add flycheck-clj-kondo.
In the dotspacemacs/user-config function add the following:
(use-package clojure-mode
:ensure t
:config
(require 'flycheck-clj-kondo))
To install it alongside joker:
In dotspacemacs-additional-packages add flycheck-clj-kondo and flycheck-joker.
In the dotspacemacs/user-config function add the following:
(use-package clojure-mode
:ensure t
:config
(require 'flycheck-joker)
(require 'flycheck-clj-kondo)
(dolist (checker '(clj-kondo-clj clj-kondo-cljs clj-kondo-cljc clj-kondo-edn))
(setq flycheck-checkers (cons checker (delq checker flycheck-checkers))))
(dolist (checkers '((clj-kondo-clj . clojure-joker)
(clj-kondo-cljs . clojurescript-joker)
(clj-kondo-cljc . clojure-joker)
(clj-kondo-edn . edn-joker)))
(flycheck-add-next-checker (car checkers) (cons 'error (cdr checkers)))))
If using the develop branch, clj-kondo is available as a part of the standard
clojure layer. This will become the way to install in the next stable
release of spacemacs.
To enable it:
dotspacemacs-configuration-layers.clojure-enable-linters with the value 'clj-kondo.It should look like this:
dotspacemacs-configuration-layers
'(...
(clojure :variables
clojure-enable-linters 'clj-kondo)
)
Reload the config to enable clj-kondo.
Add the following to ~/.config/kak/kakrc:
hook global WinSetOption filetype=clojure %{
set-option window lintcmd 'clj-kondo --lint'
}
The :lint command will run clj-kondo and annotate the buffer with lint
warnings and errors.
clj-kondo is fast enough to lint as you code! If you want to do this, use
the following configuration:
hook global WinSetOption filetype=clojure %{
set-option window lintcmd 'clj-kondo --lint'
lint-enable
hook -group lint-diagnostics window NormalIdle .* %{ lint; lint-show }
}
This works well, but tends to clear the message line too frequently. The following work-around prevents linting from displaying the warning and error counts on the message line:
define-command -hidden -override lint-show-counters %{}
Can you improve this documentation? These fine people already did:
Michiel Borkent, Timothy Pratley, Dominic Monroe, Timofey, Rahul De, Jason Felice, Khalid Jebbari, Eric Dallo, John Stevenson, Audrius, Oleg, turbo-cafe, chorin1, Peter Strömberg, Sam Han, Gerred Dillon & Rahuλ DéEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |