Skip to content

Commit

Permalink
Add option to disable asynchronous diffs.
Browse files Browse the repository at this point in the history
Closes #318.
  • Loading branch information
airblade committed Apr 21, 2016
1 parent cc77f32 commit 530bf68
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ You can customise:
* Whether or not line highlighting is on initially (defaults to off)
* Whether or not vim-gitgutter runs in "realtime" (defaults to yes)
* Whether or not vim-gitgutter runs eagerly (defaults to yes)
* Whether or not vim-gitgutter runs asynchronously in NeoVim (defaults to yes)

Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.

Expand Down Expand Up @@ -299,6 +300,15 @@ Add `let g:gitgutter_signs = 0` to your `~/.vimrc`.
Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`.


#### To turn off asynchronous updates

By default diffs are run asynchronously in NeoVim. To run diffs synchronously instead:

```viml
let g:gitgutter_async = 0
```


### FAQ

> Why can't I unstage staged changes?
Expand Down
2 changes: 1 addition & 1 deletion autoload/gitgutter/diff.vim
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff)
call setbufvar(bufnr, 'gitgutter_tracked', 1)
endif

if has('nvim') && !a:preserve_full_diff
if g:gitgutter_async && has('nvim') && !a:preserve_full_diff
let cmd = gitgutter#utility#command_in_directory_of_file(cmd)
" Note that when `cmd` doesn't produce any output, i.e. the diff is empty,
" the `stdout` event is not fired on the job handler. Therefore we keep
Expand Down
10 changes: 10 additions & 0 deletions doc/gitgutter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ You can customise:
- Whether or not line highlighting is on initially (defaults to off)
- Whether or not vim-gitgutter runs in realtime (defaults to yes)
- Whether or not vim-gitgutter runs eagerly (defaults to yes)
- Whether or not vim-gitgutter runs asynchronously in NeoVim (defaults to yes)

Please note that vim-gitgutter won't override any colours or highlights you've
set in your colorscheme.
Expand Down Expand Up @@ -266,6 +267,15 @@ Add to your |vimrc|
let g:gitgutter_eager = 0
<

TO TURN OFF ASYNCHRONOUS UPDATES

By default diffs are run asynchronously in NeoVim. To run diffs synchronously
instead:

Add to your |vimrc|
>
let g:gitgutter_async = 0
<

===============================================================================
6. FAQ *GitGutterFAQ*
Expand Down
1 change: 1 addition & 0 deletions plugin/gitgutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ 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_avoid_cmd_prompt_on_windows', 1)
call s:set('g:gitgutter_async', 1)

call gitgutter#highlight#define_sign_column_highlight()
call gitgutter#highlight#define_highlights()
Expand Down

0 comments on commit 530bf68

Please sign in to comment.