Newbie question here.

In intellij there is Ctrl-Shift T to go to the corresponding test file. (For java at least.) I would like something similar in emacs. Something like this:

For a language (or project) there need to ba a mapping between source code and corresponding test code. In Ruby it could be lib and spec and in Java/Maven it would be src/main/java and src/test/java.

For a language (or project) there need to be a mapping between file names. In Ruby it could be bits_of_code.rb maps to bits_of_code_spec.rb and in Java i might be BitsOfCode.java maps to BitsOfCodeTest.java.

This (the easy part for me now - some progress at least) should be mapped to a shortcut. T seem to be taken already for character swapping so input on what mapping that would be a natural choice for an emacser is also appreciated.


I recommend Projectile for this, and much more, project-related functionality. Projectile has a binding C-c p t (projectile-toggle-between-implementation-and-test) that offers exactly what you're looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.