b0o / nvim-conf

☄ Maddison's Neovim configuration!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help with bootstrap

tsyroid opened this issue · comments

[question]?? Don't really feel this is an 'issue', so feel free to delete once read; just didn't know how else to contact you. I'm not a twitter user.

Hi Maddison!

I've been poking around your nvim-config files the past few days, and I see all kinds of interesting/new ways of doing things I'd like to explore. And the way I typically do that is to install the config locally and hack. Problem is I can't seem to figure out how to bootstrap your config. Which is really annoying to me 😏 as I've worked through this same problem a kazillion times in the last 8 months and always managed to figure things out -- eventually. But today I'm officially stumped.

I've tried multiple renditions, but they all roughly look like this:

  • clone your nvim-conf repo into ~/.dotfiles/config/nvim (I'm on macOS).
  • nvim.
  • fails to load impatient (which it should); then fails on init.lua -- module feline not found.
  • OK, packer.nvim is not being installed for some reason, so I install it manually.
  • restart, try a PackerSync; nadda; packer's not being initialized.
  • initialize manually - :lua require('packer').init()
  • now I can PackerSync but packer first wants to uninstall itself. No packer, that's not what I want.
  • if I say 'ok' packer uninstalls itself (no, it does not move itself to opt; just uninstalls) and we're back to square one.
  • if I say 'no' packer goes off, trundles away for a spell, then dies with an obscure error I've never seen before.
  • the error is async.lua -- attempt to index local 'display-win' with a non-something-or-another

As noted, I've tried multiple different incantations on the above, but I always ultimately end up in the same spot.

Am I missing something simple? Is there a 'secret sauce' buried somewhere deep in your code's logic? Could use a little guidance.

TIA,
/tom

Hi Tom! Thanks for the report. I had not previously paid much attention to bootstrapping or portability. I've now gone through and tried to fix things up to make bootstrapping possible and to make things as portable as I can.

Mind giving it another try? Before running, please delete ~/.local/share/nvim, ~/.cache/nvim, and ~/.config/nvim/plugin/packer_compiled.lua (make backups if necessary).

Final note, my config requires nvim v0.7 or greater, and I've only tested with luajit > v2.0.5.

No worries! It will save me time in the future when I need to set up a new machine.

Glad you got it working!

During initial config/bootstrap/setup, when
you get over 60-70 plugins (or when you’re background compiling a plugin,
as Mat Jones and I discovered with his dash.nvim plugin) packer has a
tendency to timeout

Yes I noticed this too when testing on my MacBook! Very annoying. I was able to fix (or at least mitigate) it by setting packer's config.max_jobs lower. I have updated it to use $(nproc) concurrent jobs:

packer.startup {
startup,
config = {
max_jobs = tonumber(vim.fn.system 'nproc 2>/dev/null || echo 8'),

When I was testing on my MacBook with no job limit, I saw a few error messages relating to 'too many file descriptors'. I haven't experienced that issue on my desktop even with no max_jobs limit, maybe because I've upped my file descriptor limit.

On your second point, I have set up an autocommand that runs PackerCompile whenever lua/user/plugins.lua is written:

autocmd('BufWritePost', {
pattern = vim.fn.stdpath 'config' .. '/lua/user/plugins.lua',
callback = function()
vim.schedule(require('user.fn').packer_compile)
end,
})

Do you prefer I fork and send you a PR?, open an issue?, or just send you an email?

Any of the above!

Awesome, glad it’s working!

By the way, one thing I’ve noticed is that, on my Mac, using any luarocks packages caused the Packer sync to hang. Works fine on Linux so not sure what that’s about.