Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #10121

    Is there a feature/hot key to switch between associated files? E.g. foo.h to foo.c or foo.cpp


    One 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).

    Yutaka Emura

    Hi parameter,

    This is easily done by writing a macro. If you need a help writing the macro, please let me know.

    Thank you!


    It 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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.