ThePrimeagen/init.lua

E492: Not an editor command: PackerSync

Jubijub opened this issue · 7 comments

Issue : upon relaunching nvim, commands like :PackerSync show the error message : "E492: Not an editor command: PackerSync"
Going to /lua/[your_name]/packer.lua and :so the file fixes the issue, so I figured this packer.lua never gets loaded.

I did compare my setup to this very config and have the same settings, but I think I found a possible cause : in /lua/[your_name]/init.lua, we actively require the packages [your_name].remap and [your_name].set, but we never require [your_name].packer

I tried adding this to my /lua/[your_name]/init.lua and the problem goes away.

require("jubi.remap")
require("jubi.set")
require("jubi.packer")

because it not suppose to run everytime. Like I will only run packer when I need to update something. go to packer.lua :so :PackerSync.

While I agree with the idea, this is not easily understood if one hasn't watched the video.
Maybe a small comment or so in lua/theprimeagen/init.lua or packer.lua could clarify this a little bit.

Maybe is normal for vim user, bucause this action take no though. Is like the basic configuration step in my mind. Setting up zsh is like this too, config then sourse the file if I don’t want to relaunch the terminal.

Note to anyone having issues loading files: I'd double check your file configuration, ensuring files and folders are all where they are supposed to be. I'd also suggest adding

local filename = function()
  local str = debug.getinfo(2, "S").source:sub(2)
  return str:match("^.*/(.*).lua$") or str
end
print(filename());

to each *.lua for debugging.

because it not suppose to run everytime. Like I will only run packer when I need to update something. go to packer.lua :so :PackerSync.

What is the benefit of NOT sourcing packer.lua ? on a modern computer I doubt this slows down nvim that much (mine does start instantly still), and that means I can simply do :PackerSync to update my plugins.
What is the benefit of the extra friction ?

In any case, it could be worth documenting somewhere that this is required, as it's not obvious from watching the video.

I don't think there really is a benefit not to sourcing it, I'd also use the autobootstrapping feature so packer can install itself XD

zaddok commented

I get why some would argue it shouldn't be sourced. If so, however, it'd be good if people teaching how to use packer would note that this is a thing. I am sure we have not been the first people to stumble across this issue and be confused.

I am happy this issue/ticket is here, it stops me wondering what is wrong with my setup.