completion.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. signature = {
  25. enabled = true,
  26. window = {
  27. border = "single",
  28. },
  29. },
  30. completion = {
  31. list = {
  32. -- Controls how the completion items are selected
  33. -- 'preselect' will automatically select the first item in the completion list
  34. -- 'manual' will not select any item by default
  35. -- 'auto_insert' will not select any item by default, and insert the completion items automatically when selecting them
  36. selection = "auto_insert",
  37. },
  38. menu = {
  39. border = "single",
  40. draw = {
  41. components = {
  42. kind_icon = {
  43. ellipsis = false,
  44. text = function(ctx)
  45. local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
  46. return kind_icon
  47. end,
  48. highlight = function(ctx)
  49. local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
  50. return hl
  51. end,
  52. },
  53. },
  54. },
  55. },
  56. },
  57. fuzzy = {
  58. -- When enabled, allows for a number of typos relative to the length of the query
  59. -- Disabling this matches the behavior of fzf
  60. use_typo_resistance = true,
  61. -- Frecency tracks the most recently/frequently used items and boosts the score of the item
  62. use_frecency = true,
  63. -- Proximity bonus boosts the score of items matching nearby words
  64. use_proximity = true,
  65. -- Controls which sorts to use and in which order, falling back to the next sort if the first one returns nil
  66. -- You may pass a function instead of a string to customize the sorting
  67. sorts = { "score", "sort_text" },
  68. },
  69. })
  70. end
  71. return M