Skip to content

Commit 383e66c

Browse files
committed
docs: mention interactive staging for snacks via git_diff picker
1 parent 56f7e40 commit 383e66c

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ Bundle of commands focused on swift and streamlined git operations.
7979
[telescope-ui-select](https://github.com/nvim-telescope/telescope-ui-select.nvim)
8080
* [fzf-lua](https://github.com/ibhagwan/fzf-lua)
8181
- For interactive staging:
82-
[telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) (PRs
83-
adding support for other pickers are welcome.)
82+
[telescope.nvim](https://github.com/nvim-telescope/telescope.nvim). (For
83+
`snacks.nvim`, the `git_diff` picker allows interactive staging.)
8484
- For GitHub-related commands: `curl`
8585
- *Recommended*: Treesitter parser for syntax highlighting `TSInstall
8686
gitcommit`.
@@ -116,7 +116,7 @@ require("tinygit").setup {
116116
moveToNextHunkOnStagingToggle = false,
117117

118118
-- accepts the common telescope picker config
119-
telescopeOpts = {
119+
telescopeOpts = {
120120
layout_strategy = "horizontal",
121121
layout_config = {
122122
horizontal = {
@@ -214,8 +214,7 @@ since `:Tinygit` does not accept command-specific options and does not
214214
trigger visual-mode specific changes.
215215

216216
### Interactive staging
217-
- Interactive straging requires `telescope`. (PRs adding support for other
218-
pickers welcome.)
217+
- Interactive straging requires `telescope`.
219218
- This command stages hunks, that is, *parts* of a file instead of the full
220219
file. It is roughly comparable to `git add -p`.
221220
- Use `<Space>` to (un)stage the hunk, `<CR>` to go to the hunk, or `<C-r>` to
@@ -231,6 +230,10 @@ trigger visual-mode specific changes.
231230
require("tinygit").interactiveStaging()
232231
```
233232

233+
> [!NOTE]
234+
> For `snacks.nvim`, you can just use the `git_diff` picker, which pretty much
235+
> does the same thing.
236+
234237
### Smart commit
235238
- Open a commit popup, alongside a preview of what is going to be committed. If
236239
there are no staged changes, stage all changes (`git add --all`) before the
@@ -252,8 +255,18 @@ require("tinygit").smartCommit { pushIfClean = false, pullBeforePush = true }
252255
Assuming these keybindings:
253256

254257
```lua
255-
vim.keymap.set("n", "<leader>ga", function() require("tinygit").interactiveStaging() end, { desc = "git add" })
256-
vim.keymap.set("n", "<leader>gc", function() require("tinygit").smartCommit() end, { desc = "git commit" })
258+
vim.keymap.set(
259+
"n",
260+
"<leader>ga",
261+
function() require("tinygit").interactiveStaging() end,
262+
{ desc = "git add" }
263+
)
264+
vim.keymap.set(
265+
"n",
266+
"<leader>gc",
267+
function() require("tinygit").smartCommit() end,
268+
{ desc = "git commit" }
269+
)
257270
vim.keymap.set("n", "<leader>gp", function() require("tinygit").push() end, { desc = "git push" })
258271
```
259272

0 commit comments

Comments
 (0)