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

abbreviations does not work #677

Closed
2 tasks done
Snikimonkd opened this issue Dec 20, 2024 · 1 comment
Closed
2 tasks done

abbreviations does not work #677

Snikimonkd opened this issue Dec 20, 2024 · 1 comment
Labels
bug Something isn't working cmdline Related to the command line

Comments

@Snikimonkd
Copy link

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

i have this remaps and somehow blink.cmp breaks them

vim.cmd("cnoreabbrev W! w!")
vim.cmd("cnoreabbrev Q! q!")
vim.cmd("cnoreabbrev Qall! qall!")
vim.cmd("cnoreabbrev Wall! wall!")
vim.cmd("cnoreabbrev Wall wall")
vim.cmd("cnoreabbrev Wq wq")
vim.cmd("cnoreabbrev Wa wa")
vim.cmd("cnoreabbrev wQ wq")
vim.cmd("cnoreabbrev WQ wq")
vim.cmd("cnoreabbrev W w")
vim.cmd("cnoreabbrev Q q")

Relevant configuration

{
		"saghen/blink.cmp",
		lazy = false, -- lazy loading handled internally

		version = "v0.*",
		opts = {
			keymap = {
				preset = "default",
				["<C-k>"] = { "select_prev", "fallback" },
				["<C-j>"] = { "select_next", "fallback" },
				["<CR>"] = { "accept", "fallback" },
			},

			sources = {
				default = { "lsp", "path", "buffer" },
				cmdline = function()
					local type = vim.fn.getcmdtype()
					-- Search forward and backward
					if type == "/" or type == "?" or type == ":s" then
						return { "buffer" }
					end
					-- Commands
					if type == ":" then
						return {}
					end
					return {}
				end,
			},

			completion = {
				list = {
					selection = "manual",
				},
				accept = {
					auto_brackets = {
						enabled = true,
					},
				},
				menu = {
					enabled = true,
					border = "rounded",
					winhighlight = "Normal:None,FloatBorder:FloatBorder,Search:None",
					scrolloff = 2,
					scrollbar = true,
					draw = {
						padding = { 1, 0 },
						columns = {
							{ "label", gap = 2 },
							{ "kind", "source_name", gap = 1 },
						},
						components = {
							label = {
								text = function(ctx)
									return ctx.label -- .. ctx.label_detail
								end,
							},
							source_name = {
								text = function(ctx)
									return "[" .. ctx.source_name .. "]"
								end,
							},
						},
					},
				},

				-- docs
				documentation = {
					auto_show = true,
					auto_show_delay_ms = 0,
					window = {
						border = "rounded",
						winhighlight = "Normal:None,FloatBorder:FloatBorder,Search:None",
					},
				},
			},
		},
		opts_extend = { "sources.default" },
	},

neovim version

NVIM v0.10.2 Build type: Release LuaJIT 2.1.1727870382 Run "nvim -V1 -v" for more info

blink.cmp version: branch, tag, or commit

ca05bb3

@Snikimonkd Snikimonkd added the bug Something isn't working label Dec 20, 2024
@Saghen Saghen added the cmdline Related to the command line label Dec 20, 2024
@Saghen
Copy link
Owner

Saghen commented Dec 29, 2024

This seems to be a limitation or bug with neovim where using feedkeys ignores abbreviations. This may be solved by #487 but you may want to ask upstream about this

Reproduce with:

vim.cmd('cnoreabbrev Wa wa')
vim.keymap.set('c', '<CR>', function()
	vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<CR>', true, false, true), 'n', false)
end, { expr = true, noremap = true })

@Saghen Saghen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cmdline Related to the command line
Projects
None yet
Development

No branches or pull requests

2 participants