completion.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. local M = {
  2. "saghen/blink.cmp",
  3. dependencies = "rafamadriz/friendly-snippets",
  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. sources = {
  25. default = { "lsp", "path", "snippets", "buffer", "dadbod" },
  26. providers = {
  27. dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
  28. },
  29. },
  30. signature = {
  31. enabled = true,
  32. window = {
  33. border = "single",
  34. },
  35. },
  36. completion = {
  37. list = {
  38. selection = {
  39. auto_insert = true,
  40. preselect = false,
  41. },
  42. },
  43. menu = {
  44. border = "single",
  45. draw = {
  46. components = {
  47. kind_icon = {
  48. ellipsis = false,
  49. text = function(ctx)
  50. local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
  51. return kind_icon
  52. end,
  53. highlight = function(ctx)
  54. local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
  55. return hl
  56. end,
  57. },
  58. },
  59. },
  60. },
  61. },
  62. fuzzy = {
  63. -- Frecency tracks the most recently/frequently used items and boosts the score of the item
  64. use_frecency = true,
  65. -- Proximity bonus boosts the score of items matching nearby words
  66. use_proximity = true,
  67. -- Controls which sorts to use and in which order, falling back to the next sort if the first one returns nil
  68. -- You may pass a function instead of a string to customize the sorting
  69. sorts = { "score", "sort_text" },
  70. },
  71. })
  72. end
  73. return M