* Eglot ** Keybindings #+begin_src elisp (use-package eglot :bind (:map eglot-mode-map ("C-c l a" . eglot-code-actions) ("C-c l r" . eglot-rename) ("C-c l h" . eldoc) ("C-c l f" . eglot-format) ("C-c l F" . eglot-format-buffer) ("C-c l R" . eglot-reconnect))) #+end_src ** Direnv for Nix-Shell Integration Direnv is a program that will automatically run ~nix-shell~ when a ~.envrc~ file is found. Using the ~emacs-direnv~ package, you can more easily integrate nix into your development environment. #+begin_src elisp (use-package direnv :config (direnv-mode)) #+end_src * Language Servers This will include any language server packages and configuration. ** HTML #+begin_src elisp (use-package web-mode :defer t :mode ("\\.html\\'" "\\.svelte\\'") :hook (web-mode . eglot-ensure) :init (setq web-mode-engines-alist '(("svelte" . "\\.svelte\\'")))) #+end_src ** JavaScript/Typescript #+begin_src elisp (use-package typescript-mode :defer t :mode ("\\.ts\\'" "\\.js\\'") :hook (typescript-mode . eglot-ensure)) #+end_src Install the ~typescript-language-server~ through npm. #+begin_src sh npm install -g typescript-language-server #+end_src ** Python #+begin_src elisp (use-package python-mode :defer t :mode ("\\.py\\'") :hook (python-mode . eglot-ensure)) #+end_src Install the ~python-lsp-server~ though pip. #+begin_src sh pip install python-lsp-server #+end_src ** C/C++ #+begin_src elisp (use-package ccls :defer t :hook ((c-mode cc-mode c++-mode objc-mode cuda-mode) . (lambda () (require 'ccls) (lsp))) :config (setq ccls-executable "/usr/bin/ccls")) #+end_src Install ~ccls~ with homebrew using the following command. #+begin_src sh sudo apt install ccls #+end_src ** Golang #+begin_src elisp (use-package go-mode :defer t :hook (go-mode . eglot-ensure)) #+end_src ** Rust #+begin_src elisp (use-package rustic :defer t :hook (rust-mode . eglot-ensure) :init (let ((brew-prefix (string-trim (shell-command-to-string "brew --prefix")))) (when (and (memq window-system '(mac ns x)) brew-prefix (f-directory-p brew-prefix)) (setenv "YARA_LIBRARY_PATH" (expand-file-name "lib" brew-prefix)) (setenv "YARA_INCLUDE_DIR" (expand-file-name "include" brew-prefix))))) #+end_src ** C# #+begin_src elisp (use-package csharp-mode :defer t :hook (csharp-mode . eglot-ensure)) #+end_src ** JSON #+begin_src elisp (use-package json-mode :defer t :hook (json-mode . eglot-ensure)) #+end_src ** Yaml #+begin_src elisp (use-package yaml-mode :defer t :hook (yaml-mode . eglot-ensure)) #+end_src ** Yara To install the corresponding LSP, you need to install ~yls~. Using the command ~pip install -U yls-yara~. Keep in mind that ~yls~ is dependent on an up to date version of ~yara-python~. #+begin_src elisp (use-package yara-mode :defer t :hook (yara-mode . eglot-ensure) :config (with-eval-after-load 'lsp-mode (add-to-list 'lsp-language-id-configuration '(yara-mode . "yara")) (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection "yls") :activation-fn (lsp-activate-on "yara") :server-id 'yls)))) #+end_src ** R #+begin_src elisp (use-package ess :defer t :hook (R-mode . eglot-ensure)) #+end_src ** Haskell #+begin_src elisp (use-package haskell-mode :defer t :hook (haskell-mode . eglot-ensure)) (use-package lsp-haskell :defer t :hook (lsp-literate-mode . eglot-ensure)) #+end_src ** Ebuild Ebuild is the language used for Gentoo packages installed with the ~emerge~ utility. As this package is Gentoo specific, you will have to install it the command below: #+begin_src bash sudo emerge -v app-emacs/ebuild-mode #+end_src #+begin_src elisp (use-package ebuild-mode :ensure nil :defer t :hook (ebuild-mode . eglot-ensure)) #+end_src ** Nix Nix is the language used by NixOS and the Nix package manager. #+begin_src elisp (use-package lsp-nix :ensure lsp-mode :after (lsp-mode) :demand t :custom (lsp-nix-nil-formatter ["nixpkgs-fmt"])) (use-package nix-mode :mode "\\.nix\\'" :hook (nix-mode . eglot-ensure)) #+end_src