Thursday, March 8, 2012

My Sublime Text 2 on Windows 7 64bit



Sublime, the awesome, amazing editor.
1. Get 64bit portable version
2. Install Package Control
This is the most complex step.
Type Ctrl + ` and enter following python code
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'
3. Install Packages (All from package control)
  • Alignment
    • Format shortcut – Ctrl + Alt + a
  • BracketHighlighter
  • CoffeeScript
  • Display Functions (Java)
  • Edit History
    • Jump to next/previous edit location
    • Add Key Binding
      • { "keys": ["ctrl+alt+e"], "command": "previous_edit" },
        { "keys": ["ctrl+e"], "command": "next_edit" }
  • FileDiffs
    • Usage
      • Right click on tab (Or use command popup then search “Diff”)
        • Diff with clipboard – Text Diff
        • Diff with another file – Text Diff + Visual Diff Tool
          (KDiff3, WinMerge, DiffMerge…)
    • Install KDiff3
    • Modify Code (file_diffs.py)
      Under WINMERGE 
      if not WINMERGE:
          if os.path.exists("%s\KDiff3\KDiff3.exe" % os.environ['ProgramFiles(x86)']):
              WINMERGE = '"%s\KDiff3\KDiff3.exe"' % os.environ['ProgramFiles(x86)']
          else:
              WINMERGE = '"%s\KDiff3\KDiff3.exe"' % os.environ['ProgramFiles']
      ……
      End of run_diff function
      
      if from_file == 'from_file' or to_file == 'to_file':
                  cmd_line = '%s "%s" "%s"' % (WINMERGE, from_file, to_file)
                  print "KDiff3 command: " + cmd_line
                  Popen(cmd_line)
  • Git
  • HTML5
    • Snippets
  • IndentGuides
    • Indent line for editors
  • jQuery
    • Snippets
  • jQuery Snippets pack
    • Hint : Need enable jQuery support by command
    • Snippets
  • JS Minifier
    • Minify shortcut – Ctrl + Alt + m
  • JsFormat
    • Format shortcut – Ctrl + Alt + f
  • Pretty JSON
    • Format shortcut – Ctrl + Alt + j
  • Prefixr
    • Format shortcut – Ctrl + Alt + x (For CSS)
  • SideBarGit
  • SideBarEnhancement
  • SublimeCodeIntel (Must Have)
    • Autocomplete (Popup)
  • Tag
    • “/”to end tag
    • Format shortcut – Ctrl + Alt + f
    • Features : Edit –> Tag …
  • Terminal
    • Open file shortcut – Ctrl + Shift + t
    • Open folder shortcut – Ctrl + Shift + Alt + t
  • Tortoise
    • Need  TortoiseGit or TortoiseSVN
    • Update : 20120314 - error: [Error 2] The system cannot find the file specified
      • Because TortoiseGit use mysysgit as default Git under Windows 7 64bit version,
        we need to modify Tortoise.py
        class Git():
            def __init__(self, tortoise_proc_path, root_dir):
                self.git_path = os.path.abspath('C:\\PATH\\git.exe')
  • WinMerge
    • Compare shortcut – Ctrl + Alt + d (Current file with previous edit file)
    • Modify Code (WinMerge.py)
      WINMERGE = "F:\WinMerge-2.12.4\WinMergeU.exe"
  • ZenCoding (AWESOME!!)
    • Trigger – Tab
Editor Shortcut
  • Toggle sidebar (file explorer) – Ctrl + K then B
  • Command List - Ctrl + Shift + P
  • File Search – Ctrl + P
    • Search  Text in File – Ctrl + P then enter #searchText
    • Jump to specific paragraph(Function/Class/Tag) – Ctrl + P then enter @searchMethod
    • Go to specific line – Ctrl + P then enter :lineNumber
Right Click Menu Support



  • Modify the Path of following regestries
  • Save following text into a .reg file then double click on it to apply

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\SublimeText]
@="Edit With Sublime Text2"
"Icon"="D:\\WindowsApp\\Sublime\\sublime_text.exe"
"Position"="Bottom"

[HKEY_CLASSES_ROOT\*\shell\SublimeText\command]
@="D:\\WindowsApp\\Sublime\\sublime_text.exe %1"

No comments:

Post a Comment