Skip to content

Update signs of corresponding buffer for fugitive buffers #67

@blueyed

Description

@blueyed

When saving a fugitive buffer, e.g. writing to the Git index for some file, the signs for the corresponding buffer in the working tree should be updated.

It is possible to get the corresponding buffer like this:

  au BufWritePost fugitive:///* call StatuslineClearCacheFugitive()

  function! StatuslineClearCacheFugitive()
      let fug_buffer = fugitive#buffer()
      let [gitdir, fug_path] = split(bufname('%'), '//')[1:2]
      let fug_path = substitute(fug_path, '\v\w*/', '', '')
      let fug_path = fug_buffer.repo().tree(fug_path)
      let bufnr = bufnr(fug_path)
      if bufnr != -1
        call QuickfixsignsSet('BufWritePost', ..., bufnr)
      endif
  endfunction

While it would be nice to have this by default, I can imagine that it's too specific. But for that the QuickfixsignsSet function needs to have support for non-current buffers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions