Skip to content

Commit

Permalink
fix: extract blink to their own config and merge config with ai optio…
Browse files Browse the repository at this point in the history
…ns in there
  • Loading branch information
qapquiz committed Jan 1, 2025
1 parent e4a1206 commit 6d92654
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 50 deletions.
73 changes: 73 additions & 0 deletions lua/plugins/blink.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
local configs = require('configs')

local blink_default = {
'saghen/blink.cmp',
lazy = false,
dependencies = {
{ 'rafamadriz/friendly-snippets' },
},
version = '*',

---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
keymap = {
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-e>'] = { 'hide' },
['<CR>'] = { 'select_and_accept', 'fallback' },

['<C-p>'] = { 'select_prev', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },

['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
['<C-f>'] = { 'scroll_documentation_down', 'fallback' },

['<Tab>'] = { 'snippet_forward', 'fallback' },
['<S-Tab>'] = { 'snippet_backward', 'fallback' },
},
completion = {
menu = {
draw = {
columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind", gap = 1 } },
}
}
},
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
signature = { enabled = true }
},
}

local ai_config =
configs.ai.enabled
and {
dependencies = {
{ 'rafamadriz/friendly-snippets' },
{ 'supermaven-inc/supermaven-nvim' },
},
opts = {
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer', 'supermaven' },
providers = {
supermaven = {
name = 'supermaven',
module = 'blink.compat.source',

opts = {}
}
},
cmdline = {}
},
}
}
or {}

local blink_final_config = vim.tbl_deep_extend('force', blink_default, ai_config)

print(vim.inspect(blink_final_config))

return {
{ 'saghen/blink.compat' },
blink_final_config,
}
50 changes: 0 additions & 50 deletions lua/plugins/completions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,54 +71,4 @@ return {
-- },
-- },
-- },

{ 'saghen/blink.compat' },
{
'saghen/blink.cmp',
lazy = false,
dependencies = {
{ 'rafamadriz/friendly-snippets' },
{ 'supermaven-inc/supermaven-nvim' },
},
version = '*',

---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
keymap = {
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-e>'] = { 'hide' },
['<CR>'] = { 'select_and_accept', 'fallback' },

['<C-p>'] = { 'select_prev', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },

['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
['<C-f>'] = { 'scroll_documentation_down', 'fallback' },

['<Tab>'] = { 'snippet_forward', 'fallback' },
['<S-Tab>'] = { 'snippet_backward', 'fallback' },
},
completion = {
menu = {
draw = {
columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind", gap = 1 } },
}
}
},
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer', 'supermaven' },
providers = {
supermaven = {
name = 'supermaven',
module = 'blink.compat.source',

opts = {}
}
},
cmdline = {}
},
signature = { enabled = true }
},
}
}

0 comments on commit 6d92654

Please sign in to comment.