Skip to content

Instantly share code, notes, and snippets.

@gilbertw1
Created March 23, 2016 21:25
Show Gist options
  • Save gilbertw1/1ddfbb01887bd59faea5 to your computer and use it in GitHub Desktop.
Save gilbertw1/1ddfbb01887bd59faea5 to your computer and use it in GitHub Desktop.

Layers

Layers are enabled by adding the layer identifier to the dotspacemacs-configuration-layers variable in the .spacemacs file.

Additional variables can be passed to the layout using the following format: (layer-identifier :variables variable-one value variable-two value)

Layers (w / autosave)

identifer: spacemacs-layout variables:

layouts-enable-autosave (t)

layouts-autosave-delay (300)

Magit

identifier: git

Org Mode

identifier: org variables:

org-enable-github-support (t)

Markdown

identifier: markdown

Auto Completion

identifier: auto-completion

Scala

identifier: scala

Rust

identifier: rust

  • requires racer install

Additional Themes

identifier: themes-megapack

Config Changes

Configurations reside in the .spacemacs file.

Default Theme

Set first item in dotspacemacs-themes: sanityinc-tomorrow-night

Resume Layouts (re-load layouts on startup)

dotspacemacs-auto-resume-layouts t

Enable Line Numbers

dotspacemacs-line-numbers t (‘relative for relative line numbers)

Magit Fullscreen

In dotspacemacs/user-init:

(setq-default git-magit-status-fullscreen t)

Set Org Workflow Keywords

In dotspacemacs/user-config:

(setq org-todo-keywords
     '((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE")))

Turn truncate lines (word wrap) off

In dotspacemacs/user-config:

(add-hook 'hack-local-variables-hook (lambda () (setq truncate-lines t)))

Prevent Split Line On Create New Heading

In dotspacemacs/user-init:

(setq org-M-RET-may-split-line nil)

Keybindings

Navigation

h/j/k/l - cursor up/down/left/right

C-u / C-d - move half screen up / down

C-f / C-b - move full screen up / down

” - move cursor to last position

M l/r (arrows) - move occurances of current word

% - move to matching brace

{ / } - move to prev / next paragraph

z t/./b - move screen where cursor is at top/center/bottom

m <key> - set mark to <key>

’ <key> - jump to mark for <key>

Editing

v - visual mode

V - linewise visual mode

C-v - block visual mode

SPC s e - iEdit mode

S - delete / insert mode all occurances

U - uppercase all occurances

e - move to end of word (E - WORD)

w - move to next word (W - WORD)

b - move back one word (B - WORD)

A - append end of line

I - insert beginning of line

o - new line below / insert

O - new line above / insert

ea - append at end of word

J - join line with next

xp - transpose two letters (delete + paste)

Visual Mode

sf - surround function

o - move to other end of marked area

y - copy marked text

d - delete marked text

~ - switch case

< / > - increase / decrease indention

aw - mark word

ab - mark block ()

aB - mark block {}

ib - inner block ()

iB - inner block {}

i<*> - i< i[ i” i’ i`

a<*> - a< a[ a” a’ a`

A - append each selection in block

I - insert each selection in block

R - replace each selection in block

u / U - make lowercase / uppercase

Search and Replace

n - next search result

N - prev search result

/<pattern> - search for pattern

?<pattern> - search backward for pattern

:%s/old/new/g - replace all old with new

:%s/old/new/gc - replace all w/ confirmation

Window Management

SPC w c - close current window

SPC w h/j/k/l - move to window

SPC w v - split vertical

SPC w s - split horizontal

Project Management

SPC p l - open / create project layer

SPC p p - open project

SPC p f - open file in project

Layout Management

SPC l l - open / create layout

SPC l r - remove buffer from layout

Buffer Management

SPC b b - open / create buffer

SPC b d - kill buffer

File Management

SPC f f - open files

SPC f s - save file

SPC f E - open file (sudo)

SPC f C d - unix -> dos

SPC f C u - dos -> unix

Org Mode

General

SPC m : - tag

o - open below

O - open above

M-RET - open heading below

C-RET - open heading below (after content)

M-o - open sub-heading below

> - demote heading

< - promote heading

Todo

SHIFT <-/-> - cyle prev / next todo

t - TODO toggle

T - new empty TODO

SPC m s - schedule task

Agenda

SPC a o o - open agenda

SPC : org-agenda-file-to-front - add file to agenda

SPC : org-remove-file - remove file from agenda

Table

SPC m t n - new table

TAB - next field / re-format

SHIFT TAB - prev field / re-format

SPC m t e - new formula

SPC m t r - recalculate row

SPC : org-table-iterate - recalculate entire table

Scala

SPC m b c - compile project

Rust

SPC m c c - compile project

Git

SPC g s - magit status

Status

TAB - show / hide diff

c c - commit

b b - checkout branch

b c - create branch

x - discard changes

s - stage file

S - stage all files

u - unstage file

U - unstage all files

z z - stash changes

q - quit

P - push

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