Skip to content

Instantly share code, notes, and snippets.

@niquola
Last active January 12, 2018 13:59
Show Gist options
  • Save niquola/665a8bf93a72f7d871a1 to your computer and use it in GitHub Desktop.
Save niquola/665a8bf93a72f7d871a1 to your computer and use it in GitHub Desktop.

Clojure

clojure - https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/clojure

(setq-default dotspacemacs-configuration-layers '(clojure))
(setq-default dotspacemacs-configuration-layers
'((clojure :variables clojure-enable-fancify-symbols t)))

~/.lein/profiles.clj

{:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]
                  [refactor-nrepl "0.3.0-SNAPSHOT"]]
        :dependencies [[alembic "0.3.2"]
                       [org.clojure/tools.nrepl "0.2.7"]]}}

Documentation

Key Binding       |                 Description

----------------------|------------------------------------------------------------ SPC m h h | cider doc SPC m h g | cider grimoire SPC m h j | cider javadoc

Evaluation

Key Binding       |                 Description

----------------------|------------------------------------------------------------ SPC m e b | eval buffer SPC m e e | eval last sexp SPC m e f | eval function at point SPC m e r | eval region

Goto

Key Binding       |                 Description

----------------------|------------------------------------------------------------ SPC m g g | goto var SPC m g e | goto error SPC m g r | goto resource SPC m g b | go back

REPL

Key Binding       |                 Description

----------------------|------------------------------------------------------------ SPC m s b | send and eval buffer in REPL SPC m s B | send and eval buffer and switch to REPL in insert state SPC m s c | connect to REPL (cider-connect) SPC m s e | send and eval last sexp in REPL SPC m s E | send and eval last sexp and switch to REPL in insert state SPC m s f | send and eval function in REPL SPC m s F | send and eval function and switch to REPL in insert state SPC m s i | start REPL (cider-jack-in) SPC m s n | send and eval ns form in REPL SPC m s N | send and eval ns form and switch to REPL in insert state SPC m s q | kill REPL (cider-quit) SPC m s r | send and eval region in REPL SPC m s R | send and eval region and switch to REPL in insert state SPC m s s | switch to REPL

Tests

Key Binding       |                 Description

----------------------|------------------------------------------------------------ SPC m t a | run all tests in namespace SPC m t r | re-run test failures for namespace SPC m t t | run test at point

Refactoring

Key Binding         |                 Description

------------------------|------------------------------------------------------------ SPC m r a d | add declaration SPC m r a i | add import to ns SPC m r a m | add missing libspec SPC m r a p | add project dependency SPC m r a r | add require to ns SPC m r a u | add use to ns SPC m r c c | cycle coll SPC m r c i | cycle if SPC m r c n | clean ns SPC m r c p | cycle privacy SPC m r d k | destructure keys SPC m r e f | extract function SPC m r e l | expand let SPC m r f u | find usages SPC m r h d | hotload dependency SPC m r i l | introduce let SPC m r m f | move form SPC m r m l | move to let SPC m r p c | project clean SPC m r p f | promote function SPC m r r d | remove debug fns SPC m r r f | rename file SPC m r r l | remove let SPC m r r r | remove unused requires SPC m r r s | rename symbol SPC m r r u | replace use SPC m r s n | sort ns SPC m r s p | sort project dependencies SPC m r s r | stop referring SPC m r t f | thread first all SPC m r t h | thread SPC m r t l | thread last all SPC m r u a | unwind all SPC m r u w | unwind

Shell

https://github.com/syl20bnr/spacemacs/tree/master/contrib/shell

Key bindings

