Hi all,
I am new in sublime. there is any way I can added automatically every time I type $this the symbol -> after $this ?
Thank you.
Hi all,
I am new in sublime. there is any way I can added automatically every time I type $this the symbol -> after $this ?
Thank you.
Try with a snippet: http://docs.sublimetext.info/en/latest/extensibility/snippets.html
or a keybinding for the s
key, that operates in a source.php
scope, and checks the rest of the line after the caret is blank and the contents of the line before the caret are just optional whitespace followed by $thi
, and… inserts a snippet
EDIT: turns out a snippet is not necessary, because we don’t need to manipulate the selection or anything within the text being inserted. see post below.
add this to your user keybindings file:
{ "keys": ["s"], "command": "insert", "args": { "characters": "s->" }, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "source.php", "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^\\s*\\$thi$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},