Skip to content

Commit

Permalink
feat(staging): moveToNextHunkOnStagingToggle opt-in setting (cp #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Aug 8, 2024
1 parent a74ef24 commit e5393cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ The `setup` call is optional. These are the default settings:

```lua
-- default config
require("tinygit").setup({
require("tinygit").setup {
staging = { -- requires telescope
contextSize = 1, -- larger values "merge" hunks
stagedIndicator = "",
Expand All @@ -311,6 +311,7 @@ require("tinygit").setup({
gotoHunk = "<CR>",
resetHunk = "<C-r>",
},
moveToNextHunkOnStagingToggle = false,
},
commitMsg = {
commitPreview = true, -- requires nvim-notify
Expand Down Expand Up @@ -375,7 +376,7 @@ require("tinygit").setup({
enabled = true,
blend = 50, -- 0-100
},
})
}
```

The appearance of the commit preview and notifications is determined by
Expand Down
3 changes: 3 additions & 0 deletions lua/tinygit/commands/staging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ local function telescopePickHunk(hunks)
if success then
-- Change value for selected hunk in cached hunk-list
hunks[entry.index].alreadyStaged = not hunks[entry.index].alreadyStaged
if opts.moveToNextHunkOnStagingToggle then
actions.move_selection_next(prompt_bufnr)
end
refreshPicker()
end
end, { desc = "Staging Toggle" })
Expand Down
2 changes: 2 additions & 0 deletions lua/tinygit/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local M = {}
---@field contextSize number
---@field stagedIndicator string
---@field keymaps { gotoHunk: string, stagingToggle: string, resetHunk: string }
---@field moveToNextHunkOnStagingToggle boolean

---@class issueIconConfig
---@field closedIssue string
Expand Down Expand Up @@ -62,6 +63,7 @@ local defaultConfig = {
gotoHunk = "<CR>",
resetHunk = "<C-r>",
},
moveToNextHunkOnStagingToggle = false,
},
commitMsg = {
commitPreview = true, -- requires nvim-notify
Expand Down

0 comments on commit e5393cd

Please sign in to comment.