Browse Source

👌 IMPROVE: autoformat lua

pull/174/head
Xin.Chen 3 years ago
parent
commit
57fa8ef0db
  1. 3
      lua/lsp/lang/lua.lua

3
lua/lsp/lang/lua.lua

@ -34,12 +34,15 @@ local opts = {
-- 禁用格式化功能,交给专门插件插件处理
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- 绑定快捷键
require("keybindings").mapLSP(buf_set_keymap)
-- 保存时自动格式化
vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()")
end,
}

Loading…
Cancel
Save