Author Topic: Make the project name available in C/C++ Aliases  (Read 460 times)

garion911

  • Senior Community Member
  • Posts: 186
  • Hero Points: 13
Make the project name available in C/C++ Aliases
« on: September 08, 2011, 04:09:15 pm »
  • When you right click on a project in the Projects Tool Window, that you can add a new file from a template.
  • Make the project name available in C/C++ Aliases

My goal is to add a header to my C/C++ files that works with doxygen, and one of the 'requirements' is to have the project name in there. I've been using aliases for a while to add the basic structure, but can't find a way for it to insert the project name.. I tried the %RM (and %\rm) I've seen elsewhere, but I think cause aliases use %\r for the return type, its not working.

I think I could do it with file templates, but since they are buried in a menu, and not where I generally right click to add files, I don't use that feature... I think I could figure out how to add it to the menu, but I think it should be there from the get-go...

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: Make the project name available in C/C++ Aliases
« Reply #1 on: September 08, 2011, 04:39:56 pm »
@garion911: You can easily extend aliases by using the 'execute macro' feature '%\m':

- add this to e.g. common aliases 'alias.slk'
Code: [Select]
%\m_alias_ins_project%
and this alias helper macro to your user macros:
Code: [Select]
void _alias_ins_project()
{
   _insert_text( strip_filename( _project_name, 'PDE' ) );
}

You see - there is no limit ;)

Have fun,
HS2
« Last Edit: September 08, 2011, 04:42:23 pm by hs2 »