Skip to content

Instantly share code, notes, and snippets.

@samarpanda
Last active January 26, 2023 16:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samarpanda/4373209 to your computer and use it in GitHub Desktop.
Save samarpanda/4373209 to your computer and use it in GitHub Desktop.
My favorite keyboard shortcuts Sublime Text 2

Keyboard shortcuts for Sublime Text 2

  1. Multi-selection: To enable multi-selection, you have several options
  • Press Alt or Command and then click in each region where you require a cursor.
  • Select a block of line, and then press Shit + Command + L
  • Place the cursor over a particular word, and press Control/Command + D repeatedly to select additional occurences of that word.
  • Alternatively, add an additional cursor at all occurences of a word by typing Alt+F3 on Windows, or Ctrl+Command+G on the Mac.
  1. Find all occurence of a word in a file and edit all of those at a time:

Command + F then Option + Enter. All the occurance of the word should be editable.

  1. File Switching

Command + P

  1. Functions

Ctrl/Command + R

  1. Go to line Number

Ctrl + G

  1. Search word in bunch of files

Command + Shift + F To search for selected word (Command + E) (For Mac, works by default for Ubuntu)

  1. Enable file syntax highlighting before saving a new file

Command + Shift + p And type the file type i.e for PHP type php. That will set the file type before saving the file.

  1. Soft undo:

Command + u Undoes selection command as well as modifying commands, as oppossed to regular undo, which undoes modifying commands only.

  1. Start of the line

Command + Left OR Alt + Left Arrow

  1. End of the line

Command + Right Arrow OR Alt + Right Arrow

  1. Start of the file

Command + Up Arrow

  1. End of the file

Command + Down Arrow

  1. Duplicates the current line

Command+Shit+D

  1. Delete the line

Control+Shift+K

  1. Move line of code up/down

Control + Command up/down arrow

  1. Alphabetical order sorting ??

My favorite features

  1. Flexibility of the go to anything dialogue Command + t or Command + p
  • Goto file: 'contr AdC' -> app/controllers/AdController.php
  • Goto line in file: 'contr AdC:15' -> app/controllers/AdController.php line no.15
  • Goto function in file: 'contr AdC@email' -> app/controllers/AdController.php function email
  • And it will work with or without the space for all the options i.e 'contrAd@email`
  1. ctrl + t swaps text, for example foo(bar) if you place the cursor before the parenthesis and press ctrl + t it will become bar(foo).

Keybord shortcuts for sublime text 3

  1. Command + shift + [ move to left file tab / left pane cyclic
  2. Command + shift + ] move to right file tab / right pane cyclic
  3. Command + Ctrl + Shift + F Distraction free / Fullscreen
  4. Command + Option + 2 Vertical column split by 2
  5. Command + Option + Shift + 2 Horizontal split by 2

References

  1. https://blog.generalassemb.ly/sublime-text-3-tips-tricks-shortcuts/
  2. http://www.macdrifter.com/2012/07/sublime-text-working-with-multiple-panes.html
  3. http://aslanbakan.com/en/blog/33-essential-sublime-text-plugins-for-all-developers/
  4. http://www.hongkiat.com/blog/sublime-text-tips/
  5. http://marcelkalveram.com/2013/11/10-shortcuts-to-become-a-true-sublime-text-ninja/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment