ruk·si

🍋 Sublime Text

Updated at 2015-09-29 00:55

Add Sublime Text as a command. I prefer to rename it sub, subl is too long.

# to start sublime from command line, add symlink to the executable
ln -s \
    "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" \
    /usr/local/bin/sub

# for old sublime
ln -s \
    "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" \
    /usr/local/bin/sub
sub .
# and if sublime is the default editor in OS X
open file.txt
open projectname.sublime-project

Learn the keybindings. The most important ones:

  • Cmd+p: Open file in project
  • Cmd+Shift+p: Search and execute command.
  • Cmd+1: Switch to 1st tab etc.
  • Cmd+Shift+f: Search from open files and project.
  • Cmd+k, u: Convert selected to uppercase.
  • Cmd+k, l: Convert selected to lowercase.
  • Cmd+d: Find and add next similar string to selection.
  • Cmd+Shift+d: Duplicate the line you are on.
  • Cmd+Shift+t: Open recently closed file.
  • Cmd+n: Open new tab.
  • Cmd+Shift+n: Open new window.

My custom keybindings to keep functionality consistent between applications.

[
    { "keys": ["super+enter"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "}},
    { "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": false, "text": ":"}},
    { "keys": ["super+t"], "command": "new_file" }
]