common-config.lua 792 B

12345678910111213141516171819202122232425262728
  1. local M = {}
  2. M.keyAttach = function(bufnr)
  3. local function buf_set_keymap(mode, lhs, rhs)
  4. vim.keymap.set(mode, lhs, rhs, { noremap = true, silent = true, buffer = bufnr })
  5. end
  6. -- 绑定快捷键
  7. require("keybindings").mapLSP(buf_set_keymap)
  8. end
  9. -- 禁用格式化功能,交给专门插件插件处理
  10. M.disableFormat = function(client)
  11. if vim.fn.has("nvim-0.9") == 1 then
  12. client.server_capabilities.documentFormattingProvider = false
  13. client.server_capabilities.documentRangeFormattingProvider = false
  14. else
  15. client.resolved_capabilities.document_formatting = false
  16. client.resolved_capabilities.document_range_formatting = false
  17. end
  18. end
  19. M.capabilities = require("cmp_nvim_lsp").default_capabilities()
  20. M.flags = {
  21. debounce_text_changes = 150,
  22. }
  23. return M