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

Does not seem to work on MacOS #12

Open
flavius opened this issue Feb 9, 2020 · 1 comment · May be fixed by #15
Open

Does not seem to work on MacOS #12

flavius opened this issue Feb 9, 2020 · 1 comment · May be fixed by #15

Comments

@flavius
Copy link

flavius commented Feb 9, 2020

MacOS: 10.14.6
vim 8.1

error:

Screenshot 2020-02-09 at 19 16 48

idbrii added a commit to idbrii/vim-mergetool that referenced this issue Apr 16, 2020
Fix samoshkin#12: We were assuming users had 'hidden' set.

mergetool#start ends with two steps: prefer_revision and set_layout.
prefer_revision modifies the current buffer to remove conflict markers.
set_layout closes all but the first window in g:mergetool_layout and
then shows the other windows in order.

If a user has these combination of settings, closing the merge buffer's
window will trigger an error:
    set nohidden
    let g:mergetool_layout = 'rm'

We modify the merge buffer (without saving it -- so the user knows we
made changes) and then we try to close it (because 'm' is not the first
item in mergetool_layout), which triggers an "unsaved changes" error.

Prevent the error by temporarily marking the merge buffer to hide while
we're modifying the layout.

Uses setbufvar (introduced to vim in 7.0) to clean up so if the user
doesn't include 'm' in the layout, we don't fail to clean up. And in
that case, the merge buffer is already hidden, so it doesn't cause
unsaved errors until it's shown again.
@idbrii idbrii linked a pull request Apr 16, 2020 that will close this issue
@idbrii
Copy link

idbrii commented Apr 16, 2020

I saw the same problem on windows where when invoked as git mergetool you get that error. I believe it's because the code assumes you're using set hidden. I've opened a PR to handled it. @flavius can you test it out?

idbrii added a commit to idbrii/vim-mergetool that referenced this issue Apr 16, 2020
Fix samoshkin#12: We were assuming users had 'hidden' set.

mergetool#start ends with two steps: prefer_revision and set_layout.
prefer_revision modifies the current buffer to remove conflict markers.
set_layout closes all but the first window in g:mergetool_layout and
then shows the other windows in order.

If a user has these combination of settings, closing the merge buffer's
window will trigger an error:
    set nohidden
    let g:mergetool_layout = 'rm'

We modify the merge buffer (without saving it -- so the user knows we
made changes) and then we try to close it (because 'm' is not the first
item in mergetool_layout), which triggers an "unsaved changes" error.

Prevent the error by temporarily marking the merge buffer to hide while
we're modifying the layout.

Uses setbufvar (introduced to vim in 7.0) to clean up so if the user
doesn't include 'm' in the layout, we don't fail to clean up. And in
that case, the merge buffer is already hidden, so it doesn't cause
unsaved errors until it's shown again.
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

Successfully merging a pull request may close this issue.

2 participants