Open ewoij opened 2 years ago
I had exactly the same problem. Took me a while to figure out why my wildmenu
for :
is broken.
The reasons I don't want to cmp-cmdline
for :
are:
%
to current file does not get rid of the preceding %
itselfI'm guessing others are facing the same issue.
Would be really good if the author or someone else shares a solution.
The vim's key-mapping is global. So I have no solution for this problem...
The vim's key-mapping is global. So I have no solution for this problem...
I have the same issue, cmp-cmdline will break vim-grepper.
vim-grepper creates custom cmdline mapping when it is activated, and restore original maping after exit. So maybe cmp-cmdline could do with the same way? https://github.com/mhinz/vim-grepper/blob/2b93535752ffcb312f9fab73d90e80dc9f2e60fc/plugin/grepper.vim#L764..L827
I don't have a solution to this problem, but a workaround: run the setup for cmdline, but configure it with no sources and to send wildchar
on <Tab>
(or some other key). This effectively restores native cmdline completion and prevents ^I
being inserted when Tab-completing after searching once.
-- `:` cmdline setup.
-- Use cmp.cmdline only for '/' search completion because it does not play nice
-- with:
-- - $ENV_VARS
-- - wildcard expansion (%:h:p, ...)
-- - */** notation
-- Skipping the setup entirely prevents cmdline completion from working after
-- searching once (insertion of '^I' when pressing Tab).
local function send_wildchar()
local char = vim.fn.nr2char(vim.opt.wildchar:get())
local key = vim.api.nvim_replace_termcodes(char, true, false, true)
vim.api.nvim_feedkeys(key, "nt", true)
end
cmp.setup.cmdline(":", {
mapping = {
["<Tab>"] = {c = send_wildchar}
},
sources = cmp.config.sources({})
})
Hello,
I didn't manage to use the completion only for the search. Is it possible?
With the following config, the "default nvim completion" gets disabled after the first search.
Thanks,
Minimal config (nvim 0.7.0):