Reduce text shift with git-gutter

Is there a way to reduce the jumping of text back and forth when updating the git gutter, like just setting a permanent block there when there is no change

This is my my currrent setup for the gutters using the git-async plugin

hook global -group git-gutter-setup BufCreate /.* %{
  add-highlighter buffer/git-diff flag-lines Default git_diff_flags
  try %{ git show-diff }

  hook buffer -group git-gutter-buffer FocusIn .* %{
    try %{ git-async update-diff }
  }
  hook buffer -group git-gutter-buffer BufReload .* %{
    try %{ git-async update-diff }
  }
  hook buffer -group git-gutter-buffer BufWritePost .* %{
    try %{ git-async update-diff }
  }
  hook buffer -group git-gutter-buffer NormalIdle .* %{
    try %{ git-async update-diff }
  }
}

I’ve just updated git-async.kak to prevent flickering/shifting of the gutter, which was occurring when there was only a single line with a diff and that line was being edited.

The gutter will still appear/disappear when the buffer goes between there being a diff between the buffer and the staged file, and there not being a diff. I’ve added an option, bool git_gutter_leave_space, that will cause there to always be space for the git gutter when the highlighter is active, even when there is no diff. This will entirely prevent text shifting.

This works great so far, thank you

1 Like