Editor

Editor tips

To optimize your experience with the editor, make sure to check out the available editor settings. Use them to customize the editor according to your needs.

Editor shortcuts

There are four available keymaps in SourceLair: Default, Sublime, Vim and Emacs-like. Depending on your active keymap, some of the Default shortcuts might not be available.

Default shortcuts

Action

Windows Shortcut

Mac Shortcut

Save File

Ctrl-S

⌘-S

Activate Next Tab

Ctrl-Alt-]

⌘-⌥-]

Activate Previous Tab

Ctrl-Alt-[

⌘-⌥-[

Close active File

Alt-W

⌥-W

Toggle Fullscreen Editor

Ctrl-Alt-F

⌘-⌥-F

Preview File

Ctrl-Enter

⌘-Enter

Execute File

Ctrl-Enter

⌘-Enter

Code manipulation

Action

Windows Shortcut

Mac Shortcut

Autocomplete (JavaScript, Python, CSS, HTML)

Ctrl-Space

⌘-Space

Autocomplete (JavaScript, Python, CSS, HTML)

Ctrl-Space

⌘-Space

Auto indent

Shift-Tab

⇧-Tab

Indent more

Ctrl-]

⌘-]

Indent less

Ctrl-[

⌘-[

Toggle comment

Ctrl-/

⌘-/

Delete line

Ctrl-D

⌘-D

Undo

Ctrl-Z

⌘-Z

Redo

Ctrl-Y or Ctrl-Shift-Z

⌘-Y or ⌘-⇧-Z

Code navigation

Action

Windows Shortcut

Mac Shortcut

Toggle Search in File

Ctrl-F

⌘-F

Find Next

Ctrl-G

⌘-G

Find Previous

Ctrl-Shift-G

⌘-⇧-G

Goto definition (JavaScript, Python)

Alt-. or Alt-Click

⌥-. or ⌥-Click

Get documentation (JavaScript, Python)

Ctrl-I

⌘-I

Goto line

Alt-G

⌥-G

Cursor motion

Action

Windows Shortcut

Mac Shortcut

Go to start of document

Ctrl-Home

⌘-↑ or ⌘-Home

Go to end of document

Ctrl-End

⌘-↓ or ⌘-End

Go to line start

Alt-←

^-A

Go to line end

Alt-→

^-E

Go to line text start

Home

Home

Go line up

↑

^-P

Go line down

↓

^-N

Go page up

PageUp

⇧-^-V

Go page down

PageDown

^-V

Go character left

←

^-B

Go character right

→

^-F

Go group left

Ctrl-←

⌥-←

Go group right

Ctrl-→

⌥-→

Selections

Action

Windows Shortcut

Mac Shortcut

Select All

Ctrl-A

⌘-A

Rectangular selection

Alt-Mousedrag

⌥-Mousedrag

Add multiple cursors

Ctrl-Click

⌘-Click

Select Up

Shift-↑

⇧-↑

Select Down

Shift-↓

⇧-↓

Select Right

Shift-→

⇧-→

Select Left

Shift-←

⇧-←

Undo selection

Ctrl-U

⌘-U

Redo selection

Alt-U

⌘-⇧-U

Sublime shortcuts

Action

Windows Shortcut

Mac Shortcut

Go subword left

Alt-←

⌥-←

Go subword right

Alt-→

⌥-→

Scroll line up

Ctrl-↑

^-⌥-↑

Scroll line down

Ctrl-↓

^-⌥-↓

Split selection by line

Ctrl-Shift-L

⌘-⇧-L

Indent less

Shift-Tab

⇧-Tab

Kepp only single top selection

Esc

Esc

Select line

Ctrl-L

⌘-L

Delete line

Ctrl-Shift-K

^-⇧-K

Insert line after

Ctrl-Enter

⌘-Enter

Insert line before

Ctrl-Shift-Enter

⌘-⇧-Enter

Select next occurrence

Ctrl-D

⌘-D

Select scope

Ctrl-Shift-Space

⌘-⇧-Space

Select between brackets

Ctrl-Shift-M

⌘-⇧-M

Go to bracket

Ctrl-M

⌘-M

Swap line up

Ctrl-Shift-↑

⌘-⇧-↑

Swap line down

Ctrl-Shift-↓

⌘-⇧-↓

Toggle comment

Ctrl-/

⌘-/

Join lines

Ctrl-J

⌘-J

Duplicate line

Ctrl-Shift-D

⌘-⇧-D

Transpose characters

Ctrl-T

⌘-T

Sort lines

F9

F9

Sort lines case insensitive

Ctrl-F9

⌘-F9

Next bookmark

F2

F2

Previous bookmark

Shift-F2

⇧-F2

Toggle bookmark

Ctrl-F2

⌘-F2

Clear bookmarks

Ctrl-Shift-F2

⌘-⇧-F2

Select bookmarks

Alt-F2

⌥-F2

Wrap lines

Alt-Q

⌥-Q

Delete line left of cursor

Ctrl-KCtrl-Backspace

⌘-K⌘-Backspace

Smart backspace

Backspace

Backspace

Delete line right of cursor

Ctrl-KCtrl-K

⌘-K⌘-K

Make upercase at cursor

Ctrl-KCtrl-U

⌘-K⌘-U

Make lowercase at cursor

Ctrl-KCtrl-Space

⌘-K⌘-Space

Set Sublime mark

Ctrl-KCtrl-A

⌘-K⌘-A

Select to Sublime mark

Ctrl-KCtrl-A

⌘-K⌘-Space

Delete Sublime mark

Ctrl-KCtrl-W

⌘-K⌘-W

Swap with Sublime mark

Ctrl-KCtrl-X

⌘-K⌘-X

Sublime Yank

Ctrl-KCtrl-Y

⌘-K⌘-Y

Clear bookmarks

Ctrl-KCtrl-G

⌘-K⌘-G

Show in center

Ctrl-KCtrl-C

⌘-K⌘-C

Select lines upwards

⇧-⌥-↑

Select lines downwards

⇧-⌥-↓

Find under

Ctrl-F3

⌘-F3

Find under previous

Ctrl-Shift-F3

⌘-⇧-F3

Fold code

Ctrl-Shift-[

⌘-⇧-[

Unfold code

Ctrl-Shift-]

⌘-⇧-]

Unfold all

Ctrl-KCtrl-0

⌘-K⌘-0 or ⌘-K⌘-J

Replace

Ctrl-H

⌘-H

Vim shortcuts

Vim keymap, is an enriched version of the Vim mode provided by CodeMirror and features the following:

All common motions and operators, including text objects

Operator motion orthogonality

Visual mode - characterwise, linewise, blockwise

Full macro support (q, @)

Incremental highlighted search (/, ?, #, , g#, g)

Search/replace with confirm (:substitute, :%s)

Search history

Jump lists (Ctrl-o, Ctrl-i)

Key/command mapping with API (:map, :nmap, :vmap)

Sort (:sort)

Marks (`, ‘)

:global

Cross-buffer yank/paste

For your convenience, we provide bellow some of the supported ex commands as well as the shortcuts for switching between normal, ex, insert and visual modes.

Ex commands

Action

Command

Goto line

:number

Add keymap

:map

Add insert mode keymap

:imap, :im

Add normal mode keymap

:nmap, :np

Add visual and select mode keymap

:vmap, :vm

Remove keymap

:unmap

Undo

:undo, :u

Redo

:redo, :red

Set option

:set, :se

Set option locally

:setlocal, :setl

Set option globally

:setglobal, :setg

Sort lines

:sort, :sor

Find and replace text

:substitute, :s

Suspend search highlighting

:nohlsearch, :noh

Yank lines into register

:yank, :y

Delete marks

:delmarks, :delm

Display registers

:registers, :reg

Execute commands for matching lines

:global, :g

Show active theme or load specific theme

:colorscheme, :colo

Ex commands - tab actions

Action

Command

Move to next tab

:tabnext, :tabn

Move to previous tab

:tabprevious, :tabp

Open tab

:tabnew, :tabe

Close tab

:tabclose, :tabc

Close all but active

:tabonly, :tabo

Save tab

:w

Save and quit

:wq, :x

Save all tabs

:wa

Save and quit all

:wqa

Quit tab (fails if there are unsaved changes)

:q

Quit and throw away unsaved changes

:q!

Quit all tabs (fails if there are unsaved changes)

:qa

Quit all tabs and throw away unsaved changes

:qa!

Insert mode

Action

Shortcut

Insert before the cursor

i

Insert at the beggining of the line

I

Insert after the cursor

a

Insert at the end of the line

A

Append new line below current line

o

Append new line above current line

O

Insert at the end of the word

ea

Exit insert mode

Esc

Visual mode

Action

Shortcut

Toggle visual mode

v

Toggle linewise visual mode

V

Toggle blockwise visual mode

Ctrl-v or Ctrl-q

Exit visual mode

Esc

Exit insert mode

Esc

Emacs-like shortcuts

Emacs keymap based on the original Emacs keybindings but in some cases it is only a loose approximation. Also note that some emacs keybindings might not work on some OS/browsers due to bindings like Ctrl-W, Ctrl-T and Ctrl-N being handled directly by the browser.

Action

Shortcut

Kill to end of line

Ctrl-K

Mark one end of region

Ctrl-Space or Ctrl-Shift-2

Cut - after you Mark and move to other end

Ctrl-W

Copy - after you Mark and move to other end

Alt-W

Yank (paste) most recently killed (cut or copied)

Ctrl-Y

Yank (paste) next most recently killed. Repeat to cycle

Alt-Y

Move character right

Ctr-F or →

Move charcter left

Ctrl-B or ←

Delete character from the right

Ctlr-D

Delete selection or character from the right

Delete

Delete character from the left

Ctrl-H

Delete selection or character from the left

Backspace

Move word forward

Alt-F

Move word backward

Alt-B

Kill word to the right

Alt-D

Kill word to the left

Alt-Backspace

Move line forward

Ctrl-N

Move line backward

Ctrl-P

Move to line start

Ctrl-A or Home

Move to line end

Ctrl-E or End

Move page up

Alt-V or PageUp

Move page down

Ctrl-V or PageDown

Move paragraph up

Ctrl-↑

Move paragraph down

Ctrl-↓

Move sentence backward

Alt-A

Move sentence forward

Alt-E

Kill sentence to end

Alt-K

Kill sentence to start

Ctrl-Alt-Backspace

Move expression forward

Ctrl-Alt-F

Move expression backward

Cltr-Alt-B

Mark to end of expression

Ctrl-Shift-Alt-2

Transpose current with next expression

Ctrl-Alt-T

Move to beggining of enclosing expression

Ctrl-Alt-U

Add single space or replace multiple whitespace with one space

Alt-Space

Replace selection with newline

Ctrl-O

Transpose characters

Ctrl-T

Capitalize current letter of word and lowercase the following letters

Alt-C

Uppercase all following letters of word

Alt-U

Lowercase all following letters of word

Alt-L

Toggle line comment

Alt-;

Undo

Ctrl-/ or Ctrl-Shift-- or Ctrl-Z

Goto document start

Shift-Alt-,

Goto document end

Shift-Alt-.

Find next (while having an active search)

Ctrl-S

Find previous (while having an active search)

Ctrl-R

Quit search

Ctrl-G

Open search and replace prompt

Shift-Alt-5

Autocomplete

Alt-/

New line and indent

Ctrl-J

Enter new line

Enter

Auto indent

Tab

Goto line

Alt-G G

Indent selection

Ctrl-X Tab

Set selection

Ctrl-X Ctrl-X

Save file

Ctrl-X Ctrl-S or Ctrl-X Ctrl-W

Save all files

Ctrl-X S

Open file

Ctrl-X F

Undo

Ctrl-X U

Close file

Ctrl-X K

Delete sentence

Ctrl-X Delete

Select all

Ctrl-X H

Insert tab

Ctrl-Q Tab

Emmet

The editor also comes with the emmet plugin preinstalled. All you have to do is enable it from your editor settings.
Check out Emmet’s official docs and cheat-sheet to master the power and easiness of Emmet.