One of the first things you’ll do as a new programmer is choose a text editor to work with on a regular basis. Two of the most popular text editors, Atom and Sublime, offer features that can make your work a lot easier. But which one is better?
Sublime Text with Emmet allows you to automatically update width and height attributes on img tags. Place the cursor inside an img tag and hit Ctrl–Shift–I (Mac) or Ctrl–U (Windows).
Note: This keystroke requires Emmet to be installed in Sublime Text. For instructions on how to install Emmet, download our Sublime Text Enhancements Installation Guide.
In Sublime Text, you can quickly jump to any line in the code. Hit Ctrl–G (Mac and Windows). Type in a line number and hit Return/Enter to go to that line.
To jump to the beginning or end of the line, hold Cmd and hit Left or Right Arrow (Mac). Windows users, hit Home to jump to the beginning of the line and End to jump to the end of the line. This is an operating system feature so it should work in any text editor.
Sublime Text remembers the last 15 items you’ve copied and you can paste any one of them!
Hit Cmd–Option–V (Mac) or Ctrl–K then Ctrl–V in quick succession (Windows) to access the list of copied items. Use the arrow keys to select an item and hit Return/Enter to paste.
In Sublime Text, you can select lines with a keystroke. Hit Cmd–L (Mac) or Ctrl–L (Windows) to select the current line. Repeat the keystroke to add the line below.
Sublime Text allows you to quickly join lines together. Select the lines and hit Cmd–J (Mac) or Ctrl–J (Windows).
If nothing is selected, Sublime Text will join the line below to the current line.
Sublime Text allows you to quickly sort lines alphabetically. Select the lines you want to sort and choose Edit > Sort Lines. You can also use the keystroke F5 (Mac) or F9 (Windows).
While you can place multiple text cursors in Sublime Text with Cmd–Click (Mac) or Ctrl–Click (Windows), here's another technique that comes in handy.
Hold Ctrl–Shift (Mac) or Ctrl–Alt (Windows) and hit Up or Down Arrow to place an additional text cursor above or below the current cursor.
Windows Users: Ctrl–Alt and Arrow keys may rotate the screen. You may need to change or disable those keystrokes in your display settings.
Sublime text allows you to quickly convert selected text to upper case or lower case.
- To convert to upper case: In quick succession, hit Cmd–K then Cmd–U (Mac) or Ctrl–K then Ctrl–U (Windows).
- To convert to lower case: In quick succession, hit Cmd–K then Cmd–L (Mac) or Ctrl–K then Ctrl–L (Windows).
You can also convert to title case by choosing Edit > Convert Case > Title Case (there’s no keyboard shortcut).