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

Comrade for neovim conflicts with gitgutter navigation #6

Open
ahshah opened this issue Sep 17, 2019 · 5 comments
Open

Comrade for neovim conflicts with gitgutter navigation #6

ahshah opened this issue Sep 17, 2019 · 5 comments

Comments

@ahshah
Copy link

ahshah commented Sep 17, 2019

I realize that this may not be an issue with Comrade, however I'm remarking here in the event it is.

Comrade uses the sign column, however it stops GitGutter from working effectively, namely it interferes with GitGutter's navigational commands:

  • GitGutterNextHunk
  • GitGutterPrevHunk

I don't know why, but I'm happy to help look into what is going on if I can maybe get a few hints from the original developer her how to do so (I'm not very familiar with vim plugin dev)

@beeender
Copy link
Owner

The function to do GitGutterNextHunk
https://github.com/airblade/vim-gitgutter/blob/0469b8435ab8b2f25302ef04136591934730e56a/autoload/gitgutter/hunk.vim#L45

Had a quick look, it feels the two should work fine with each other since they both use their one buffer var to record the sign info.

Maybe check the hunks bufvar here https://github.com/airblade/vim-gitgutter/blob/0469b8435ab8b2f25302ef04136591934730e56a/autoload/gitgutter/hunk.vim#L9
can give you some idea about what was going wrong.

To inspect the vars, try:

:echo b:gitgutter

this should show all buffer var used by gitgutter (I didn't try :B)

@ahshah
Copy link
Author

ahshah commented Sep 19, 2019

Will report back here, thanks for taking a look!

@ahshah
Copy link
Author

ahshah commented Sep 19, 2019

It seems that somehow Comrade is some how wiping out gitgutter's hunk bufvar (along with others).

Loading test file without comrade enabled:

:echo b:gitgutter

{'hunks': [[1, 0, 2, 1], [2, 0, 4, 3], [10, 3, 14, 2], [110, 0, 114, 2]], 'tracked': 1, 'summary': [6, 2, 1], 'other_signs': [], 'last_tick': 3, 'dummy_sign': 0, 'gitgutter_signs': {'2': {'id': 3000, 'name': 'GitGutterLineAdded'}, '115': {'id': 3007, 'name': 'GitGutterLin eAdded'}, '4': {'id': 3001, 'name': 'GitGutterLineAdded'}, '5': {'id': 3002, 'name': 'GitGutterLineAdded'}, '6': {'id': 3003, 'name': 'GitGutterLineAdded'}, '14': {'id': 3004, 'name': 'GitGutterLineModified'}, '15': {'id': 3005, 'name': 'GitGutterLineModifiedRemoved'}, '1 14': {'id': 3006, 'name': 'GitGutterLineAdded'}}}

With comrade enabled:

:echo b:gitgutter

{'hunks': [], 'tracked': 1, 'summary': [0, 0, 0], 'other_signs': [], 'last_tick': 3, 'dummy_sign': 0, 'gitgutter_signs': {}}

Loading test file (second time) without comrade enabled:

:echo b:gitgutter

{'hunks': [[1, 0, 2, 1], [2, 0, 4, 3], [10, 3, 14, 2], [110, 0, 114, 2]], 'tracked': 1, 'summary': [6, 2, 1], 'other_signs': [], 'last_tick': 3, 'dummy_sign': 0, 'gitgutter_signs': {'2': {'id': 3000, 'name': 'GitGutterLineAdded'}, '115': {'id': 3007, 'name': 'GitGutterLin eAdded'}, '4': {'id': 3001, 'name': 'GitGutterLineAdded'}, '5': {'id': 3002, 'name': 'GitGutterLineAdded'}, '6': {'id': 3003, 'name': 'GitGutterLineAdded'}, '14': {'id': 3004, 'name': 'GitGutterLineModified'}, '15': {'id': 3005, 'name': 'GitGutterLineModifiedRemoved'}, '1 14': {'id': 3006, 'name': 'GitGutterLineAdded'}}}

@ahshah
Copy link
Author

ahshah commented Sep 19, 2019

If I exit studio, and then load the file with comrade, the buffer remains untouched and navigation remains ok!

@ahshah
Copy link
Author

ahshah commented Sep 19, 2019

Okay, seems like the problem is here:
https://github.com/airblade/vim-gitgutter/blob/0469b8435ab8b2f25302ef04136591934730e56a/autoload/gitgutter/utility.vim#L69

When comrade is enabled this function return false, and the value returned by:
echo getbufvar(1, '&buftype') is empty

When Comrade is disabled:
echo getbufvar(1, '&buftype') is acwrite

Somehow comrade is setting the buftype to empty as its probably writing to a buffer linked to the studio process.

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