Home Download Buy Blog Forum Support

How to jump to the end after auto-pairing?

How to jump to the end after auto-pairing?

Postby Marty on Thu Aug 02, 2012 4:07 am

If I write "[", Sublime ofcourse adds the "]" automatically and I can write what's supposed to be in between.
However, in other editors i've gotten used to be able to press the TAB key after finnish writing inside the brackets (or any other auto-pairing characters/snippets) to "jump out" of the auto-paired part.

Is this feature already available and i'm just missing it?
Marty
 
Posts: 3
Joined: Thu Aug 02, 2012 4:04 am

Re: How to jump to the end after auto-pairing?

Postby C0D312 on Thu Aug 02, 2012 4:18 am

Add to your keybindings:
Code: Select all
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [
        { "key": "following_text", "operator": "regex_contains", "operand": "^[)\"'\\]\\};]", "match_all": true },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false },
        { "key": "has_next_field", "operator": "equal", "operand": false }
    ]   
  },
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: How to jump to the end after auto-pairing?

Postby Marty on Thu Aug 02, 2012 5:23 am

Yes, it works! Thank you very much.

But I found after setting it, if I really want to use 'tab' to give 4 spaces before characters like "]","}", the cursor will jump to the right of the character.
Other IDEs just jump after auto-pairing.
I don't know if ST2 can do it?
Marty
 
Posts: 3
Joined: Thu Aug 02, 2012 4:04 am

Re: How to jump to the end after auto-pairing?

Postby nick. on Thu Aug 02, 2012 11:55 am

Similar to the above. I got it from this forum, forget who wrote it though... :oops:
Code: Select all
/* Set <tab> to pass through auto-filled punctuation */
   { "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true},
      "context": [ { "key": "selection_empty", "operator": "equal", "operand": true },
                { "key": "preceding_text", "operator": "not_regex_match", "operand": "[[:space:]]*", "match_all": true },
                { "key": "following_text", "operator": "regex_contains", "operand": "^[\"'\\)\\}\\]]", "match_all": true },
                { "key": "auto_complete_visible", "operator": "equal", "operand": false },
                { "key": "has_next_field", "operator": "equal", "operand": false } ] },
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: How to jump to the end after auto-pairing?

Postby Marty on Fri Aug 03, 2012 12:07 am

AWESOME! Thank you all.
Marty
 
Posts: 3
Joined: Thu Aug 02, 2012 4:04 am

Re: How to jump to the end after auto-pairing?

Postby ayang23 on Sun Dec 16, 2012 3:29 pm

nick. wrote:Similar to the above. I got it from this forum, forget who wrote it though... :oops:
Code: Select all
/* Set <tab> to pass through auto-filled punctuation */
   { "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true},
      "context": [ { "key": "selection_empty", "operator": "equal", "operand": true },
                { "key": "preceding_text", "operator": "not_regex_match", "operand": "[[:space:]]*", "match_all": true },
                { "key": "following_text", "operator": "regex_contains", "operand": "^[\"'\\)\\}\\]]", "match_all": true },
                { "key": "auto_complete_visible", "operator": "equal", "operand": false },
                { "key": "has_next_field", "operator": "equal", "operand": false } ] },

This is very good for me. Thank you.
ayang23
 
Posts: 1
Joined: Sun Dec 16, 2012 3:27 pm


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests

cron