Skip to content

Instantly share code, notes, and snippets.

@d6y
Last active November 16, 2016 11:41

Revisions

  1. d6y revised this gist May 15, 2015. 1 changed file with 36 additions and 5 deletions.
    41 changes: 36 additions & 5 deletions space.md
    Original file line number Diff line number Diff line change
    @@ -70,7 +70,7 @@ Clues
    Colours have meaning.
    Bottom right (and cursor): orange (default mode), green insert mode

    space = global command key (the "leader key") e.g.,
    space = global command key (the "leader key") e.g.,

    - space b ... brings up list of comands to do with buffers
    - space f ... bring up list of commands to do with f
    @@ -111,22 +111,51 @@ Editing

    TODO:

    - how to quickly/easily increase/decrease font size.
    - how to get hash key working on UK keyboard.


    ### Search

    Usual `/` and `?`, but `<spc> sc` to clear any persistent highlighting.

    `<n>G` to jump to line n. Eg `121G`

    ### Quickly change font size

    `Ctrl-x Ctrl-+` and `Ctrl-x Ctrl--`

    or

    `<spc> z x` and then repeatedly as required use `=` (reset), `+` (increase), and `-` (decrease). Any other key to leave this mode.



    ### Multiple cursors

    - https://github.com/tsdh/iedit
    - https://github.com/syl20bnr/evil-iedit-state


    E.g., put our cursor on cat below, do do

    - space se (switches to iedit mode, red)
    - `<spc> s e` (switches to iedit mode, red)
    - L (restrict to current line, excluding the word cat <- here)
    - S dog ESC ESC (replace all)
    - `S` (substitute) dog ESC ESC (should replace cats with dogs)

    ```The cat sat on the cat by the cat```

    ### Block mode

    E.g., go to the `<` in `<- f` below. Press `Ctrl-v`, then down cursor to select the next line.
    Go into insert mode by pressing `I`, tap space then `ESC` You have aligned the generators.

    for {
    a <- f
    b <- g
    why <- h
    } yield a * b / why


    ### More config

    edit .spacemacs file and in the config section at the endd add:
    @@ -153,7 +182,7 @@ also set default theme:
    dotspacemacs-themes '(subatomic256)
    ```

    ...or whatever list of themes you want from the megapack
    ...or monochrome or whatever theme you want from the megapack

    Ctrl-C Ctrl-C to reload

    @@ -162,6 +191,8 @@ Ctrl-C Ctrl-C to reload
    Files
    -----

    `<spc> p t` bring up file navigator thingy as buffer/window 0.

    Changing working dir

    Set working directory to your SBT project
  2. d6y revised this gist Apr 17, 2015. 1 changed file with 35 additions and 36 deletions.
    71 changes: 35 additions & 36 deletions space.md
    Original file line number Diff line number Diff line change
    @@ -47,44 +47,44 @@ Edit ~/.spacemacs
    Save, and restart. Ensime will download

    For spell checking:
    $ brew install aspell
    $ brew install aspell

    Install SBT plugin:

    edit ~/.sbt/0.13/plugins/build.sbt

    add:

    addSbtPlugin("org.ensime" % "ensime-sbt" % "0.1.5")
    addSbtPlugin("org.ensime" % "ensime-sbt" % "0.1.5")

    Per Project
    -----------

    In your SBT project, run gen-ensime (generates a .ensime file)
    In your SBT project, run `gen-ensime` (generates a _.ensime_ file)



    Clues
    -----

    Colours have meaning.
    Bottom righti (and cursor): orange (default mode), green insert mode
    Bottom right (and cursor): orange (default mode), green insert mode

    space = global command key (the "leader key")
    e.g., space b ... brings up list of comands to do with buffers
    space f ... bring up list of commands to do with f
    space f r - list of recent files
    space f S - save all buffers
    space w 2 - two column layout
    space 1 - switch to buffer 1 (or click in it.. buffer number is shown bottom right)
    space = global command key (the "leader key") e.g.,

    space b d - close (delete?) the buffer
    - space b ... brings up list of comands to do with buffers
    - space f ... bring up list of commands to do with f
    - space f r - list of recent files
    - space f S - save all buffers
    - space w 2 - two column layout
    - space 1 - switch to buffer 1 (or click in it.. buffer number is shown bottom right)
    - space b d - close (delete?) the buffer
    - space : - same as meta key on Emacs

    Sample workflow:
    space w - (split window below) or space w / (split right)
    space f r (select recent file to edit)
    Sample workflow:

    space : - same as meta key on Emacs
    - space w - (split window below) or space w / (split right)
    - space f r (select recent file to edit)

    Scala
    -----
    @@ -110,34 +110,28 @@ Editing
    -------

    TODO:

    - how to quickly/easily increase/decrease font size.
    - how to get hash key working on UK keyboard.

    Multiple cursors:
    https://github.com/tsdh/iedit
    https://github.com/syl20bnr/evil-iedit-state

    E.g., put our cursor on cat below, do do
    space se (switches to iedit mode, red)
    L (restrict to current line, excluding the word cat <- here)
    S dog ESC ESC (replace all)
    ### Multiple cursors

    The cat sat on the cat by the cat
    - https://github.com/tsdh/iedit
    - https://github.com/syl20bnr/evil-iedit-state

    E.g., put our cursor on cat below, do do

    Fixing indent
    - space se (switches to iedit mode, red)
    - L (restrict to current line, excluding the word cat <- here)
    - S dog ESC ESC (replace all)

    (TODO: figure this one out... how to position at first <- and indent it and the next line to align with <- flip)
    ```The cat sat on the cat by the cat```

    for {
    x <- f
    dummy <- brad
    y <- flip
    } yield 9
    ### More config

    More config:
    edit .spacemacs file and in the config section at the endd add:

    ```
    (add-hook 'before-save-hook 'delete-trailing-whitespace)
    (global-linum-mode)
    (setq tab-width 2)
    @@ -151,9 +145,14 @@ edit .spacemacs file and in the config section at the endd add:
    (add-hook 'kill-emacs-hook
    `(lambda ()
    (desktop-save ,your-own-path t)))
    ```

    also set default theme:
    dotspacemacs-themes '(subatomic256)

    ```
    dotspacemacs-themes '(subatomic256)
    ```

    ...or whatever list of themes you want from the megapack

    Ctrl-C Ctrl-C to reload
    @@ -168,5 +167,5 @@ Changing working dir
    Set working directory to your SBT project
    E.g.,

    space : cd
    type then right arrow to select and navigate, return to select a directory
    - space : cd
    - type then right arrow to select and navigate, return to select a directory
  3. d6y revised this gist Apr 17, 2015. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions space.md
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,7 @@ Edit ~/.spacemacs

    (nb the themes megapack produces a lot of messages)

    ```
    dotspacemacs-configuration-layers
    '(
    scala
    @@ -41,10 +42,8 @@ Edit ~/.spacemacs
    ;; better-defaults
    ;; (git :variables
    ;; git-gutter-use-fringe t)
    ;; markdown
    ;; org
    ;; syntax-checking

    etc
    ```
    Save, and restart. Ensime will download

    For spell checking:
  4. d6y created this gist Apr 17, 2015.
    173 changes: 173 additions & 0 deletions space.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,173 @@
    Spacecmacs, VIM editor plus a crapton of plugins for Scala
    ==========================================================

    Useful:
    - https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.md
    - http://thume.ca/howto/2015/03/07/configuring-spacemacs-a-tutorial/


    One Time Set Up
    ---------------

    Install MacEmacs
    http://emacsformacosx.com/

    Set up the command line:
    http://emacsformacosx.com/tips

    Do the clone thing in the spacemacs guide.
    https://github.com/syl20bnr/spacemacs

    Start spaceemacs and press return when asked about evil mode or emacs mode (you want evil)

    Edit ~/.spacemacs

    (nb the themes megapack produces a lot of messages)

    dotspacemacs-configuration-layers
    '(
    scala
    git
    osx
    markdown
    javascript
    themes-megapack

    ;; --------------------------------------------------------
    ;; Example of useful layers you may want to use right away
    ;; Uncomment a layer name and press C-c C-c to install it
    ;; --------------------------------------------------------
    ;; auto-completion
    ;; better-defaults
    ;; (git :variables
    ;; git-gutter-use-fringe t)
    ;; markdown
    ;; org
    ;; syntax-checking

    Save, and restart. Ensime will download

    For spell checking:
    $ brew install aspell

    Install SBT plugin:

    edit ~/.sbt/0.13/plugins/build.sbt

    add:

    addSbtPlugin("org.ensime" % "ensime-sbt" % "0.1.5")

    Per Project
    -----------

    In your SBT project, run gen-ensime (generates a .ensime file)



    Clues
    -----

    Colours have meaning.
    Bottom righti (and cursor): orange (default mode), green insert mode

    space = global command key (the "leader key")
    e.g., space b ... brings up list of comands to do with buffers
    space f ... bring up list of commands to do with f
    space f r - list of recent files
    space f S - save all buffers
    space w 2 - two column layout
    space 1 - switch to buffer 1 (or click in it.. buffer number is shown bottom right)

    space b d - close (delete?) the buffer

    Sample workflow:
    space w - (split window below) or space w / (split right)
    space f r (select recent file to edit)

    space : - same as meta key on Emacs

    Scala
    -----

    In Emacs, edit a Scala file in your project. Ensime starts, should have syntax highlighting.

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

    Ctrl-Click to jump to source
    See: http://ensime.github.io/

    SBT
    ---

    You must have a project/build.properties file

    Then... space : sbt-start to start sbt
    Ctrl-n / p = go to next and previous errors

    https://github.com/hvesalai/sbt-mode

    Editing
    -------

    TODO:
    - how to quickly/easily increase/decrease font size.
    - how to get hash key working on UK keyboard.

    Multiple cursors:
    https://github.com/tsdh/iedit
    https://github.com/syl20bnr/evil-iedit-state

    E.g., put our cursor on cat below, do do
    space se (switches to iedit mode, red)
    L (restrict to current line, excluding the word cat <- here)
    S dog ESC ESC (replace all)

    The cat sat on the cat by the cat


    Fixing indent

    (TODO: figure this one out... how to position at first <- and indent it and the next line to align with <- flip)

    for {
    x <- f
    dummy <- brad
    y <- flip
    } yield 9

    More config:
    edit .spacemacs file and in the config section at the endd add:

    (add-hook 'before-save-hook 'delete-trailing-whitespace)
    (global-linum-mode)
    (setq tab-width 2)

    ;;; From http://stackoverflow.com/questions/24921390/how-to-get-emacs-to-automatically-load-and-save-desktop-from-initial-directory
    (setq your-own-path default-directory)
    (if (file-exists-p
    (concat your-own-path ".emacs.desktop"))
    (desktop-read your-own-path))

    (add-hook 'kill-emacs-hook
    `(lambda ()
    (desktop-save ,your-own-path t)))

    also set default theme:
    dotspacemacs-themes '(subatomic256)
    ...or whatever list of themes you want from the megapack

    Ctrl-C Ctrl-C to reload

    , = context sensitive key for commands in say scala

    Files
    -----

    Changing working dir

    Set working directory to your SBT project
    E.g.,

    space : cd
    type then right arrow to select and navigate, return to select a directory