-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathgitv.txt
870 lines (673 loc) · 36.4 KB
/
gitv.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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
gitv -- gitk for vim.
AUTHOR: Greg Sexton <[email protected]> *gitv-author*
MAINTAINER: Roger Bongers <[email protected]>
WEBSITE: http://www.gregsexton.org/portfolio/gitv/
LICENSE: Same terms as Vim itself (see :help license).
NOTES: Much of the credit for gitv goes to Tim Pope and the fugitive plugin
where this plugin either uses functionality directly or was inspired
heavily.
gitv *gitv*
1. Introduction |gitv-introduction|
2. Installation |gitv-installation|
3. Usage |gitv-usage|
4. Configuration Options |gitv-config-options|
5. Changelog |gitv-changelog|
6. Misc |gitv-misc|
==============================================================================
1. Introduction *gitv-introduction*
|gitv| is a 'gitk clone' plugin for the text editor Vim. The goal is to give
you a similar set of functionality as a repository viewer. Using this plugin
you can view a repository's history including branching and merging, you can
see which commits refs point to. You can quickly and easily view what changed
to which files and when. You can perform arbitrary diffs (using Vim's
excellent built in diff functionality) and you can easily check out whole
commits and branches or just individual files if need be.
Throw in the fact that it is running in Vim and you get for free: the ability
to move over repository history quickly and precisely using Vim's built in
movement operators. You get excellent code syntax highlighting due to Vim's
built in ability. You can open up all sorts of repository views in multiple
windows and position them exactly how you like. You can take advantage of
Vim's registers to copy multiple fragments of code from previous commits. The
list goes on.
This plugin is an extension of the |fugitive| plugin.
I hope you like it!
==============================================================================
2. Installation *gitv-installation*
Install in ~/.vim, or in ~\vimfiles if you're on Windows. This plugin should
be fully pathogen compatible if you want to install it this way.
|gitv| was developed against Vim 7.3 but earlier versions of Vim should work.
Vim 7.2+ is recommended as it ships with syntax highlighting for many Git file
types. You will also need the |fugitive| plugin installed and working for
|gitv| to work.
==============================================================================
3. Usage *gitv-usage*
|gitv| defines the following command.
:[range]Gitv[!] [args]
Invoking this command on a buffer that belongs to a git
repository causes the gitv browser to open. '!' causes gitv
to open in file mode rather than browser mode. Any [args]
supplied are passed on to the gitv viewer and can be used to
narrow the commits that are shown. If this command is run
on a buffer not belonging to a git repository a message
stating 'Not a git repository.' is displayed.
When used with a [range] this has no effect in browser mode.
In file mode it narrows the commits shown to only those
affecting lines in the range. See section 3.8 for more
details.
The following abbreviation is also defined so that you can type :gitv without
capitalisation. The abbreviation is defined in such a way that this
substitution is only performed when 'gitv' is the first word on the command
line.
>
cabbrev gitv Gitv
<
3.1 Browser mode
|gitv| has two distinct modes. Browser mode and file mode. The browser mode is
opened in a new tab and allows the repository history to be viewed for all
files. This is activated by running :Gitv without a '!'.
In this mode you can view the entire repository history and see which files
were changed with each commit. This mode tries to closely resemble gitk.
3.2 File mode
File mode is opened in a |preview-window| above the buffer you are currently in.
This view is tailored to act on the buffer that :Gitv! was run from, the
"focused" file. Whilst in this mode all actions performed are specific to the
single focused file. The browser only shows commits where the focused file
changed. Selecting a commit, views the focused file as it was in that commit.
Performing a check out only checks the focused file out as it was in the
commit. And so on. See 3.4 for the differences.
3.3 Arguments
You can pass arguments to the :Gitv command. These allow you to filter and
narrow the commits shown. Essentially, gitv is a glorified 'git log' wrapper
and so any flag that 'git log' accepts so will gitv. gitv does not inspect the
arguments passed on to 'git log' and so may not work if they don't make sense.
Without any arguments gitv behaves just like gitk and git log without
arguments. It will display the commit history for the currently checked out
branch.
Gitv will also accept and autocomplete filenames. Only filenames at the end of
the command are supported, as in 'git log'.
Here are some particularly useful examples of arguments that could be
passed to :Gitv. For more info see 'git help log' and in particular the
section: "Commit Limiting".
Flag Description ~
--all View repository history for all refs.
--bisect If a bisect is started, show only the remaining commits.
<since>..<until> Show only commits between the named two commits. When
either <since> or <until> is omitted, it defaults to
HEAD, i.e. the tip of the current branch. For a more
complete list of ways to spell <since> and <until>,
see gitrevisions(7).
--merges View only merge commits.
-S<string> Look for differences that introduce or remove an
instance of <string>. Note that this is different than
the string simply appearing in diff output; see the
pickaxe entry in gitdiffcore(7) for more details.
-G<regex> Look for differences whose added or removed line
matches the given <regex>.
3.4 Key mappings. *gitv-browser-mappings*
This is a list of key mappings that will work only in the gitv browser window.
Where appropriate the differences in action is described for the two gitv
modes.
Mode Map Description~
normal <cr> Opens a commit. In browser mode this will show the
commit header information including the commit
message. It will also display a full diff showing all the
changes to files.
Tip: if you press <cr> on anything sensible you can
view the expected output. For example pressing <cr> on
the line beginning a file diff, it will display the
diff using Vim's built in diff viewing capability.
Pressing <cr> on the tree sha will list all the files
in the commit and pressing <cr> on one of these will
show that file as it was in the commit. And so on.
Pressing <cr> on the line "-- Load More --" will load
|g:Gitv_CommitStep| more commits.
In file mode this will open the focused file as it was
in the currently selected diff. This allows you to
easily go back in time and look at the focused file.
Pressing <cr> on the top line in file mode opens the
current working copy of the focused file.
normal <c-n> In either browser or file mode, this moves down to
J the next commit and opens it. This allows you to
quickly move from commit to commit and view either
the commit details or the file itself, depending on
the mode, in one action.
normal <c-p> The same as <c-n> but move back a commit.
K
normal o The same as <cr> but opens in a new |split|.
<c-j>
normal O The same as <cr> but opens in a new |tab|.
<c-l>
normal s The same as <cr> but opens in a new |vsplit|.
<c-k>
normal gw Switch between the preview window and browser.
normal i This performs the same thing as <cr> in browser mode.
<c-cr> In file mode it opens the commit details rather than
the focused file. (NOTE: many terminal emulators do
not support <c-cr>).
normal q Quits gitv. In browser mode this will close the entire
tab. In file mode this closes only the |preview-window|.
Note: in browser mode this will close the tab
regardless of any windows you may have opened as well
as the gitv windows.
normal a Switches the '--all' argument and updates the browser
window.
normal u Forces an update of the content of the browser window.
normal co Performs a 'git checkout' of the commit the cursor is
on. In both modes this will present you with a choice
of whether you would like to checkout the sha or any
ref that might point to this commit.
File mode differs in that it doesn't check out the
entire commit but just the focused file in that
commit.
Tip: in gVim this will present you with a pop up dialog.
You can make this a text choice by performing ':set
guioptions+=c.'
normal D Performs a diff using Vim's built in diff viewing
capabilities. This does nothing in browser mode. In
file mode it will diff the current file with the
focused file in the commit under the cursor.
visual D In visual mode this performs a diff against the file
in the commit at the top of the selection against the
file in the commit at the bottom of the selection. The
newest file is always on the right.
normal S Open a diffstat of everything that has changed since
the commit under the cursor, in both browse and
normal mode.
visual S In visual mode this works in exactly the same way as
normal mode. However, it only shows what has changed
in the range of commits that are highlighted.
visual m Merges the commit in either the top or bottom line of
the selection into the commit specified by the other
end of the selection. This uses prompts to guide you
through the merge process and should be fairly
intuitive. By default, it will also ask for
confirmation if you wish to perform a fast-forward
merge or not. If you have defined g:Gitv_MergeArgs,
you will not be prompted to fast forward.
gitv does not allow you to merge arbitrary commits.
The lines at the top and bottom of the selection
must contain refs in the form of tags, remotes or
local branches.
visual cp Cherry-Picks the selected commits to the active
branch.
normal cp Same as visual cp
visual rb Reset (mixed) the active branch to the top of the
selected commits.
normal rb Same as visual rb
visual rbs Reset (soft) the active branch to the top of the
selected commits.
normal rbs Same as visual rbs
visual rbh Reset (hard) the active branch to the top of the
selected commits.
normal rbh Same as visual rbh
normal rev Revert the commit. If the commit is a merge, selects
the first parent for reverting to.
visual rev Same as rev, but revert a range of commits. If a
merge is within the range, fails by necessity.
visual d Delete a branch or tag on the selected line. You will
be asked which branch/tag to use.
normal d Same as visual d
normal <leader>m Merges the first ref found on the current line in to
the branch currently pointed to by HEAD. By default,
this will prompt you if you wish to use a fast-forward
merge. If you have defined g:Gitv_MergeArgs, you
will not be prompted to fast forward.
normal git Enters command mode with ":Git " already typed for
you. Just a convenient shortcut for executing git
commands and watching them affect the repository.
normal yc Copy the sha on the current line in either mode.
This also copies it to the '+' register so that it
can be pasted externally. If there is no commit on
the current line the behaviour (although harmless)
is undefined.
Here is a list of extra key mappings that can be used to efficiently move
around a repository history in the browser window.
Mode Map Description~
normal x Jumps the cursor forward to the next branching point
in the history.
normal X Jumps the cursor backward to the previous branching
point in the history.
normal r Jumps the cursor forward to the next ref in the
history.
normal R Jumps the cursor backward to the previous ref in the
history.
normal P Jumps the cursor to the commit referenced by HEAD.
normal p Jumps the cursor to the commit which is the parent of
current line. When on a merge commit, a |count|
may be used to choose a parent other than the first.
Here is a list of mappings for rebasing.
Mode Map Description~
normal grr Rebase the current HEAD onto the ref or commit under
the cursor. A choice will be given of multiple refs.
normal grR Mark the commit under the line for reword.
normal grE Mark the commit under the line for edit.
normal grS Mark the commit under the line for squash.
normal grF Mark the commit under the line for fixup.
normal grX Mark the commit under the line for exec. A command must
be entered to be executed. The command will be
executed after performing an instruction on the
commit. By default, the commit will be picked.
normal grD Mark the commit under the line for dropping.
normal grP Mark the commit under the line for picking. Since this
is the default instruction, if every commit is marked
for picking, no commits will be considered marked.
This also removes exec commands from marking commits
with grX.
normal grs Start or stop (disable) an interactive rebase.
Interactive rebasing is only available in browser mode.
Merge commits are preserved.
If the rebase has already been started, merely enables
rebase mode.
If starting the rebase without instructions, it begins
at the commit before the commit under the cursor in
edit mode. This is a limitation of interactive
rebasing.
If any commits have been marked for an instruction,
automatically runs the interactive rebase.
If enabled in browser mode with files specified, will
drop the file names while the rebase is in progress.
normal gra Abort the current rebase.
normal grn Go to the next commit in the current rebase (skip).
Accepts a count.
normal grc Continue through the rebase until input is needed.
visual grR, Same as normal mode, but marks every commit.
grE,
grS,
grF,
grX,
grD,
grP
visual grs, Same as normal mode, but will attempt to rebase from
grr a ref at the top or bottom to the other end of the
selection.
Here is a list of mappings for bisecting.
Mode Map Description~
normal gbs Begin the bisecting process. If the bisecting process
has been started elsewhere, merely enables bisect mode.
If the bisecting process has already been enabled,
disables bisecting mode.
Works in both modes.
If file names have been specified, only bisects the
selected files.
Mnemonic- git bisect start/git bisect stop.
visual gbs Same as normal mode, but if the bisecting process has
not yet been started, marks the first commit selected
as bad and the last commit selected as good.
normal gbg Mark the commit under the cursor as good.
visual gbg Mark selected commits as good.
normal gbb Mark the commit under the cursor as bad.
visual gbb Mark selected commits as bad.
normal gbn Skip the current commit. Accepts a count. If a count
is given, skips the number of times specified.
Mnemonic- git bisect next.
visual gbn Skip the selected range of commits.
normal gbr End the bisect process. Mnemonic- git bisect reset.
normal gbl Save the current bisect history to a file. Edit the log
file to correct mistakes and replay later.
Mnemonic- git bisect log.
normal gbp Replay a saved log file.
3.5 Commands
Running the |:Git| command in the commit browser window, in either mode, will
cause the |:Git| command to be run as expected but the commit history will
automatically update to reflect any changes too.
3.6 Windows
In browser mode, two windows are opened initially. The "browser window" that
displays the commit history and the "preview window" that shows the currently
selected commit.
In file mode, a |preview-window| is opened above the current file. This is a
browser window filtered to show commits only affecting the focused file. The
window holding the focused file acts as the preview window in this mode.
NOTE: In both modes the buffer in the preview window is wiped after replacing
it. This is to stop the quick build up of fugitive buffers. A buffer will not
be wiped if it contains unsaved changes. Buffers are not wiped when opening a
commit in a split, vsplit or a new tab.
When opening a commit, the window it will be opened in is determined by simple
rules. If in browser mode and the layout is vertical it will open in the
window to the immediate right (exactly as if you performed <c-w>l). If in a
horizontal layout, it will be opened in the window immediately below (exactly
as if you performed <c-w>j). If in file mode, it will open exactly like
browser mode split horizontally. NOTE: It is for this reason that you should
not move the browser window as it will cause commits to be opened in
unexpected places.
3.7 Folding
Folding of branches is supported in the browser window. Initially all folds
are always open and will open on a reload. You can collapse any branch by
using Vim's built in fold operators. See |folding| for more details.
3.8 Using with a range of lines
If a range is passed to the :Gitv command it will have no effect in browser
mode. In file mode however, only commits that affect at least one line in the
range will be displayed. This is useful, for example, to view the commit
history for a function and all of the changes made to it.
If a range of less than two lines is used then gitv opens in regular file
mode.
Selecting a commit by pressing <cr> on it will show the file as it was in that
commit with all lines not in the range folded away. This allows you to quickly
and easily move from commit to commit viewing the evolution of the range of
lines. Pressing <c-cr> will show you the commit details so that you can see
any other changes it may have made. (NOTE: many terminal emulators do not
support <c-cr>).
The range that Git looks at is specified by the first and last line in the
range passed to :Gitv. These lines are escaped appropriately and passed to Git
to use as a regular expression. If you wish to modify either regex delimiter
this can be done by pressing <cr> on the appropriate line near the top of the
file mode buffer. Vim will prompt you to modify the regex. If you press enter
without modification, nothing happens. If you modify the regex (Git supports
POSIX regular expressions) gitv will automatically update.
You may also pass arguments to the :Gitv! command when using a range. This
filters the commits that are to be compared for changes in the range. For
example you could pass the name of a branch to only look at changes in commits
on that branch.
Note: This feature requires the bash shell to be installed on your system and
in your path. This should already be the case for the majority of users.
Note: Using a range searches back through the commit history looking at each
section of lines for where changes occurred. It will only look at the last
g:Gitv_CommitStep number, if you don't get any matches you could try pressing
<cr> on the 'load more' line. This command may be slow if you choose a large
range and have a large g:Gitv_CommitStep.
3.9 Bisecting *gitv-bisecting*
gitv provides several bisecting instructions that essentially send it into a
separate mode. It is intended that this mode can be enabled/disabled at will
so as to use gitv as normal if desired. This also allows entering into the
bisecting mode at any time. Since gitv is a visual branch manager, bisecting
mode offers its most useful capabilities via visual selection.
When gitv is in bisecting mode, only the range of commits being bisected is
shown. This is why capabilities are given to disable bisecting mode and
explore branches as normal while bisecting. This is a wrapper around the
`git log --bisect` command.
When the repository is not in bisecting mode, pressing `gbs` or the keybinding
to `bisectStart` will start the bisecting process. It is recommended that for
small ranges of commits, you start the bisecting process using visual mode.
When the repository is in visual mode and gitv is not, pressing `gbs` will
only put gitv into bisecting mode.
However bisecting mode has been enabled, it can always be disabled again using
`gbs` and enabled again in the same way. It does not keeep stateful
information about the bisecting process.
You should be able to see which commits have been marked as good, bad, or to
skip via the output from the `--bisect` command. You should also see the
current commit marked with `HEAD`. If you need to perform operations on the
current head, you can jump to it via `P` key or the keybinding to `head`.
`gbr` will call `git bisect --reset` and stop the bisecting process, as
opposed to just disabling it.
3.10 Rebasing *gitv-rebasing*
Similar to bisecting, rebasing in gitv provides a separate mode which can be
easily toggled on and off as to jump into the rebasing process at any time. It
also provides useful visual commands.
There are three ways to start a rebase with gitv if rebasing is not already in
process in the repository. The most simple, non interactive way, is to use
`grr`. This is the same as calling `git rebase (ref)` or
`git rebase (ref1) (ref2)` for a range.
The rest of the ways to start rebasing are wrappers around the
`git rebase --interactive` command, which allows performing special
instructions on commits.
The first way to interactively rebase is to call `gbs` when the cursor is on
the desired ref or commit to rebase without doing anything else first. This
opens up the file normally used for entering in `--interactive` instructions.
After you enter in your instructions and save, rebasing does not continue
automatically. This is to allow you to re-edit your instructions via
selecting `Edit rebase todo` in the branch viewer. You must use `grc` or the
keybinding to `rebaseContinue` to confirm you wish to proceed. You may re-edit
instructions at any time during the rebasing procedure.
In case it is useful to view the branch history structure while editing rebase
instructions, a third method is provided for entering rebase mode. By staging
instructions using the `grR`, `grE`, `grS`, `grF`, `grX`, `grD`, and `grP`
commands or custom bindings, you can skip editing the initial todo file.
However, you must still press `grs` on the ref or commit you wish to begin
rebasing on. Be advised that after you press `grs`, you will not get another
chance to confirm with `grc`. However, you can still edit the todo at any time
during the rebasing process. Staged instructions can be cleared using `grP`.
If you are already in the process of an interactive rebase and you enter gitv,
`grs` will enable rebasing mode instead of starting it.
Once rebasing mode is enabled, `grc` may do one of several things. If the
rebasing instruction would normally trigger a commit, the fugitive commit
window will automatically open. If you are not sure why the window has opened,
please view the comments in the commit window. If the window is closed, it can
always be reopened with `Gcommit`. gitv may also do nothing. This indicates
that you have a chance to edit the commit.
You can continue with the rebase process at any interactive instruction with
`grc` whenever you are ready. When the rebasing ends, gitv will automatically
return to normal mode.
You may cancel the rebasing process at any time with `gra` or the
`git rebase --abort` command.
If you git into an undesirable state after rebasing, you may use `git reflog`
to recover.
==============================================================================
4. Configuration Options *gitv-config-options*
You can set the following options in your .vimrc to override the values used
by |gitv|. The defaults are shown.
4.1 Commit Step
This is the number of commits to show each time. When pressing <cr> on
"-- Load More --", the number of extra commits loaded is g:Gitv_CommitStep.
The default is a screen's worth of lines. This should be set to an integer
number. Setting this to a value _really_ high will load the entire repo in one
go.
>
g:Gitv_CommitStep = &lines
<
4.2 Open Horizontal
This is the default layout to use in browser mode. If set to 0 then browser
mode will open in a vertical split. If set to 1 then browser mode will open in
a horizontal split. If set to 'auto' then browser mode will open in a vertical
split unless the content fits better in a horizontal split, in which case it
will open horizontally.
The commit browser width and height is automatically sized to best fit the
content in all modes and settings.
>
g:Gitv_OpenHorizontal = 0
<
4.3 Git Executable
Gitv uses the same executable as fugitive.
4.4 Wipe All on Close
This option should be set to either 0 (to disable) or 1 (to enable). If set to
1 then on closing the browser mode by using the q key all buffers displayed in
a window in the tab will be wiped before the tab is closed. This option allows
you to limit the number of fugitive buffers that accumulate in the use of gitv.
NOTE: This will not wipe any buffer with unsaved content. It will however
mercilessly wipe all buffers in the tab regardless of the file they hold.
>
g:Gitv_WipeAllOnClose = 0
<
4.5 Wrap Lines
If set to 1 then line wrapping is enabled. This is useful if you have
occasional very long commit messages.
>
g:Gitv_WrapLines = 0
<
4.6 Truncate Commit Subjects
If set to 1 then commit subject truncation is enabled. This will truncate
commit subjects, where necessary, so that the whole line will fit in one
screen width. If this is set, then automatically switching to a horizontal
layout will no longer work as commits will be truncated to always fit in a
vertical split. NOTE: It is possible that this can truncate any refs pointing
at a commit. In this situation it will not be possible to check out any of
these refs. This is due to gitv being unable to recognise that they are refs.
>
g:Gitv_TruncateCommitSubjects = 0
<
4.7 Open Preview On Launch
If set to 1 then the preview window is displayed when launching gitv in
browser mode. If set to 0 then no preview window is displayed until a commit
is opened. This option has no effect in file mode.
>
g:Gitv_OpenPreviewOnLaunch = 1
<
4.8 Prompt to Delete Merge Branch
If set to 1 then, when performing a merge using gitv, you will be prompted if
you wish to delete the topic branch. If you often merge a branch into another
and rarely wish to delete branches, set this to 0. The default is 0.
>
let g:Gitv_PromptToDeleteMergeBranch = 0
<
4.9 Custom merge arguments
The purpose of this option is to customize the merging behaviour. To use the
default merge behaviour, unset this variable. To not confirm for fast forward,
set this to an empty string. By default, this is undefined.
>
unset! g:Gitv_MergeArgs
<
Example: if you wish to use a different merge strategy, you can use this.
>
fu! MergeOurs()
let g:Gitv_MergeArgs = '--strategy=ours'
" Escape put in because of :normal quirks with space
execute "normal \<Esc> m"
" Put whatever your default is here
unlet! g:Gitv_MergeArgs
enfu
autocmd FileType gitv nno Mo :<C-U>call MergeOurs()<C-M>
<
4.10 Do not map the control key
If this is set then no mappings that use the control key will be created. The
control key mappings are all alternatives and so can be disabled without
losing functionality. The default is to create the mappings.
>
let g:Gitv_DoNotMapCtrlKey = 1
>
4.11 Do not log bisect actions
If this is set then no bisect mappings will log their actions. This will
prevent the need to press enter after every bisect action, but could cause
confusion. Errors will still be shown.
>
let g:Gitv_QuietBisect = 1
4.12 Custom key mappings *gitv-custom-browser-mappings*
Set custom key mappings which will overwrite the defaults. The following would
result in bindings equivalent to the defaults.
>
let g:Gitv_CustomMappings = {
\'quit': 'q',
\'update': 'u',
\'toggleAll': 'a',
\'nextBranch': 'x',
\'prevBranch': 'X',
\'nextRef': 'r',
\'prevRef': 'R',
\'editCommit': [
\'<cr>', { 'keys': '<LeftMouse>', 'prefix', '<LeftMouse>' }
\],
\'prevCommit': 'J',
\'nextCommit': 'K',
\'splitCommit': 'o',
\'vertSplitCommit': 's',
\'tabeCommit': 'O',
\'editCommitDetails': 'i',
\'diff': 'D',
\'vdiff': 'D',
\'stat': 'S',
\'vstat': 'S',
\'checkout': 'co',
\'merge': '<leader>m',
\'vmerge': 'm',
\'cherryPick': 'cp',
\'vcherryPick': 'cp',
\'reset': 'rb',
\'vreset': 'rb',
\'resetSoft': 'rbs',
\'vresetSoft': 'rbs',
\'resetHard': 'rbh',
\'vresetHard': 'rbh',
\'revert': 'rev',
\'vrevert': 'rev',
\'delete': 'd',
\'vdelete': 'd',
\'rebase': 'grr',
\'vrebase': 'grr',
\'rebasePick': 'grP',
\'vrebasePick': 'grP',
\'rebaseReword': 'grR',
\'vrebaseReword': 'grR',
\'rebaseMarkEdit': 'grF',
\'vrebaseMarkEdit': 'grF',
\'rebaseSquash': 'grF',
\'vrebaseSquash': 'grF',
\'rebaseFixup': 'grF',
\'vrebaseFixup': 'grF',
\'rebaseExec': 'grF',
\'vrebaseExec': 'grF',
\'rebaseDrop': 'grF',
\'vrebaseDrop': 'grF',
\'rebaseAbort': 'gra',
\'rebaseToggle': 'grs',
\'vrebaseToggle': 'grs',
\'rebaseSkip': 'grn',
\'rebaseContinue': 'grc',
\'rebaseEdit': 'gre',
\'bisectStart': 'gbs',
\'vbisectStart': 'gbs',
\'bisectGood': 'gbg',
\'vbisectGood': 'gbg',
\'bisectBad': 'gbb',
\'vbisectBad': 'gbb',
\'bisectSkip': 'gbn',
\'vbisectSkip': 'gbn',
\'bisectReset': 'gbr',
\'bisectLog': 'gbl',
\'bisectReplay': 'gbp',
\'head': 'P',
\'parent': 'p',
\'toggleWindow': 'gw',
\'git': 'git',
\'yank': 'yc'
\}
<
Bindings that use the ctrl modifier are kept internal and disabled when
g:Gitv_DoNotMapCtrlKey is set.
4.13 Change The Behaviour Of The Preview Window
Set custom options for the preview window. These options are passed directly
to |git-show|.
>
let g:Gitv_PreviewOptions = '--name-only'
<
==============================================================================
5. Changelog *gitv-changelog*
1.1 Nodes displaying local changes are inserted above HEAD ref.
Added range feature.
Merging branches is possible in gitv.
strwidth bugfix (thanks Adam Reeve).
Prevent bdelete errors (thanks pydave).
1.0 First release. I hope you enjoy gitv!
==============================================================================
6. Misc *gitv-misc*
6.1 Tips and tricks
I use the following mappings to make working with |gitv| easier.
>
nmap <leader>gv :Gitv --all<cr>
nmap <leader>gV :Gitv! --all<cr>
vmap <leader>gV :Gitv! --all<cr>
<
The vmap equivalent for file mode is to make dealing with ranges easier. It
allows you to visually select a range of lines to view the commit history for
that section of the file.
I highly recommend adding to your vimrc:
>
set lazyredraw
<
This stops Vim from redrawing the screen during complex operations and results
in much smoother looking plugins.
6.2 API
You can grab the current line's hash programatically with
>
gitv#util#line#sha(line('.'))
<
You can grab the ref with
>
gitv#util#line#refs('.')
<
The function: 'Gitv_OpenGitCommand(command, windowCmd)' is provided to allow
the more advanced user to create their own commands. This function will
execute the git command provided in the new window created using windowCmd.
By using this function you get for free: the buffer set up for read only git
output, including syntax highlighting and many other tailored options. You
also get mappings for 'u' to update the output and 'q' to easily close the
window.
Here is an example of getting diff output both cached and not, in a vertical
and horizontal split respectively.
>
call Gitv_OpenGitCommand("diff --no-color --cached", 'vnew')
call Gitv_OpenGitCommand("diff --no-color", 'new')
Use this command at your own risk. gitv currently makes certain assumptions
about window layout, and custom layouts could break certain functions.
6.3 Bugs, issues, features and contributing.
Bugs, suggestions, pull requests and patches are all very welcome. If you find
issues with |gitv| please add them to the issues page on the github project.
Anything else, feel free to email me at [email protected]
Please run `Gitv_GetDebugInfo()` and post your clipboard output for bugs.
vim:tw=78:ts=8:ft=help:norl: