Merge pull request #255 from bnjmnt4n/docs/emacs

Emacs: update setup instructions
This commit is contained in:
Alexandros Naskos 2021-03-21 12:16:54 +02:00 committed by GitHub
commit 4198edbdaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 33 deletions

View File

@ -216,13 +216,12 @@ let g:LanguageClient_serverCommands = {
- [zig mode](https://github.com/ziglang/zig-mode) is also useful
```elisp
(require 'lsp)
(add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "<path to zls>")
:major-modes '(zig-mode)
:server-id 'zls))
;; Setup lsp-mode as desired.
;; See https://emacs-lsp.github.io/lsp-mode/page/installation/ for more information.
(require 'lsp-mode)
;; Either place zls in your PATH or add the following:
(setq lsp-zig-zls-executable "<path to zls>")
```
### Doom Emacs
@ -231,17 +230,17 @@ let g:LanguageClient_serverCommands = {
- Install the [zig-mode](https://github.com/ziglang/zig-mode) package (add `(package! zig-mode)` to your `packages.el` file
```elisp
(require 'lsp)
(use-package! zig-mode
:hook ((zig-mode . lsp))
:hook ((zig-mode . lsp-deferred))
:custom (zig-format-on-save nil)
:init
:config
(after! lsp-mode
(add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "<path to zls>")
:major-modes '(zig-mode)
:server-id 'zls)))
:server-id 'zls))))
```
## Related Projects

View File

@ -146,31 +146,26 @@ pub fn config(step: *std.build.Step) anyerror!void {
\\Zig mode (https://github.com/ziglang/zig-mode) is also useful!
\\Then, add the following to your emacs config:
\\
\\(require 'lsp)
\\(add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
\\(lsp-register-client
\\ (make-lsp-client
\\ :new-connection (lsp-stdio-connection "<path to zls>")
\\ :major-modes '(zig-mode)
\\ :server-id 'zls))
\\(require 'lsp-mode)
\\(setq lsp-zig-zls-executable "<path to zls>")
, .{});
},
.Doom => {
std.debug.warn(
\\To use ZLS in Doom Emacs, enable the lsp module
\\And install the zig mode (https://github.com/ziglang/zig-mode) package by adding `(package! zig-mode)` to your packages.el file.
\\And install the `zig-mode` (https://github.com/ziglang/zig-mode) package by adding `(package! zig-mode)` to your packages.el file.
\\
\\(require 'lsp)
\\(use-package! zig-mode
\\ :hook ((zig-mode . lsp))
\\ :hook ((zig-mode . lsp-deferred))
\\ :custom (zig-format-on-save nil)
\\ :init
\\ :config
\\ (after! lsp-mode
\\ (add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
\\ (lsp-register-client
\\ (make-lsp-client
\\ :new-connection (lsp-stdio-connection "<path to zls>")
\\ :major-modes '(zig-mode)
\\ :server-id 'zls)))
\\ :server-id 'zls))))
, .{});
},
.Other => {