Search code examples
macossublimetext3curly-braces

Move to next curly brace in Sublime Text 3


Is there a way to jump to the next curly brace? I am aware of CTRL+M for Mac, but that only jumps to the matching brace. I would like to jump to the next brace, as I find using the arrow keys to do this a pain. Anyone know if this is possible?


Solution

  • Depending on why you want to jump to another bracket, you could accomplish in at least three ways.

    • use super+f, select far left icon (use regex) and then search for \{|\}. Just continue to press return to jump between each instance.

    • write a macro which uses move and a regex

    • You might benefit by using the EasyMotion package.

    EasyMotion is a Sublime Text 2 plugin that allows you to move the cursor to any character in your current view.

    It's heavily inspired by Vim's EasyMotion, and Emacs' AceJump plugins.

    After pressing the EasyMotion shortcut (default cmd-;/ctrl-;), you then press the character that you'd like to jump to. EasyMotion will then replace all currently visible instances of that character with one of a-zA-Z0-9. Press the key for the one you want and your cursor will be moved right to it.

    For example, if you have something like the following: enter image description here

    and you are interested in moving through all of the { characters, then you can press super+;,{ and it will hightlight all of the {'s present, and label them, starting with a.

    enter image description here

    Press the letter that corresponds with the { you want to move to, in this case I pressed d. (Screenshot caught the blinking cursor while 'off', but you can see where the underscore is present).

    enter image description here