mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 16:41:43 +05:30
feat(nvim): nvim.cmp -> blink.cmp
- Codeium made to work with help from blink.compat - Blink added to lsp capabilities - Catppuccin theme integration for blink
This commit is contained in:
@@ -3,6 +3,15 @@ return {
|
||||
{
|
||||
"Exafunction/codeium.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"saghen/blink.compat",
|
||||
opts = {
|
||||
enable_events = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
cmd = "Codeium",
|
||||
build = ":Codeium Auth",
|
||||
event = "InsertEnter",
|
||||
|
||||
@@ -1,116 +1,128 @@
|
||||
return {
|
||||
{
|
||||
-- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
"saghen/blink.cmp",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
"rafamadriz/friendly-snippets",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"Exafunction/codeium.nvim",
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
"saghen/blink.compat",
|
||||
optional = true,
|
||||
},
|
||||
{
|
||||
"saghen/blink.compat",
|
||||
opts = {
|
||||
enable_events = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = "*",
|
||||
|
||||
opts_extend = {
|
||||
"sources.completion.enabled_providers",
|
||||
"sources.compat",
|
||||
"sources.default",
|
||||
},
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- 'default' for mappings similar to built-in completion
|
||||
-- '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
|
||||
-- See the full "keymap" documentation for information on defining your own keymap.
|
||||
keymap = {
|
||||
preset = "enter",
|
||||
["<C-y>"] = { "select_and_accept" },
|
||||
|
||||
["<Tab>"] = { "snippet_forward", "fallback" },
|
||||
["<S-Tab>"] = { "snippet_backward", "fallback" },
|
||||
|
||||
["<C-p>"] = { "select_prev", "fallback" },
|
||||
["<C-n>"] = { "select_next", "fallback" },
|
||||
|
||||
["<C-b>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-f>"] = { "scroll_documentation_down", "fallback" },
|
||||
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<C-e>"] = { "hide", "fallback" },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
use_nvim_cmp_as_default = true,
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
signature = { enabled = true },
|
||||
|
||||
-- This comes from the luasnip extra, if you don't add it, won't be able to
|
||||
-- jump forward or backward in luasnip snippets
|
||||
snippets = {
|
||||
expand = function(snippet)
|
||||
require("luasnip").lsp_expand(snippet)
|
||||
end,
|
||||
active = function(filter)
|
||||
if filter and filter.direction then
|
||||
return require("luasnip").jumpable(filter.direction)
|
||||
end
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode")
|
||||
end,
|
||||
return require("luasnip").in_snippet()
|
||||
end,
|
||||
jump = function(direction)
|
||||
require("luasnip").jump(direction)
|
||||
end,
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = {
|
||||
"lsp",
|
||||
"buffer",
|
||||
"dadbod",
|
||||
"snippets",
|
||||
"luasnip",
|
||||
"path",
|
||||
"codeium",
|
||||
},
|
||||
cmdline = {},
|
||||
|
||||
providers = {
|
||||
lsp = {
|
||||
score_offset = 1000,
|
||||
},
|
||||
buffer = {
|
||||
score_offset = 950,
|
||||
},
|
||||
dadbod = {
|
||||
name = "Dadbod",
|
||||
module = "vim_dadbod_completion.blink",
|
||||
score_offset = 900,
|
||||
},
|
||||
snippets = {
|
||||
score_offset = 1150,
|
||||
},
|
||||
luasnip = {
|
||||
score_offset = 1100,
|
||||
},
|
||||
path = {
|
||||
score_offset = 750,
|
||||
},
|
||||
codeium = {
|
||||
name = "codeium",
|
||||
module = "blink.compat.source",
|
||||
score_offset = 1200,
|
||||
},
|
||||
},
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
|
||||
-- Adds LSP completion capabilities
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-buffer",
|
||||
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"Exafunction/codeium",
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require("cmp")
|
||||
local defaults = require("cmp.config.default")()
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
luasnip.config.setup({})
|
||||
|
||||
-- vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||
cmp.setup({
|
||||
-- experimental = {
|
||||
-- ghost_text = {
|
||||
-- hl_group = "CmpGhostText",
|
||||
-- },
|
||||
-- },
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "codeium" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<C-x>"] = cmp.mapping.abort(),
|
||||
|
||||
-- Enter to perform the completion
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
select = true,
|
||||
}),
|
||||
["<S-CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
|
||||
-- <C-l> will move you to the right of each of the expansion locations
|
||||
-- <C-h> is similar, except moving you backwards.
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sorting = defaults.sorting,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
version = "v2.*",
|
||||
keys = {
|
||||
{
|
||||
"<tab>",
|
||||
|
||||
@@ -25,8 +25,6 @@ return {
|
||||
{ "<leader>gD", "<cmd>DiffviewOpen<cr>", desc = "Git: Open Diffview against master", mode = { "n" } },
|
||||
{ "<leader>gf", "<cmd>DiffviewFileHistory<cr>", desc = "Git: Show file history", mode = { "n" } },
|
||||
},
|
||||
-- TODO:
|
||||
-- Toggle Diffview keymap
|
||||
},
|
||||
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
|
||||
@@ -11,8 +11,7 @@ return {
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
|
||||
-- Allows extra capabilities provided by nvim-cmp
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"saghen/blink.cmp",
|
||||
},
|
||||
config = function()
|
||||
-- Every time a new file is opened that is associated with
|
||||
@@ -230,6 +229,10 @@ return {
|
||||
-- Ensure the servers and tools above are installed
|
||||
require("mason").setup()
|
||||
|
||||
-- Add completion capabilities
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, require("blink.cmp").get_lsp_capabilities())
|
||||
|
||||
-- Add other tools here that you want Mason to install for you
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
|
||||
@@ -44,6 +44,7 @@ return {
|
||||
},
|
||||
|
||||
-- These were disabled by default
|
||||
blink_cmp = true,
|
||||
diffview = true,
|
||||
fidget = true,
|
||||
lsp_saga = true,
|
||||
|
||||
Reference in New Issue
Block a user