~gpanders/dotfiles

9b4f7e691abe1f650b67642a580ef4c1efe3b3d8 — Gregory Anders 2 months ago aa05ae6
nvim: gitsigns: defer loading until fugitive is enabled

Also use the b:gitsigns_head variable in the statusline, if available.
2 files changed, 5 insertions(+), 1 deletions(-)

M .config/nvim/after/plugin/gitsigns.vim
M .config/nvim/autoload/statusline.vim
M .config/nvim/after/plugin/gitsigns.vim => .config/nvim/after/plugin/gitsigns.vim +1 -1
@@ 1,1 1,1 @@
autocmd BufRead * ++once lua require('gitsigns').setup()
autocmd User Fugitive ++once lua require("gitsigns").setup()

M .config/nvim/autoload/statusline.vim => .config/nvim/autoload/statusline.vim +4 -0
@@ 1,4 1,8 @@
function! statusline#git() abort
  if exists('b:gitsigns_head')
    return b:gitsigns_head
  end

  if get(g:, 'loaded_fugitive')
    let branch = fugitive#head()
    if branch !=# ''