completion.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. local M = {
  2. "saghen/blink.cmp",
  3. dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" },
  4. version = "v0.*",
  5. }
  6. M.config = function()
  7. require("blink.cmp").setup({
  8. keymap = {
  9. ["<C-space>"] = {
  10. "show",
  11. "show_documentation",
  12. "hide_documentation",
  13. },
  14. ["<C-d>"] = { "hide", "fallback" },
  15. ["<C-c>"] = { "hide", "fallback" },
  16. ["<CR>"] = { "accept", "fallback" },
  17. ["<C-k>"] = { "select_prev", "fallback" },
  18. ["<C-j>"] = { "select_next", "fallback" },
  19. },
  20. appearance = {
  21. use_nvim_cmp_as_default = true,
  22. nerd_font_variant = "mono",
  23. },
  24. snippets = { preset = "luasnip" },
  25. sources = {
  26. default = { "lsp", "path", "snippets", "buffer", "dadbod" },
  27. providers = {
  28. dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
  29. },
  30. },
  31. signature = {
  32. enabled = true,
  33. window = {
  34. border = "single",
  35. },
  36. },
  37. completion = {
  38. list = {
  39. selection = {
  40. auto_insert = true,
  41. preselect = false,
  42. },
  43. },
  44. menu = {
  45. border = "single",
  46. draw = {
  47. components = {
  48. kind_icon = {
  49. ellipsis = false,
  50. text = function(ctx)
  51. local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
  52. return kind_icon
  53. end,
  54. highlight = function(ctx)
  55. local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
  56. return hl
  57. end,
  58. },
  59. },
  60. },
  61. },
  62. },
  63. fuzzy = {
  64. -- Frecency tracks the most recently/frequently used items and boosts the score of the item
  65. use_frecency = true,
  66. -- Proximity bonus boosts the score of items matching nearby words
  67. use_proximity = true,
  68. -- Controls which sorts to use and in which order, falling back to the next sort if the first one returns nil
  69. -- You may pass a function instead of a string to customize the sorting
  70. sorts = { "score", "sort_text" },
  71. },
  72. })
  73. end
  74. return M