Closed vunhatchuong closed 1 month ago
Thanks for letting me know! Will fix this soon
Hi @vunhatchuong - I can't seem to reproduce your bug... Do you mind sharing your compile-mode configuration? Or trying to reproduce this with a minimal config?
{
"ej-shafran/compile-mode.nvim",
cmd = { "Compile", "Recompile" },
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>ox", "<cmd>Compile<cr>", desc = "Compile" },
{
"<leader>or",
function()
vim.cmd("Recompile")
end,
desc = "Compile",
},
},
config = function()
vim.g.compile_mode = {}
end,
},
There's some interesting thing here:
Changing every instance of bufnr
to 0
thus reverting this commit "fixes" it.
The doc of [vim.fn.bufnr](https://neovim.io/doc/user/builtin.html#bufnr()) stated that it will return -1
(like my bug) if the buffer doesn't exist.
Seems like Windows doesn't like buffer name with *
suffix.
So these will work:
vim.g.compile_mode = {
buffer_name = "*compilation",
-- buffer_name = "compilation",
}
But not:
vim.g.compile_mode = {
buffer_name = "compilation*",
}
So remove vim.fn.fnameescape
fixes the problem:
ftplugin/compilation.lua:4
- local bufnr = vim.fn.bufnr(vim.fn.fnameescape(config.buffer_name))
+ local bufnr = vim.fn.bufnr(config.buffer_name)
How interesting... I added the fnameescape
to try and fix an issue with this exact thing. I'll give this another look and try to push a fix to nightly sometime today.
Alright; finally managed to properly setup Windows in the CI, and the error is happening there. Will try to solve and hopefully the CI can act as a check for all platforms from now on.
Ahh. This seems to summarize it pretty well:
https://github.com/neovim/neovim/issues/3912#issuecomment-167899148
I'll take a look at removing the fnameescape
call, then. Maybe it's time to change the default compilation buffer name, as well, since these wildcards seem to only cause issues.
Hiya. I believe the changes in 4.0.1 should fix your issue. Mind giving it a look and seeing that everything seems to be fine?
Fixed.
Describe the bug When I run
:Compile
every time after the 1st time the error always appears.To Reproduce Steps to reproduce the behavior:
:Compile
zig build
Expected behavior The compile buffer opens and run the command.
Screenshots
Neovim Version
compile-mode.nvim Version v4.0.0
Additional context