packer.nvim
packer.nvim copied to clipboard
packer.nvim not working when shellslash is set
-
nvim --version
:
NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilato da runneradmin@fv-az320-113
Features: -acl +iconv +tui
See ":help feature-compile"
file vimrc di sistema: "$VIM\sysinit.vim"
$VIM di riserva: "C:/Program Files/nvim/share/nvim"
-
git --version
: 2.31.1.windows.1 - Operating system/version: Windows 10
- Terminal name/version: Windows Terminal
Steps to reproduce
Clone packer.nvim in the folder ~/AppData/Local/nvim-data/site/pack/packer/opt/packer.nvim (I've also tried creating it in the "start" directory instead of "opt")
Create an init.lua file with the following option:
vim.o.shellslash = true
-- Only if it's in the "opt" directory
vim.cmd [[packadd packer.nvim]]
-- Just a few plugins to show the problem
return require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'kyazdani42/nvim-web-devicons'
use 'EdenEast/nightfox.nvim'
use {
'nvim-lualine/lualine.nvim',
config = function()
require('lualine').setup({})
end
}
end)
Actual behaviour
When I launch ":PackerSync" it asks to remove the "packer.nvim" folder in the "opt" directory. After accepting, it installs all other modules, but at the next restart it will give an error, saying that "packer.nvim" cannot be found. It will do this even if you activate "shellslash" after having a working configuration, and then run ":PackerSync"
Expected behaviour
The same that it does when "shellslash" is not set: it doesn't ask to remove the "packer.nvim" folder in the "opt" directory and the plugin system works without any error.
packer files
packer log file
I couldn't find any log file
packer compiled file
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "C:\\Users\\Test\\AppData\\Local\\Temp/nvim\\packer_hererocks\\2.1.0-beta3\\share\\lua\\5.1\\?.lua;C:\\Users\\Test\\AppData\\Local\\Temp/nvim\\packer_hererocks\\2.1.0-beta3\\share\\lua\\5.1\\?\\init.lua;C:\\Users\\Test\\AppData\\Local\\Temp/nvim\\packer_hererocks\\2.1.0-beta3\\lib\\luarocks\\rocks-5.1\\?.lua;C:\\Users\\Test\\AppData\\Local\\Temp/nvim\\packer_hererocks\\2.1.0-beta3\\lib\\luarocks\\rocks-5.1\\?\\init.lua"
local install_cpath_pattern = "C:\\Users\\Test\\AppData\\Local\\Temp/nvim\\packer_hererocks\\2.1.0-beta3\\lib\\lua\\5.1\\?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["EdenEast/nightfox.nvim"] = {
loaded = true,
path = "C:\\Users\\Test\\AppData\\Local\\nvim-data\\site\\pack/\\packer\\start\\EdenEast/nightfox.nvim",
url = "https://github.com/EdenEast/nightfox.nvim"
},
["kyazdani42/nvim-web-devicons"] = {
loaded = true,
path = "C:\\Users\\Test\\AppData\\Local\\nvim-data\\site\\pack/\\packer\\start\\kyazdani42/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
},
["nvim-lualine/lualine.nvim"] = {
config = { "\27LJ\2\n]\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\foptions\1\0\0\1\0\1\17globalstatus\2\nsetup\flualine\frequire\0" },
loaded = true,
path = "C:\\Users\\Test\\AppData\\Local\\nvim-data\\site\\pack/\\packer\\start\\nvim-lualine/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["wbthomason/packer.nvim"] = {
loaded = true,
path = "C:\\Users\\Test\\AppData\\Local\\nvim-data\\site\\pack/\\packer\\start\\wbthomason/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
}
}
time([[Defining packer_plugins]], false)
-- Config for: nvim-lualine/lualine.nvim
time([[Config for nvim-lualine/lualine.nvim]], true)
try_loadstring("\27LJ\2\n]\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\foptions\1\0\0\1\0\1\17globalstatus\2\nsetup\flualine\frequire\0", "config", "nvim-lualine/lualine.nvim")
time([[Config for nvim-lualine/lualine.nvim]], false)
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end
Did some troubleshooting: Even if I don't let him remove the packer.nvim directory, the modules are not loaded. After some digging through the code, I've found the culprit, and made a fork to fix this problem. Now the plugins load but, for some reason, packer still wants to uninstall itself (always asking for "Removing directories (packer.nvim)"). I couldn't find out why this happens. Will do some more digging, but if anyone has some informations on that regard, it could be very helpful 🙂
Checked in my forked version, and now the shellslash option works without issue. I've created a pull request about this
+1 on this, it took lots of frustrating debugging to figure out that shellslash
was the problem here. At least for now, I've switched to paq-nvim
, which does not exhibit this problem.