在Neovim中配置Lua开发环境

安装LSP服务端:

1
brew install lua-language-server

创建一个配置目录:

1
mkdir -p lua/lspconfig/sumneko_lua && cd $_

创建init.lua配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'lspconfig'.sumneko_lua.setup {
cmd = { "lua-language-server", "--locale=zh-CN" },
settings = {
Lua = {
format = {
defaultConfig = {
indent_style = "space",
indent_size = "2",
tab_width = "2",
continuation_indent_size = "2"
}
},
diagnostics = {
globals = { "vim" }
}
}
}
}

init.lua增加配置文件的引用:

1
require('lspconfig.sumneko_lua')

References