Move to Match


The Mathematica code editor supports moving between matching characters. This is useful for Mathematica, where characters such as "[" and "]" are used very frequently.

Place the cursor by a matching character (or select the character), and then press Ctrl+Shift+P (on a Macintosh this is Command+Shift+P). This will select the corresponding character and scroll the editor to that character. Moving the visible region is very useful when you are working with large functions.

For example, place the cursor before the "[" character.

Before Match

Now if you press Ctrl+Shift+P, the cursor will move to the corresponding character.

After Match

The move to match feature is implemented for "[" and "]", "(" and ")", "{" and "}", as well as "(*" and "*)". In addition, you can move between string-terminating characters '"'.

Another way to see matching characters is the bracket matching feature. This highlights a matching character automatically. However, sometimes it is useful to move the cursor to the matching character.