2015-10-30 13:23:24 +00:00
|
|
|
|
#+TITLE: Spacemacs Conventions
|
2015-10-30 11:20:58 +00:00
|
|
|
|
|
2016-03-31 02:59:55 +00:00
|
|
|
|
* Spacemacs conventions :TOC_4_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
|
- [[#code-guidelines][Code guidelines]]
|
|
|
|
|
- [[#spacemacs-core-and-layer][Spacemacs core and layer]]
|
|
|
|
|
- [[#all-layers][All layers]]
|
|
|
|
|
- [[#use-package][Use-package]]
|
|
|
|
|
- [[#key-bindings-conventions][Key bindings conventions]]
|
|
|
|
|
- [[#reserved-prefix][Reserved prefix]]
|
|
|
|
|
- [[#user-prefix][User prefix]]
|
|
|
|
|
- [[#major-mode-prefix][Major mode prefix]]
|
|
|
|
|
- [[#transient-state][Transient-state]]
|
|
|
|
|
- [[#evilified-buffers][Evilified buffers]]
|
|
|
|
|
- [[#navigation][Navigation]]
|
|
|
|
|
- [[#n-and-n][n and N]]
|
|
|
|
|
- [[#code-navigation][Code Navigation]]
|
|
|
|
|
- [[#insert-state-buffers][=insert state= buffers]]
|
|
|
|
|
- [[#confirm-and-abort][Confirm and Abort]]
|
|
|
|
|
- [[#evaluation][Evaluation]]
|
|
|
|
|
- [[#repls][REPLs]]
|
|
|
|
|
- [[#send-code][Send code]]
|
|
|
|
|
- [[#in-terminal][In terminal]]
|
|
|
|
|
- [[#building-and-compilation][Building and Compilation]]
|
|
|
|
|
- [[#debugging][Debugging]]
|
|
|
|
|
- [[#plain-text-markup-languages][Plain Text Markup Languages]]
|
|
|
|
|
- [[#headers][Headers]]
|
|
|
|
|
- [[#insertion-of-common-elements][Insertion of common elements]]
|
|
|
|
|
- [[#text-manipulation][Text manipulation]]
|
|
|
|
|
- [[#movement-in-normal-mode][Movement in normal mode]]
|
|
|
|
|
- [[#promotion-demotion-and-element-movement][Promotion, Demotion and element movement]]
|
|
|
|
|
- [[#table-editing][Table editing]]
|
|
|
|
|
- [[#tests][Tests]]
|
|
|
|
|
- [[#all-languages][All languages]]
|
|
|
|
|
- [[#language-specific][Language specific]]
|
|
|
|
|
- [[#toggles][Toggles]]
|
|
|
|
|
- [[#refactoring][Refactoring]]
|
|
|
|
|
- [[#code-formatting][Code Formatting]]
|
|
|
|
|
- [[#help-or-documentation][Help or Documentation]]
|
|
|
|
|
- [[#writing-documentation][Writing documentation]]
|
|
|
|
|
- [[#spacing-in-documentation][Spacing in documentation]]
|
2015-10-30 11:20:58 +00:00
|
|
|
|
|
|
|
|
|
* Code guidelines
|
|
|
|
|
** Spacemacs core and layer
|
2015-06-10 18:26:13 +00:00
|
|
|
|
Function names follow these conventions:
|
|
|
|
|
- =spacemacs/xxx= is an interactive function called =xxx=
|
|
|
|
|
- =spacemacs//xxx= is a private function called =xxx= (implementation details)
|
|
|
|
|
- =spacemacs|xxx= is a /macro/ called =xxx=
|
|
|
|
|
|
|
|
|
|
Variables follow these conventions:
|
|
|
|
|
- =spacemacs-xxx= is a variable
|
|
|
|
|
- =spacemacs--xxx= is a private variable (implementation details)
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** All layers
|
2015-06-10 18:26:13 +00:00
|
|
|
|
A package is initialized in a function with name =<layer>/init-xxx= where:
|
|
|
|
|
- =<layer>= is the layer name
|
|
|
|
|
- =xxx= is the package name
|
2016-01-30 11:32:53 +00:00
|
|
|
|
|
2016-01-18 04:42:04 +00:00
|
|
|
|
** Use-package
|
|
|
|
|
- Always use =progn= when a code block requires multiple lines for =:init= or
|
|
|
|
|
=:config= keywords.
|
|
|
|
|
- If there is only one line of code then try to keep =:init= or =:config=
|
|
|
|
|
keywords on the same line.
|
|
|
|
|
- Don't nest multiple =use-package= calls unless you have a very good reason
|
|
|
|
|
to do it.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
* Key bindings conventions
|
|
|
|
|
** Reserved prefix
|
|
|
|
|
*** User prefix
|
2015-08-17 18:25:48 +00:00
|
|
|
|
~SPC o~ and ~SPC m o~ must not be used by any layer. They are reserved for the
|
|
|
|
|
user.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Major mode prefix
|
2015-06-10 18:26:13 +00:00
|
|
|
|
~SPC m~ is reserved for the current major mode. Three keys bindings are not an
|
2016-02-29 09:23:14 +00:00
|
|
|
|
issue (ie. ~SPC m h d~) since ~SPC m~ can be accessed via ~,~.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2016-01-30 11:32:53 +00:00
|
|
|
|
*** Transient-state
|
|
|
|
|
Whenever possible a transient-state should be enabled with ~M-SPC~ and ~s-M-SPC~. We
|
2015-06-10 18:26:13 +00:00
|
|
|
|
need the latter bindings on OS X since ~M-SPC~ is used by the OS for spotlight.
|
|
|
|
|
|
2016-01-30 11:32:53 +00:00
|
|
|
|
For instance transient-states dedicated to special buffers like =helm= or =ido=
|
2015-06-10 18:26:13 +00:00
|
|
|
|
buffers are good candidates to be put on ~M-SPC~ and ~s-M-SPC~.
|
|
|
|
|
|
2016-01-30 11:32:53 +00:00
|
|
|
|
It is recommended to add ~q~ to leave the transient-state.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Evilified buffers
|
2015-06-10 18:26:13 +00:00
|
|
|
|
/Evilifying/ a buffer is to set the =evilified state= as the default
|
|
|
|
|
state for the major mode of the buffer.
|
|
|
|
|
|
|
|
|
|
The =evilified state= is derived from the =emacs state= and modify the
|
2015-09-30 01:35:21 +00:00
|
|
|
|
map to:
|
|
|
|
|
- add ~hjkl~ navigation
|
2016-01-30 11:32:53 +00:00
|
|
|
|
- add scrolling feature on ~C-f~, ~C-b~, ~C-d~ and ~C-u~
|
2015-09-30 01:35:21 +00:00
|
|
|
|
- ~G~ and ~gg~ to go to the end and beginning of the buffer
|
|
|
|
|
- add incremental search with ~/~, ~n~ and ~N~
|
|
|
|
|
- enabling =evil-ex= on ~:~
|
|
|
|
|
- add =visual state= and =visual line state= on ~v~ and ~V~
|
|
|
|
|
- add yank on ~y~ _in visual state only_
|
|
|
|
|
- activate evil-leader key on ~SPC~
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
|
|
|
|
Setting the =evilified state= to a mode is done by calling the macro
|
2017-05-10 13:33:02 +00:00
|
|
|
|
=evilified-state-evilify-map=.
|
2015-09-30 01:35:21 +00:00
|
|
|
|
|
|
|
|
|
/Evilification/ rebinds shadowed key bindings according to the following
|
|
|
|
|
rules:
|
|
|
|
|
- alphabetic key bindings: ~x~ -> ~X~ -> ~C-x~ -> ~C-X~
|
2016-02-29 09:23:14 +00:00
|
|
|
|
- ~SPC~ -> ~'~
|
2015-09-30 01:35:21 +00:00
|
|
|
|
- ~/~ -> ~\~
|
|
|
|
|
- ~:~ -> ~|~
|
|
|
|
|
- ~C-g~ cannot be shadowed
|
|
|
|
|
|
|
|
|
|
If a key binding cannot be remapped then it is ignored and a warning message
|
|
|
|
|
is displayed in =*Messages*=.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Navigation
|
|
|
|
|
*** n and N
|
2015-06-10 18:26:13 +00:00
|
|
|
|
To be consistent with the Vim way, ~n~ and ~N~ are favored over Emacs ~n~ and
|
|
|
|
|
~p~.
|
|
|
|
|
|
2016-01-30 11:32:53 +00:00
|
|
|
|
Ideally a transient-state should be provided to smooth the navigation
|
|
|
|
|
experience. A transient-state allows to repeat key bindings without entering
|
|
|
|
|
each time the prefix commands. More info on transient-states in the
|
2017-08-18 19:07:43 +00:00
|
|
|
|
[[https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#transient-states][documentation]].
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Code Navigation
|
2015-06-10 18:26:13 +00:00
|
|
|
|
The prefix for going to something is ~SPC m g~.
|
|
|
|
|
|
2015-08-25 01:24:54 +00:00
|
|
|
|
| Key | Description |
|
|
|
|
|
|---------+-------------------------------------------------|
|
|
|
|
|
| ~m g a~ | go to alternate file (i.e. =.h <--> .cpp=) |
|
|
|
|
|
| ~m g b~ | go back to previous location (before last jump) |
|
|
|
|
|
| ~m g g~ | go to things under point |
|
|
|
|
|
| ~m g G~ | go to things under point in other window |
|
|
|
|
|
| ~m g t~ | go to corresponding test file if any |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** =insert state= buffers
|
2015-06-10 18:26:13 +00:00
|
|
|
|
Navigation in buffers like =Helm= and =ido= which are in =insert state=
|
|
|
|
|
should be performed with ~C-j~ and ~C-k~ bindings for vertical movements.
|
|
|
|
|
|
|
|
|
|
| Key | Description |
|
|
|
|
|
|-------+-------------|
|
|
|
|
|
| ~C-j~ | go down |
|
|
|
|
|
| ~C-k~ | go up |
|
|
|
|
|
|
2016-01-04 05:34:14 +00:00
|
|
|
|
** Confirm and Abort
|
|
|
|
|
Confirming and aborting actions which are bound to ~C-c C-c~ and ~C-c C-k~
|
|
|
|
|
in raw Emacs are mirrored in Spacemacs to:
|
2015-12-05 15:03:34 +00:00
|
|
|
|
|
2015-12-09 05:51:50 +00:00
|
|
|
|
| Key | Description |
|
|
|
|
|
|-------------------------+---------------------------|
|
2016-02-29 09:23:14 +00:00
|
|
|
|
| ~SPC m ,~ and ~SPC m c~ | Valid/Confirm the message |
|
2015-12-09 05:51:50 +00:00
|
|
|
|
| ~SPC m a~ and ~SPC m k~ | Abort/Discard the message |
|
2015-12-05 15:03:34 +00:00
|
|
|
|
|
|
|
|
|
Some example of these modes are =magit= commit messages, =message-mode= for
|
|
|
|
|
mails or =org-mode= notes.
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Evaluation
|
2015-06-10 18:26:13 +00:00
|
|
|
|
Live evaluation of code is under the prefix ~SPC m e~.
|
|
|
|
|
|
2016-01-27 14:15:34 +00:00
|
|
|
|
| Key | Description |
|
|
|
|
|
|---------+-----------------------------------------------|
|
|
|
|
|
| ~m e $~ | put point at the end of the line and evaluate |
|
|
|
|
|
| ~m e b~ | evaluate buffer |
|
|
|
|
|
| ~m e e~ | evaluate last expression |
|
|
|
|
|
| ~m e f~ | evaluate function |
|
|
|
|
|
| ~m e l~ | evaluate line |
|
|
|
|
|
| ~m e r~ | evaluate region |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** REPLs
|
|
|
|
|
*** Send code
|
2015-06-10 18:26:13 +00:00
|
|
|
|
A lot of languages can interact with a REPL. To help keeping a
|
|
|
|
|
consistent behavior between those languages the following conventions
|
|
|
|
|
should be followed:
|
|
|
|
|
- ~SPC m s~ is the prefix for sending code. This allows fast interaction with
|
|
|
|
|
the REPL whenever it is possible
|
|
|
|
|
- lower case key bindings keep the focus on the current buffer
|
|
|
|
|
- upper case key bindings move the focus to the REPL buffer
|
|
|
|
|
|
|
|
|
|
| Key | Description |
|
|
|
|
|
|---------+--------------------------------------------------------------|
|
|
|
|
|
| ~m s b~ | send buffer |
|
|
|
|
|
| ~m s B~ | send buffer and switch to REPL |
|
|
|
|
|
| ~m s d~ | first key to send buffer and switch to REPL to debug (step) |
|
|
|
|
|
| ~m s D~ | second key to send buffer and switch to REPL to debug (step) |
|
|
|
|
|
| ~m s f~ | send function |
|
|
|
|
|
| ~m s F~ | send function and switch to REPL |
|
|
|
|
|
| ~m s i~ | start/switch to REPL inferior process |
|
|
|
|
|
| ~m s l~ | send line |
|
|
|
|
|
| ~m s L~ | send line and switch to REPL |
|
|
|
|
|
| ~m s r~ | send region |
|
|
|
|
|
| ~m s R~ | send region and switch to REPL |
|
|
|
|
|
|
|
|
|
|
Note: we don't distinguish between the file and the buffer.
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** In terminal
|
2015-06-10 18:26:13 +00:00
|
|
|
|
History navigation in shells or REPLs buffers should be bound as well to
|
|
|
|
|
~C-j~ and ~C-k~.
|
|
|
|
|
|
|
|
|
|
| Key | Description |
|
|
|
|
|
|-------+----------------------------|
|
|
|
|
|
| ~C-j~ | next item in history |
|
|
|
|
|
| ~C-k~ | previous item in history |
|
|
|
|
|
| ~C-l~ | clear screen |
|
|
|
|
|
| ~C-r~ | search backward in history |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Building and Compilation
|
2015-06-10 18:26:13 +00:00
|
|
|
|
The base prefix for major mode specific compilation is ~SPC m c~.
|
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+-------------------|
|
|
|
|
|
| ~m c b~ | compile buffer |
|
|
|
|
|
| ~m c c~ | compile |
|
2017-02-03 15:59:32 +00:00
|
|
|
|
| ~m c C~ | clean |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
| ~m c r~ | clean and compile |
|
|
|
|
|
|
|
|
|
|
Note: we don't distinguish between the file and the buffer. We can
|
|
|
|
|
implement an auto-save of the buffer before compiling the buffer.
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Debugging
|
2017-01-07 20:57:15 +00:00
|
|
|
|
The base prefix for debugging commands is ~SPC m d~.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+-------------------------|
|
|
|
|
|
| ~m d a~ | abandon current process |
|
|
|
|
|
| ~m d b~ | toggle a breakpoint |
|
|
|
|
|
| ~m d B~ | clear all breakpoints |
|
|
|
|
|
| ~m d c~ | continue |
|
|
|
|
|
| ~m d d~ | start debug session |
|
2017-02-12 18:02:55 +00:00
|
|
|
|
| ~m d i~ | step in |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
| ~m d l~ | local variables |
|
2017-02-12 18:02:55 +00:00
|
|
|
|
| ~m d o~ | step out |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
| ~m d r~ | run |
|
2017-02-12 18:02:55 +00:00
|
|
|
|
| ~m d s~ | next step |
|
|
|
|
|
| ~m d v~ | inspect value at point |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
|
|
|
|
Notes:
|
2016-01-30 11:32:53 +00:00
|
|
|
|
- Ideally a transient-state for breakpoint navigation should be provided.
|
2015-06-10 18:26:13 +00:00
|
|
|
|
- If there is no toggle breakpoint function, then it should be implemented at
|
|
|
|
|
the spacemacs level and ideally the function should be proposed as a patch
|
|
|
|
|
upstream (major mode repository).
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Plain Text Markup Languages
|
2015-06-10 18:26:13 +00:00
|
|
|
|
For layers supporting markup languages please follow the following
|
|
|
|
|
keybindings whenever applicable.
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Headers
|
2015-06-10 18:26:13 +00:00
|
|
|
|
All header functionality should be grouped under ~SPC m h~
|
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+--------------------------------------------------|
|
|
|
|
|
| ~m h i~ | Insert a header |
|
|
|
|
|
| ~m h I~ | Insert a header alternative method (if existing) |
|
|
|
|
|
| ~m h 1..10~ | Insert a header of level 1..10 (if possible) |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Insertion of common elements
|
2015-06-10 18:26:13 +00:00
|
|
|
|
Insertion of common elements like links or footnotes should be grouped
|
|
|
|
|
under ~SPC m i~
|
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+------------------|
|
|
|
|
|
| ~m i f~ | Insert footnote |
|
|
|
|
|
| ~m i i~ | Insert image |
|
|
|
|
|
| ~m i l~ | Insert link |
|
|
|
|
|
| ~m i u~ | Insert url |
|
|
|
|
|
| ~m i w~ | Insert wiki-link |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Text manipulation
|
2015-09-28 18:44:00 +00:00
|
|
|
|
Manipulation of text regions should be grouped under ~SPC m x~
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+-------------------------------|
|
|
|
|
|
| ~m x b~ | Make region bold |
|
|
|
|
|
| ~m x c~ | Make region code |
|
|
|
|
|
| ~m x i~ | Make region italic |
|
|
|
|
|
| ~m x q~ | Quote a region |
|
|
|
|
|
| ~m x r~ | Remove formatting from region |
|
|
|
|
|
| ~m x s~ | Make region strike-through |
|
|
|
|
|
| ~m x u~ | Make region underlined |
|
|
|
|
|
| ~m x v~ | Make region verbose |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Movement in normal mode
|
2015-06-10 18:26:13 +00:00
|
|
|
|
In normal mode Vim style movement should be enabled with these keybindings:
|
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+----------------------------------------|
|
|
|
|
|
| ~g h~ | Move up one level in headings |
|
|
|
|
|
| ~g j~ | Move to next heading on same level |
|
|
|
|
|
| ~g k~ | Move to previous heading on same level |
|
|
|
|
|
| ~g l~ | Move down one level in headings |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Promotion, Demotion and element movement
|
2015-06-10 18:26:13 +00:00
|
|
|
|
Promotion, demotion and movement of headings or list elements (whatever is
|
|
|
|
|
possible) should be enabled with the following keys in any mode
|
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+------------------------------|
|
|
|
|
|
| ~M-h~ | Promote heading by one level |
|
|
|
|
|
| ~M-j~ | Move element down |
|
|
|
|
|
| ~M-k~ | Move element up |
|
|
|
|
|
| ~M-l~ | Demote heading by one level |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Table editing
|
2015-06-10 18:26:13 +00:00
|
|
|
|
If table specific commands are available the they are grouped under the
|
|
|
|
|
~SPC m t~ group.
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Tests
|
2015-06-10 18:26:13 +00:00
|
|
|
|
A lot of languages have their own test frameworks. These frameworks
|
2015-08-25 01:22:45 +00:00
|
|
|
|
share common actions that we can unite under the same key bindings:
|
|
|
|
|
- ~SPC m t~ is the prefix for test execution.
|
|
|
|
|
- ~SPC m t X~ is used to execute ~SPC m t x~ but in debug mode (if supported).
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** All languages
|
2015-08-25 01:22:45 +00:00
|
|
|
|
|
|
|
|
|
| Key | Description |
|
|
|
|
|
|---------+--------------------------------------------------------------|
|
|
|
|
|
| ~m t a~ | execute all the tests of the current project |
|
|
|
|
|
| ~m t A~ | execute all the tests of the current project in debug |
|
|
|
|
|
| ~m t b~ | execute all the tests of the current buffer |
|
|
|
|
|
| ~m t B~ | execute all the tests of the current buffer in debug |
|
|
|
|
|
| ~m t t~ | execute the current test (thing at point, function) |
|
|
|
|
|
| ~m t T~ | execute the current test in debug (thing at point, function) |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
|
|
|
|
Note: we don't distinguish between the file and the buffer. We can
|
|
|
|
|
implement an auto-save of the buffer before executing the tests of
|
|
|
|
|
buffer.
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
*** Language specific
|
2016-04-13 03:31:38 +00:00
|
|
|
|
|
2015-08-25 01:22:45 +00:00
|
|
|
|
| Key | Description |
|
|
|
|
|
|---------+--------------------------------------------------|
|
|
|
|
|
| ~m t m~ | execute the tests of the current module |
|
|
|
|
|
| ~m t M~ | execute the tests of the current module in debug |
|
|
|
|
|
| ~m t s~ | execute the tests of the current suite |
|
|
|
|
|
| ~m t S~ | execute the tests of the current suite in debug |
|
2015-06-10 18:26:13 +00:00
|
|
|
|
|
|
|
|
|
Note that there are overlaps, depending on the language we will choose
|
|
|
|
|
one or more bindings for the same thing
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Toggles
|
2015-08-25 01:23:28 +00:00
|
|
|
|
- Global toggles are under ~SPC t~, ~SPC T~ and ~SPC C-t~
|
|
|
|
|
- Major mode toggles are only under ~SPC m T~
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Refactoring
|
2015-06-10 18:26:13 +00:00
|
|
|
|
Refactoring prefix is ~SPC m r~.
|
|
|
|
|
|
2016-07-07 02:10:34 +00:00
|
|
|
|
** Code Formatting
|
|
|
|
|
Major-mode code formatting is under prefix ~SPC m =~.
|
|
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|
|-------------+--------------------------|
|
|
|
|
|
| ~m = =~ | format thing under point |
|
|
|
|
|
| ~m = b~ | format current buffer |
|
|
|
|
|
| ~m = f~ | format current function |
|
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Help or Documentation
|
2017-01-07 20:57:15 +00:00
|
|
|
|
The base prefix for help commands is ~SPC m h~. Documentation is considered
|
2015-06-10 18:26:13 +00:00
|
|
|
|
as an help command.
|
|
|
|
|
|
|
|
|
|
| Key | Description |
|
|
|
|
|
|---------+------------------------------------|
|
|
|
|
|
| ~m h h~ | documentation of thing under point |
|
|
|
|
|
| ~m h r~ | documentation of selected region |
|
2015-07-25 05:33:04 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
* Writing documentation
|
2015-07-25 05:33:04 +00:00
|
|
|
|
Spacemacs provides an example layer =README.org= file in
|
2015-11-16 13:13:06 +00:00
|
|
|
|
=~/.emacs.d/core/templates/README.org.template=.
|
2015-07-25 05:33:04 +00:00
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
|
** Spacing in documentation
|
2016-01-18 04:42:04 +00:00
|
|
|
|
- Spacemacs tries to keep the documentation consistent between all layers by
|
|
|
|
|
providing some rules for spacing:
|
2015-07-25 05:33:04 +00:00
|
|
|
|
- After each header, you should not add an empty line
|
|
|
|
|
- *Exception*: If the first item under the header is a table, add an empty
|
|
|
|
|
line after it
|
|
|
|
|
- At the end of each header node, there should be an empty line
|
|
|
|
|
- Note: Many layer =READMEs= do not follow this convention yet. Please fix
|
|
|
|
|
them if you can.
|
2016-01-30 11:32:53 +00:00
|
|
|
|
|
2016-01-18 04:42:04 +00:00
|
|
|
|
- To keep things readable only mention the prefix ~SPC~ when documenting
|
2016-01-30 11:32:53 +00:00
|
|
|
|
key bindings, you don't need to mention ~M-m~.
|