From 9e7ad6074746a3f7d60e164be919b53ad17a33dd Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Wed, 30 Jun 2021 18:45:40 -0400 Subject: refactor autocommands --- lua/lsp/lua-ls.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lua/lsp/lua-ls.lua') diff --git a/lua/lsp/lua-ls.lua b/lua/lsp/lua-ls.lua index 775eb92f..4257605f 100644 --- a/lua/lsp/lua-ls.lua +++ b/lua/lsp/lua-ls.lua @@ -19,9 +19,23 @@ require'lspconfig'.sumneko_lua.setup { }, workspace = { -- Make the server aware of Neovim runtime files - library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}, + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true + }, maxPreload = 10000 } } } } +if O.lang.lua.autoformat then + require('lv-utils').define_augroups({ + _lua_autoformat = { + { + 'BufWritePre', '*.lua', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + } + }) +end + -- cgit v1.2.3