mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Update only visible buffers on FocusGained and TabEnter.
This commit is contained in:
@@ -63,7 +63,7 @@ nmap <silent> ]h :<C-U>execute v:count1 . "GitGutterNextHunk"<CR>
|
|||||||
nmap <silent> [h :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR>
|
nmap <silent> [h :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR>
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, you can force vim-gitgutter to update its signs across all buffers with `:GitGutterAll`.
|
Finally, you can force vim-gitgutter to update its signs across all visible buffers with `:GitGutterAll`.
|
||||||
|
|
||||||
See the customisation section below for how to change the defaults.
|
See the customisation section below for how to change the defaults.
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ You can customise:
|
|||||||
* Whether or not signs are shown (defaults to yes)
|
* Whether or not signs are shown (defaults to yes)
|
||||||
* 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)
|
||||||
* Whether or not vim-gitgutter runs for all buffers on `FocusGained` (defaults to yes)
|
* Whether or not vim-gitgutter runs for all visible buffers on `FocusGained` (defaults to yes)
|
||||||
|
|
||||||
Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.
|
Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ let g:gitgutter_on_bufenter = 0
|
|||||||
If you turn it off, vim-gitgutter will instead run every time you read or write a buffer.
|
If you turn it off, vim-gitgutter will instead run every time you read or write a buffer.
|
||||||
|
|
||||||
|
|
||||||
#### To stop vim-gitgutter running for all buffers on `FocusGained`
|
#### To stop vim-gitgutter running for all visible buffers on `FocusGained`
|
||||||
|
|
||||||
This is on by default but causes a noticeable lag for some people. To turn it off, add this to your `~/.vimrc`:
|
This is on by default but causes a noticeable lag for some people. To turn it off, add this to your `~/.vimrc`:
|
||||||
|
|
||||||
|
|||||||
@@ -114,14 +114,6 @@ function! s:buffers()
|
|||||||
return filter(range(1, bufnr('$')), 'buflisted(v:val)')
|
return filter(range(1, bufnr('$')), 'buflisted(v:val)')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:visible_buffers()
|
|
||||||
let visible = []
|
|
||||||
for i in range(tabpagenr('$'))
|
|
||||||
call extend(visible, tabpagebuflist(i + 1))
|
|
||||||
endfor
|
|
||||||
return visible
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Highlights and signs {{{
|
" Highlights and signs {{{
|
||||||
@@ -399,7 +391,7 @@ endfunction
|
|||||||
" Public interface {{{
|
" Public interface {{{
|
||||||
|
|
||||||
function! GitGutterAll()
|
function! GitGutterAll()
|
||||||
let buffer_ids = g:gitgutter_on_bufenter ? s:visible_buffers() : s:buffers()
|
let buffer_ids = g:gitgutter_on_bufenter ? tabpagebuflist() : s:buffers()
|
||||||
for buffer_id in buffer_ids
|
for buffer_id in buffer_ids
|
||||||
call GitGutter(expand('#' . buffer_id . ':p'))
|
call GitGutter(expand('#' . buffer_id . ':p'))
|
||||||
endfor
|
endfor
|
||||||
@@ -524,8 +516,11 @@ augroup gitgutter
|
|||||||
else
|
else
|
||||||
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter(s:current_file())
|
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter(s:current_file())
|
||||||
endif
|
endif
|
||||||
if g:gitgutter_all_on_focusgained && !has('gui_win32')
|
if g:gitgutter_all_on_focusgained
|
||||||
autocmd FocusGained * call GitGutterAll()
|
if !has('gui_win32')
|
||||||
|
autocmd FocusGained * call GitGutterAll()
|
||||||
|
endif
|
||||||
|
autocmd TabEnter * call GitGutterAll()
|
||||||
endif
|
endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user