thiagobraga
3/3/2013 - 8:39 AM

[Automate Packages Installation in Sublime Text 2] -- Automatically install Sublime Text 2 packages (some necessary ones, w/o fucking crap o

[Automate Packages Installation in Sublime Text 2] -- Automatically install Sublime Text 2 packages (some necessary ones, w/o fucking crap ones which makes sublime alike hell!)

  • To install packages, every time pressing ' ctrl+shift+pPackage Control: Install Package is very cumbersome task... right?

  • After fresh installation of ST2, open it and ctrl+` and hit enter after pasting below line (1):

  import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')
  • Restart ST2.

  • Open terminal, and navigate to Sublime's dir under your home folder by below command and create file w/ name Package Control.sublime-settings there in:

cd $HOME/.config/sublime-text-2/Packages/User && touch Package\ Control.sublime-settings
  • Add below json (these packages were stable at the time of writing this gist, maybe you can add yours to it) to this above created file, and save it (2):
  {
    "installed_packages":
    [
        "Alignment",
        "Alternative Autocompletion",
        "ApacheConf.tmLanguage",
        "Auto Encoding for Ruby",
        "Autocomplete Javascript with Method Signature",
        "AutoFileName",
        "Backbone.js",
        "BeautifyRuby",
        "Bracketeer",
        "BracketHighlighter",
        "BufferScroll",
        "C++",
        "ChangeQuotes",
        "CoffeeCompile",
        "CoffeeScript",
        "CoffeeScript Function Finder",
        "Color Highlighter",
        "Color Scheme - Default",
        "ColorPick",
        "ColorSchemeSelector",
        "Console API Snippets (JavaScript)",
        "copy-file-name",
        "CSS",
        "CSS Less(ish)",
        "CSS Media Query Snippets",
        "CSS Snippets",
        "CSScomb",
        "CSSFormat",
        "Csslisible",
        "CSSTidy",
        "CTags",
        "Current Scope",
        "Dayle Rees Color Schemes",
        "Default",
        "DetectSyntax",
        "Diff",
        "ERB Insert and Toggle Commands",
        "ERB Snippets",
        "Git",
        "Git Status Files",
        "GitGutter",
        "Hacker News",
        "Haml",
        "HighlightDuplicates",
        "HTML",
        "HTML2Haml",
        "HTML5",
        "HTMLAttributes",
        "HtmlTidy",
        "InsertDate",
        "JavaScript",
        "JavaScript Snippets",
        "jQuery",
        "jQuery Snippets pack",
        "JS Snippets",
        "JS2Coffee",
        "JsFormat",
        "JSHint",
        "JsMinifier",
        "Language - English",
        "LESS",
        "Less2Css",
        "Line Completion",
        "LineEndings",
        "Logs Colorize",
        "LoremIpsum",
        "Markdown",
        "Markdown Preview",
        "Meld diff",
        "Missing Palette Commands",
        "MoveText",
        "Nodejs",
        "Open Folder",
        "Open Recent Files",
        "Package Control",
        "PHP",
        "Placehold.it Image Tag Generator",
        "PlainTasks",
        "Prefixr",
        "Pretty JSON",
        "Python",
        "Rails",
        "Rails Partial",
        "Regular Expressions",
        "Ruby",
        "Ruby on Rails snippets",
        "RubyFormat",
        "RubyToggleString",
        "Sass",
        "SCSS",
        "SCSS Snippets",
        "Search Anywhere",
        "ShellScript",
        "SideBarEnhancements",
        "Simple Rails Navigator",
        "SortTabs",
        "SQL",
        "Sublime-HTMLPrettify",
        "SublimeWebColors",
        "SyncedSideBar",
        "Textile",
        "Theme - Default",
        "Theme - Night",
        "Themr",
        "Todo",
        "Toggle Symbol to String",
        "Twig",
        "Unicode Character Highlighter",
        "URLEncode",
        "User",
        "Vintage",
        "WordCount",
        "XML",
        "YAML"
    ]
  }
  • Now when you open your ST2 again, it looks for this file, and if the packages specified in this file are missing, then it automatically downloads and installs for you!

  • ctrl+` to see what's it installing, (displays tailed log of al the happenings in your ST2 environment)!

  • You just seat back for some time and watch it or bring some popcorn and hot tea! It takes no time either!

;)


References