Skip to content

Instantly share code, notes, and snippets.

@gilbertw1
Created January 6, 2017 20:22
Show Gist options
  • Save gilbertw1/b96569ad5191a9077c9f0974e9aa767b to your computer and use it in GitHub Desktop.
Save gilbertw1/b96569ad5191a9077c9f0974e9aa767b 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)

RestClient

identifier: restclient

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 dostspacemacs/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"))

Distinguish between TAB and C-i (Make evil jump forward work)

In dotspacemacs/user-config

(setq dotspacemacs-distinguish-gui-tab t)

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 SPC j j - use avy to jump to char SPC j l - use avy to jump to line '' - 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 C-o / C-i - jump back / forward in history

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) SPC r y - view / select items in kill ring

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

Company Completion

C-/ - search potential completions while completions are active

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 J - move current line down K - move current line up 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

/<query> - search buffer for SPC s s - swiper search (interactive) SPC s c - clear search result highlight n - next search result N - prev search result * - search for word under cursor (forward) # - search for work under cursor (backward) SPC * - search project for current word using Ag SPC / - search project using Ag

Ivy Search Results Buffer

C-<return> - use entered text as selection C-c C-o - put results in ivy-occur buffer , w - enter wgrep editable buffer from ivy occur , , - save changes from wgrep buffer to files , a - abort wgrep buffer changes

Window Management

SPC w . - window management transient state SPC w / - split current window vertically SPC w - - split current window horizontally SPC w = - balance windows evenly SPC w m - toggle maximize window SPC w w - cycle next window SPC w u - undo last window change SPC w U - redo last window change

Transient State

] - enlarge current window horizontally [ - shrink current window horizontally } - enlarge current window vertically { - shrink current window vertically g - toggle golden ratio mode (large selected window)

Project Management

SPC p f - find file in project SPC p / - search open project using ag SPC p t - open neotree w/ project as base SPC p r - replace in project

Layout Management

SPC l l - switch to or create new layout SPC l - layout transient state SPC l x - kill current layout SPC l s - save layouts

Dired Mode

SPC b w - enter writable dired buffer that allows renaming C-c C-c - save wdired changes C-c ESC - abort wdired changes

Magit

SPC g s - enter magit status s - stage change u - unstage change x - discard change b b - checkout branch b c - create & checkout branch P p - push C - commit z z - stash changes z a - apply stashed changes

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