spacemacs/README.md

783 lines
32 KiB
Markdown
Raw Normal View History

2014-09-02 04:24:33 +00:00
# Spacemacs Starter Kit
2012-12-17 21:34:04 +00:00
2014-09-07 02:39:58 +00:00
███████╗██████╗**█████╗**██████╗███████╗███╗***███╗*█████╗**██████╗███████╗
██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗*████║██╔══██╗██╔════╝██╔════╝
███████╗██████╔╝███████║██║*****█████╗**██╔████╔██║███████║██║*****███████╗
╚════██║██╔═══╝*██╔══██║██║*****██╔══╝**██║╚██╔╝██║██╔══██║██║*****╚════██║
███████║██║*****██║**██║╚██████╗███████╗██║*╚═╝*██║██║**██║╚██████╗███████║
╚══════╝╚═╝*****╚═╝**╚═╝*╚═════╝╚══════╝╚═╝*****╚═╝╚═╝**╚═╝*╚═════╝╚══════╝
2014-09-07 02:42:32 +00:00
[The best editor is not *Emacs* nor *Vim*, the best editor it's]
2014-09-07 02:39:58 +00:00
[*Emacs+Vim*]
2014-09-07 20:15:04 +00:00
**Quick One Step Install:**
git clone --recursive http://github.com/syl20bnr/spacemacs .emacs.d
2013-11-24 04:00:41 +00:00
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
2014-09-01 04:30:20 +00:00
- [Goals](#user-content-goals)
2014-09-01 05:15:52 +00:00
- [Screenshot](#user-content-screenshot)
2014-09-01 04:30:20 +00:00
- [Who can benefit from this ?](#user-content-who-can-benefit-from-this-)
- [Install](#user-content-install)
- [Troubleshoot](#user-content-troubleshoot)
2014-09-01 04:30:20 +00:00
- [Packages and Extensions Organization](#user-content-packages-and-extensions-organization)
- [How it works](#user-content-how-it-works)
- [How to switch to normal mode efficiently ?](#user-content-how-to-switch-to-normal-mode-efficiently-)
- [Evil plugins](#user-content-evil-plugins)
- [How to use it ?](#user-content-how-to-use-it-)
- [Executing Vim and Emacs commands](#user-content-executing-vim-and-emacs-commands)
- [Key bindings help](#user-content-key-bindings-help)
- [About helm](#user-content-about-helm)
- [Navigation](#user-content-navigation)
- [Point/Cursor](#user-content-pointcursor)
- [ace-jump mode](#user-content-ace-jump-mode)
- [Buffers and Files](#user-content-buffers-and-files)
- [Bookmarks](#user-content-bookmarks)
- [Window manipulation](#user-content-window-manipulation)
- [Text manipulation commands](#user-content-text-manipulation-commands)
- [Spell checking](#user-content-spell-checking)
- [Region selection](#user-content-region-selection)
- [Region narrowing](#user-content-region-narrowing)
- [Auto highlight](#user-content-auto-highlight)
- [Color theme](#user-content-color-theme)
- [UI elements](#user-content-ui-elements)
2014-09-01 04:52:19 +00:00
- [Mode-line](#user-content-mode-line)
- [Toggles](#user-content-toggles)
2014-09-01 04:30:20 +00:00
- [Minor Modes](#user-content-minor-modes)
- [Line formatting](#user-content-line-formatting)
- [Errors handling](#user-content-errors-handling)
- [Project management](#user-content-project-management)
- [Modes](#user-content-modes)
- [Helm](#user-content-helm)
- [Erlang](#user-content-erlang)
- [Ledger](#user-content-ledger)
- [Lisp](#user-content-lisp)
- [Magit](#user-content-magit)
- [Org](#user-content-org)
- [Perforce](#user-content-perforce)
- [Python](#user-content-python)
2014-09-01 05:49:51 +00:00
- [Inferior REPL process](#user-content-inferior-repl-process)
2014-09-01 04:30:20 +00:00
- [Testing in Python](#user-content-testing-in-python)
- [Other Python commands](#user-content-other-python-commands)
- [R (ESS)](#user-content-r-ess)
2014-09-01 05:49:51 +00:00
- [Inferior REPL process](#user-content-inferior-repl-process-1)
2014-09-01 04:30:20 +00:00
- [Other R commands](#user-content-other-r-commands)
- [rcirc](#user-content-rcirc)
- [TODO list](#user-content-todo-list)
2013-11-24 04:00:41 +00:00
2014-09-01 04:27:52 +00:00
## Goals
2014-09-03 00:46:10 +00:00
- The main goal of `Spacemacs` is to **bring the power of Vim modal editing
to the powerful Emacs editing platform**.
2014-09-01 06:17:18 +00:00
- Slick integration with Evil states/Vi modes, tries as much as possible to
2014-09-03 00:46:10 +00:00
**keep your fingers on the home row**, no matter the mode you are in.
2014-09-01 05:23:13 +00:00
2014-09-03 00:46:10 +00:00
- **Lower the risk of RSI**, your hands will thank `Spacemacs`.
2014-09-02 04:28:03 +00:00
2014-09-03 00:46:10 +00:00
- **Community driven configuration** based on a configuration layer system
2014-09-03 01:13:48 +00:00
*(work in progress)*. Contribute your own personal layer upstream and
2014-09-03 00:46:10 +00:00
everybody can use it.
- **Minimalistic UI**, keep your available screen space for what matters:
your text files.
- Hopefully, make you love modal editing :-)
2014-09-01 05:23:13 +00:00
2014-09-07 02:47:20 +00:00
## Screenshots
2014-09-01 05:15:52 +00:00
2014-09-07 01:59:04 +00:00
![src_startup](https://raw.githubusercontent.com/syl20bnr/spacemacs/master/doc/spacemacs_startup.png)
![scr_python](https://raw.githubusercontent.com/syl20bnr/spacemacs/master/doc/spacemacs.png)
2014-09-01 05:15:52 +00:00
2013-12-13 17:18:28 +00:00
## Who can benefit from this ?
2013-11-23 05:46:33 +00:00
2014-08-31 17:11:49 +00:00
`Spacemacs` is first intended to be used by **Vim users** who want to go to the
2013-12-01 03:37:00 +00:00
next level by using Emacs.
2013-11-23 05:46:33 +00:00
2014-08-31 17:11:49 +00:00
It is also a good fit for people wanting to **lower the [risk of RSI][RSI]**
2013-11-23 05:46:33 +00:00
induced by the default Emacs key bindings.
2014-08-31 17:11:49 +00:00
People wanting to learn **a different way to edit files** or wanting to learn
Vim key bindings.
2013-11-23 05:46:33 +00:00
As a note side, if you are a programmer and you don't know Vim key bindings
yet, I deeply recommend you to learn the basics as recommended in
[Sacha Chua's one-page guide][sacha_guide] about how to learn Emacs.
## Install
`Spacemacs` is tested with `Emacs 24.3.1` on `Ubuntu 14.04`, `Mac OS X 10.10`,
`Windows 7`.
2013-11-23 05:46:33 +00:00
Backup your current `.emacs.d`, clone the repo. _with the submodules_ and
you are good to go:
2013-11-23 05:46:33 +00:00
cd ~
mv .emacs.d .emacs.bak
git clone --recursive http://github.com/syl20bnr/spacemacs .emacs.d
2013-11-23 05:46:33 +00:00
## Troubleshoot
### Marmalade repository is down
Unfortunately for now there is little you can do in `Spacemacs` if `marmalade`
repository goes down and you need to install packages. Though there will be
solutions in a future release of the contribution system.
2013-11-23 05:46:33 +00:00
## Packages and Extensions Organization
2014-09-07 04:19:07 +00:00
*work in progress* _stay tuned_
2013-11-23 05:46:33 +00:00
## How it works
2014-09-01 06:17:18 +00:00
`Spacemacs` uses the [evil][evil] mode to emulate Vim key bindings. It is a
very complete emulation (the most complete I've seen yet).
2014-09-01 06:17:18 +00:00
`Spacemacs` heavily uses the [evil-leader][evil-leader] mode which brings the
Vim leader key to the Emacs world.
2014-08-31 17:11:49 +00:00
This leader key is commonly set to `,` by Vim users, in `Spacemacs` the leader
key is set on `SPC` (space bar, this is why the name `spacemacs`). This key is
the most accessible key on a keyboard and it is pressed with the thumb which is
a good choice to lower the risk of [RSI][RSI].
2014-09-01 06:17:18 +00:00
So with `Spacemacs` there is no need to remap your keyboard modifiers to
attempt to reduce the risk of RSI, every command can be executed very easily
while you are in `normal` mode by pressing the `SPC` leader key, here are a
few examples:
2013-11-23 05:46:33 +00:00
2014-08-31 17:11:49 +00:00
- Save a buffer: `<SPC> f s`
- Save all opened buffers: `<SPC> f S`
- Open (switch) to a buffer with `helm`: `<SPC> b s`
2013-11-23 05:46:33 +00:00
## How to switch to normal mode efficiently ?
2013-11-24 03:50:11 +00:00
One of the main design flaw in Vim key bindings is that you often have to press
the `ESC` key to return to `normal` mode and `ESC` key is very far from the
home row.
2013-11-23 05:46:33 +00:00
The popular way to avoid this is to replace `ESC` by `jj` pressed rapidly. In
2013-12-01 03:37:00 +00:00
`Spacemacs` you have to press `fd` quickly by default.
2013-11-23 05:46:33 +00:00
2013-11-24 03:50:11 +00:00
`fd` also works to quit minibuffer prompts.
2014-08-31 17:11:49 +00:00
**Note:** For those who know about [keychords.el][keychords] mode. This mode is
not used to achieve this, the reasons for this is latency and the fact that
keychords wants you to press several keys almost at the same time which is
something very difficult to master correctly on a keyboard. `Spacemacs` has a
special function called `fd-trigger` to handle the `fd` key sequence and fix
the above keychords issues.
2013-11-23 05:46:33 +00:00
2013-12-17 02:11:47 +00:00
## Evil plugins
`Spacemacs` ships with the following evil plugins:
2014-08-31 17:11:49 +00:00
Mode | Description
2014-09-01 06:17:18 +00:00
----------------------------------------|--------------------------------------
2014-08-31 17:11:49 +00:00
[evil-leader][evil-leader] | vim leader that bring a new layer of keys in normal mode
[evil-little-word][evil-plugin01] | port of [camelcasemotion.vim][vim-plugin01]
[evil-operator-comment][evil-plugin01] | comment/uncomment with `CC`
[evil-visualstar][evil-plugin03] | search for current selection with `*`
[evil-exchange][evil-plugin05] | port of [vim-exchange][vim-plugin04]
[surround][evil-plugin04] | port of [surround.vim][vim-plugin03]
2013-12-17 02:11:47 +00:00
2013-11-23 05:46:33 +00:00
## How to use it ?
2013-11-24 03:50:11 +00:00
Every sequences must be performed in `normal` mode.
### Executing Vim and Emacs commands
Vim commands are execute as usual with the `:` key.
2014-08-31 17:11:49 +00:00
2013-11-24 03:50:11 +00:00
To execute an Emacs command:
<SPC> :
2013-11-23 05:46:33 +00:00
### Key bindings help
A list of all the key bindings can be accessed by pressing:
<SPC> ?
2013-12-01 03:37:00 +00:00
To narrow the list to `Spacemacs` specific key bindings set the pattern to `SPC`
2013-12-13 17:15:03 +00:00
### About helm
`Spacemacs` tries to use [helm][helm] as much as possible.
[helm][helm] is coupled to [popwin][popwin] so `helm` window always appears in
a new temporary windows at the bottom.
The following `helm` modes are installed with `Spacemacs`:
2014-08-31 17:11:49 +00:00
Key Binding | Mode | Description
------------|-----------------------------------------|------------------------
`<SPC> h s` | [helm-swoop][hswoop] | search for occurrences within a file and edit the result
`<SPC> h c` | [helm-css-scss][hcss] | for quick navigation in CSS
`<SPC> h y` | [helm-c-yasnippet][hyas] | select snippets
`<SPC> h t` | [helm-themes][hthemes] | select a theme
`<SPC> p f` | [helm-projectile][projectile] | select files within a projectile project
`<SPC> ?` | [helm-descbinds][hdescbinds] | show key bindings
`<SPC> s c` | [cofi/helm-flyspell-correct][hflyspell] | choose a corrected word
2013-12-13 17:15:03 +00:00
2014-09-01 04:27:52 +00:00
### Navigation
#### Point/Cursor
2013-11-23 05:46:33 +00:00
Navigation is performed using the Vi key bindings `hjkl`.
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------|------------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`h` | move cursor left
`j` | move cursor down
`k` | move cursor up
`l` | move cursor right
`H` | move quickly up (10 lines at a time)
`L` | move quickly down (10 lines at a time)
`<SPC> j h` | go to the beginning of line (and set a mark at the previous location in the line)
`<SPC> j l` | go to the end of line (and set a mark at the previous location in the line)
`<SPC> z z` | lock the cursor at the center of the screen
2013-11-23 05:46:33 +00:00
#### [ace-jump mode][ace-jump]
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------|------------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`,` | initiate ace jump
`<SPC> ,` | go back to the previous location (before the jump)
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Buffers and Files
2013-11-23 05:46:33 +00:00
2013-12-13 17:15:03 +00:00
`Spacemacs` uses `ido` for opening files since `ido` way to navigate
the file system is better than `helm` in my opinion (especially because `ido` can
2013-11-23 05:46:33 +00:00
remember the last selected directories and buffers, maybe helm can do this ?).
`ido` is also used to kill buffers.
2014-08-31 17:11:49 +00:00
Buffer manipulation commands (start with `b`):
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`<SPC> b d` | delete the current buffer (beware the associated file is also deleted)
`<SPC> b k` | kill the current buffer
`<SPC> b K` | kill all buffers except the current one
`<SPC> b m h` | move a buffer to the left
`<SPC> b m j` | move a buffer to the bottom
`<SPC> b m k` | move a buffer to the top
`<SPC> b m l` | move a buffer to the right
`<SPC> b n` | switch to next buffer
`<SPC> b p` | switch to previous buffer
`<SPC> b r` | rename the current buffer
`<SPC> b s` | switch to a buffer using `helm`
`<SPC> b w` | toggle read-only
Files manipulation commands (start with `f`):
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`<SPC> f f` | open a file using `ido`
`<SPC> f i` | open your `init.el` file
`<SPC> f s` | save a file
`<SPC> f S` | save all files
`<SPC> f y` | show current file absolute path in the mini buffer
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Bookmarks
Bookmarks can be set anywhere in a file. Bookmarks are persistent. They are very
useful to jump to/open a known project. `Spacemacs` used `helm-bookmarks` to
manage them.
2014-09-01 04:27:52 +00:00
Open an `helm` window with the current bookmarks by pressing:
<SPC> h b
Then in the `helm-bookmarks` buffer:
2014-09-01 04:27:52 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
`CTRL+d` | delete the selected bookmark
`CTRL+e` | edit the selected bookmark
`CTRL+f` | toggle filename location
`CTRL+o` | open the selected bookmark in another window
To save a new bookmark, just type the name of the bookmark and press `RET`.
2014-09-01 04:27:52 +00:00
2013-11-23 05:46:33 +00:00
### Window manipulation
Split windows are dynamically resized depending on whether they are selected or
not. Resizing is performed by the [golden-ratio][golden-ratio] mode.
Every window has a number displayed at the start of the mode-line and can
2014-08-31 17:11:49 +00:00
be quickly accessed using `<SPC> number`.
Key Binding | Description
2014-09-01 06:17:18 +00:00
--------------|----------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`<SPC> 1` | go to first window
`<SPC> 2` | go to window number 2
`<SPC> 3` | go to window number 3
`<SPC> 4` | go to window number 4
`<SPC> 5` | go to window number 5
`<SPC> 6` | go to window number 6
`<SPC> 7` | go to window number 7
`<SPC> 8` | go to window number 8
`<SPC> 9` | go to window number 9
`<SPC> 0` | go to window number 10
Windows manipulation commands (start with `w`):
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`<SPC> w b` | split a window horizontally
`<SPC> w c` | close a window
`<SPC> w d` | toggle window dedication (dedicated window cannot be used by a mode)
`<SPC> w H` | move window to the left
`<SPC> w J` | move window to the bottom
`<SPC> w K` | move window to the top
`<SPC> w L` | move window to the right
`<SPC> w m` | maximize/minimize a window
`<SPC> w M` | maximize/minimize a window, when maximized the buffer is centered
2014-08-31 21:30:26 +00:00
`<SPC> w p` | close the current sticky popup window
2014-08-31 17:11:49 +00:00
`<SPC> w r` | rotate windows clockwise
`<SPC> w R` | rotate windows counter-clockwise
`<SPC> w u` | undo window layout (used to effectively undo a close window)
`<SPC> w U` | redo window layout
`<SPC> w v` | split a window vertically
`<SPC> w w` | cycle and focus between windows
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
### Text manipulation commands
2013-11-24 03:50:11 +00:00
2014-08-31 17:11:49 +00:00
Text related commands (start with `x`):
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-08-31 17:11:49 +00:00
`<SPC> x +` | increase text font size
`<SPC> x -` | decrease text font size
`<SPC> x =` | reset text font size
`<SPC> x u` | set the selected text to lower case
`<SPC> x U` | set the selected text to upper case
`<SPC> x d w` | delete trailing whitespaces
`<SPC> x g l` | set languages used by translate commands
`<SPC> x g t` | translate current word using Google Translate
`<SPC> x g T` | reverse source and target languages
`<SPC> x m j` | move down a line of text
`<SPC> x m k` | move up a line of text
`<SPC> x t c` | swap (transpose) the current character with the previous one
`<SPC> x t w` | swap (transpose) the current word with the previous one
`<SPC> x t l` | swap (transpose) the current line with the previous one
`<SPC> x w c` | count the number of words in the selection region
`<SPC> x w C` | count the number of occurrences per word in the select region
2013-11-24 03:50:11 +00:00
### Spell checking
2014-09-01 04:27:52 +00:00
Spell checking commands start with `s`:
2013-11-24 03:50:11 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> s c` | list of corrections in a `helm` buffer
`<SPC> s d` | change dictionary language
`<SPC> s n` | go to the next spell check error
2013-11-24 03:50:11 +00:00
2014-09-01 04:27:52 +00:00
### Region selection
2013-11-24 03:50:11 +00:00
2014-09-01 04:27:52 +00:00
Vi `Visual` modes are all supported by `evil`, `Spacemacs` adds another
2014-09-01 04:50:53 +00:00
`Visual` mode via the [expand-region][expand-region] mode.
2013-11-24 03:50:11 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> v` | initiate expand-region mode then...
`v` | expand the region by one semantic unit
`V` | contract the region by one semantic unit
`r` | reset the region to initial selection
2014-09-01 04:50:53 +00:00
`ESC` | leave expand-region mode
2014-09-01 04:27:52 +00:00
### Region narrowing
2013-11-24 03:50:11 +00:00
2014-09-01 06:17:18 +00:00
The displayed text of a buffer can be narrowed with the commands
(start with `n`):
2014-09-01 04:27:52 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> n f` | narrow the buffer to the current function
`<SPC> n p` | narrow the buffer to the visible page
`<SPC> n r` | narrow the buffer to the selected text
`<SPC> n w` | widen, i.e show the whole buffer again
### Auto highlight
`Spacemacs` supports auto highlighting of the current word (provided by the
[auto-highlight-symbol][auto-highlight] mode).
2014-09-01 06:17:18 +00:00
Key Binding | Description
--------------|----------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> h e` | edit all occurrences of the current word
`<SPC> h n` | go to next occurrence
`<SPC> h p` | go to previous occurrence
`<SPC> t h` | toggle the auto highlighting
2013-11-24 03:50:11 +00:00
2013-11-23 05:46:33 +00:00
### Color theme
2014-09-01 04:54:40 +00:00
By default, `Spacemacs` uses the theme [Solarized][solarized-theme].
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-02 18:42:53 +00:00
`<SPC> c t` | cycle between `Spacemacs` themes
2014-09-01 04:27:52 +00:00
`<SPC> h t` | select a theme using a `helm` buffer
2013-11-23 05:46:33 +00:00
2014-09-02 18:42:53 +00:00
`Spacemacs` available themes:
2014-09-01 04:54:40 +00:00
- [Solarized][solarized-theme]
2014-09-01 04:51:57 +00:00
- [Monokai][monokai-theme]
- [Zenburn][zenburn-theme]
2014-09-01 04:52:19 +00:00
2013-11-23 05:46:33 +00:00
### UI elements
2014-09-01 04:52:19 +00:00
#### Mode-line
2013-11-23 05:46:33 +00:00
The mode line is a [powerline][powerline] customized to show the window
number and the colorized Evil current state.
2013-11-23 05:46:33 +00:00
2014-09-01 04:52:19 +00:00
The color codes for modes are:
Evil State | Color
2014-09-01 04:52:19 +00:00
------------------|------------------
Normal | Orange
Insert | Green
Visual | Grey
Emacs | Red
Motion | Purple
2014-09-01 05:38:11 +00:00
When [Flycheck][flycheck] minor mode is enabled, the mode line color changes
according to the current flycheck state:
![mode line with solarized dark error](https://raw.github.com/syl20bnr/flycheck-color-mode-line/master/doc/flycheck-color-mode-line-dark-e.png)
![mode line with solarized dark warning](https://raw.github.com/syl20bnr/flycheck-color-mode-line/master/doc/flycheck-color-mode-line-dark-w.png)
![mode line with solarized dark warning](https://raw.github.com/syl20bnr/flycheck-color-mode-line/master/doc/flycheck-color-mode-line-dark-i.png)
2014-09-01 04:52:19 +00:00
#### Toggles
2014-09-01 04:27:52 +00:00
Some UI indicators can be toggled on and off (toggles start with `t`):
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> t 8` | display a mark on the 80th column
`<SPC> t f` | toggle display of the fringe
`<SPC> t n` | show the line numbers (relative to current position)
`<SPC> t N` | show the absolute line numbers
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
### Minor Modes
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` uses [diminish][diminish] mode to reduce the size of minor mode
indicators:
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
The minor mode area can be toggled on and off with (default is off):
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
<SPC> t m
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Lighter | Mode
2014-09-01 06:17:18 +00:00
-------------|-----------------------------------------------------------------
2014-09-01 04:27:52 +00:00
Ⓐ | [auto-complete][auto-complete] mode
Ⓗ | [auto-highlight-symbol][auto-highlight] mode
Ⓒ | [centered-cursor][centered-cursor] mode
eⓅ | [e-project][e-project] mode
Ⓟ | [projectile][projectile] mode
Ⓕ | flymake mode
Ⓢ | flyspell mode
(Ⓢ) | [smartparens][sp] mode
(Ⓟ) | paredit mode
Ⓨ | [yasnippet][yasnippet] mode
**Note:** in terminal the regular indicators are used instead of the utf-8
ones.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
### Line formatting
2013-11-23 05:46:33 +00:00
`Spacemacs` replaces the default `J` Vi key binding (join current line with next
line) by a slightly more frequent action which is to `go to the line below point
and indent it`.
Join lines can still be performed with `<SPC> j k`
2014-09-01 04:27:52 +00:00
Line formatting commands start with `j`:
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
`J` | go to next line and indent it using auto-indent rules
2014-09-13 03:20:43 +00:00
`<SPC> j j` | same as `J` but will split the current line at point
`<SPC> J` | split a quoted string or s-expression in place
`<SPC> j J` | split a quoted string or s-expression and auto-indent
2014-09-01 04:27:52 +00:00
`<SPC> j k` | join the current line with the next line
2013-11-23 05:46:33 +00:00
Used together these key bindings are very powerful to quickly reformat the code.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
### Errors handling
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` uses [Flycheck][flycheck] to gives error feedback on the fly.
The checks are only performed at save time by default.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Errors management commands (star with `f` for `flycheck`):
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> f c` | clear all errors
`<SPC> f l` | display the `flycheck` list of errors/warnings
`<SPC> f n` | go to the next `flycheck` error
`<SPC> f p` | go to the previous flycheck error
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
### Project management
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Projects in `Spacemacs` are managed with [projectile][projectile].
So projects are defined implicitly, for instance the root of a project
is found when a `.git` repository or `.projectile` file is encountered
in the file tree.
Projects management commands (start with `p`):
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> p b` | switch to a buffer of the project
`<SPC> p C` | invalidate the cache of `projectile`
`<SPC> p d` | open a `dired` buffer at the root of the project
`<SPC> p f` | open a file of the project using `helm`
`<SPC> p F` | find a file if the project using `ido`
`<SPC> p k` | kill all the buffers of the project
`<SPC> p g` | grep search in the project
`<SPC> p r` | replace a string in the files of the project
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
### Modes
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` tries to add more natural Vi key bindings to some modes or
simply add new leader key bindings.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Leader key bindings start with `m` because they are bindings related to
the current `major mode`.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Helm
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` add `hjkl` navigation to `helm` buffers:
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`CTRL+h` | go to previous page
`CTRL+j` | go to previous item
`CTRL+k` | go to next item
`CTRL+l` | go to next page
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Erlang
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` uses [EDTS][edts] as an Erlang coding environment.
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> m d` | show man page documentation
`<SPC> m e` | go to next issue
`<SPC> m g` | go to definition
`<SPC> m G` | find a module in the current project
`<SPC> m h` | open the header file under point
`<SPC> m l` | find a function in the current module
`<SPC> m m` | go to the macro definition under point
`<SPC> m r` | go to the record definition under point
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Ledger
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> m a` | add a transaction
`<SPC> m d` | delete current transaction
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Lisp
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
**TODO**
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Magit
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` add `hjkl` navigation support for the following magit modes:
- branch manager
- commit
- log
- process
- status
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
**Note:** in `status` mode only `j` and `k` are remapped (to go down and up).
Press `K` instead of `k` to discard changes to an item.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Org
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
In `org`, [evil-org-mode][evil-org-mode] is activated.
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`gh` | outline-up-heading
`gj` | org-forward-heading-same-level
`gk` | org-backward-heading-same-level
`gl` | outline-next-visible-heading
`t` | org-todo
`T` | org-insert-todo-heading nil
`H` | org-beginning-of-line
`L` | org-end-of-line
`;t` | org-show-todo-tree
`o` | always-insert-item
`O` | org-insert-heading
`$` | org-end-of-line
`^` | org-beginning-of-line
`<` | org-metaleft
`>` | org-metaright
`;a` | org-agenda`
#### Perforce
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> p 4 a` | add a file in depot
`<SPC> p 4 d` | delete a file in depot
`<SPC> p 4 D` | p4-describe
`<SPC> p 4 e` | checkout a file
`<SPC> p 4 r` | rename a file
`<SPC> p 4 R` | revert a file
`<SPC> p 4 S` | submit CL
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### Python
2013-11-23 05:46:33 +00:00
##### Inferior REPL process
2013-11-23 05:46:33 +00:00
Start an iPython inferior REPL process with `<SPC> m i`.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Send code to inferior process commands:
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> m b` | send buffer and keep code buffer focused
`<SPC> m B` | send buffer and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`<SPC> m f` | send function and keep code buffer focused
`<SPC> m F` | send function and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`<SPC> m r` | send region and keep code buffer focused
`<SPC> m R` | send region and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`CTRL+j` | next item in REPL history
`CTRL+k` | previous item in REPL history
##### Testing in Python
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
`Spacemacs` uses [nose][nose] as a test runner. An improved version of
[nose.el][nose.el] is shipped with `Spacemacs`, this version adds:
- windows support
- test suite support
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
The root of the project is detected with a `.git` directory or a `setup.cfg` file.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Test commands (start with `m t` or `m T`):
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
No Debug | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
<SPC> m t a | launch all tests of the project
<SPC> m t f | launch the current test under point
<SPC> m t m | launch all tests of the current module
<SPC> m t s | launch all tests of the current suite
2014-09-01 04:53:01 +00:00
2014-09-01 06:17:18 +00:00
Debug | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
<SPC> m T a | launch all tests of the project in debug mode
<SPC> m T f | launch the current test under point in debug mode
<SPC> m T m | launch all tests of the current module in debug mode
<SPC> m T s | launch all tests of the current suite in debug mode
##### Other Python commands
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> m d` | open documentation in `firefox` using [pylookup][pylookup]
`<SPC> m g` | go to definition using [emacs-jedi][jedi]
`<SPC> m p` | add a breakpoint
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### R (ESS)
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
**Important**:
In order to speed up the boot time of `Spacemacs`, `ESS` must be loaded
manually via the key binding `<SPC> l e`.
2013-11-23 05:46:33 +00:00
##### Inferior REPL process
2013-11-23 05:46:33 +00:00
Start an `R` inferior REPL process with `<SPC> m i`.
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
Send code to inferior process commands:
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> m b` | send buffer and keep code buffer focused
`<SPC> m B` | send buffer and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`<SPC> m f` | send function and keep code buffer focused
`<SPC> m F` | send function and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`<SPC> m l` | send line and keep code buffer focused
`<SPC> m L` | send line and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`<SPC> m r` | send region and keep code buffer focused
`<SPC> m R` | send region and switch to REPL in insert mode
2014-09-01 04:27:52 +00:00
`<SPC> m s` | send region or line and step (debug)
`<SPC> m S` | send function or paragraph and step (debug)
`CTRL+j` | next item in REPL history
`CTRL+k` | previous item in REPL history
##### Other R commands
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`<SPC> m p` | object introspection popup [ess-R-object-popup][ess-R-object-popup]
`<SPC> m v p` | view data under point using [ess-R-data-view][ess-R-data-view]
`<SPC> m v t` | view table using [ess-R-data-view][ess-R-data-view]
2013-11-23 05:46:33 +00:00
2014-09-01 04:27:52 +00:00
#### rcirc
2013-11-23 05:46:33 +00:00
2014-09-01 06:17:18 +00:00
Key Binding | Description
------------------|------------------------------------------------------------
2014-09-01 04:27:52 +00:00
`CTRL+j` | next item in command history
`CTRL+k` | previous item in command history
2013-11-23 05:46:33 +00:00
## TODO list
- Add support for [multiple-cursors][multiple-cursors] mode.
[evil]: https://gitorious.org/evil/pages/Home
[evil-leader]: https://github.com/cofi/evil-leader
[RSI]: http://en.wikipedia.org/wiki/Repetitive_strain_injury
[sacha_guide]: http://sachachua.com/blog/2013/05/how-to-learn-emacs-a-hand-drawn-one-pager-for-beginners/
[use-package]: https://github.com/jwiegley/use-package
[keychords]: http://www.emacswiki.org/emacs/KeyChord
[centered-cursor]: http://www.emacswiki.org/emacs/centered-cursor-mode.el
[ace-jump]: https://github.com/winterTTr/ace-jump-mode
[helm]: https://github.com/emacs-helm/helm
[popwin]: http://www.emacswiki.org/emacs/PopWin
[golden-ratio]: https://github.com/roman/golden-ratio.el
[solarized-theme]: https://github.com/bbatsov/solarized-emacs
[powerline]: https://github.com/milkypostman/powerline
[diminish]: http://www.emacswiki.org/emacs/DiminishedModes
[auto-complete]: https://github.com/auto-complete
[auto-highlight]: https://github.com/emacsmirror/auto-highlight-symbol
[e-project]: https://github.com/jrockway/eproject
[projectile]: https://github.com/bbatsov/projectile
[sp]: https://github.com/Fuco1/smartparens
[flycheck]: https://github.com/flycheck
[yasnippet]: https://github.com/capitaomorte/yasnippet
[expand-region]: https://github.com/magnars/expand-region.el
[multiple-cursors]: https://github.com/magnars/multiple-cursors.el
[keybindings]: https://github.com/syl20bnr/vimacs/blob/master/my-keybindings.el
2013-12-13 17:15:03 +00:00
[hswoop]: https://github.com/ShingoFukuyama/helm-swoop
[hcss]: https://github.com/ShingoFukuyama/helm-css-scss
[hyas]: https://github.com/emacs-helm/helm-c-yasnippet
[hthemes]: https://github.com/syohex/emacs-helm-themes
[projectile]: https://github.com/bbatsov/projectile
[hdescbinds]: https://github.com/emacs-helm/helm-descbinds
[hflyspell]: https://gist.github.com/cofi/3013327
2013-12-17 02:11:47 +00:00
[evil-plugin01]: https://github.com/tarao/evil-plugins
[evil-plugin02]: https://github.com/redguardtoo/evil-matchit
[evil-plugin03]: https://github.com/bling/evil-visualstar
[evil-plugin04]: https://github.com/timcharper/evil-surround
2014-08-31 17:11:49 +00:00
[evil-plugin05]: https://github.com/Dewdrops/evil-exchange
2013-12-17 02:15:54 +00:00
[vim-plugin01]: http://www.vim.org/scripts/script.php?script_id=1905
[vim-plugin02]: http://www.vim.org/scripts/script.php?script_id=39
[vim-plugin03]: http://www.vim.org/scripts/script.php?script_id=1697
2014-08-31 17:11:49 +00:00
[vim-plugin04]: https://github.com/tommcdo/vim-exchange
2014-09-01 04:27:52 +00:00
[evil-org-mode]: https://github.com/edwtjo/evil-org-mode
[nose]: https://github.com/nose-devs/nose/
[nose.el]: https://github.com/syl20bnr/nose.el
[pylookup]: https://github.com/tsgates/pylookup
[jedi]: https://github.com/tkf/emacs-jedi
[edts]: https://github.com/tjarvstrand/edts
[ess-R-object-popup]: https://github.com/myuhe/ess-R-object-popup.el
[ess-R-data-view]: https://github.com/myuhe/ess-R-data-view.el
2014-09-01 04:52:45 +00:00
[monokai-theme]: https://github.com/oneKelvinSmith/monokai-emacs
[zenburn-theme]: https://github.com/bbatsov/zenburn-emacs