airblade/vim-gitgutter

Should an option be added to set wrap in the preview window?

Aster89 opened this issue · 6 comments

I'm recently been working on a LaTeX project, and I decided to have the wrap option active and never artificially break a line; I only break a line if I want a new paragraph.

This means that in gitgutter's preview window, the lines are not visible, so I have to move to that window and scan it via **w.

Can maybe the preview window inherit the wrap setting from the window in which the hunk is?


As regards the reason why I did it:

  • partly precisely to see where some Vim workflows/plugins come up short,
  • but most importantly because I don't want some file to appear as it changed a lot when all that happened is that I inserted one word somewhere, and caused a reflow when doing gq{motion}.

Please could you add a screenshot to show the problem?

The red square indicates the only change on that line.

gitgutter

I set 'wrap' in my vimrc and all windows inherit it, including the preview window.

Do you only set 'wrap' for your LaTeX files rather than always? If so you could use this autocmd for the preview window (untested):

autocmd! BufWinEnter * if &previewwindow | setlocal wrap | endif

I feel this is a vim configuration issue rather than a vim-gitgutter one.

I set 'wrap' in my vimrc and all windows inherit it, including the preview window.

Yeah, but in my vimrc I have and want to have nowrap.

Do you only set 'wrap' for your LaTeX files rather than always? If so you could use this autocmd for the preview window (untested):

But that would affect preview windows in general. At the moment I don't know if any other of the plugins I use uses a preview window, but in principle I might not want to affect them all.

I feel this is a vim configuration issue rather than a vim-gitgutter one.

I think that having vim-gitgutter default wrap to the value of the "parent" window, or at least having a global option that tells it to do so, would be a reasonable thing to do, because the vim-gitgutter preview windows shows the text that one edits in another buffer, so why not showing it the same way?

I think that having vim-gitgutter default 'wrap' to the value of the "parent" window...

That would be consistent with the way vim handles local options (like 'wrap'). It seems an anomaly that it doesn't happen anyway for the preview window.