swapping header/implementation file

I can't seem to find a feature that lets me easily open the corresponding file.  

For instance if I have main.cpp open and I want to switch to or open main.h, in other editors I can just hit a quick hotkey and switch.  Is there a way to do this in clion?  If not, would it be added anytime soon?  And if not to that, could I write a plugin to handle it?

Thanks in advance.

8 comments
Comment actions Permalink

Hi Mike.

It is a 'Declaration' action. You can use ⌘+B for OS X and Ctrl+B for Linux and Windows.
It's also go to 'Releated symbol' ⌘^↑ for OS X.

0
Comment actions Permalink

Thanks for the response Anna.

That isn't quite what I was looking for though.  A lot of times I want to switch to a header or implementation file without being on a symbol that would cause it to switch.

So if I was in a random spot in the cpp file and wanted to go to the header I could hit a hotkey and it would open the header file without any context tagging support.

Oh and also this only changes from cpp to h, to find the declaration of a function.  So I can't go from the header to the cpp file with it. *edit* nevermind I see the goto declaration function too, so that could be used.  But a lot of time I'm not on the symbol and just want a quick change.

It probably would be quite easy to write a plugin to do it, but I wanted to see if there was a way to map that type of hotkey before I spent the time. :)

0
Comment actions Permalink

Mike, try the Ctrl+Alt+Home key combo.

0
Comment actions Permalink

That was it, thanks a bunch! :)

0
Comment actions Permalink

What is it in Mac?
Thanks!

0
Comment actions Permalink

Yuval, please try ^⌘↑ shortcut.

0
Comment actions Permalink

This works also for me, but I think the description of the command should be made clearer, since this is such a frequently used command. Without this forum post I would have never found it.

0

Please sign in to leave a comment.