mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-10 12:33:47 -05:00
12
README.mkd
12
README.mkd
@@ -9,6 +9,7 @@ Features:
|
|||||||
* Ensures signs are always as up to date as possible (but without running more than necessary).
|
* Ensures signs are always as up to date as possible (but without running more than necessary).
|
||||||
* Quick jumping between blocks of changed lines ("hunks").
|
* Quick jumping between blocks of changed lines ("hunks").
|
||||||
* Stage/revert/preview individual hunks.
|
* Stage/revert/preview individual hunks.
|
||||||
|
* Diffs against index (default) or any commit.
|
||||||
* Handles line endings correctly, even with repos that do CRLF conversion.
|
* Handles line endings correctly, even with repos that do CRLF conversion.
|
||||||
* Optional line highlighting.
|
* Optional line highlighting.
|
||||||
* Fully customisable (signs, sign column, line highlights, mappings, extra git-diff arguments, etc).
|
* Fully customisable (signs, sign column, line highlights, mappings, extra git-diff arguments, etc).
|
||||||
@@ -178,6 +179,7 @@ You can customise:
|
|||||||
* Whether or not the sign column is shown when there aren't any signs (defaults to no)
|
* Whether or not the sign column is shown when there aren't any signs (defaults to no)
|
||||||
* The signs' colours and symbols
|
* The signs' colours and symbols
|
||||||
* Line highlights
|
* Line highlights
|
||||||
|
* The base of the diff
|
||||||
* Extra arguments for `git diff`
|
* Extra arguments for `git diff`
|
||||||
* Key mappings
|
* Key mappings
|
||||||
* Whether or not vim-gitgutter is on initially (defaults to on)
|
* Whether or not vim-gitgutter is on initially (defaults to on)
|
||||||
@@ -244,6 +246,16 @@ GitGutterDeleteLine " default: links to DiffDelete
|
|||||||
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange
|
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### The base of the diff
|
||||||
|
|
||||||
|
By default buffers are diffed against the index. However you can diff against any commit by setting:
|
||||||
|
|
||||||
|
```viml
|
||||||
|
let g:gitgutter_diff_base = '<commit SHA>'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Extra arguments for `git diff`
|
#### Extra arguments for `git diff`
|
||||||
|
|
||||||
If you want to pass extra arguments to `git diff`, for example to ignore whitespace, do so like this:
|
If you want to pass extra arguments to `git diff`, for example to ignore whitespace, do so like this:
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if a:realtime
|
if a:realtime
|
||||||
let blob_name = ':'.gitgutter#utility#shellescape(gitgutter#utility#file_relative_to_repo_root())
|
let blob_name = g:gitgutter_diff_base.':'.gitgutter#utility#shellescape(gitgutter#utility#file_relative_to_repo_root())
|
||||||
let blob_file = s:temp_index
|
let blob_file = s:temp_index
|
||||||
let buff_file = s:temp_buffer
|
let buff_file = s:temp_buffer
|
||||||
let extension = gitgutter#utility#extension()
|
let extension = gitgutter#utility#extension()
|
||||||
@@ -88,11 +88,12 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff)
|
|||||||
call setpos("']", op_mark_end)
|
call setpos("']", op_mark_end)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let cmd .= 'git -c "diff.autorefreshindex=0" diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args.' -- '
|
let cmd .= 'git -c "diff.autorefreshindex=0" diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args.' '
|
||||||
|
|
||||||
if a:realtime
|
if a:realtime
|
||||||
let cmd .= blob_file.' '.buff_file
|
let cmd .= ' -- '.blob_file.' '.buff_file
|
||||||
else
|
else
|
||||||
let cmd .= gitgutter#utility#shellescape(gitgutter#utility#filename())
|
let cmd .= g:gitgutter_diff_base.' -- '.gitgutter#utility#shellescape(gitgutter#utility#filename())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !a:preserve_full_diff && s:grep_available
|
if !a:preserve_full_diff && s:grep_available
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ You can customise:
|
|||||||
- The sign column's colours
|
- The sign column's colours
|
||||||
- The signs' colours and symbols
|
- The signs' colours and symbols
|
||||||
- Line highlights
|
- Line highlights
|
||||||
|
- The base of the diff
|
||||||
- Extra arguments for git-diff
|
- Extra arguments for git-diff
|
||||||
- Key mappings
|
- Key mappings
|
||||||
- The grep executable used
|
- The grep executable used
|
||||||
@@ -185,6 +186,14 @@ colorscheme or |vimrc|:
|
|||||||
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault
|
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault
|
||||||
<
|
<
|
||||||
|
|
||||||
|
THE BASE OF THE DIFF
|
||||||
|
|
||||||
|
By default buffers are diffed against the index. To diff against a commit
|
||||||
|
instead:
|
||||||
|
>
|
||||||
|
let g:gitgutter_diff_base = '<commit SHA>'
|
||||||
|
<
|
||||||
|
|
||||||
EXTRA ARGUMENTS FOR GIT-DIFF
|
EXTRA ARGUMENTS FOR GIT-DIFF
|
||||||
|
|
||||||
To pass extra arguments to git-diff, add this to your |vimrc|:
|
To pass extra arguments to git-diff, add this to your |vimrc|:
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ endtry
|
|||||||
|
|
||||||
call s:set('g:gitgutter_sign_modified_removed', '~_')
|
call s:set('g:gitgutter_sign_modified_removed', '~_')
|
||||||
call s:set('g:gitgutter_diff_args', '')
|
call s:set('g:gitgutter_diff_args', '')
|
||||||
|
call s:set('g:gitgutter_diff_base', '')
|
||||||
call s:set('g:gitgutter_map_keys', 1)
|
call s:set('g:gitgutter_map_keys', 1)
|
||||||
call s:set('g:gitgutter_avoid_cmd_prompt_on_windows', 1)
|
call s:set('g:gitgutter_avoid_cmd_prompt_on_windows', 1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user