diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 54fca2c..b2422e1 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -8,6 +8,28 @@ lsp.ensure_installed({ 'jedi_language_server', -- Python }) +-- Fix undefined global 'vim' +lsp.configure('lua_ls', { + cmd = { 'lua-language-server' }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + path = vim.split(package.path, ';'), + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + }, + }, + }, + }, +}) + lsp.on_attach(function(client, bufnr) lsp.default_keymaps({buffer = bufnr}) end)