Skip to content

Latest commit

 

History

History

sublime

sublime

Offical home page : http:https://www.sublimetext.com/

Note for XP

** Unicode Error ** UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 15: ordinal not in range(128)

need to change a line in Sublime Text 2\Packages\Default\exec.py

for k, v in proc_env.iteritems():
            proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
# change the line to 
proc_env[k] = os.path.expandvars(v.decode(sys.getfilesystemencoding())).encode(sys.getfilesystemencoding())

More details : see 1 and 2

Setup Sublime Text

User Setting

Ctrl-Shift-P-> user

The 4 space per tab

{
    "tab_size": 4,
    "translate_tabs_to_spaces": true, 
    "detect_indentation": false
}

note: detect_indentation to false will let Sublime stop to guess which indendation style to use when opening files.

Active Vim mode

  1. for sublime 2, vintage is good enough.

presss command-P Prefersu, add fellowing settings

{
    //enable "Vintage"
    "ignored_packages": []
}
  1. for sublime 3 , use vintagous instead. Download from here, copy into "/Users/{your_name}/Library/Application Support/Sublime Text 3/Installed Packages/" folder BTW, although the office doc says vintagous need to ensure Vintage is in the ignored_packages, wried the two can work together in my test.

  2. In Mac, need to disable repeat key context menu, see here for more details

defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false

Working in commandline

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

Console

Ctrl-` will open a python console (with embeded inside sublime).

Install Package Installer

Download from wbond site

Install Md extend syntax highlight

  • Install : CMD-Shift+P -> enter pkgin -> enter markdownextend

  • Make it default : View -> Syntax -> Open all with current extension as... -> Markdown Extended

Install Md preview

  • Install : CMD-Shift-P -> enter pkgin -> enter markdownpreview
  • Usage : Ctrl-Shift-P (Windows/Linux) or CMD-Shift-P (Mac) -> enter prewb

Terminal

Sometimes, you may want a os terminal inside your working folder, here a plugin called sublime_terminal is.

  • Install : Ctrl-SHIFT-P -> pkgin -> terminal
  • Usage :
    • Ctrl-SHIFT-T open under your file
    • Ctrl-Alt-T open under your project

Git Glutter

  • Install : Ctrl-Shift-p -> 'pkgin' -. 'git-glutter' Show git-diff in your glutter

Git plugin

  • Install : Ctrl-P -> 'pkgin' -> git
  • Usage :
    • Ctrl-P -> gits : list git status

Very useful, see the wiki for more details.

Advanced New File

A plugin to create file folder also See here for details

  • Install : Ctrl-P -> 'pkgin' -> 'AdvancedNewFile'
  • Usage : Ctrl-alt-N

Nettuts+ Fetch

fetch a file/files from remote (look it as a curl command executed by a inputted key).

see usage

Sublime Prefixr

runs CSS through the Prefixr API (create cross-browser css)

Shell Turtlestein

  • Uasge : Ctrl-Shift-C (Quit use ESC, up and down see the history commands)

Sidebar Enhancements

SublimeREPL

  • Install : CMD-P -> pkgin -> 'sublimerepl' (need to restart )

repl:shell can open a os shell

sublime-github

Jshint

sublime linter

A framework for interactive code linting

html-tidy

SublimeCodeIntel

Better than the default code complete.

Tag

Build JavaScript code

Go to "Tools > Build System > New Build System" , add code like:

{
    "cmd": ["node","$file"],
    "selector": "source.js"
}

After that, we can use ctrl-B to build JavaScript.

Node.js binding