common-config.lua 901 B

1234567891011121314151617181920212223242526272829
  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").update_capabilities(vim.lsp.protocol.make_client_capabilities())
  20. M.capabilities = require("cmp_nvim_lsp").default_capabilities()
  21. M.flags = {
  22. debounce_text_changes = 150,
  23. }
  24. return M