-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgitlogdiff.txt
More file actions
131 lines (84 loc) · 4.02 KB
/
Copy pathgitlogdiff.txt
File metadata and controls
131 lines (84 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
*gitlogdiff.txt* Recent Git commits and diffs
==============================================================================
INTRODUCTION *gitlogdiff-intro*
A tiny Neovim plugin that shows a simple, keyboard‑driven list of recent Git commits and lets you diff them quickly via Diffview.
Works great for: “show me the last N commits, let me pick one (or two) and open the diff”.
!Preview
==============================================================================
FEATURES *gitlogdiff-features*
- Lists recent commits using git log (configurable max_count)
- Toggle selection with space, navigate with j/k
- Press Enter to open diffs in diffview.nvim or codediff.nvim
- 1 selected commit → diff that commit against its parent (<hash>^..<hash>)
- Consecutive commits selected → diff the whole range (<oldest>^..<newest>)
- Non-consecutive commits selected → combined diff of only the selected
commits (like JetBrains' git log): the skipped commits in between are left
out. This works by cherry-picking the selection onto a synthetic commit in
a temporary worktree; if a skipped commit conflicts with a selected one,
the plugin falls back to opening one diff per selected commit.
==============================================================================
REQUIREMENTS *gitlogdiff-requirements*
- Neovim ≥ 0.10 (uses vim.system)
- Git available on your $PATH
- One diff viewer plugin:
- sindrets/diffview.nvim, or
- esmuellert/codediff.nvim
==============================================================================
INSTALLATION *gitlogdiff-installation*
lazy.nvim *gitlogdiff-lazy.nvim*
>
{
"Salanoid/gitlogdiff.nvim",
main = "gitlogdiff",
dependencies = {
"sindrets/diffview.nvim",
},
cmd = "GitLogDiff",
opts = { max_count = 300 },
}
<
packer.nvim *gitlogdiff-packer.nvim*
>
use({
"Salanoid/gitlogdiff.nvim",
requires = {
"sindrets/diffview.nvim",
},
config = function()
require("gitlogdiff").setup({
max_count = 300,
})
end,
})
<
Note: This plugin defines the :GitLogDiff command on load. If your plugin manager pre-defines lazy command stubs, gitlogdiff.nvim will safely overwrite them (we create the command with force = true).
==============================================================================
USAGE *gitlogdiff-usage*
- Run :GitLogDiff inside a Git repository
- Navigate with j/k
- Toggle selection with <space>
- Press <CR> to open diffs in your diff viewer
- Press q to close the list
==============================================================================
CONFIGURATION *gitlogdiff-configuration*
>
require("gitlogdiff").setup({
max_count = 300, -- how many commits to list
viewer = "auto", -- "auto" | "diffview" | "codediff"
})
<
With viewer = "auto" (the default), the plugin uses diffview.nvim if it is
installed and falls back to codediff.nvim otherwise. Set it explicitly if you
have both and want codediff.
==============================================================================
TROUBLESHOOTING *gitlogdiff-troubleshooting*
- “No git commits found”: you are likely not in a Git repo (or max_count is 0)
- “git log failed …”: check that git is installed and available in $PATH
==============================================================================
LICENSE *gitlogdiff-license*
MIT — see LICENSE.
sindrets/diffview.nvim: https://github.com/sindrets/diffview.nvim
diffview.nvim: https://github.com/sindrets/diffview.nvim
esmuellert/codediff.nvim: https://github.com/esmuellert/codediff.nvim
codediff.nvim: https://github.com/esmuellert/codediff.nvim
vim:tw=78:ts=8:ft=help:norl: