-
i tried with both preset opts = {
keymap = {
preset = 'none',
['<C-y>'] = { 'accept', 'fallback' },
['<C-p>'] = { 'select_prev', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },
['<C-space>'] = { function(cmp) cmp.show() end },
}, any ideas how to make this work? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
I had worse case none of the keybinding work.
At first I think there may be a keybinding conflict between "nvim-snippets". but if I comment the keybinding config in nvim-snippets it still wont work. I use lazyvim. return {
{
"saghen/blink.compat",
-- use the latest release, via version = '*', if you also use the latest release for blink.cmp
version = "*",
-- lazy.nvim will automatically load the plugin when it's required by blink.cmp
lazy = true,
-- make sure to set opts so that lazy.nvim calls blink.compat's setup
opts = {},
},
{
"saghen/blink.cmp",
-- optional: provides snippets for the snippet source
dependencies = "rafamadriz/friendly-snippets",
-- use a release tag to download pre-built binaries
version = "*",
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@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 = {
-- set to 'none' to disable the 'default' preset
preset = "none",
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide" },
["<C-y>"] = { "select_and_accept" },
["<Enter>"] = { "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" },
},
appearance = {
-- Sets the fallback highlight groups to nvim-cmp's highlight groups
-- Useful for when your theme doesn't support blink.cmp
-- Will be removed in a future release
use_nvim_cmp_as_default = true,
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
},
-- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend`
sources = {
default = { "lsp", "path", "snippets", "buffer" },
-- providers = {
-- -- create provider
-- digraphs = {
-- name = "dictionary", -- IMPORTANT: use the same name as you would for nvim-cmp
-- module = "blink.compat.source",
--
-- -- all blink.cmp source config options work as normal:
-- score_offset = -3,
--
-- -- this table is passed directly to the proxied completion source
-- -- as the `option` field in nvim-cmp's source config
-- --
-- -- this is NOT the same as the opts in a plugin's lazy.nvim spec
-- opts = {
-- -- this is an option from cmp-digraphs
-- keyword_length = 2,
-- },
-- },
-- },
},
},
opts_extend = { "sources.default" },
},
}
Here is my config for nvim-snippets return {
"garymjr/nvim-snippets",
-- keys = {
-- {
-- "<Tab>",
-- function()
-- if vim.snippet.active({ direction = 1 }) then
-- vim.schedule(function()
-- vim.snippet.jump(1)
-- end)
-- return
-- end
-- return "<Tab>"
-- end,
-- expr = true,
-- silent = true,
-- mode = "i",
-- },
-- {
-- "<Tab>",
-- function()
-- vim.schedule(function()
-- vim.snippet.jump(1)
-- end)
-- end,
-- expr = true,
-- silent = true,
-- mode = "s",
-- },
-- {
-- "<S-Tab>",
-- function()
-- if vim.snippet.active({ direction = -1 }) then
-- vim.schedule(function()
-- vim.snippet.jump(-1)
-- end)
-- return
-- end
-- return "<S-Tab>"
-- end,
-- expr = true,
-- silent = true,
-- mode = { "i", "s" },
-- },
-- },
}
|
Beta Was this translation helpful? Give feedback.
-
You can try map another key to see if it still happens again. There may be a conflict with the |
Beta Was this translation helpful? Give feedback.
-
@waikoo Please try using repro.lua with your Blink configuration. If your keymaps work, then it must be a plugin conflict or not. |
Beta Was this translation helpful? Give feedback.
@waikoo Please try using repro.lua with your Blink configuration. If your keymaps work, then it must be a plugin conflict or not.