-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
GoToDefinition splits instead of replacing buffer if modified but opened elsewhere #4223
Comments
The suggested behaviour feels very wrong to me. You told YCM to open the definition in the same buffer youbare in and expect YCM to switch a tab and maybe still end up with a tabpage with a bunch of splits? I am also of the opinion thatv Personal preferences aside, |
No, sorry if I was not clear. The issue is that calling My personal example where I opened a tab was just my personal use-case for this. Just to clarify further, in my case, the sequence of actions performed is:
I hope this is a bit more clear. |
Right, that makes more sense, but I'd have to check if vim itself agrees and if there's a noticable performance hit for the usual use case. I am on a vacation currently, so next week, probably. |
Fair enough, it's definitely not urgent. Thanks a lot for looking into it! |
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
insidethe brackets) before filing your issue:
[Frequently Asked Questions][faq] section.
about to report and couldn't find an answer to my problem.
that any help I receive is a selfless, heartfelt gift of their free time. I
know I am not entitled to anything and will be polite and courteous.
actually perform all of these steps.
Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
Issue Details
I like to both manually use
:YcmCompleter GoTo
commands, while also keeping a keybind to use them while directly opening the resulting file/line in a new tab. As mentioned in #1146, this can be achieved by settingg:ycm_goto_buffer_command
tosame-buffer
, and creating the following keybind:Now something I noticed is that from time to time this would still result in a split. After reading again the manpage for
g:ycm_goto_buffer_command
, I now realize the reason for this:Indeed, if my starting buffer is modified, my custom map will open a new tab, then call
YcmCompleter GoToDefinition
, see that the buffer is modified, and create new split.However, this is completely unnecessary, as there already exists an opened window (the one I left in the original tab) containing the same modified buffer, so there is no chance of the changes being lost if jumping within the same buffer. For this reason, I'd like to suggest that if it can be proven by YCM that the current buffer, although modified, is already opened elsewhere, that the
same-buffer
policy can be fully respected regardless of the state of the buffer in the current window.The text was updated successfully, but these errors were encountered: