Skip to content

How can I set mapping for search mode but not for command line mode? #130

@ai4bing

Description

@ai4bing

Hi, I'd like to use cmp-cmdline for only the search mode, but it seems to also have effect on the cmdline mode. Once search mode is triggered, the function of the Tab key in cmdline mode changes as well, and so the builtin cmdline completion fails to work. Is there a way to prevent this? For some reason I want to avoid using your cmdline completion.

Below is my minimal config (neovim with lazy.nvim)
The builtin cmdline completion dies after pressing / and then <BS>

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"--branch=stable",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	spec = {
		{
			"hrsh7th/nvim-cmp",
			dependencies = { "hrsh7th/cmp-cmdline" },
			config = function()
				require("cmp").setup.cmdline({ "/", "?" }, { mapping = { ["<Tab>"] = { c = function() end } } })
			end,
		},
	},
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions