Open Janfel opened 2 years ago
I have found a workaround by using sed
to rewrite packer_compiled.lua
on PackerCompileDone
.
function()
local file = require("packer").config.compile_path
if vim.fn.filereadable(file) ~= 1 then return end
local sed = vim.fn.exepath("sed")
if sed == "" then error("Could not find `sed`") end
-- This skips the first line, but line number zero is a GNU extension.
-- https://stackoverflow.com/questions/148451/how-to-use-sed-to-replace-only-the-first-occurrence-in-a-file
local old = [[vim\.api\.nvim_command('packadd packer\.nvim')]]
local new = [[vim\.api\.nvim_command('packadd packer')]]
local sedscript = "1,/"..old.."/ s/"..old.."/"..new.."/"
local cmd = { sed, "--in-place", "--expression", sedscript , "--", file }
return vim.fn.jobstart(cmd, { stdin = "null" })
end
nvim --version
: 0.7.0git --version
: 2.36.1Steps to reproduce
as
key.Actual behaviour
The line
vim.api.nvim_command('packadd packer.nvim')
inpacker_compiled.lua
throws an error becausepacker.nvim
could not be found.Expected behaviour
Packer works regardless of the name it is installed as.
packer files
Irrelevant to this issue.