So, I have 2 files: tictactoe.cpp and tictactoe.h. You can see the image for these two files below in Emacs. I have them stacked horizontally and also have tabbar to show the name of the files

I have helm installed and setup gtags to work. I also mapped helm-gtag-dwim to a shortcut M-n.

Everthing works: whenever I am near a function call in my main tictactoe.cpp file, I can just do M-n and it would search for the definition and bring up the tictactoe.h file, with the relevant function highlighted.

enter image description here

However, my current window will get overwritten. For example, in current picture, tictactoe.cpp is on top, and tictactoe.h is at the bottom

In the tictactoe.cpp if I do M-n on instruction();, that top window will turn into tictactoe.h and highlight where the definition for instruction(); is.

In other words, I would lose the focus of my main code tictactoe.cpp and instead get 2 instances of tictactoe.h stacked on top of each other.

What I want: keep the main tictactoe.cpp or the top window stay in focused. Then, whenever I do helm-gtag-dwim, the cursor should jump to the bottom window, helm then does its thing and highlight the relevant function call in the bottom window.

How can I achieve this for horizontal split as well as vertical split?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.