nvim-cmp
nvim-cmp copied to clipboard
cmdline input method (@) completion failed int filetype c files
FAQ
- [X] I have checked the FAQ and it didn't resolve my problem.
Announcement
- [X] I have checked Breaking change announcement.
Minimal reproducible full config
- mini.lua
vim.opt.runtimepath:remove(vim.fn.stdpath("config"))
vim.opt.packpath:remove(vim.fn.stdpath("data") .. "/site")
vim.opt.termguicolors = true
vim.opt.laststatus = 0
local test_dir = "/tmp/nvim-config"
vim.opt.runtimepath:append(vim.fn.expand(test_dir))
vim.opt.packpath:append(vim.fn.expand(test_dir))
-- install packer
local install_path = test_dir .. "/pack/packer/start/packer.nvim"
local install_plugins = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
vim.cmd("packadd packer.nvim")
install_plugins = true
end
local packer = require("packer")
packer.init({
package_root = test_dir .. "/pack",
compile_path = test_dir .. "/plugin/packer_compiled.lua",
})
packer.startup(function(use)
use("wbthomason/packer.nvim")
use('hrsh7th/cmp-path')
use('hrsh7th/cmp-cmdline')
use('hrsh7th/nvim-cmp')
if install_plugins then
packer.sync()
end
end)
local cmp = require'cmp'
cmp.setup({
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'cmdline' },
})
})
cmp.setup.cmdline({':', '@'}, {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
- nvim --clean -u mini.lua test.c
- steps video
https://github.com/hrsh7th/nvim-cmp/assets/1296332/86c61c48-bc5b-4621-9390-f3e916a9785c
Description
using vim.fn.input method on command mode, some filetypes cannot path complete correctly, eg: c files.
Steps to reproduce
-
open a suffix c file
-
command mode input:
call input('from dir@:', '/usr/local/share/nvim', 'dir')
-
backsapce some characters of the path (see video above)
-
you will see somewrong.
-
if
set filetype=txt
, reproduce the steps above , that's ok.
Expected behavior
hope the c file @ completion correctly on the cmdline.
Actual behavior
no path completion.
Additional context
No response
The video seems broken.
same problem