From 665bb8d32e2a0d0c7d9e708dfc6a2d03f0d677f2 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 28 May 2020 18:55:16 +0200 Subject: [PATCH 1/3] Add Neovim/Vim8 option to config wizard This commit adds minimal config option for Neovim/Vim8 editors in the config wizard. It assumes use of CoC engine to facilitate LSP. --- build.zig | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index a40d079..b3256b0 100644 --- a/build.zig +++ b/build.zig @@ -34,7 +34,7 @@ pub fn config(step: *std.build.Step) anyerror!void { std.debug.warn("Successfully saved configuration options!\n", .{}); - const editor = try zinput.askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Other }); + const editor = try zinput.askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Other }); std.debug.warn("\n", .{}); switch (editor) { @@ -78,6 +78,20 @@ pub fn config(step: *std.build.Step) anyerror!void { \\}} , .{}); }, + .Neovim, .Vim8 => { + std.debug.warn( + \\To use ZLS in Neovim/Vim8, we recommend using CoC engine. You can get it from 'https://github.com/neoclide/coc.nvim'. + \\Then, simply issue cmd from Neovim/Vim8 `:CocConfig`, and add this to your CoC config: + \\{{ + \\ "lanuageserver": {{ + \\ "zls" : {{ + \\ "command": "command_or_path_to_zls", + \\ "filetypes": ["zig"] + \\ }} + \\ }} + \\}} + , .{}); + }, .Other => { std.debug.warn( \\We might not *officially* support your editor, but you can definitely still use ZLS! @@ -138,8 +152,8 @@ pub fn build(b: *std.build.Builder) !void { test_step.dependOn(&exe.step); var unit_tests = b.addTest("tests/unit_tests.zig"); - unit_tests.addPackage(.{ .name = "analysis", .path = "src/analysis.zig" }); - unit_tests.addPackage(.{ .name = "types", .path = "src/types.zig" }); + unit_tests.addPackage(.{ .name = "analysis", .path = "src/analysis.zig" }); + unit_tests.addPackage(.{ .name = "types", .path = "src/types.zig" }); unit_tests.setBuildMode(.Debug); test_step.dependOn(&unit_tests.step); } From e4e13ea9fd02f30016e68c40d37bc4c31aa9c011 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 28 May 2020 19:14:59 +0200 Subject: [PATCH 2/3] Reflect changes in the README --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index c0319d8..b7b4920 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,21 @@ Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-v } ``` +### Neovim/Vim8 + +- Install the CoC engine from [here](https://github.com/neoclide/coc.nvim). +- Issue `:CocConfig` from within your Vim editor, and the following snippet: +```json +{ + "lanuageserver": { + "zls" : { + "command": "command_or_path_to_zls", + "filetypes": ["zig"] + } + } +} +``` + ## Related Projects - [`sublime-zig-language` by @prime31](https://github.com/prime31/sublime-zig-language) - Supports basic language features From 8ecbe4c6fd4ef450b2838a66f44b0d63e53933a2 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 28 May 2020 19:16:37 +0200 Subject: [PATCH 3/3] Update ToC --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b7b4920..f152560 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Zig Language Server, or `zls`, is a language server for Zig. The Zig wiki states - [VSCode](#vscode) - [Sublime Text 3](#sublime-text-3) - [Kate](#kate) + - [Neovim/Vim8](#neovimvim8) - [Related Projects](#related-projects) - [License](#license)