Skip to content

Instantly share code, notes, and snippets.

@gilbertw1
Last active May 18, 2016 17:18
Show Gist options
  • Save gilbertw1/4d706aa4ce438d2751fb00d43a89336a to your computer and use it in GitHub Desktop.
Save gilbertw1/4d706aa4ce438d2751fb00d43a89336a to your computer and use it in GitHub Desktop.

Table of Contents

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:

  1. layouts-enable-autosave (t)

  2. layouts-autosave-delay (300)

Magit

identifier: git

Github

identifier: github

Org Mode

identifier: org variables:

  1. org-enable-github-support (t)

Markdown

identifier: markdown

Evil-Snipe

identifier: evil-snipe variables:

  1. evil-snipe-enable-alternate-f-and-t-behaviors (t)

Auto Completion

identifier: auto-completion

Scala

identifier: scala

Rust

identifier: rust

  • requires racer install

Clojure

identifier: clojure variables:

  1. clojure-enable-fancify-symbols (t)

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

Command

: - enter command mode

SPC : - enter emacs command mode

C-y - paste into command bar

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 - set mark to

' - jump to mark for

[{ - jump to previous open brace (works with braces & parens)

[} - jump to next closing brace

g d - smart jump to declaration

Editing :editing:

v - visual mode

V - linewise visual mode

C-v - block visual mode

SPC v - enter expand / select region mode

SPC s e - iEdit mode

  1. S - delete / insert mode all occurances

  2. U - uppercase all occurances

  3. C-U - downcase all occurrances

  4. A - insert mode end of all occurances

  5. I - insert mode beginning of all occurances

  6. L - restrict to current line

  7. J - increase editing scope by one line below

  8. K - increase editing scope by one line above

  9. n - next occurance

  10. gg - first occuance

  11. G - last occurance

  12. - prefix all occurrances with increasing number

  13. D - delete all occurances

  14. p - replace occurrances with last yanked text

  15. V - toggle visibility of lines with no occurrance

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

D - delete from cursor to end of line

dd - delete line

C - change from cursor to end of line

cc - change line

J - join line with next

xp - transpose two letters (delete + paste)

, s/^// - Prepend to lines x through n

, s/$// - Append to lines x through n

f - move to next

t - move to but not including

" _ d - delete without saving to clipboard

" _ x - delete char / selection without saving to clipboard

g c c - comment current line

g c - comment using motion (e.g. gc5j comment current line + 5 below)

Visual Mode

sf - surround function

s - surround with e.g. (,[,{,<,",'

cs - change surrounding brace from 1 to 2

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

p - replace selection with paste

: s//replace/ - substitute in visual selection

Search and Replace

n - next search result

N - prev search result

* - search for word under cursor (forward)

# - search for word under cursor (backward)

/ - search for pattern

? - search backward for pattern

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

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

s/S - helm-snipe forward / backward (search two char)

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

SPC w / - split vertical

SPC w - - split horizontal

SPC w m - maximize / un-maximize window

Project Management :project:

SPC p l - open / create project layer

SPC p p - open project

SPC p f - open file in project

SPC p h - open anything project

Layout Management :layout:

SPC l l - open / create layout

SPC l r - remove buffer from layout

Buffer Management :buffer:

SPC b b - open / create buffer

SPC b d - kill buffer

SPC TAB - previous buffer

File Management :files:

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 :org:

General

  1. SPC m : - tag

  2. o - open below

  3. O - open above

  4. M-RET - open heading below

  5. C-RET - open heading below (after content)

  6. M-o - open sub-heading below

    • demote heading
  7. < - promote heading

Todo

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

  2. t - TODO toggle

  3. T - new empty TODO

  4. SPC m s - schedule task

Agenda

  1. SPC a o o - open agenda

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

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

Table

  1. SPC m t n - new table

  2. TAB - next field / re-format

  3. SHIFT TAB - prev field / re-format

  4. SPC m t e - new formula

  5. SPC m t r - recalculate row

  6. 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

  1. TAB - show / hide diff

  2. c c - commit

  3. b b - checkout branch

  4. b c - create branch

  5. x - discard changes

  6. s - stage file

  7. S - stage all files

  8. u - unstage file

  9. U - unstage all files

  10. z z - stash changes

  11. q - quit

  12. P - push

Github

SPC g g b - create public gist from buffer

SPC g g B - create private gist from buffer

SPC g g l - open list of gists

SPC g g r - create public gist from region

SPC g g R - create private gist from region

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