问题
When I create new class MyClass, CLion creates MyClass.h and MyClass.cpp, but I want my_class.h and my_class.cpp. And when I try to rename files it renames class to class my_class {}. How can I have class MyClass {} and my_class.h, my_class.cpp?
回答1:
You have to write some Apache Velocity engine code to do that. Inside the CLion preferences you can adjust the file creation template settings (something like that, I don't have CLion open here to look it up) and write something like:
#set( $CamelCaseName = "" )
#set( $part = "" )
#foreach($part in $NAME.split("-"))
#set( $CamelCaseName = "${CamelCaseName}$part.substring(0,1).toUpperCase()$part.substring(1).toLowerCase()" )
#end
回答2:
You can go to "Settings -> Editor -> Code Style -> C/C++ -> New File Extensions" and change "File Naming Convention".
来源:https://stackoverflow.com/questions/38037467/how-to-use-snake-case-for-file-names-and-camel-case-for-file-names-in-clion