Skip to content

Instantly share code, notes, and snippets.

@gilbertw1
Last active June 20, 2016 14:09
Show Gist options
  • Save gilbertw1/8bb8ed45d60dbbc0ba9f9c6a5c97d1f2 to your computer and use it in GitHub Desktop.
Save gilbertw1/8bb8ed45d60dbbc0ba9f9c6a5c97d1f2 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:

  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)

Prevent save to clipboard on visual selection update

In dotspacemacs/user-config:

(fset 'evil-visual-update-x-selection 'ignore)

Properly ignore certain files / folders when using helm-ag search

In dotspacemacs/user-config

(setq helm-ag-use-grep-ignore-list t)
(setq projectile-globally-ignored-directories '("target" ".ensime_cache"))
(setq grep-find-ignored-directories '("target" ".ensime_cache"))

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

' <key> - 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

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)

<x>,<n> s/^/<txt>/ - Prepend to lines x through n

<x>,<n> s/$/<txt>/ - Append to lines x through n

f <char> - move to next

t <char> - 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 <m> - comment using motion (e.g. gc5j comment current line + 5 below)

IEdit Mode

S - delete / insert mode all occurances

U - uppercase all occurances

C-U - downcase all occurrances

A - insert mode end of all occurances

I - insert mode beginning of all occurances

L - restrict to current line

J - increase editing scope by one line below

K - increase editing scope by one line above

n - next occurance

gg - first occuance

G - last occurance

# - prefix all occurrances with increasing number

D - delete all occurances

p - replace occurrances with last yanked text

V - toggle visibility of lines with no occurrance

Visual Mode

sf - surround function

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

cs<brace1><brace2> - 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/<find>/replace/ - substitute in visual selection

Search and Replace

n - next search result

N - prev search result

* - search for word under cursor (forward)

# -

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