mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Allow configuration of extra arguments for git-diff.
This commit is contained in:
@@ -76,6 +76,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
|
||||||
|
* Extra arguments for `git diff`
|
||||||
* Whether or not vim-gitgutter is on initially (defaults to on)
|
* Whether or not vim-gitgutter is on initially (defaults to on)
|
||||||
* Whether or not line highlighting is on initially (defaults to off)
|
* Whether or not line highlighting is on initially (defaults to off)
|
||||||
* Whether or not vim-gitgutter runs on `BufEnter` (defaults to yes)
|
* Whether or not vim-gitgutter runs on `BufEnter` (defaults to yes)
|
||||||
@@ -134,6 +135,14 @@ GitGutterDeleteLine " default: links to DiffDelete
|
|||||||
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange
|
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Extra arguments for `git diff`
|
||||||
|
|
||||||
|
If you want to pass extra arguments to `git diff`, for example to ignore whitespace, do so like this:
|
||||||
|
|
||||||
|
```viml
|
||||||
|
let g:gitgutter_diff_args = '-w'
|
||||||
|
```
|
||||||
|
|
||||||
#### To turn off vim-gitgutter by default
|
#### To turn off vim-gitgutter by default
|
||||||
|
|
||||||
Add `let g:gitgutter_enabled = 0` to your `~/.vimrc`.
|
Add `let g:gitgutter_enabled = 0` to your `~/.vimrc`.
|
||||||
|
|||||||
@@ -94,6 +94,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
|
||||||
|
- Extra arguments for git-diff
|
||||||
- Whether or not vim-gitgutter is on initially (defaults to on)
|
- Whether or not vim-gitgutter is on initially (defaults to on)
|
||||||
- Whether or not line highlighting is on initially (defaults to off)
|
- Whether or not line highlighting is on initially (defaults to off)
|
||||||
- Whether or not vim-gitgutter runs on `BufEnter` (defaults to yes)
|
- Whether or not vim-gitgutter runs on `BufEnter` (defaults to yes)
|
||||||
@@ -165,6 +166,13 @@ colorscheme or |vimrc|:
|
|||||||
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault
|
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault
|
||||||
<
|
<
|
||||||
|
|
||||||
|
EXTRA ARGUMENTS FOR GIT-DIFF
|
||||||
|
|
||||||
|
To pass extra arguments to git-diff, add this to your |vimrc|:
|
||||||
|
>
|
||||||
|
let g:gitgutter_diff_args = '-w'
|
||||||
|
<
|
||||||
|
|
||||||
TO TURN OFF VIM-GITGUTTER BY DEFAULT
|
TO TURN OFF VIM-GITGUTTER BY DEFAULT
|
||||||
|
|
||||||
Add to your |vimrc|
|
Add to your |vimrc|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ call s:set('g:gitgutter_sign_added', '+')
|
|||||||
call s:set('g:gitgutter_sign_modified', '~')
|
call s:set('g:gitgutter_sign_modified', '~')
|
||||||
call s:set('g:gitgutter_sign_removed', '_')
|
call s:set('g:gitgutter_sign_removed', '_')
|
||||||
call s:set('g:gitgutter_sign_modified_removed', '~_')
|
call s:set('g:gitgutter_sign_modified_removed', '~_')
|
||||||
|
call s:set('g:gitgutter_diff_args', '')
|
||||||
|
|
||||||
let s:file = ''
|
let s:file = ''
|
||||||
|
|
||||||
@@ -173,7 +174,6 @@ function! s:define_sign_text_highlights()
|
|||||||
sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDelete
|
sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDelete
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:define_sign_line_highlights()
|
function! s:define_sign_line_highlights()
|
||||||
if s:highlight_lines
|
if s:highlight_lines
|
||||||
sign define GitGutterLineAdded linehl=GitGutterAddLine
|
sign define GitGutterLineAdded linehl=GitGutterAddLine
|
||||||
@@ -194,8 +194,8 @@ endfunction
|
|||||||
" Diff processing {{{
|
" Diff processing {{{
|
||||||
|
|
||||||
function! s:run_diff()
|
function! s:run_diff()
|
||||||
let cmd = 'git diff --no-ext-diff --no-color -U0 ' . shellescape(s:file()) .
|
let cmd = 'git diff --no-ext-diff --no-color -U0 ' . g:gitgutter_diff_args . ' ' .
|
||||||
\ ' | grep -e "^@@ "'
|
\ shellescape(s:file()) . ' | grep -e "^@@ "'
|
||||||
let diff = system(s:command_in_directory_of_file(cmd))
|
let diff = system(s:command_in_directory_of_file(cmd))
|
||||||
return diff
|
return diff
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user