Skip to content

Refactor/vim.pack#2005

Open
oriori1703 wants to merge 6 commits intomasterfrom
refactor/vim.pack
Open

Refactor/vim.pack#2005
oriori1703 wants to merge 6 commits intomasterfrom
refactor/vim.pack

Conversation

@oriori1703
Copy link
Copy Markdown
Collaborator

@oriori1703 oriori1703 commented Apr 20, 2026

Migrate from lazy.nvim to vim.pack.

Caution

This changes a lot of the config, so I'm looking for any
feedback about the new structure / explanations.

Tasks / need feedback:

  • Choose between one big vim.pack.add in the beginning vs vim.pack.add near each relevant require
  • Better doc strings for vim.pack
  • Measure the startuptime diff
  • Maybe add more lazy loading for heavier plugins? Seems like the performance is good enough without it :)
    • If so, should it be using plain autocmds or using mini's MiniMisc.safely()

If you want to make it easier to see the diff, I suggest cloning and running git diff --ignore-all-space --ignore-blank-lines c4605421e52ae77f04fcf2f56d3bbb7a174e7142 (or the commit id of the first commit, if I rebase this branch)

fixes #1630

@nathanzeng
Copy link
Copy Markdown
Contributor

Great work, I am strongly in favor of using vim.pack

Startup Time Diff
This will differ based on hardware, but I was getting 65-75ms with this branch and 42-47ms with the master branch.
I measured using nvim --startuptime startup.log and looking at the bottom of the log file.

Lazy Loading
I don't think it's necessary, but maybe add a note saying to look into autocommands, MiniMisc, lazy.nvim, etc. if concerned.

@oriori1703
Copy link
Copy Markdown
Collaborator Author

I also did some testing of my own and the results are promising :)

It seems that after adding vim.loader.enable the vim.pack is only 3-4 ms slower than lazy (both of them were measured after a couple of restarts to allow them to compile the bytecode).

lazy.nvim (master 9b4fbc5) vim.pack (18c335c) vim.pack + vim.loader (bcf7a2c)
064.016 094.045 067.264

Relevant system info:

orip@Ori-pc ~/.c/upstream-kickstart (refactor/vim.pack)> inxi
CPU: 8-core AMD Ryzen 7 5800X (-MT MCP-) speed/min/max: 4195/614/5363 MHz
Kernel: 7.0.0-200.nobara.fc43.x86_64 x86_64 Up: 2d 13h 8m
Mem: 9.5/31.25 GiB (30.4%) Storage: 5.48 TiB (12.0% used) Procs: 511
Shell: fish inxi: 3.3.40

orip@Ori-pc ~/.c/upstream-kickstart (refactor/vim.pack)> nvim --version
NVIM v0.12.1
Build type: Release
LuaJIT 2.1.1774638290

orip@Ori-pc ~/.c/upstream-kickstart (refactor/vim.pack)> ghostty --version
Ghostty 1.3.1

Version
  - version: 1.3.1
  - channel: stable
Build Config
  - Zig version   : 0.15.2
  - build mode    : .ReleaseFast
  - app runtime   : .gtk
  - font engine   : .fontconfig_freetype
  - renderer      : renderer.generic.Renderer(renderer.OpenGL)
  - libxev        : io_uring
  - kernel version: 7.0.0-200.nobara.fc43.x86_64
  - desktop env   : other
  - GTK version   :
    build         : 4.20.3
    runtime       : 4.20.4
  - libadwaita    : enabled
    build         : 1.8.4
    runtime       : 1.8.5
  - libX11        : enabled
  - libwayland    : enabled

@feketegy
Copy link
Copy Markdown
Contributor

I just converted my own configs to use vim.pack exclusively without any issues; and the startup time is not noticeable at all between vim.pack and lazy.nvim.

Given that the current config uses lazy require at each relevant point in the file, I would favor replicating that with vim.pack. I think it would be clearer for users that all related code are grouped together.

@oriori1703 oriori1703 force-pushed the refactor/vim.pack branch 3 times, most recently from e26f2ac to e4916fd Compare April 23, 2026 22:52
@oriori1703
Copy link
Copy Markdown
Collaborator Author

I reordered the sections a bit, and surrounded each of them do ... end so it would be easier to know where they start/end.
This also makes them foldable if it is enabled (maybe we should explain that and enable it by default?).

I think this is pretty much ready, so I would love to hear some feedback before merging - especially about the comments, explanations, and overall structure :)

@oriori1703 oriori1703 marked this pull request as ready for review April 23, 2026 22:58
Comment thread init.lua Outdated
Comment thread init.lua Outdated
@Christoph-Raab
Copy link
Copy Markdown

I don't have any opinion on lazy/pack.

Just the request, if kickstart switches to vim.pack, please add a doc for how to migrate lazy based config for the newbs.

And maybe add a min Version check for vim 0.12 somewhere.

@nathanzeng
Copy link
Copy Markdown
Contributor

@Christoph-Raab In case you are looking for some resources to get started with right now, I would recommend reading this blog from the creator of vim.pack. It's got plenty of resources and a linked youtube video as well. The relevant section where migration from lazy.nvim is discussed is here but I would suggest reading the entire thing start to finish.

@roland-5
Copy link
Copy Markdown

I think vim.pack.add near each relevant require is better option than one big vim.pack.add in the beginning.

@oriori1703
Copy link
Copy Markdown
Collaborator Author

I think vim.pack.add near each relevant require is better option than one big vim.pack.add in the beginning.

I have added this in the latest commit. WDYT?

@roland-5
Copy link
Copy Markdown

roland-5 commented May 3, 2026

It looks so much better now, it's much clearer and easier for beginners to see what came from where and what activated it. As someone who uses the vanilla version of kickstart.nvim, I really like it.

@roland-5
Copy link
Copy Markdown

roland-5 commented May 3, 2026

I must admit that if there are any differences in file opening speed or performance, I don't see them between lazy.nvim (master) and vim.pack + vim.loader (f9b6223) - or maybe my eyes are that bad.

Comment thread lua/custom/plugins/init.lua Outdated
@oriori1703 oriori1703 force-pushed the refactor/vim.pack branch 5 times, most recently from ffcbda1 to 8f8a272 Compare May 4, 2026 22:17
@oriori1703 oriori1703 force-pushed the refactor/vim.pack branch from 8f8a272 to 065d14f Compare May 4, 2026 22:19
@oriori1703 oriori1703 force-pushed the refactor/vim.pack branch from 065d14f to 2fccee4 Compare May 4, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use vim.pack as package manager when Nvim 0.12 is released

6 participants