Sublime Text

From HaFrWiki
Revision as of 12:11, 25 November 2018 by Hjmf (talk | contribs)
Jump to: navigation, search

Sublime Text is a sophisticated text editor for code, markup and prose [1]. You'll love the slick user interface, extraordinary features and amazing performance. First of all Sublime Text is multi-platform, so available for OS X, Windows and Linux.


Keyboard shortcuts

One very important shortcut for OSX is the one is the ⌘ + ⇧ + . which shows the normal hidden files in a directory (i.e. .bashrc) [2].

The keyboard shortcuts for OSX are base on the Websites:

Editing
Keypress Command
⌘ + X Cut line
⌘ + ↩ Insert line after
⌘ + ⇧ + ↩ Insert line before
⌘ + ⌃ + ↑ Move line / selection up
⌘ + ⌃ + ↓ Move line/selection down
⌘ + D Select word - Repeat to select next occurrence
⌘ + L Select line - Repeat to select next lines
⌃ + ⌘ + G Select all occurrence of the line above
⌃ + ⇧ + ↑ Extra cursor on the line above
⌃ + ⇧ + ↓ Extra cursor on the line below
⌃ + M Jump to closing parentheses Repeat to jump to opening parentheses
⌃ + ⇧ + M Select all contents of the current parentheses
⌃ + A
⌘ + Left
Move to beginning of line
⌃ + E
⌘ + Right
Move to end of line
⌘ + K, ⌘ + K Delete from cursor to end of line
⌘ + K + ⌫ Delete from cursor to start of line
⌘ + ] Indent current (selected) line(s)
⌘ + [ Un-Indent current (selected) line(s)
⌘ + ⇧ + D Duplicate line(s)
⌘ + J Join line below to the end of the current line
⌘ + / Comment/un-comment current line
⌘ + ⌥ + / Block comment current selection
⌘ + Y Redo, or repeat last keyboard shortcut command
⌘ + ⇧ + V Paste and indent correctly
⌃ + Space Select next auto-complete suggestion
⌃ + U Soft undo; jumps to your last change before undoing change when repeated
⌃ + ⇧ + Up Column selection up
⌃ + ⇧ + Down Column selection down
⌃ + ⇧ + W Wrap Selection in html tag
⌃ + ⇧ + K Delete current line of cursor
 
Navigation / Goto anywhere
Keypress Command
⌃ + G Goto line in current file, overlay (:)
⌘ + P
⌘ + T
Quick-open files by name
⌘ + ⇧ + R Goto symbol / function / method, overlay (@)
F12 Goto definition
⌃ + - Jump back, go to previous location
⌃ + ⇧ + - Jump forward, go to next location.

 

General
Keypress Command
⌘ + ⇧ + P Command Palette
⌃ + ` Python Console
⌃ + ⌘ + F Toggle fullscreen mode
⌃ + ⇧ + ⌘ + F Toggle distraction free mode
⌘ + K, ⌘ + B Toggle side bar
⌃ + ⇧ + P Show scope in status bar

 

Tabs
Keypress Command
⌘ + ⇧ + T Open last closed tab
⌘ + [NUM] Jump to tab in current group where num is 1-9
⌘ + 0 Jump to 10th tab in current group
⌘ + ⇧ + [ Cycle left through tabs
⌘ + ⇧ + ] Cycle right through tabs
^ + Tab Cycle up through recent tabs
^ + ⇧ + Tab Cycle down through recent tabs

 

Files
Keypress Command
⌘ + ⇧ + . Shows all files in directory
Split Window
Keypress Command
⌘ + ⌥ + 1 Revert view to single column
⌘ + ⌥ + 2 Split view into two columns
⌘ + ⌥ + 3 Split view into three columns
⌘ + ⌥ + 4 Split view into four columns
⌘ + ⌥ + 5 Set view to grid (4 groups)
⌃ + [NUM] Jump to group where num is 1-4
⌃ + ⇧ + [NUM] Move file to specified group where num is 1-4

 

Bookmarks
Keypress Command
⌘ + F2 Toggle bookmark
F2 Next bookmark
⇧ + F2 Previous bookmark
⇧ + ⌘ + F2 Clear bookmarks

 

Text manipulation
Keypress Command
⌘ + K, ⌘ + U Transform to Uppercase
⌘ + K, ⌘ + L Transform to Lowercase
⌘ + ⌃ + up Clip text upwards, exchange 2-lines
⌘ + ⌃ + down Clip text downwards, exchange 2-lines

 

Find / Replace
Keypress Command
⌘ + F Find in file
⌘ + ⌥ + F Replace in file
⌘ + ⇧ + F Find in files

Descriptions

Command Palette

The Command Palette holds infrequently used functionality, like sorting, changing the syntax and changing the indentation settings. With just a few keystrokes, you can search for what you want, without ever having to navigate through the menus or remember obscure key bindings.
Show the Command Palette with ⌘⇧P.
Examples:

  • Snippet to insert a code snippet.
  • Rename to rename a file
  • Package Control to see or insert Packages.
Goto Anything

Use Goto Anything to open files with only a few keystrokes, and instantly jump to symbols, lines or words.
Triggered with ⌘P, it is possible to:

  • Type part of a file name to open it.
  • Type @ to jump to symbols,
  • Type # to search within the file,
  • Type : to go to a line number.

These shortcuts can be combined, so tp@rf may take you to a function read_file within a file text_parser.py.
Similarly, tp:100 would take you to line 100 of the same file.

Split Editing

Get the most out of your wide screen monitor with split editing support. Edit files side by side, or edit two locations in the one file. You can edit with as many rows and columns as you wish.
Take advantage of multiple monitors by editing with multiple windows, and using multiple splits in each window.

  • Take a look at the ViewLayout menu for split editing options.
  • To open multiple views into the one file, use the FileNew View into File menu item.
Multiple Selections

Make ten changes at the same time, not one change ten times. Multiple selections allow you to interactively change many lines at once, rename variables with ease, and manipulate files faster than ever.

  • Try pressing ⇧⌘L to split the selection into lines
  • ⌘D to select the next occurrence of the selected word.
  • To make multiple selections with the mouse, take a look at the Column Selection documentation.
Distraction Free Mode

When you need to focus, Distraction Free Mode is there to help you out. Distraction Free Mode is full screen, chrome free editing, with nothing but your text in the center of the screen.
You can incrementally show elements of the UI, such as tabs and the find panel, as you need them.

  • You can enter Distraction Free Mode using the ViewEnter Distraction Free Mode menu.
Instant Project Switch

Projects in Sublime Text capture the full contents of the workspace, including modified and unsaved files. You can switch between projects in a manner similar to Goto Anything, and the switch is instant, with no save prompts - all your modifications will be restored next time the project is opened.

See also

top

Reference

top

  1. SublimeText, A programmers editor the way it should be.
  2. Stack-Exchange, Show hidden files in the open file dialog on OSX.