(setq-default dotspacemacs-configuration-layers '(shell))

Key Binding Description
SPC ' Open, close or go to the default shell
SPC a s e Open, close or go to an eshell
SPC a s i Open, close or go to a shell
SPC a s m Open, close or go to a multi-term
SPC a s t Open, close or go to a ansi-term
SPC a s T Open, close or go to a term
SPC m h browse history with helm (works in eshell and shell)
C-j next item in history
C-k previous item in history

Note You can open multiple shells using a numerical prefix argument, for instance pressing 2 SPC ; will a second default shell, the number of shell is indicated on the mode-line.

Multi-term

Key Binding Description
SPC p $ t run multi-term shell in root

Javascript

https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/javascript

npm install -g tern npm install -g js-beautify

js2-mode

Key Binding     |                 Description

--------------------|------------------------------------------------------------ SPC m w | toggle js2-mode warnings and errors

Folding (js2-mode)

Key Binding       |                 Description

----------------------|------------------------------------------------------------ SPC m z c | hide element SPC m z o | show element SPC m z r | show all element SPC m z e | toggle hide/show element SPC m z F | toggle hide functions SPC m z C | toggle hide comments

Refactoring (js2-refactor)

Bindings should match the plain emacs assignments.

Key Binding         |                 Description

------------------------|------------------------------------------------------------ SPC x m j | move line down, while keeping commas correctly placed SPC x m k | move line up, while keeping commas correctly placed SPC m k | deletes to the end of the line, but does not cross semantic boundaries SPC m r 3 i | converts ternary operator to if-statement SPC m r a g | creates a /* global */ annotation if it is missing, and adds var to point to it SPC m r a o | replaces arguments to a function call with an object literal of named arguments SPC m r b a | moves the last child out of current function, if-statement, for-loop or while-loop SPC m r c a | converts a multiline array to one line SPC m r c o | converts a multiline object literal to one line SPC m r c u | converts a multiline function to one line (expecting semicolons as statement delimiters) SPC m r e a | converts a one line array to multiline SPC m r e f | extracts the marked expressions into a new named function SPC m r e m | extracts the marked expressions out into a new method in an object literal SPC m r e o | converts a one line object literal to multiline SPC m r e u | converts a one line function to multiline (expecting semicolons as statement delimiters) SPC m r e v | takes a marked expression and replaces it with a var SPC m r i g | creates a shortcut for a marked global by injecting it in the wrapping immediately invoked function expression SPC m r i p | changes the marked expression to a parameter in a local function SPC m r i v | replaces all instances of a variable with its initial value SPC m r l p | changes a parameter to a local var in a local function SPC m r l t | adds a console.log statement for what is at point (or region) SPC m r r v | renames the variable on point and all occurrences in its lexical scope SPC m r s l | moves the next statement into current function, if-statement, for-loop, while-loop SPC m r s s | splits a String SPC m r s v | splits a var with multiple vars declared into several var statements SPC m r t f | toggle between function declaration and function expression SPC m r u w | replaces the parent statement with the selected region SPC m r v t | changes local var a to be this.a instead SPC m r w i | wraps the entire buffer in an immediately invoked function expression SPC m r w l | wraps the region in a for-loop

Formatting (web-beautify)

Key Binding        |                 Description

-----------------------|------------------------------------------------------------ SPC m = | beautify code in js2-mode, json-mode, web-mode, and css-mode

Documentation (js-doc)

Key Binding        |                 Description

-----------------------|------------------------------------------------------------ SPC m r d b | insert JSDoc comment for current file SPC m r d f | insert JSDoc comment for function SPC m r d t | insert tag to comment SPC m r d h | show list of available jsdoc tags

Auto-complete and documentation (tern)

Key Binding        |                 Description

-----------------------|------------------------------------------------------------ SPC m C-g | brings you back to last place you were when you pressed M-.. SPC m g g | jump to the definition of the thing under the cursor SPC m g G | jump to definition for the given name SPC m h d | find docs of the thing under the cursor. Press again to open the associated URL (if any) SPC m h t | find the type of the thing under the cursor SPC m r r V | rename variable under the cursor using tern

HTML

https://github.com/syl20bnr/spacemacs/blob/master/contrib/!lang/html/README.md

Web mode

Key Binding      |                 Description

---------------------|------------------------------------------------------------ SPC m g p | quickly navigate CSS rules using helm SPC m e h | highlight DOM errors SPC m g b | go to the beginning of current element SPC m g c | go to the first child element SPC m g p | go to the parent element SPC m g s | go to next sibling SPC m h p | show xpath of the current element SPC m r c | clone the current element SPC m r d | delete the current element (does not delete the children) SPC m r r | rename current element SPC m r w | wrap current element SPC m z | fold/unfold current element

A micro-state is also defined, start it with SPC m . or , .

Key Binding      |                 Description

---------------------|------------------------------------------------------------ ? | Toggle full help c | clone current element d | delete (vanish) current element (does not delete the children) h | previous element l | next element L | next sibling element k | parent element j | first child element p | show xpath of current element r | rename current element q | leave the micro-state w | wrap current element

CSS/Scss

Key Binding      |                 Description

---------------------|------------------------------------------------------------ SPC m g h | quickly navigate CSS rules using helm

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