CLion: Keyboard cmd to switch between header and implementation files like in xcode
Asked Answered
H

4

78

In xcode I type cmd-shift up/down to switch between .h and .c files. How do I do that in CLion? Or more usefully, what would that action be called in the keymap? I don't find the keymap names terribly usefully named. None stand out for this purpose, including after the usual googling.

Habitforming answered 25/11, 2015 at 0:35 Comment(0)
K
133

The shortcut is called 'Related Symbol' in the keymap.
On Mac it defaults to Ctrl+Cmd+Up,
on Windows/Linux -- to Ctrl+Alt+Home.

Kbp answered 4/12, 2015 at 15:59 Comment(2)
Ubuntu running o a Mac: Ctrl + Alt + fn + LeftWarmblooded
Does not work for me. Do .c and .h files have to be in the same folder? I use CMake and my headers are in a separate includes directory. Is there a workaround?Winegar
C
21

To switch between .h and .c files I use F10 key or the Navigate menu in CLion in Linux system:

F10 Header/Source

Commutative answered 17/2, 2020 at 18:55 Comment(4)
Please be more specificMidland
It does not work in Ubuntu 18.04 because of the stupid system-wide Ubuntu shortcutWinegar
Aleksei Petrenko you can change this shortcut in Keymap option in Setting. My system is Debian 10, and Altgr+F10 it's free for this purpose.Commutative
Found my way here from the linked question regarding Android Studio. In Windows Android Studio 4.0.1 seems to support F10 as well (ctrl + alt + home works too, but pressing single key is much more convenient).Prejudicial
P
5

you can try: Navigate | Related Symbol

Parmenter answered 17/12, 2015 at 2:59 Comment(1)
This doesn't sound like an answer. If you're sure this works, kindly elaborate your point.Lo
D
0

If header and implementation files are already open you can switch between windows with double-shift and enter keys.

Douma answered 20/4, 2016 at 11:50 Comment(1)
That switches to the last window, not between header and source.Complicacy

© 2022 - 2024 — McMap. All rights reserved.