Omid's Blog

Working with Sublime Text

Getting used to an editor speeds up things greatly, so I’ve decided to know Sublime Text. Here are my notes.


shortlink for this page:

Adding a shortcut for auto indenting:

<span class="pun">Preferences → <code>KeybindingsUser
{</span> "keys": ["f12"], "command": "reindent"}   </code>

Text Selections
Alt + arrow : Moves the cursor word by word instead of charachter by charachter. 
Ctrl + D : selects a word 
Ctrl + L : selects a Line
Ctrl Shift A : select a tag
Ctlr Shift M : select brackets 
Ctrl Shift J : select by indentation 
Ctrl Shift Space: Select by Scope (words with the same color)

Ctrl Home : to go the beginning of the file

Ctrl end: to go to the end

Ctrl Del: to delete the word after the cursor

Ctrl Backspace: del the word befor the cursor

Ctrl L: jump to address bar

Edit Menu
Ctrl Shift T : transposes two letters, or two words
Ctrl Shift Up and down : swap line up and down 
  indent current line(s)
  un-indent current line(s)
  move line (or selection) up
  select line (repeat to select next lines)
  jump to closing bracket for current code, repeat to jump to opening bracket
  select all contents of the current brackets (curly brackets, square brackets, parentheses)
  comment/un-comment current line
Ctrl+ /
  block comment current selection
  paste and indent correctly
  select next auto-complete suggestion
  soft undo (somehow undoes your movements; it jumps to your last change before undoing it when you repeat this command)

  quick-open files by name in your project (doesn’t seem to need an actual project set up, it just searches in the directories around the currently-opened file
  command prompt
Ctrl K B Hides the sidebar

Using double column interface:
Shift Alt 2 

Cltrl F2: sets a bookmark
F2 : goes to your bookmark 

Go To Anything
Ctrl P : go to any file 
Add a # it and it searches the files with fuzzy matching
Ex: inde#div 

:50 : goes to line 50 
ex: ind:30 

@ : it finds ids in the file! 

Ctrl Shift P : brings the commands 

    "auto_complete": false

I had to change my userkeybindings files like this to enable Ctrl Space keybinding on linux:

    { "keys": ["f12"], "command": "reindent"},
    { "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }

When I auto complete a tag, it's an snippet. So it puts my cursor on the first field. Then if I press
tab I can go to the next field! 

in command pallet, you can write snip and see all the snippets. 

Package Manager: 
Go to push install, get the code, go to sublime > view > show console
paset the command and push enter. Now we have a package manager! :O 

CTRL P > packaging install > readmeplease
installs a utility to read the readme files of all packages 

Packaging install > colorpicker 
Also line ending package is a good one. 
To change the theme, download soda and extract it to packages folder, rename it to:
Theme - Soda
Then add this line to user prefs: 
    "theme": "Soda Light.sublime-theme"


Color Scheme - Kuroir
Posted October 9, 2014

Omid Hezaveh lives and works in Helsinki find him on twitter