-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Currently there's this rather annoying quirk:
If You have a few files open, say, main.c and data.h, and in main.c you include some struct from data.h, then you can miw and gd to goto definition of the struct to find out its fields/change the fields/anything really. The problem is that upon pressing gd a completely new, separate buffer is opened for the same data.h. The only difference between the two is that the one opened by gd has absolute path specified to it.
This wouldn't be half as bad if it just littered the buffer list, I'd be able to live with that. The issue is that it's pretty easy to blindly switch to either of the buffers without fully realizing it, and that is an issue since now You need to do a reload-all every time you switch the buffers, just in case.
Doing gd even on the symbols that are local to the current file (i.e. if you have a global int x in currently focused buffer and then gd on it), then the another buffer is opened as well instead of just jumping to the definition.
Now imagine if you modified one of those buffers somewhere in the beginning, but didn't write out the changes yet (or maybe you did, but forgot to reload-all afterwards). You get distracted by your build system and come back a little bit later. You open the other buffer and start writing stuff somewhere at the end of file, not knowing that now the two buffers diverge. Eventually You notice it, but the damage has already been done at that point, and all of that because You were looking at the contents of your file and not at the bottom left corner, where the buffer name resides. This is what happened to me a few times and it's quite frustrating, so I'd really appreciate if this gets somehow addressed, either by providing a config for g* or just making lookup be performed in an already opened buffer by default.
I tried searching for this but didn't manage to find any issues or PRs related to this.
I propose just checking list of currently opened buffers and searching it for definitions/declarations/etc first, and only then looking globally on the system.
