Closed qazip closed 4 years ago
You can do let g:gitgutter_preview_win_floating = 0
to see the diff in a "normal" preview window rather than a floating one.
Ah, cool! How do I change the height of this new window? Any option for that?
With Vim's previewheight
option.
Weirdly enough, set previewheight=50 (or any other value) doesn't change anything. But alright, this is now a (neo)vim issue! Thanks @airblade !
More specifically, the preview window's height is set to the smaller of the diff's height and &previewheight
.
Hey @airblade, sorry for bothering you again!
I haven't been able to fix this. Doing "set previewheight = 30" (or whatever number) doesn't seem to help, so I guess it is being decided by the "diff's height". How would I change that?
I'm not sure what you're trying to fix. Are you trying to get the preview window to always be 50 (or 30 or whatever you set) lines high, even if the diff it's showing is only 10 lines?
If so, there's no built-in way to change that. If previewheight
is 50 and the diff is 10 lines long, the preview window will be 10 lines high. If the diff is 60 lines long, the preview window will be 50 lines high.
The only way to change this is to comment out line 499 linked above in your copy of vim-gitgutter.
Well, I would like the preview-window to show the whole difference. Here is my use case:
It will only show 2 lines, so it will only show the red and not the green. I would like to see the red and the green at the same time. This works if the changed sentence/hunk is only 1 line long. If the hunk is more than 2 lines, then it won't even show the whole hunk as red, and so I have to scroll down to see the whole thing..
EDIT: This happens regardless of using preview window or preview floating. The diff is always 2 lines long and so it doesn't show the whole thing..
What is your previewheight
value? :echo &previewheight
set previewheight=30
Please can you send me a screenshot of the situation you described just above? I'm not 100% sure I understand what you're seeing.
Sure. First picture shows that it is only showing 2 lines. Second picture shows the whole hunk with "Git diff" from Vim-Fugitire.
Ah, I see now. Thanks for the screenshots.
So the preview window's height is based on screen lines, not "real" lines. I'll come up with a fix...
When doing GitGutterPreviewHunk on a changed hunk, I should be able to see the whole line so I am able to see the changes. This is not true, the line gets cut-off before the changes are actually shown. This is for a long (markdown) line, however.
Would it be possible to show the preview-window in a new window and not as a popup/floating? Or just show it as actual text, like sublime-text does?
EDIT: I've tried adding
let g:gitgutter_preview_win_location = 'bel'
(or 'abo' or 'to') to my init.vim but nothing changes..