]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nvim/lua/plugins/blink-cmp.lua
neovim: configure, using ghostty and tmux
[julm/julm-nix.git] / home-manager / profiles / nvim / lua / plugins / blink-cmp.lua
1 -- Performant, batteries-included completion plugin for Neovim.
2 -- https://github.com/Saghen/blink.cmp
3 return {
4 "blink.cmp",
5 event = "InsertEnter",
6 after = function()
7 require("blink-cmp").setup({
8 -- Enables keymaps, completions and signature help when true (doesn't apply to cmdline or term)
9 --
10 -- If the function returns 'force', the default conditions for disabling the plugin will be ignored
11 -- Default conditions: (vim.bo.buftype ~= 'prompt' and vim.b.completion ~= false)
12 -- Note that the default conditions are ignored when `vim.b.completion` is explicitly set to `true`
13 --
14 -- Exceptions: vim.bo.filetype == 'dap-repl'
15 --enabled = function()
16 -- return not vim.tbl_contains({ "lua", "markdown" }, vim.bo.filetype)
17 --end,
18
19 -- Disable cmdline
20 -- cmdline = { enabled = false },
21
22 completion = {
23 -- 'prefix' will fuzzy match on the text before the cursor
24 -- 'full' will fuzzy match on the text before _and_ after the cursor
25 -- example: 'foo_|_bar' will match 'foo_' for 'prefix' and 'foo__bar' for 'full'
26 keyword = { range = "prefix" },
27
28 -- Disable auto brackets
29 -- NOTE: some LSPs may add auto brackets themselves anyway
30 accept = { auto_brackets = { enabled = false } },
31 list = {
32 selection = {
33 preselect = true,
34 auto_insert = true,
35 },
36 },
37 -- or set via a function
38 --list = {
39 -- selection = {
40 -- preselect = function(ctx)
41 -- return vim.bo.filetype ~= "markdown"
42 -- end,
43 -- },
44 --},
45
46 menu = {
47 auto_show = true,
48
49 -- nvim-cmp style menu
50 --draw = {
51 -- columns = {
52 -- { "label", "label_description", gap = 1 },
53 -- { "kind_icon", "kind" },
54 -- },
55 --},
56 },
57
58 -- Show documentation when selecting a completion item
59 documentation = { auto_show = true, auto_show_delay_ms = 2000 },
60
61 -- Whether to display a preview of the selected item on the current line
62 ghost_text = { enabled = false },
63 },
64 keymap = {
65 -- set to 'none' to disable the 'default' preset
66 preset = "none",
67
68 ["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
69 ["<C-e>"] = { "hide", "fallback" },
70 ["<CR>"] = { "accept", "fallback" },
71
72 ["<Tab>"] = { "snippet_forward", "fallback" },
73 ["<S-Tab>"] = { "snippet_backward", "fallback" },
74
75 ["<Up>"] = { "select_prev", "fallback" },
76 ["<Down>"] = { "select_next", "fallback" },
77 ["<C-i>"] = { "select_prev", "fallback_to_mappings" },
78 ["<C-k>"] = { "select_next", "fallback_to_mappings" },
79
80 ["<C-j>"] = { "scroll_documentation_up", "fallback" },
81 ["<C-l>"] = { "scroll_documentation_down", "fallback" },
82
83 ["<C-n>"] = { "show_signature", "hide_signature", "fallback" },
84 },
85
86 sources = {
87 -- Remove 'buffer' if you don't want text completions,
88 -- by default it's only enabled when LSP returns no items
89 default = { "lsp", "path", "snippets", "buffer" },
90 },
91
92 -- Use a preset for snippets, check the snippets documentation for more information
93 snippets = { preset = "default" }, -- | "luasnip" | "mini_snippets" | "vsnip"
94
95 -- Experimental signature help support
96 signature = { enabled = true },
97 })
98 end,
99 }