Skip to content

Commit ccd3d6d

Browse files
authored
update: neovim config instructions (#58)
* update: neovim install instructions * update: neovim configuration instructions * chore: styling * suggested neovim config changes as per DrKJeff * update link for learning more about neovim config
1 parent 235b334 commit ccd3d6d

File tree

2 files changed

+77
-51
lines changed

2 files changed

+77
-51
lines changed

src/content/wiki/configuration.mdx

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Other settings like [`workspace.library`](/wiki/settings#workspace-library) _sho
4444

4545
### Neovim
4646

47-
Below are some examples for getting set up in Neovim in different environments.
47+
Below are some examples for getting set up in Neovim using different tools:
4848

4949
<AccordionGroup>
5050
<Accordion>
@@ -55,21 +55,45 @@ Below are some examples for getting set up in Neovim in different environments.
5555
Below is a minimal example showing how to set the runtime version of the language server.
5656

5757
```Lua
58-
require'lspconfig'.lua_ls.setup{
58+
vim.lsp.config('lua_ls', {
59+
cmd = { 'lua-language-server' },
60+
filetypes = { 'lua' },
61+
-- Sets the "workspace" to the directory where any of these files is found.
62+
root_markers = {
63+
".luarc.json",
64+
".luarc.jsonc",
65+
".luacheckrc",
66+
".stylua.toml",
67+
".git",
68+
},
5969
settings = {
6070
Lua = {
6171
runtime = {
62-
version = "LuaJIT"
72+
version = 'LuaJIT',
6373
}
6474
}
6575
}
66-
}
76+
})
77+
78+
-- Now that the language server is configured, it must be enabled
79+
vim.lsp.enable('lua_ls')
6780
```
6881

82+
See [github.com/neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#lua_ls) for a more detailed example.
83+
6984
And here is an example that can be used when using Luarocks:
7085

7186
```Lua
72-
require'lspconfig'.lua_ls.setup{
87+
vim.lsp.config('lua_ls', {
88+
cmd = { 'lua-language-server' },
89+
filetypes = { 'lua' },
90+
root_markers = {
91+
".luarc.json",
92+
".luarc.jsonc",
93+
".luacheckrc",
94+
".stylua.toml",
95+
".git",
96+
},
7397
settings = {
7498
Lua = {
7599
runtime = {
@@ -91,7 +115,10 @@ require'lspconfig'.lua_ls.setup{
91115
}
92116
}
93117
}
94-
}
118+
})
119+
120+
-- Now that the language server is configured, it must be enabled
121+
vim.lsp.enable('lua_ls')
95122
```
96123

97124
</Accordion>

src/pages/index.astro

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -217,57 +217,56 @@ const annotationCount = annotationsPage
217217
<div id="neovim-install">
218218
<h3>Neovim</h3>
219219
<div class="instructions">
220-
<ol>
221-
<li>
222-
Install lua-language-server
223-
<ol type="A">
224-
<li>
225-
From package manager
226-
<ul>
227-
<li>
228-
Scoop: <code>scoop install lua-language-server</code>
229-
</li>
220+
<div>
221+
<ol>
222+
<li>
223+
Install lua-language-server
224+
<ol type="A">
225+
<li>
226+
From package manager
227+
<ul>
228+
<li>
229+
Scoop: <code>scoop install lua-language-server</code>
230+
</li>
231+
<li>
232+
Homebrew: <code>brew install lua-language-server</code
233+
>
234+
</li>
235+
<li>
236+
Macports: <code
237+
>sudo port install lua-language-server</code
238+
>
239+
</li>
240+
</ul>
230241
<li>
231-
Homebrew: <code>brew install lua-language-server</code>
242+
From <ExternalLink
243+
url="https://github.com/LuaLS/lua-language-server/releases/latest"
244+
>
245+
latest release
246+
</ExternalLink>
232247
</li>
233248
<li>
234-
Macports: <code
235-
>sudo port install lua-language-server</code
249+
<a href="/wiki/build/" target="_blank"
250+
>Build from scratch</a
236251
>
237252
</li>
238-
</ul>
239-
<li>
240-
From <ExternalLink
241-
url="https://github.com/LuaLS/lua-language-server/releases/latest"
242-
>
243-
latest release
244-
</ExternalLink>
245253
</li>
246-
<li>
247-
<a href="/wiki/build/" target="_blank"
248-
>Build from scratch</a
249-
>
250-
</li>
251-
</li>
252-
</ol>
253-
</li>
254-
<li>
255-
Ensure that the <code>lua-language-server</code> is executable from
256-
the command line. It may need to be added to <code>$PATH</code>.
257-
</li>
258-
<li>
259-
In your Neovim configuration file, add the following:
260-
<!-- prettier-ignore -->
261-
<CodeBlock language="Lua"><pre>require'lspconfig'.lua_ls.setup&#123;&#125;</pre></CodeBlock>
262-
</li>
263-
<li>
264-
See the <ExternalLink
265-
url="https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#lua_ls"
266-
>
267-
Neovim documentation for more
268-
</ExternalLink>
269-
</li>
270-
</ol>
254+
</ol>
255+
</li>
256+
<li>
257+
Ensure that the <code>lua-language-server</code> is executable
258+
from the command line. It may need to be added to <code
259+
>$PATH</code
260+
>.
261+
</li>
262+
<li>
263+
See <ExternalLink
264+
url="https://neovim.io/doc/user/lsp.html#lsp-quickstart"
265+
>Neovim's quickstart guide for language servers</ExternalLink
266+
>
267+
</li>
268+
</ol>
269+
</div>
271270
</div>
272271
</div>
273272
<div id="jetbrains-install">

0 commit comments

Comments
 (0)