Default to not limiting number of signs on newer Vims

The limit on the maximum number of signs was introduced when Vim's sign
drawing code was much slower than it is now.

See #681.
This commit is contained in:
Andy Stewart
2020-04-27 10:09:22 +01:00
parent 70855aa93d
commit ea14301cb4
3 changed files with 11 additions and 5 deletions

View File

@@ -137,10 +137,11 @@ The same caveat applies to line number highlighting as to line highlighting just
If you switch off both line highlighting and signs, you won't see the sign column. If you switch off both line highlighting and signs, you won't see the sign column.
To keep your Vim snappy, vim-gitgutter will suppress the signs when a file has more than 500 changes. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with: In older Vims (pre 8.1.0614 / Neovim 0.4.0) vim-gitgutter will suppress the signs when a file has more than 500 changes, to avoid slowing down the UI. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with:
```viml ```viml
let g:gitgutter_max_signs = 500 " default value let g:gitgutter_max_signs = 500 " default value (Vim < 8.1.0614, Neovim < 0.4.0)
let g:gitgutter_max_signs = -1 " default value (otherwise)
``` ```
You can also remove the limit by setting `g:gitgutter_max_signs = -1`. You can also remove the limit by setting `g:gitgutter_max_signs = -1`.

View File

@@ -412,14 +412,15 @@ Default: 0
Determines whether or not to show line number highlights. Determines whether or not to show line number highlights.
*g:gitgutter_max_signs* *g:gitgutter_max_signs*
Default: 500 Default: 500 (Vim < 8.1.0614, Neovim < 0.4.0)
-1 (otherwise)
Sets the maximum number of signs to show in a buffer. Vim is slow at updating Sets the maximum number of signs to show in a buffer. Vim is slow at updating
signs, so to avoid slowing down the GUI the number of signs is capped. When signs, so to avoid slowing down the GUI the number of signs is capped. When
the number of changed lines exceeds this value, the plugin removes all signs the number of changed lines exceeds this value, the plugin removes all signs
and displays a warning message. and displays a warning message.
Set to -1 to remove the limit. When set to -1 the limit is not applied.
*g:gitgutter_sign_priority* *g:gitgutter_sign_priority*
Default: 10 Default: 10

View File

@@ -29,7 +29,11 @@ else
call s:set('g:gitgutter_preview_win_floating', 0) call s:set('g:gitgutter_preview_win_floating', 0)
endif endif
call s:set('g:gitgutter_enabled', 1) call s:set('g:gitgutter_enabled', 1)
call s:set('g:gitgutter_max_signs', 500) if exists('*sign_unplace')
call s:set('g:gitgutter_max_signs', -1)
else
call s:set('g:gitgutter_max_signs', 500)
endif
call s:set('g:gitgutter_signs', 1) call s:set('g:gitgutter_signs', 1)
call s:set('g:gitgutter_highlight_lines', 0) call s:set('g:gitgutter_highlight_lines', 0)
call s:set('g:gitgutter_highlight_linenrs', 0) call s:set('g:gitgutter_highlight_linenrs', 0)