mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 16:41:43 +05:30
feat(nvim-code-completion): Updates to blink.nvim config
- Bump version to "1.*" - More community plugins added: emoji, conventional-commits - <C-CR> to accept and NOT select_and_accept - Rounded border - Quickly show documentations - Commandline completion configuration - Codeium plugin configured through blink.compat - File based completion settings for: sql, markdown & gitcommit
This commit is contained in:
@@ -1,38 +1,21 @@
|
|||||||
return {
|
return {
|
||||||
|
{
|
||||||
|
"saghen/blink.compat",
|
||||||
|
lazy = true,
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- codeium
|
-- codeium
|
||||||
{
|
{
|
||||||
"Exafunction/codeium.nvim",
|
"Exafunction/codeium.nvim",
|
||||||
cond = require("config.util").is_not_vscode(),
|
cond = require("config.util").is_not_vscode(),
|
||||||
dependencies = {
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
{
|
|
||||||
"saghen/blink.compat",
|
|
||||||
opts = function()
|
|
||||||
-- Do NOT use if codeium is not loaded
|
|
||||||
local codeium_loaded, _ = pcall(require, "codeium")
|
|
||||||
if not codeium_loaded then
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
return {
|
|
||||||
enable_events = true,
|
|
||||||
sources = {
|
|
||||||
providers = {
|
|
||||||
codeium = {
|
|
||||||
name = "codeium",
|
|
||||||
module = "blink.compat.source",
|
|
||||||
score_offset = 1200,
|
|
||||||
async = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cmd = "Codeium",
|
cmd = "Codeium",
|
||||||
build = ":Codeium Auth",
|
build = ":Codeium Auth",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
opts = {
|
opts = {
|
||||||
|
-- TODO: Get all sources.default on blink.nvim and add "codeium" to the list
|
||||||
|
-- TODO: Get all sources.providers registered on blink.nvim and append "codeium" to it here
|
||||||
enable_cmp_source = true,
|
enable_cmp_source = true,
|
||||||
virtual_text = {
|
virtual_text = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
|
|||||||
@@ -7,20 +7,13 @@ return {
|
|||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
"Exafunction/codeium.nvim",
|
"Exafunction/codeium.nvim",
|
||||||
{
|
"kristijanhusak/vim-dadbod-completion",
|
||||||
"saghen/blink.compat",
|
"moyiz/blink-emoji.nvim",
|
||||||
optional = true,
|
"disrupted/blink-cmp-conventional-commits",
|
||||||
},
|
|
||||||
{
|
|
||||||
"saghen/blink.compat",
|
|
||||||
opts = {
|
|
||||||
enable_events = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- use a release tag to download pre-built binaries
|
-- use a release tag to download pre-built binaries
|
||||||
version = "*",
|
version = "1.*",
|
||||||
|
|
||||||
opts_extend = {
|
opts_extend = {
|
||||||
"sources.completion.enabled_providers",
|
"sources.completion.enabled_providers",
|
||||||
@@ -34,10 +27,10 @@ return {
|
|||||||
-- 'default' for mappings similar to built-in completion
|
-- 'default' for mappings similar to built-in completion
|
||||||
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
|
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
|
||||||
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
|
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
|
||||||
-- See the full "keymap" documentation for information on defining your own keymap.
|
-- 'none' - create all the mappings yourself
|
||||||
keymap = {
|
keymap = {
|
||||||
preset = "none",
|
preset = "none",
|
||||||
["<C-CR>"] = { "select_and_accept" }, -- Ctrl + Enter to accept
|
["<C-CR>"] = { "accept", "fallback" }, -- Ctrl + Enter to accept
|
||||||
["<C-x>"] = { "hide", "fallback" }, -- Ctrl + x to reject
|
["<C-x>"] = { "hide", "fallback" }, -- Ctrl + x to reject
|
||||||
|
|
||||||
["<Tab>"] = { "snippet_forward", "fallback" },
|
["<Tab>"] = { "snippet_forward", "fallback" },
|
||||||
@@ -61,13 +54,14 @@ return {
|
|||||||
keyword = { range = "full" },
|
keyword = { range = "full" },
|
||||||
accept = { auto_brackets = { enabled = false } },
|
accept = { auto_brackets = { enabled = false } },
|
||||||
menu = {
|
menu = {
|
||||||
|
border = "rounded",
|
||||||
draw = {
|
draw = {
|
||||||
treesitter = { "lsp" },
|
treesitter = { "lsp" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
documentation = {
|
documentation = {
|
||||||
auto_show = true,
|
auto_show = true,
|
||||||
auto_show_delay_ms = 200,
|
auto_show_delay_ms = 100,
|
||||||
},
|
},
|
||||||
ghost_text = {
|
ghost_text = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -80,18 +74,82 @@ return {
|
|||||||
-- jump forward or backward in luasnip snippets
|
-- jump forward or backward in luasnip snippets
|
||||||
snippets = { preset = "luasnip" },
|
snippets = { preset = "luasnip" },
|
||||||
|
|
||||||
|
cmdline = {
|
||||||
|
enabled = true,
|
||||||
|
-- use 'inherit' to inherit mappings from top level `keymap` config
|
||||||
|
keymap = { preset = "inherit" },
|
||||||
|
sources = function()
|
||||||
|
local type = vim.fn.getcmdtype()
|
||||||
|
-- Search forward and backward
|
||||||
|
if type == "/" or type == "?" then
|
||||||
|
return { "buffer" }
|
||||||
|
end
|
||||||
|
-- Commands
|
||||||
|
if type == ":" or type == "@" then
|
||||||
|
return { "cmdline" }
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
completion = {
|
||||||
|
trigger = {
|
||||||
|
show_on_blocked_trigger_characters = {},
|
||||||
|
show_on_x_blocked_trigger_characters = {},
|
||||||
|
},
|
||||||
|
list = {
|
||||||
|
selection = {
|
||||||
|
-- When `true`, will automatically select the first item in the completion list
|
||||||
|
preselect = true,
|
||||||
|
-- When `true`, inserts the completion item automatically when selecting it
|
||||||
|
auto_insert = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Whether to automatically show the window when new completion items are available
|
||||||
|
menu = { auto_show = true },
|
||||||
|
-- Displays a preview of the selected item on the current line
|
||||||
|
ghost_text = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
default = {
|
default = {
|
||||||
"lsp",
|
"lsp",
|
||||||
"buffer",
|
"buffer",
|
||||||
"path",
|
"path",
|
||||||
"dadbod",
|
|
||||||
"snippets",
|
"snippets",
|
||||||
"markdown",
|
"codeium",
|
||||||
|
},
|
||||||
|
per_filetype = {
|
||||||
|
sql = { "snippets", "dadbod", "buffer" },
|
||||||
|
markdown = { "markdown", "snippets", "buffer", "path", "emoji" },
|
||||||
|
gitcommit = { "conventional_commits", "emoji", "buffer", "snippets" },
|
||||||
},
|
},
|
||||||
cmdline = {},
|
|
||||||
|
|
||||||
providers = {
|
providers = {
|
||||||
|
codeium = {
|
||||||
|
name = "codeium", -- Cause it's registered on nvim-cmp as "codeium"
|
||||||
|
module = "blink.compat.source",
|
||||||
|
score_offset = 600,
|
||||||
|
},
|
||||||
|
conventional_commits = {
|
||||||
|
name = "Conventional Commits",
|
||||||
|
module = "blink-cmp-conventional-commits",
|
||||||
|
should_show_items = function()
|
||||||
|
return vim.tbl_contains({ "gitcommit" }, vim.o.filetype)
|
||||||
|
end,
|
||||||
|
---@module 'blink-cmp-conventional-commits'
|
||||||
|
---@type blink-cmp-conventional-commits.Options
|
||||||
|
opts = {},
|
||||||
|
score_offset = 700,
|
||||||
|
},
|
||||||
|
emoji = {
|
||||||
|
module = "blink-emoji",
|
||||||
|
name = "Emoji",
|
||||||
|
score_offset = 700,
|
||||||
|
opts = { insert = true },
|
||||||
|
should_show_items = function()
|
||||||
|
return vim.tbl_contains({ "gitcommit", "markdown" }, vim.o.filetype)
|
||||||
|
end,
|
||||||
|
},
|
||||||
lsp = {
|
lsp = {
|
||||||
score_offset = 1000,
|
score_offset = 1000,
|
||||||
},
|
},
|
||||||
@@ -112,6 +170,7 @@ return {
|
|||||||
markdown = {
|
markdown = {
|
||||||
name = "RenderMarkdown",
|
name = "RenderMarkdown",
|
||||||
module = "render-markdown.integ.blink",
|
module = "render-markdown.integ.blink",
|
||||||
|
score_offset = 900,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user