- AuthorPosts
- March 5, 2012 at 9:17 pm #10121parameterMember
Is there a feature/hot key to switch between associated files? E.g. foo.h to foo.c or foo.cpp
March 5, 2012 at 11:17 pm #10128parameterMemberOne way to do this in a more general way (i.e. not just c++) would be to have a command to rotate through the extensions (associations) for a given configuration.
So for HTML, if you were editing foo.htm when you executed the command then Emedit would look for foo.html, foo.asp, foo.aspx, foo.shtml, and foo.shtm in the same directory as foo.htm and open that file (whichever it found next).
For C++, in my version of Emedit, it looks like that list would be cpp, cxx, c, h, hpp, inl, and rc. If I only had a foo.cpp and a foo.h file in that directory I’d effectively jump between the two associated files with this command.
If I also had a foo.inl in that directory, I’d rotate between all three.
I’m hoping this will make the feature request more appealing to implement as it will be more generally useful and elegant (vs. my initial request to jump between two files for one specific programming language).
March 6, 2012 at 5:58 pm #10132Yutaka EmuraKeymasterHi parameter,
This is easily done by writing a macro. If you need a help writing the macro, please let me know.
Thank you!
March 6, 2012 at 11:19 pm #10145parameterMemberIt was pretty easy to get this far:
var current_file=document.FullName;
var with_out_ext=current_file.substring(0, current_file.lastIndexOf(“.”));
var ext=current_file.substring(current_file.lastIndexOf(“.”));
switch (ext)
{
case “.cpp”: ext = “.h”; break;
case “.h”: ext = “.cpp”; break;
}
editor.OpenFile(with_out_ext+ext, 0, eeOpenAllowNewWindow);But I haven’t found where to get the list of extensions from the current configuration. I’m also not sure how to test if the file exists (so I can try the next file extension if it does not exist).
Tips/suggestions welcome.
- AuthorPosts
- You must be logged in to reply to this topic.