diff --git a/README.mkd b/README.mkd index 8b64cff..d55432f 100644 --- a/README.mkd +++ b/README.mkd @@ -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. @@ -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? diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index b7be225..95fcc5f 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -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 diff --git a/doc/gitgutter.txt b/doc/gitgutter.txt index 741820b..d36651f 100644 --- a/doc/gitgutter.txt +++ b/doc/gitgutter.txt @@ -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. @@ -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* diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index d42c304..2597f81 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -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()