Home Download Buy Blog Forum Support

Mimicking TextMate's auto-insert of {} on #?

Mimicking TextMate's auto-insert of {} on #?

Postby Jay Levitt on Tue Dec 06, 2011 3:45 pm

I like that TextMate, when in the appropriate Ruby string scope, will take # as a trigger to insert {} and put my cursor in the middle. Where would I start to look in Sublime to do this? The auto_match characters seem hardcoded.
Jay Levitt
 
Posts: 52
Joined: Sun Sep 25, 2011 6:22 pm

Re: Mimicking TextMate's auto-insert of {} on #?

Postby eddyk on Sun Dec 11, 2011 7:42 am

Add this to your user keybinding config

Code: Select all
[
  {
    "args": {
      "contents": "#{${0:$SELECTION}}"
    },
    "command": "insert_snippet",
    "context": [
      {
        "key": "selector",
        "match_all": true,
        "operand": "string.quoted.double.ruby",
        "operator": "equal"
      }
    ],
    "keys": [
      "#"
    ]
  },


i don't recall exactly where this came from. either somewhere on this forum or on the nets.
eddyk
 
Posts: 6
Joined: Sun Jul 10, 2011 5:24 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 38 guests