Comrade for neovim conflicts with gitgutter navigation
Opened this issue · 5 comments
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)
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)
Will report back here, thanks for taking a look!
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'}}}
If I exit studio, and then load the file with comrade, the buffer remains untouched and navigation remains ok!
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.