Created
April 30, 2012 18:43
-
-
Save Muon/2561013 to your computer and use it in GitHub Desktop.
C/C++ header guard snippet for Sublime Text 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
#ifndef ${TM_FILEPATH/(([A-Za-z]+)\/src\/)|./\U(?1:$2_)\E/g}${TM_FILENAME/(([A-Z])([A-Z][a-z]))|(([a-z])([A-Z]))|([a-z])|(\.)/\U(?1:$2_$3)(?4:$5_$6)$7(?8:_)\E/g} | |
#define ${TM_FILEPATH/(([A-Za-z]+)\/src\/)|./\U(?1:$2_)\E/g}${TM_FILENAME/(([A-Z])([A-Z][a-z]))|(([a-z])([A-Z]))|([a-z])|(\.)/\U(?1:$2_$3)(?4:$5_$6)$7(?8:_)\E/g} | |
$0 | |
#endif | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>guard</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.c++</scope> | |
<scope>source.c</scope> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Woah, blast from the past. Sorry, I didn't notice your comment at all. (Are there notifications for this? @_@) I unfortunately can't remember how this works any more. I might be compelled to reexamine this in the near future. I suggest trying to hijack the part which matches multiple capitals to match non-leading digits as well. That would probably solve your problem. Good luck!