Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signs are not shown correctly #431

Closed
cartoonist opened this issue Jul 31, 2017 · 10 comments
Closed

Signs are not shown correctly #431

cartoonist opened this issue Jul 31, 2017 · 10 comments

Comments

@cartoonist
Copy link

cartoonist commented Jul 31, 2017

I have came across with this problem recently. The signs are not displayed correctly. This snapshot shows a file (right pane) compared to its HEAD version (left pane):

2017-07-31-155046_1004x276_scrot

As you see, the first line is not annotated by ~ sign although it is detected as a hunk (for example during navigation by [c or ]c). This is just an example. I am facing other similar issues; e.g. missing +s.

@airblade
Copy link
Owner

What commit of the plugin are you using? Nvim or Vim?

@cartoonist
Copy link
Author

I am using last commit in master branch and Vim 8.0.

@airblade
Copy link
Owner

airblade commented Aug 1, 2017

I have occasionally experienced a hunk missing a sign while the hunk navigation still works. I've never been able to reproduce it reliably though and I'm not sure what the cause might be.

Next time it happens, please could you show the result of :echo getbufvar('', 'gitgutter')?

@cartoonist
Copy link
Author

Yes, sure.

@cartoonist
Copy link
Author

It seems that these two lines in my ~/.vimrc are responsible for hiding the sign of the first line:

autocmd BufEnter * sign define dummy
autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')

I added these two lines to always show the sign column. When I commented those out, it works fine.

@airblade
Copy link
Owner

airblade commented Aug 2, 2017

Aha, that makes sense.

You could try placing your dummy sign at line 9999, the same line as gitgutter, and also make sure you don't tell gitgutter to always show the sign column.

It's one of the strange things about Vim's signs – the line number for a sign doesn't need to exist.

@cartoonist
Copy link
Author

cartoonist commented Aug 2, 2017

Excuse me, I do not know much about vim signs. You mean I should change line=1 to line=9999? By changing the line number from 1 to 9999 the problem would just transfer from line 1 to 9999. It hides the sign for line 9999 instead of the first line.
And how can I tell gitgutter not to always show the sign column?

@airblade
Copy link
Owner

airblade commented Aug 2, 2017

Yes, I mean change line=1 to line=9999, assuming you don't have any files with 9999 lines.

By not telling gitgutter to show the sign column, I meant don't add let g:gitgutter_sign_column_always=1 to your vimrc.

But I just checked and as of Vim 7.4.2201 you don't need to do this because it's built into Vim. You can just do this instead: set signcolumn=yes.

@cartoonist
Copy link
Author

Thanks a lot. I did not know about set signcolumn=yes. That does what I want.

@airblade
Copy link
Owner

airblade commented Aug 2, 2017

Great!

@airblade airblade closed this as completed Aug 2, 2017
arcticicestudio added a commit to arcticicestudio/igloo that referenced this issue Aug 3, 2017
Vim 8 introduced a new option to configure the state of the sign column
to be always visible ("yes"), always hidden ("no") or to automatically
toggle ("auto") when there are signs available to display.

This change is related to the warning message added to
"airblade/vim-gitgutter@dc73a81" which also advises to remove the custom
option "g:gitgutter_sign_column_always = 1" and use
"set signcolumn = auto" instead, described by the plugin owner in
"airblade/vim-gitgutter#431" "airblade/vim-gitgutter#431 (comment)).

References:
:help signcolumn

GH-32
jamesiain added a commit to jamesiain/rcm-dotfiles-local that referenced this issue Feb 28, 2018
Vim 8 adds a new option where the sign column can be always visible
(yes), always hidden (no) or automatically toggled (auto) when signs are
available to display. Prefer the more generic option over the plugin
specific one, and set to automatically toggle.

More details:
arcticicestudio/igloo#32
airblade/vim-gitgutter@dc73a81
airblade/vim-gitgutter#431 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants