Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keymap.accept prints my keymap when I press "enter" #47

Closed
strash opened this issue Oct 8, 2024 · 5 comments
Closed

keymap.accept prints my keymap when I press "enter" #47

strash opened this issue Oct 8, 2024 · 5 comments

Comments

@strash
Copy link

strash commented Oct 8, 2024

My blink config:

require("blink.cmp").setup({
	keymap = {
		show = "<C-f>",
		accept = "<CR>",
		select_prev = { "<Up>", "<C-p>" },
		select_next = { "<Down>", "<C-n>" },
		scroll_documentation_up = "<C-k>",
		scroll_documentation_down = "<C-j>",
	},
	highlight = {
		use_nvim_cmp_as_default = true,
	},
	nerd_font_variant = "mono",
	accept = {
		auto_brackets = {
			enabled = false
		}
	},
	trigger = {
		completion = {
			blocked_trigger_characters = { " ", "\n", "\t", "{", "}" },
		},
		signature_help = {
			enabled = true
		}
	},
	windows = {
		documentation = {
			max_width = 90,
			max_height = 47,
		},
	},
})
Screen.Recording.2024-10-09.at.00.36.40.mov
@strash
Copy link
Author

strash commented Oct 8, 2024

Before the v0.2.1 update there was no such issue.

@Saghen
Copy link
Owner

Saghen commented Oct 8, 2024

This keymap code is tricky... please send the output of these two commands

:verbose map <cr>
:verbose imap <cr>

@strash
Copy link
Author

strash commented Oct 8, 2024

:verbose map <cr>

s  <CR>        * <Lua 99: ~/.config/nvim/lua/map.lua:30>                                                                                                                                          
                 scroll down and align the cursor                                                                                                                                                 
        Last set from Lua (run Nvim with -V1 for more details)                                                                                                                                    
n  <CR>        * <Lua 80: ~/.config/nvim/lua/map.lua:30>                                                                                                                                          
                 scroll down and align the cursor                                                                                                                                                 
        Last set from Lua (run Nvim with -V1 for more details) 

:verbose imap <cr>

i  <CR>        *@<Lua 247: ~/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/keymap.lua:47>                                                                                                        
                 blink.cmp                                                                                                                                                                        
        Last set from Lua (run Nvim with -V1 for more details)                                                                                                                                    
i  <CR>        * <Lua 76: ~/.config/nvim/lua/map.lua:30>                                                                                                                                          
                 scroll down and align the cursor                                                                                                                                                 
        Last set from Lua (run Nvim with -V1 for more details) 

@Saghen
Copy link
Owner

Saghen commented Oct 8, 2024

Thanks! Could you send over your code for the two keymaps listed there?

@strash
Copy link
Author

strash commented Oct 8, 2024

You mean this?
~/.config/nvim/lua/map.lua:30

	{
		mode = { "n", "i", "s" },
		key = "<CR>",
		cmd = function()
			if vim.snippet.active() then
				return map_util.wrap_in_cmd("lua vim.snippet.stop()")
			else
				return "<CR>"
			end
		end,
		opts = { desc = "scroll down and align the cursor", expr = true }
	},

@Saghen Saghen closed this as completed in df5c0de Oct 9, 2024
lopi-py pushed a commit to lopi-py/blink.cmp that referenced this issue Oct 10, 2024
lopi-py pushed a commit to lopi-py/blink.cmp that referenced this issue Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants