Quickstart¶
This page gives a quick introduction into Flycheck and an overview of its most important features. Before you start here please make sure that Flycheck is installed.
Enable Flycheck¶
Now add the following code to your init file to permanently enable syntax checking with Flycheck:
(add-hook 'after-init-hook #'global-flycheck-mode)
A modern setup¶
For an experience closer to a modern IDE, turn on inline diagnostics and let Flycheck surface your language server’s diagnostics too:
;; Check syntax everywhere
(add-hook 'after-init-hook #'global-flycheck-mode)
;; Show diagnostics inline, next to the code (in the spirit of Error Lens)
(add-hook 'after-init-hook #'global-flycheck-annotate-mode)
;; Report Eglot's LSP diagnostics through Flycheck
(global-flycheck-eglot-mode 1)
If you don’t use Eglot but want diagnostics straight from a linter’s own LSP
server (such as RuboCop, Ruff, Biome or Harper), enable
global-flycheck-lsp-mode instead. See Check buffers for the
full story on both LSP integrations.
Install syntax checker programs¶
Now you need to install syntax checking programs for the languages you’d like to use Flycheck with. The list of supported languages tells you which languages Flycheck supports and what programs it uses.
For instance, you can install Pylint for Python and ESLint for Javascript:
$ pip install pylint
$ npm install eslint
Check syntax in a buffer¶
Now you are ready to use Flycheck in a Python or Javascript buffer. Visit a
Python or Javascript file and check whether your Flycheck setup is complete with
C-c ! v.
If everything is green, Flycheck will now start to check the buffer on the fly while you are editing. Whenever you make a mistake that eslint or Pylint can catch, Flycheck will highlight the corresponding place in the buffer with an error underline whose color reflects the severity of the issue. Additionally, Flycheck will put a symbol into the fringe for affected lines and show the total number of errors and warnings in the buffer in the mode line.
More features¶
All Flycheck commands are available in the Emacs Menu at :
The menu of Flycheck, showing all available Flycheck commands¶
The same menu also pops up when you click on the mode line lighter:
The mode line menu of Flycheck¶
What else Flycheck can do¶
The basics above are only the start. A few highlights worth knowing about:
Inline error messages. Flycheck can show each message right next to the code it refers to, in the spirit of VS Code’s Error Lens - turn on
flycheck-annotate-mode(see See errors in buffers).Fixes. Some checkers report a machine-applicable fix; apply the one at point with C-c ! f, or every fix in the buffer with C-c ! F (see Interact with errors).
Related locations. When an error points at other places (an earlier definition, a borrow), jump to them with C-c ! j (see Interact with errors).
Language servers. Flycheck can report a language server’s diagnostics - either through Eglot (
flycheck-eglot-mode) or by talking to a diagnostics linter directly, with no full LSP client (flycheck-lsp-mode). See Check buffers.