There are some good example of what we call "multi-step" mapped keys that function very similar to macros over in this other thread.

There is an introduction to rotations (i.e. multi-step mapped keys) in one of MiRai's videos.