Next: , Previous: , Up: Eglot   [Contents][Index]

1 Quick Start

This chapter provides concise instructions for setting up and using Eglot with your programming project in common usage scenarios. For more detailed instructions regarding Eglot setup, see Eglot and LSP Servers. See Using Eglot, for detailed description of using Eglot, and see Customizing Eglot, for adapting Eglot to less common use patterns.

Here’s how to start using Eglot with your programming project:

  1. Select and install a language server.

    Eglot comes pre-configured for many popular language servers, see the value of eglot-server-programs. If the server(s) mentioned there satisfy your needs for the programming language(s) with which you want to use Eglot, you just need to make sure those servers are installed on your system and Eglot can find them.

    Alternatively, install one or more servers of your choice and tell Eglot where to find them. To do that, you may add to the value of eglot-server-programs, as described in Setting Up LSP Servers or have Eglot prompt you about it (see Eglot Commands).

  2. Turn on Eglot for your project.

    To start using Eglot for a project, type M-x eglot RET in a buffer visiting any file that belongs to the project. This starts the language server configured for the programming language of that buffer, and causes Eglot to start managing file-visiting buffers related to that programming language. This includes files that are already visited at the time the eglot command is invoked, as well as any files visited after this invocation.

    The notion of a “project” used by Eglot is the same Emacs uses (see Projects in GNU Emacs Manual): in the simplest case, the “project” is the single file you are editing, but it can also be all the files in a single directory or a directory tree under some version control system, such as Git.

    There are alternate ways of starting Eglot; see Starting Eglot for details.

  3. Use Eglot.

    Most Eglot facilities are integrated into Emacs features, such as ElDoc, Flymake, Xref, and Imenu. However, Eglot also provides commands of its own, mainly to perform tasks by the language server, such as M-x eglot-rename (to rename an identifier across the entire project), M-x eglot-format (to reformat and reindent code), and some others. See Eglot Commands, for the detailed list of Eglot commands.

  4. That’s it!

Next: Eglot and LSP Servers, Previous: Eglot, Up: Eglot   [Contents][Index]