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: http://gik.fi/subshort

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 
<td>
  indent current line(s)
</td>
<td>
  un-indent current line(s)
</td>
Ctrl+]
Ctrl+[
<td>
  move line (or selection) up
</td>
Ctrl+⇧+↑
<td>
  select line (repeat to select next lines)
</td>
Ctrl+L
<td>
  jump to closing bracket for current code, repeat to jump to opening bracket
</td>
Ctrl+M
<td>
  select all contents of the current brackets (curly brackets, square brackets, parentheses)
</td>
Ctrl+⇧+M
<td>
  comment/un-comment current line
</td>
Ctrl+ /
<td>
  block comment current selection
</td>
Ctrl+⇧+/
<td>
  paste and indent correctly
</td>
Ctrl+⇧+V
<td>
  select next auto-complete suggestion
</td>
Ctrl+Space
<td>
  soft undo (somehow undoes your movements; it jumps to your last change before undoing it when you repeat this command)
</td>
Ctrl+U

<td>
  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
</td>
Ctrl+P
<td>
  command prompt
</td>
Ctrl+⇧+P
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 

Autocompletion: 
    "auto_complete_commit_on_tab":true,
    "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 https://sublime.wbond.net/installation 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 

Colorpicker
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"



colorscheme
https://github.com/MarioRicalde/TextMate-Kuroir-Theme

Color Scheme - Kuroir
Posted October 9, 2014

Omid Hezaveh lives and works in Helsinki find him on twitter