Sublime Forum

Tab out of brackets (() {} <> "")) How to exclude these symbols at the beginning of the line?

#1

The following code is used for tabs to break out of brackets. I want to exclude {} () <> [] “” "at the beginning of the line. How do I write it?

{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "following_text", "operator": "regex_contains", "operand": "^[();\\[\\]<\\>\"{'},/]", "match_all": true} ] },

Exclude%20these%20situations

0 Likes

#2

To your original question:

    {
        "keys": ["tab"],
        "command": "move",
        "args": {"by": "characters", "forward": true},
        "context": [{
            "key": "preceding_text",
            "operator": "not_regex_match",
            "operand": "^\\s*$",
            "match_all": true,
        }, {
            "key": "following_text",
            "operator": "regex_contains",
            "operand": "^[();\\[\\]<\\>\"{'},/]",
            "match_all": true,
        }],
    },

But since your keybinding is just moving the caret by one char forward. I guess customizing ↑↓←→ is generally more useful… or maybe it’s just my personal habbit.


Here are some hidden gems for people who use BracketHighlighter:

  • press it once to go to the begin/end of the quoted content
  • press it twice to go out of the quote
  • and a keybinding to select the quoted content (without selecting quotes), which I answered before on reddit but people seem do not like it :man_shrugging:

The quote above means tags, brackets, quotes or whatever customized in the bracket settings such as backticks or triple backticks. It’s really handy and underrated usage.

0 Likes