Skip to content

Instantly share code, notes, and snippets.

@dwmkerr
Last active April 11, 2020 03:30
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save dwmkerr/04fa8b8c15d049d0381e7798a79bcc45 to your computer and use it in GitHub Desktop.
Save dwmkerr/04fa8b8c15d049d0381e7798a79bcc45 to your computer and use it in GitHub Desktop.
Quickly setup Sublime Text 3 for Angular 2

Quick Setup for Sublime Text 3 for Angular 2

Easy to remember, easy to forget.

Step 1: Download Sublime Text 3

Sublime Text 3 Download

Step 2: Create a bash shortcut

It's nice to be able to run subl in a terminal.

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime

Step 3: Install Package Manager

Hit Ctrl+` to open the terminal and execute the python code below:

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Step 4: Add the Typescript Package

  • Cmd+P
  • Install Package
  • TypeScript
  • Restart

Step 5: Configure TypeScript tabs

  • Preferences > Settings > Syntax Specific (User)
{
  "tab_size": 2,
  "translate_tabs_to_spaces": true
}
@michalmw
Copy link

Hey, what about autoimport?

when i in component write:

constructor(private router: Route.. <then click enter and in inport part of my file (top) start import { Router } form '@angular....' ? Any idea? - I can pay for this plugin..

@shazmoh
Copy link

shazmoh commented Oct 1, 2017

Step 3 didn't work. Snippet from https://packagecontrol.io/installation worked as mentioned by @miikkaa

@saulcstartx
Copy link

Step 3 is in the sublime terminal, I mean, Open subl and then use Ctrl + `. I got an error related to the h = '...88', I just change it with the suggested value in the error and it works! I hope that can help you! ;)

@navrudh
Copy link

navrudh commented Dec 11, 2017

step 5. b. could be to install the EditorConfig plugin

@chondo92
Copy link

step 3 brings an error to my side

@chondo92
Copy link

step 3 brings the following error,am using ubuntu 19.04
Screenshot from 2019-12-31 09-53-51

@neldroid
Copy link

For step 3, in the same Sublime press Win/Linux: ctrl+shift+p, Mac: cmd+shift+p. Type Install Package Control and press Enter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment