mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
feat: Luasnip working with blink.cmp
This commit is contained in:
@@ -1,58 +1,54 @@
|
||||
-- https://cmp.saghen.dev/
|
||||
return {
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
enabled = false,
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
--"L3MON4D3/LuaSnip",
|
||||
},
|
||||
version = "v0.*",
|
||||
opts = {
|
||||
appearance = {
|
||||
use_nvim_cmp_as_default = true,
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
signature = { enabled = true },
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
["<C-space>"] = {
|
||||
function(cmp)
|
||||
cmp.show({ providers = { "snippets" } })
|
||||
end,
|
||||
},
|
||||
--["<C-k>"] = { "select_prev", "fallback" },
|
||||
--["<C-j>"] = { "select_next", "fallback" },
|
||||
["<C-n>"] = {
|
||||
function(cmp)
|
||||
if cmp.snippet_active() then
|
||||
return cmp.accept()
|
||||
else
|
||||
return cmp.select_and_accept()
|
||||
end
|
||||
end,
|
||||
"snippet_forward",
|
||||
"fallback",
|
||||
},
|
||||
},
|
||||
-- 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 require("luasnip").in_snippet()
|
||||
-- end,
|
||||
-- jump = function(direction)
|
||||
-- require("luasnip").jump(direction)
|
||||
-- end,
|
||||
-- },
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
enabled = true,
|
||||
dependencies = {
|
||||
-- "rafamadriz/friendly-snippets",
|
||||
{ "L3MON4D3/LuaSnip", version = "v2.*" },
|
||||
},
|
||||
version = "v0.*",
|
||||
opts = {
|
||||
signature = { enabled = true },
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer", "luasnip" },
|
||||
providers = {
|
||||
lsp = {
|
||||
name = "lsp",
|
||||
enabled = true,
|
||||
module = "blink.cmp.sources.lsp",
|
||||
score_offset = 1000, -- higher = higher priority
|
||||
},
|
||||
luasnip = {
|
||||
name = "luasnip",
|
||||
enabled = true,
|
||||
module = "blink.cmp.sources.luasnip",
|
||||
score_offset = 950,
|
||||
},
|
||||
snippets = {
|
||||
name = "snippets",
|
||||
enabled = true,
|
||||
module = "blink.cmp.sources.snippets",
|
||||
score_offset = 900,
|
||||
},
|
||||
},
|
||||
},
|
||||
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 require("luasnip").in_snippet()
|
||||
end,
|
||||
jump = function(direction)
|
||||
require("luasnip").jump(direction)
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
keymap = { preset = "default" },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
enabled = true,
|
||||
enabled = false,
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
|
||||
@@ -3,8 +3,8 @@ return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
--"saghen/blink.cmp",
|
||||
-- "hrsh7th/cmp-nvim-lsp",
|
||||
"saghen/blink.cmp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
@@ -37,9 +37,9 @@ return {
|
||||
automatic_installation = true,
|
||||
})
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
--local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
-- local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
-- local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local opts = { noremap = true, silent = true }
|
||||
local on_attach = function(_, bufnr)
|
||||
opts.buffer = bufnr
|
||||
|
||||
@@ -24,7 +24,7 @@ return {
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
ls.setup({
|
||||
history = true,
|
||||
|
||||
Reference in New Issue
Block a user