Neovim sync module#
python/src/dotfiles/nvim.py computes sync plans and applies runtime Neovim
state into home/dot_config/nvim.
High-level structure#
nvim.py
|-- snapshot models
| |-- NvimPathPair
| |-- NvimLuaSubdirManifest
| |-- NvimSubdirManifest
| `-- NvimSyncPlan / NvimSyncInfoCounts
|-- abstractions
| |-- ShellOp (writes)
| `-- DiskAccessor (reads)
|-- request models
| |-- NvimSyncWithMimicArgs
| `-- NvimInfoArgs
|-- plan and diff helpers
| `-- managed-surface totals helpers
| |-- _nvim_count_existing_top_level_files
| `-- _nvim_collect_managed_surface_totals
`-- orchestration
|-- _nvim_sync
|-- nvim_sync_with_mimic
`-- nvim_info
Builds a snapshot plan from runtime and local manifests.
Splits file changes into add, update, unchanged buckets.
Removes missing runtime entries and copies changed runtime entries.
Computes managed-surface totals through dedicated helpers before sync-change counts.
Resolves runtime/local paths and branch/worktree prechecks in one place.
Sync flow#
nvim_sync_with_mimicresolves runtime/local paths from request args.It validates runtime git cleanliness and branch policy.
_nvim_syncresolvesShellOpfromdry_runand builds sync plan.Removes explicit top-level targets except
lua.Prunes missing runtime files/directories from local
lua.Copies non-
luabase targets and changed top-level files.Copies changed
luafiles while preserving protected templates.
Info flow#
nvim_collect_sync_info_countscomputes totals and add/update/remove counts from the same plan model used by sync.nvim_infologs those counts and returns the structured summary.
Mimic flow#
nvim_sync_with_mimiccan run sync against a temporary copy of local nvim.It then runs
nvim_infoagainst the mimicked directory to verify no pending managed-surface changes remain.