Skip to content

Instantly share code, notes, and snippets.

@niquola
Last active January 12, 2018 13:59
Show Gist options
  • Select an option

  • Save niquola/665a8bf93a72f7d871a1 to your computer and use it in GitHub Desktop.

Select an option

Save niquola/665a8bf93a72f7d871a1 to your computer and use it in GitHub Desktop.

Revisions

  1. niquola revised this gist Jun 23, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion spacemacs.md
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,10 @@ clojure - https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/clojur
    (setq-default dotspacemacs-configuration-layers '(clojure))
    (setq-default dotspacemacs-configuration-layers
    '((clojure :variables clojure-enable-fancify-symbols t)))
    ```

    ~/.lein/profiles.clj

    ```clj
    {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]
    [refactor-nrepl "0.3.0-SNAPSHOT"]]
  2. niquola revised this gist Jun 23, 2015. 1 changed file with 51 additions and 1 deletion.
    52 changes: 51 additions & 1 deletion spacemacs.md
    Original file line number Diff line number Diff line change
    @@ -230,4 +230,54 @@ Bindings should match the plain emacs assignments.
    [js2-refactor]: https://github.com/magnars/js2-refactor.el
    [tern]: http://ternjs.net/
    [js-doc]: https://github.com/mooz/js-doc/
    [web-beautify]: https://github.com/yasuyk/web-beautify
    [web-beautify]: https://github.com/yasuyk/web-beautify


    ## HTML

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

    ### Web mode

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

    A micro-state is also defined, start it with <kbd>SPC m .</kbd> or
    <kbd>, .</kbd>

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

    ### CSS/Scss

    Key Binding | Description
    ---------------------|------------------------------------------------------------
    <kbd>SPC m g h</kbd> | quickly navigate CSS rules using `helm`

    [web-mode]: http://web-mode.org/
    [emmet-mode]: https://github.com/smihica/emmet-mode
    [evil-matchit]: https://github.com/redguardtoo/evil-matchit
  3. niquola revised this gist Jun 23, 2015. 1 changed file with 178 additions and 1 deletion.
    179 changes: 178 additions & 1 deletion spacemacs.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,97 @@ clojure - https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/clojur
    [org.clojure/tools.nrepl "0.2.7"]]}}
    ```

    ### Documentation

    Key Binding | Description
    ----------------------|------------------------------------------------------------
    <kbd>SPC m h h</kbd> | cider doc
    <kbd>SPC m h g</kbd> | cider grimoire
    <kbd>SPC m h j</kbd> | cider javadoc

    ### Evaluation

    Key Binding | Description
    ----------------------|------------------------------------------------------------
    <kbd>SPC m e b</kbd> | eval buffer
    <kbd>SPC m e e</kbd> | eval last sexp
    <kbd>SPC m e f</kbd> | eval function at point
    <kbd>SPC m e r</kbd> | eval region

    ### Goto

    Key Binding | Description
    ----------------------|------------------------------------------------------------
    <kbd>SPC m g g</kbd> | goto var
    <kbd>SPC m g e</kbd> | goto error
    <kbd>SPC m g r</kbd> | goto resource
    <kbd>SPC m g b</kbd> | go back

    ### REPL

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

    ### Tests

    Key Binding | Description
    ----------------------|------------------------------------------------------------
    <kbd>SPC m t a</kbd> | run all tests in namespace
    <kbd>SPC m t r</kbd> | re-run test failures for namespace
    <kbd>SPC m t t</kbd> | run test at point

    ### Refactoring

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

    ## Shell

    @@ -53,4 +144,90 @@ Key Binding | Description
    https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/javascript

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

    ### js2-mode

    Key Binding | Description
    --------------------|------------------------------------------------------------
    <kbd>SPC m w</kbd> | toggle js2-mode warnings and errors

    ### Folding (js2-mode)

    Key Binding | Description
    ----------------------|------------------------------------------------------------
    <kbd>SPC m z c</kbd> | hide element
    <kbd>SPC m z o</kbd> | show element
    <kbd>SPC m z r</kbd> | show all element
    <kbd>SPC m z e</kbd> | toggle hide/show element
    <kbd>SPC m z F</kbd> | toggle hide functions
    <kbd>SPC m z C</kbd> | toggle hide comments

    ### Refactoring (js2-refactor)

    Bindings should match the plain emacs assignments.

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

    ### Formatting (web-beautify)

    Key Binding | Description
    -----------------------|------------------------------------------------------------
    <kbd>SPC m =</kbd> | beautify code in js2-mode, json-mode, web-mode, and css-mode

    #### Documentation (js-doc)

    Key Binding | Description
    -----------------------|------------------------------------------------------------
    <kbd>SPC m r d b</kbd> | insert JSDoc comment for current file
    <kbd>SPC m r d f</kbd> | insert JSDoc comment for function
    <kbd>SPC m r d t</kbd> | insert tag to comment
    <kbd>SPC m r d h</kbd> | show list of available jsdoc tags

    ### Auto-complete and documentation (tern)

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

    [js2-mode]: https://github.com/mooz/js2-mode
    [js2-refactor]: https://github.com/magnars/js2-refactor.el
    [tern]: http://ternjs.net/
    [js-doc]: https://github.com/mooz/js-doc/
    [web-beautify]: https://github.com/yasuyk/web-beautify
  4. niquola revised this gist Jun 23, 2015. 1 changed file with 36 additions and 0 deletions.
    36 changes: 36 additions & 0 deletions spacemacs.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    ## Clojure

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

    ```
    (setq-default dotspacemacs-configuration-layers '(clojure))
    (setq-default dotspacemacs-configuration-layers
    @@ -14,6 +17,39 @@ clojure - https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/clojur
    ```


    ## Shell

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

    ## Key bindings

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

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

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

    ### Multi-term

    Key Binding | Description
    ---------------------|------------------------------------------------------------
    <kbd>SPC p $ t</kbd> | run multi-term shell in root


    ## Javascript

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

    npm install -g tern
  5. niquola created this gist Jun 23, 2015.
    20 changes: 20 additions & 0 deletions spacemacs.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    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
    ```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"]]}}
    ```


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

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