mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Suppress signs when there are more than 500.
This commit is contained in:
@@ -80,6 +80,11 @@ Note that if you have line highlighting on and signs off, you will have an empty
|
|||||||
|
|
||||||
If you switch off both line highlighting and signs, you won't see the sign column. That is unless you have set `let g:gitgutter_sign_column_always = 1` so it's always there.
|
If you switch off both line highlighting and signs, you won't see the sign column. That is unless you have set `let g:gitgutter_sign_column_always = 1` so it's always there.
|
||||||
|
|
||||||
|
To keep your Vim snappy, vim-gitgutter will suppress itself 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:
|
||||||
|
|
||||||
|
```viml
|
||||||
|
let g:gitgutter_max_signs = 500 " default value
|
||||||
|
```
|
||||||
|
|
||||||
#### Hunks
|
#### Hunks
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ function! gitgutter#process_buffer(file, realtime)
|
|||||||
call gitgutter#hunk#set_hunks(gitgutter#diff#parse_diff(diff))
|
call gitgutter#hunk#set_hunks(gitgutter#diff#parse_diff(diff))
|
||||||
let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks())
|
let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks())
|
||||||
|
|
||||||
|
if len(modified_lines) > g:gitgutter_max_signs
|
||||||
|
call gitgutter#utility#warn('exceeded maximum number of signs (configured by g:gitgutter_max_signs).')
|
||||||
|
call gitgutter#sign#clear_signs(a:file)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
if g:gitgutter_signs || g:gitgutter_highlight_lines
|
if g:gitgutter_signs || g:gitgutter_highlight_lines
|
||||||
call gitgutter#sign#update_signs(a:file, modified_lines)
|
call gitgutter#sign#update_signs(a:file, modified_lines)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ let s:file = ''
|
|||||||
let s:using_xolox_shell = -1
|
let s:using_xolox_shell = -1
|
||||||
let s:exit_code = 0
|
let s:exit_code = 0
|
||||||
|
|
||||||
|
function! gitgutter#utility#warn(message)
|
||||||
|
echohl WarningMsg
|
||||||
|
echomsg 'vim-gitgutter: ' . a:message
|
||||||
|
echohl None
|
||||||
|
let b:warningmsg = a:message
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! gitgutter#utility#is_active()
|
function! gitgutter#utility#is_active()
|
||||||
return g:gitgutter_enabled && gitgutter#utility#exists_file()
|
return g:gitgutter_enabled && gitgutter#utility#exists_file()
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ function! s:set(var, default)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:set('g:gitgutter_enabled', 1)
|
call s:set('g:gitgutter_enabled', 1)
|
||||||
|
call s:set('g:gitgutter_max_signs', 500)
|
||||||
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_sign_column_always', 0)
|
call s:set('g:gitgutter_sign_column_always', 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user