-
Notifications
You must be signed in to change notification settings - Fork 24
/
agit.txt
347 lines (263 loc) · 11.6 KB
/
agit.txt
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
*agit.txt* yet another gitk clone for Vim
Version : 1.0.0
Author : cohama / cohama@live.jp
License : MIT license {{{
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}}}
==============================================================================
CONTENTS *agit-contents*
INTRODUCTION |agit-introduction|
USAGE |agit-usage|
INTERFACE |agit-interface|
COMMANDS |agit-commands|
KEY-MAPPINGS |agit-key-mappings|
DEFAULT KEY-MAPPINGS |agit-default-key-mappings|
VARIABLES |agit-variables|
TODO |agit-todo|
==============================================================================
INTRODUCTION *agit-introduction*
*agit.vim* is yet another gitk clone plugin for Vim.
You can show repository history and commit details at the same time.
This plugin also provides the following features.
* Executable various git command
* No |fugitive| dependency, but well cooperation if that exists.
* Supporting multibyte character
Latest version:
https://github.com/cohama/agit.vim
==============================================================================
USAGE *agit-usage*
When you edit a file which in any git repository, type the below
>
:Agit
and an Agit tab will be opened.
The Agit tab is composed with three windows/buffers. Left windows is
|agit-log|, right above is |agit-stat| and right bellow is |agit-diff|.
*agit-log*
|agit-log| shows the 'git log' result including branches and tags. You can move
the cursor arbitrarily and this updates |agit-stat| and |agit-diff| buffers
automatically.
Some useful commands such as |<Plug>(agit-git-checkout)|,
|<Plug>(agit-git-reset)| are defined in this buffer.
If you installed |fugitive|, some fugitive commands (e.g. |:Gcommit|,
|:Gstatus|) are also available.
*agit-stat*
|agit-stat| shows the 'git diff --stat' result. This means that it shows
changed files between the commit under the cursor in |agit-log| buffer and
the previous commit of it.
*agit-diff*
|agit-diff| shows the 'git diff' result. This is similar to |agit-stat| but it
shows patches.
If you want to exit from agit.vim, press |q| or |:q|.
You can also use |:AgitFile| to trace single file.
>
:AgitFile
==============================================================================
INTERFACE *agit-interface*
------------------------------------------------------------------------------
COMMANDS *agit-commands*
*:Agit*
:Agit [{options}]
Open a new Agit tab. Repository path is automatically searched from a
current buffer path.
This command can receive some options.
--dir={basedir} *agit-option-dir*
Set the repository path to {basedir}.
*:AgitFile*
:AgitFile [{options}]
Similar to |:Agit| but trace only current file log.
You can see raw file instead of |agit-stat| and |agit-diff|.
--file={path} *agit-option-file*
Specify the file you want to trace. If omitted, % (current file) is
used.
*:AgitGit*
:AgitGit[!] {args}
Execute the specified git command. This is done in a current git
repository path.
Note: This command is available only in |agit-log| buffer.
Note: This command is similar to |fugitive|'s |:Git| command, but this
command uses |system()| internally so that the shell is not launched.
If you specify !, this command uses |:!| instead of |system()|.
(Same as |fugitive|'s |:Git|)
*:AgitDiff*
:AgitDiff [{revisions}]
Show |vimdiff| against the target file.
AgitDiff accepts target revision(s) as an argument.
Note: This command is available only in |agit-log| buffer from
|:AgitFile| and |agit-stat| buffer.
When launched from |agit-log| buffer, target of |:AgitFile| is treated
as target file.
When launched from |agit-stat| buffer, AgitDiff trys to pick target file
from cursor position. (see |<cfile>|)
If you installed |fugitive|, AgitDiff uses |fugitive| when showing staged
file. This means you can stage or unstage each hunks like |:Gdiff|.
*agit-diff-revspec*
revisions can be specified by almost same way as "git diff".
For example:
:AgitDiff (No revision specified)
show changes made by current revision
:AgitDiff REV1
show changes between REV1 and local
:AgitDiff REV1..REV2
show changes between REV1 and REV2
:AgitDiff REV1...REV2
show changes between marge_base(REV1, REV2) and REV2
marge_base(REV1, REV2) means "newest common ancestor of REV1 and REV2"
:AgitDiff REV1..
show changes between REV1 and HEAD ("HEAD" can be omitted)
------------------------------------------------------------------------------
KEY-MAPPINGS *agit-key-mappings*
The following key mappings can be used.
(All of these mappings are buffer-local mappings)
Available only in |agit-log| buffer unless explicitly mentioned.
<Plug>(agit-scrolldown-stat) *<Plug>(agit-scrolldown-stat)*
Scroll downwards the |agit-stat| window. The number of scroll lines is the
half a window.
Available in |agit-log|, |agit-diff|
TODO: Allow to customize the scroll size
<Plug>(agit-scrollup-stat) *<Plug>(agit-scrollup-stat)*
Scroll upwards the |agit-stat| window. The number of scroll lines is the
half a window.
Available in |agit-log|, |agit-diff|
<Plug>(agit-scrolldown-diff) *<Plug>(agit-scrolldown-diff)*
Scroll upwards the |agit-diff| window. The number of scroll lines is the
half a window.
Available in |agit-log|, |agit-stat|
<Plug>(agit-scrollup-diff) *<Plug>(agit-scrollup-diff)*
Scroll downwards the |agit-diff| window. The number of scroll lines is the
half a window.
Available in |agit-log|, |agit-stat|
<Plug>(agit-reload) *<Plug>(agit-reload)*
Manually update the agit buffers.
Available in |agit-log|, |agit-stat|, |agit-diff|
<PLug>(agit-yank-hash) *<Plug>(agit-yank-hash)*
Yank the hash of the commit under the cursor
<Plug>(agit-print-commitmsg) *<Plug>(agit-print-commitmsg)*
Print the commit message.
<PLug>(agit-exit) *<Plug>(agit-exit)*
Exit from agit.
Available in |agit-log|, |agit-stat|, |agit-diff|
<Plug>(agit-git-checkout) *<Plug>(agit-git-checkout)*
Execute 'git checkout' to change the current branch which under the
cursor.
<Plug>(agit-git-checkout-b) *<Plug>(agit-git-checkout-b)*
Execute 'git checkout -b' to create a new branch on the current
commit.
<Plug>(agit-git-branch-d) *<Plug>(agit-git-branch-d)*
Execute 'git branch -d' to delete the branch which under the cursor.
<Plug>(agit-git-reset-soft) *<Plug>(agit-git-reset-soft)*
Execute 'git reset --soft' to the cursor line commit.
<Plug>(agit-git-reset) *<Plug>(agit-git-reset)*
Execute 'git reset' to the cursor line commit.
<Plug>(agit-git-reset-hard) *<Plug>(agit-git-reset-hard)*
Execute 'git reset --hard' on the cursor line commit.
<Plug>(agit-git-rebase) *<Plug>(agit-git-rebase)*
Execute 'git rebase' to rebase HEAD to the cursor line commit.
<Plug>(agit-git-rebase-i) *<Plug>(agit-git-rebase-i)*
Execute 'git rebase -i' to rebase HEAD to the cursor line commit.
<Plug>(agit-git-cherry-pick) *<Plug>(agit-git-cherry-pick)*
Execute 'git cherry-pick' to apply the changes in the cursor line
commit.
<Plug>(agit-git-revert) *<Plug>(agit-git-revert)*
Execute 'git revert' to revert the cursor line commit.
<Plug>(agit-diff) *<Plug>(agit-diff)*
Show |vimdiff| against the target file of the current revision.
Availabie in |agit-log|, |agit-stat|
<Plug>(agit-diff-with-local) *<Plug>(agit-diff-with-local)*
Show |vimdiff| against the target file changes between current
revision and local.
Availabie in |agit-log|, |agit-stat|
------------------------------------------------------------------------------
DEFAULT KEY-MAPPINGS *agit-default-key-mappings*
J <Plug>(agit-scrolldown-stat)
K <Plug>(agit-scrollup-stat)
<C-j> <Plug>(agit-scrolldown-diff)
<C-k> <Plug>(agit-scrollup-diff)
u <PLug>(agit-reload)
yh <Plug>(agit-yank-hash)
<C-g> <Plug>(agit-print-commitmsg)
q <Plug>(agit-exit)
C <Plug>(agit-git-checkout)
cb <Plug>(agit-git-checkout-b)
D <Plug>(agit-git-branch-d)
rs <Plug>(agit-git-reset-soft)
rm <Plug>(agit-git-reset)
rh <Plug>(agit-git-reset-hard)
rb <Plug>(agit-git-rebase)
ri <Plug>(agit-git-rebase-i)
di <Plug>(agit-diff)
dl <Plug>(agit-diff-with-local)
------------------------------------------------------------------------------
VARIABLES *agit-variables*
g:agit_no_default_mappings *g:agit_no_default_mappings*
If it is non-zero, |agit-default-key-mappings| will be disabled.
You should define the key mappings.
default value: 0
g:agit_enable_auto_show_commit *g:agit_enable_auto_show_commit*
If it is non-zero, |agit-stat| and |agit-diff| buffers are
automatically updated when the cursor moved in |agit-log| buffer.
default value: 1
g:agit_enable_auto_refresh *g:agit_enable_auto_refresh*
If it is non-zero, |agit-log| buffer is automatically updated when
switched to the Agit tab. (Internally, |BufEnter| autocmd is used.)
You can always show the latest repository state but this causes less
performance.
default value: 0
g:agit_max_log_lines *g:agit_max_log_lines*
Determine the number of lines to display in |agit-log| buffer.
Large value is useful to explore the very old history but it causes
less performance.
default value: 500
g:agit_max_author_name_width *g:agit_max_author_name_width*
If it is non-zero, the commit author names in |agit-log| buffer are
truncated to the value.
default value: 0
g:agit_skip_empty_line *g:agit_skip_empty_line*
If it is non-zero, empty lines are skipped when you move the cursor in
|agit-log| buffer.
default value: 1
g:agit_localchanges_always_on_top *g:agit_localchanges_always_on_top*
If it is non-zero, a message line of uncommitted changes is placed
always on the top of |agit-log|.
default value: 1
g:agit_ignore_spaces *g:agit_ignore_spaces*
If it is non-zero, Agit ignore whitespace changes as showing
|agit-diff| and |agit-stat| buffer.
default value: 1
g:agit_log_width *g:agit_log_width*
Max columns of |agit-log| buffer, zero to use window width.
default value: 0
g:agit_stat_width *g:agit_stat_width*
Max columns of |agit-stat| buffer.
default value: 80
g:agit_reuse_tab *g:agit_reuse_tab*
If it is non-zero and there already is an Agit tab with same git
directory and layout as launching one, Agit reuse the existing tab.
default value: 1
==============================================================================
TODO *agit-todo*
* Arbitrary log format
* More performance by using |if_lua|
* Pagination
* Commit filtering
==============================================================================
CHANGELOG *agit-changelog*
v1.1 Add |:AgitFile|
Refactoring.
v1.0 First version
==============================================================================
vim:tw=78:ts=8:sts=8:sw=8:ft=help:norl:noet:fen: