diff --git a/README.md b/README.md index a0e27ac..45bde6e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ - [x] support for Plugin.lock - [ ] health checks: check merge conflicts async -- [ ] defaults for git log +- [x] defaults for git log - [x] view keybindings for update/clean/... - [x] add profiler to view - [x] add buttons for actions @@ -38,6 +38,17 @@ - [ ] use uv file watcher to check for config changes - [x] clear errors - [x] add support for versions `git tag --sort v:refname` -- [ ] rename requires to deps +- [x] rename requires to dependencies - [x] move tasks etc to Plugin.state - [ ] allow setting up plugins through config +- [ ] handlers imply opt +- [ ] dependencies imply opt for deps +- [x] fix local plugin spec + +## 📦 Differences with Packer + +- **Plugin Spec**: + + - `setup` => `init` + - `requires` => `dependencies` + - `as` => `name` diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 2b3930b..800eefb 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -27,6 +27,11 @@ M.defaults = { task = "✔ ", }, }, + git = { + -- defaults for `Lazy log` + log = { "-10" }, -- last 10 commits + -- log = { "--since=3 days ago" }, -- commits from the last 3 days + }, } M.ns = vim.api.nvim_create_namespace("lazy") diff --git a/lua/lazy/manage/task/git.lua b/lua/lazy/manage/task/git.lua index 1371194..0055acc 100644 --- a/lua/lazy/manage/task/git.lua +++ b/lua/lazy/manage/task/git.lua @@ -1,19 +1,20 @@ local Util = require("lazy.util") local Git = require("lazy.manage.git") local Lock = require("lazy.manage.lock") +local Config = require("lazy.core.config") ---@type table local M = {} M.log = { - ---@param opts {since?: string, updated?:boolean, check?: boolean} + ---@param opts {updated?:boolean, check?: boolean} skip = function(plugin, opts) if opts.updated and not (plugin._.updated and plugin._.updated.from ~= plugin._.updated.to) then return true end return not Util.file_exists(plugin.dir .. "/.git") end, - ---@param opts {since?: string, updated?:boolean, check?:boolean} + ---@param opts {args?: string[], updated?:boolean, check?:boolean} run = function(self, opts) local args = { "log", @@ -30,10 +31,8 @@ M.log = { local info = assert(Git.info(self.plugin.dir)) local target = assert(Git.get_target(self.plugin)) table.insert(args, info.commit .. ".." .. target.commit) - elseif opts.since then - table.insert(args, "--since=" .. (opts.since or "3 days ago")) else - table.insert(args, "-10") + vim.list_extend(args, opts.args or Config.options.git.log) end self:spawn("git", {