diff options
| author | 2026-05-13 13:43:09 +0100 | |
|---|---|---|
| committer | 2026-05-13 13:43:09 +0100 | |
| commit | effc568d9676e061f58d45df2d5c5634ef0f760e (patch) | |
| tree | f75fef6a66452600ed3321ab481d4fb80472da5a | |
| parent | fc09c6d0a9616e8bbf43b65020bc8ba638ad13eb (diff) | |
| download | dotfiles-effc568d9676e061f58d45df2d5c5634ef0f760e.tar.gz dotfiles-effc568d9676e061f58d45df2d5c5634ef0f760e.tar.bz2 dotfiles-effc568d9676e061f58d45df2d5c5634ef0f760e.zip | |
feat(just): add 'update' recipe — system + nvim plugins + mason
New recipes (new 'Updates' section after 'Day-to-day'):
- update: pkg-update nvim-update
- pkg-update: paru -Syu
- nvim-update: nvim --headless +'lua require("config.update").run()'
New dot_config/nvim/lua/config/update.lua drives the headless session:
clean orphan plugins, vim.pack.update with force=true (skips the confirm
buffer since this is unattended; changes still go to nvim-pack.log),
then :MasonToolsUpdateSync — the blocking variant intended for headless
Interactive :PackSync stays unchanged (confirm buffer remains visible
for reviewed updates).
| -rw-r--r-- | dot_config/nvim/lua/config/update.lua | 47 | ||||
| -rw-r--r-- | justfile | 15 |
2 files changed, 62 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/config/update.lua b/dot_config/nvim/lua/config/update.lua new file mode 100644 index 0000000..72cb566 --- /dev/null +++ b/dot_config/nvim/lua/config/update.lua @@ -0,0 +1,47 @@ +-- Headless update orchestrator. Invoked from the justfile via: +-- nvim --headless +'lua require("config.update").run()' +-- +-- Cleans orphan plugins, applies plugin updates without prompting, then +-- runs :MasonToolsUpdateSync (blocking variant intended for headless use). + +local M = {} + +local function say(msg) + io.stdout:write(msg .. "\n") + io.stdout:flush() +end + +local function orphan_names() + return vim + .iter(vim.pack.get()) + :filter(function(x) + return not x.active + end) + :map(function(x) + return x.spec.name + end) + :totable() +end + +function M.run() + local orphans = orphan_names() + if #orphans > 0 then + say( + ("[pack] removing %d orphan(s): %s"):format( + #orphans, + table.concat(orphans, ", ") + ) + ) + vim.pack.del(orphans) + end + + say("[pack] updating plugins…") + vim.pack.update(nil, { force = true }) + + say("[mason] updating tools…") + vim.cmd("MasonToolsUpdateSync") + + vim.cmd("qa!") +end + +return M @@ -20,6 +20,21 @@ sync: apply pkg-fix unit-apply apply: chezmoi apply -S . +# ═══════════════════════════════════════════════════════════════════ +# Updates +# ═══════════════════════════════════════════════════════════════════ + +# Update everything: system packages, Neovim plugins, Mason tools +update: pkg-update nvim-update + +# Upgrade all system + AUR packages +pkg-update: + paru -Syu + +# Update Neovim plugins (vim.pack) and Mason tools in a headless session +nvim-update: + nvim --headless '+lua require("config.update").run()' + # Re-add changes from live files back into the repo; pass a path to target one, or omit for all re-add *paths: #!/usr/bin/env bash |
