diff --git a/README.md b/README.md index d722451..f09af9d 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,12 @@ return { across all boards (read-only — items show their `[board]`; only open-link is offered). - `:ShepherdStats` — open shepherd's stats charts in the floating terminal. -- `:ShepherdBoards` — pick a board (shows `open/total`, `*` marks current), - then **switch** the session to it, **rename**, **archive**, or **delete** it - (delete shows a dry-run preview and asks to confirm first). Switching overrides - the configured `board` until you switch again or restart. +- `:ShepherdBoards` — pick a board (shows `open/total`, `*` marks current, and + its working **dir** if set), then **switch** the session to it, **rename**, + set its **dir** (working directory; empty clears), **archive**, or **delete** + it (delete shows a dry-run preview and asks to confirm first). Switching + overrides the configured `board` until you switch again or restart, and + `:tcd`s to the board's dir when it has one. - `:ShepherdBoardsArchived` — pick an archived board to unarchive. - `:ShepherdCapture` — turn the current line into a todo; in visual mode (`:'<,'>ShepherdCapture`) the selection. Strips a leading comment marker and diff --git a/lua/shepherd/board.lua b/lua/shepherd/board.lua index d2e4f80..5d5fad7 100644 --- a/lua/shepherd/board.lua +++ b/lua/shepherd/board.lua @@ -28,7 +28,11 @@ local function fetch(args, cb) end local function plabel(b) - return string.format("%s %s (%d/%d)", b.current and "*" or " ", b.name, b.open, b.total) + local s = string.format("%s %s (%d/%d)", b.current and "*" or " ", b.name, b.open, b.total) + if b.dir and b.dir ~= "" then + s = s .. " " .. vim.fn.fnamemodify(b.dir, ":~") + end + return s end -- confirm_delete previews the removal with --dry-run, then requires an explicit @@ -57,11 +61,21 @@ function M.switch() if not b then return end - vim.ui.select({ "switch", "rename", "archive", "delete" }, { prompt = b.name }, function(act) + vim.ui.select({ "switch", "rename", "dir", "archive", "delete" }, { prompt = b.name }, function(act) if act == "switch" then sh.set_active_board(b.name) + if b.dir and b.dir ~= "" then + vim.cmd.tcd(vim.fn.fnamemodify(b.dir, ":p")) + end sh.refresh() vim.notify("shepherd: board " .. b.name) + elseif act == "dir" then + -- omit to show is CLI-only; here empty clears, a path sets it + vim.ui.input({ prompt = "dir: ", default = b.dir or "" }, function(v) + if v ~= nil then + sh._run({ "board", "dir", b.name, v }, "dir " .. b.name, { no_board = true }) + end + end) elseif act == "rename" then vim.ui.input({ prompt = "rename to: ", default = b.name }, function(v) if v and v ~= "" and v ~= b.name then