Hi guys. I’m new to Sublime (former E user) and I’m trying to add to Sublime features that I had in E.
Soft Tabs
First thing that was annoying to me was the soft tabs. I tried to mess with all settings but with no luck.
So i made this custom shortcut/key bind:
{ "keys": "tab"], "command": "move", "args": { "by": "words", "forward": true }, "context":
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\t", "match_all":true }
]}
(sublime-keymap)
Selection Wrap
I found there was a package with a lot of stuff that had this thing too, but was for Sublime 1. So i made this key bind:
{
"keys" : "alt+shift+w"],
"command" : "insert_snippet",
"args" : {
"contents": "<${1:p}>${0:$SELECTION}</${1/\\s.*//}>"
}
}
Tada! Works!
Switch Syntax
this is the initial version, read below
[size=85]
This is kind of tricky. It may be a shorter version for this, but i didn’t get it how to do it. All i found was this. Unfortunately, I didn’t understand too much from that thing and what should i do with it. I was stuck at this:
{ "keys": "alt+1"], "command": "set_file_type", "args":{ ***** } }
With no clue on what should i put where astericses are.
So i did this keybinds:
{ "keys": "alt+1"], "command": "set_js_syntax" },
{ "keys": "alt+2"], "command": "set_html_syntax" },
{ "keys": "alt+3"], "command": "set_php_syntax" },
{ "keys": "alt+4"], "command": "set_css_syntax" }
And for all syntax i created a new plugin that contains this:
import sublime, sublime_plugin
class set_css_syntax(sublime_plugin.TextCommand):
def run(self, edit):
self.view.settings().set('syntax', 'Packages/CSS/CSS.tmLanguage')
[/size]
Updated (10x to jbjornson)
{ "keys": "alt+1"], "command": "set_file_type", "args":{ "syntax" : "Packages/JavaScript/JavaScript.tmLanguage" } },
{ "keys": "alt+2"], "command": "set_file_type", "args":{ "syntax" : "Packages/HTML/HTML.tmLanguage" } },
{ "keys": "alt+3"], "command": "set_file_type", "args":{ "syntax" : "Packages/PHP/PHP.tmLanguage" } },
{ "keys": "alt+4"], "command": "set_file_type", "args":{ "syntax" : "Packages/CSS/CSS.tmLanguage" } },
(you can replace CSS with any syntax you want)
So, what do you think guys?
The only two thing that I need to replace E completely is: translate all snippets from E to ST and make ctrl+tab to behave (is very redundant right now). Go to last active tab would be great. Any clues?
(oh, and a history tree would be nice to have)