Vim shortcuts pair <C-]> and <C-t> nicely. With ALEGoToDefinition, there isn't a nice equivalent jump back command (e.g. <C-t> ALEGoBackFromDefinition or <C-t>) which would be nice to have.
You can use <C-o>. See :help jump-motions.
I've been using <C-o> as well, but the main difference is that <C-t> returns to the point where the previous <C-]> jump was made.
With <C-o>, you step backwards through all the jump movement history you may have made while looking around the definitions, and jumping into deeper definitions.
A <C-t> would be nice, but <C-o> is workable.
@chaucerbao Yup. That's actually why i mentioned this issue.
@w0rp Is it possible for ALEGoToDefinition to increment the tag stack so we can use C-t to jump back?
Okay, what is a tag stack, and how do I increment it?
h tag && h tagstack.
I'm not an expert on vim so you may want to get a second opinion before implementing this feature. Maybe this isn't a good idea for some reason we don't know about, or maybe there is a nice solution we don't know about.
On second thought, I am considering that better possible solution would be to have the existing ALEGoToDefinition, add a new ALEGoBackFromDefinition (or some other name), and have some optional way to seamlessly integrate Ale with the C-t and C-] shortcuts (by having an option for the a ALE commands to manipulate the tag stack). This way we don't force any unexpected behaviour upon the tags system, while giving vim users the option for convenience.
I would still definitely need some extra opinions on the above ideas. I am not 100% confident that either of the above options are the best solution
What would this new command do that Ctrl+O doesn't do already?
As @chaucerbao said, C-o is not the same as C-t. vim help menus will tell you more about them
I was thinking that ale would use its own internal stack that has the information required for ALEGoBackFromDefinition to work.
I think the right thing to do is to update the tag stack, and add an option for disabling that behaviour. That will probably make everyone happy.
Most helpful comment
I think the right thing to do is to update the tag stack, and add an option for disabling that behaviour. That will probably make everyone happy.