Skip to content

Instantly share code, notes, and snippets.

@barnes7td
Last active December 16, 2015 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barnes7td/5384821 to your computer and use it in GitHub Desktop.
Save barnes7td/5384821 to your computer and use it in GitHub Desktop.
First post for Bloc Sublime's shortcuts

Sublime Tip #1

This is the start of a series of posts to help you better utilize your most important tool in developing, your text editor. For this course we are recommending that you start out with Sublime Text 2. If you have chosen a different editor, read the shortcuts below and find the equivalent actions in your chosen editor. As usual, ask your mentor if you have questions or would like these demonstrated.

The goal of learning these shortcuts is to keep your hands on the keyboard as much as possible and to keep your hands in the same position on the keyboard. Using your mouse moves your hands from the keyboard and can slow your coding.


Autocomplete

Sublime by default gives you many autocomplete features. As you start typing a word you may get a context menu of possible choices. Pressing tab selects the choice that is currently highlighted. Continue to type out the word until it becomes the highlighted choice or use the arrow keys to highlight the correct choice, then press tab to finish the word. This feature becomes more useful as your program gets bigger, as this context list will expand as you create methods and assign variables.

autocomplete


Comment/Uncomment Lines

No matter where the cursor is on the line, this shortcut will comment the whole line or uncomment if the line has already been made a comment. (In Ruby lines starting with # are comment lines, or lines that are not executed) The file's syntax must be set to Ruby in order for these key shortcuts to work. This is most easily done by saving the file with a .rb extension.

Comment/Uncomment:

Mac: cmd + /
Win: ctrl + /


Add line below current line

Instead of moving your cursor to the end of the line and pressing enter, use:

Mac: cmd + return
Win: ctrl + return

Add line above current line

Instead of moving your cursor to the beginning of the line and pressing enter and then moving the cursor up with the up arrow, use:

Mac: cmd + shift + return
Win: ctrl + shift + return

Delete current line

Instead of highlighting the whole line with the mouse and then pressing delete, use:

Mac: cmd + x
Win: ctrl + x


Move Cursor functions

Unfortunately, Sublime doesn't have the greatest key commands for moving your cursor around without the mouse. By default the arrow keys are used for moving your cursor around. You can command the cmd key or ctrl key to skip to the beginning or end of the line:

Mac:
Go to end of line: cmd + right arrow
Go to beg. of line: cmd + left arrow

Win:
Go to end of line: ctrl + right arrow
Go to beg. of line: ctrl + left arrow

Next post, I will discuss some of the basic setting's you should begin with and show you how to customize key shortcuts that can make Sublime more useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment