From cac705a23380f7de79302c7d6850ddfdf29de70d Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 25 Dec 2022 02:39:04 +0530 Subject: [PATCH] Add emacs lsp-mode documentation and fix typo (#47) --- README.md | 25 +++++++++++++++++++++++++ docs/configuration.md | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fa60d4f..2fd8fb6 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,31 @@ if executable('nil') endif ``` +### Emacs with [`lsp-mode`] + +[`lsp-mode`]: https://github.com/emacs-lsp/lsp-mode + +Add the following elisp code to your configuration. (using `use-package`) + +```elisp +(use-package lsp-mode + :ensure t) + +(use-package lsp-nix + :ensure lsp-mode + :after (lsp-mode) + :demand t + :custom + (lsp-nix-nil-formatter ["nixpkgs-fmt"])) + +(use-package nix-mode + :hook (nix-mode . lsp-deferred) + :ensure t) +``` + +There are various other configurations to tweak it. Refer the +[specific manual page](https://emacs-lsp.github.io/lsp-mode/page/lsp-nix-nil/ "https://emacs-lsp.github.io/lsp-mode/page/lsp-nix-nil/") for more details. + ### Emacs with [`eglot`] [`eglot`]: https://github.com/joaotavora/eglot diff --git a/docs/configuration.md b/docs/configuration.md index 281e87a..e7914f5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,7 +1,7 @@ ## LSP Configuration There are some tunable options and settings for `nil`. -They are retrieved via LSP and support runtine modification. +They are retrieved via LSP and support runtime modification. All settings are nested under a key `"nil"`. For example, `formatting.command` means to write @@ -24,7 +24,7 @@ The values shown here are the default values. // It should accepts file content in stdin and print the formatted code into stdout. // Type: [string] | null // Example: ["nixpkgs-fmt"] - "command": null, + "command": null, }, "diagnostics": { // Ignored diagnostic kinds.