Update conventions (mh, mg)

This commit is contained in:
syl20bnr 2015-01-20 22:29:02 -05:00
parent 6c655d29d9
commit 10334431fa

View file

@ -8,9 +8,12 @@
- [Spacemacs core and layer](#spacemacs-core-and-layer)
- [All layers](#all-layers)
- [Key bindings conventions](#key-bindings-conventions)
- [Prefix reserved to the user](#prefix-reserved-to-the-user)
- [Prefix reserved to the current major mode](#prefix-reserved-to-the-current-major-mode)
- [Navigation between items](#navigation-between-items)
- [Reserved prefix](#reserved-prefix)
- [User prefix](#user-prefix)
- [Major mode prefix](#major-mode-prefix)
- [Navigation](#navigation)
- [Navigation with n and N](#navigation-with-n-and-n)
- [Code Navigation](#code-navigation)
- [In buffer evaluation of code](#in-buffer-evaluation-of-code)
- [Interactions with REPLs](#interactions-with-repls)
- [Interactions with Tests](#interactions-with-tests)
@ -18,10 +21,9 @@
- [Depending on the language](#depending-on-the-language)
- [Building and Compilation](#building-and-compilation)
- [Debugging](#debugging)
- [Code navigation](#code-navigation)
- [Getting Help or Documentation](#getting-help-or-documentation)
- [Evilify buffers](#evilify-buffers)
- [Navigation in `insert state` buffers](#navigation-in-insert-state-buffers)
- [Evilify buffers](#evilify-buffers)
<!-- markdown-toc end -->
@ -46,17 +48,21 @@ A package is initialized in a function with name `<layer>/init-xxx` where:
## Key bindings conventions
### Prefix reserved to the user
### Reserved prefix
#### User prefix
<kbd>SPC o</kbd> must not be used by any layer. It is reserved for the user.
### Prefix reserved to the current major mode
#### Major mode prefix
<kbd>SPC m</kbd> is reserved for the current major mode. Three keys bindings
are not an issue (ie. <kbd>SPC m h d</kbd>) since <kbd>SPC m</kbd> can be
accessed via <kbd>,</kbd>.
### Navigation between items
### Navigation
#### Navigation with n and N
To be consistent with the Vim way, <kbd>n</kbd> and <kbd>N</kbd> are favored
over Emacs <kbd>n</kbd> and <kbd>p</kbd>.
@ -66,18 +72,28 @@ A micro-state allows to repeat key bindings without entering each time the
prefix commands.
More info on micro-states in the [documentation](DOCUMENTATION.md#micro-states).
### In buffer evaluation of code
#### Code Navigation
Live evaluation of code is under the prefix `<SPC> e`.
The prefix for going to something is `<SPC> m g`.
Key | Description
------------------|------------------------------------------------------------
<kbd>e $</kbd> | put the point at the end of the line and evaluate
<kbd>e b</kbd> | evaluate buffer
<kbd>e e</kbd> | evaluate last expression
<kbd>e f</kbd> | evaluate function
<kbd>e l</kbd> | evaluate line
<kbd>e r</kbd> | evaluate region
<kbd>m g a</kbd> | go to alternate file (i.e. `.h <--> .cpp`)
<kbd>m g g</kbd> | go to things under point
<kbd>m g t</kbd> | go to corresponding test file if any
### In buffer evaluation of code
Live evaluation of code is under the prefix `<SPC> m e`.
Key | Description
------------------|------------------------------------------------------------
<kbd>m e $</kbd> | put the point at the end of the line and evaluate
<kbd>m e b</kbd> | evaluate buffer
<kbd>m e e</kbd> | evaluate last expression
<kbd>m e f</kbd> | evaluate function
<kbd>m e l</kbd> | evaluate line
<kbd>m e r</kbd> | evaluate region
### Interactions with REPLs
@ -122,7 +138,7 @@ common actions that we can unite under the same key bindings:
<kbd>m t t</kbd> | execute the current test (thing at point, function)
Note: we don't distinguish between the file and the buffer. We can implement
an auto-save of the buffer before executing the tests.
an auto-save of the buffer before executing the tests of buffer.
#### Depending on the language
@ -140,8 +156,12 @@ The base prefix for major mode specific compilation is <kbd>SPC m c</kbd>.
Key Binding | Description
---------------------|------------------------------------------------------------
<kbd>m c b</kbd> | compile buffer
<kbd>m c c</kbd> | compile
<kbd>m c r</kbd> | recompile
<kbd>m c r</kbd> | 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.
### Debugging
@ -152,9 +172,9 @@ The base prefix for debugging commands is <kbd>SPC d</kbd>.
<kbd>m d a</kbd> | abandon current process
<kbd>m d b</kbd> | toggle a breakpoint
<kbd>m d c</kbd> | continue current process
<kbd>m d d</kbd> | start debug process
<kbd>m d n</kbd> | next breakpoint
<kbd>m d N</kbd> | previous breakpoint
<kbd>m d s</kbd> | start debug process
Notes:
- Ideally a micro-state for breakpoint navigation should be provided.
@ -162,12 +182,6 @@ Notes:
the spacemacs level and ideally the function should be proposed as a patch
upstream (major mode repository).
### Code navigation
Key | Description
------------------|------------------------------------------------------------
<kbd>m g</kbd> | go to definition of thing under point
### Getting Help or Documentation
The base prefix for help commands is <kbd>SPC h</kbd>. Documentation is
@ -175,7 +189,27 @@ considered as an help command.
Key | Description
------------------|------------------------------------------------------------
<kbd>m h d</kbd> | documentation of thing under point
<kbd>m h h</kbd> | documentation of thing under point
<kbd>m h r</kbd> | documentation of selected region
### Navigation in `insert state` buffers
Navigation in buffers like `Helm` and `ido` which are in `insert state` should
be performed with <kbd>C-j</kbd> and <kbd>C-k</kbd> bindings for vertical
movements.
Key | Description
----------------|------------------------------------------------------------
<kbd>C-j</kbd> | go down
<kbd>C-k</kbd> | go up
History navigation in shells or REPLs buffers should be bound as well to
<kbd>C-j</kbd> and <kbd>C-k</kbd>.
Key | Description
----------------|------------------------------------------------------------
<kbd>C-j</kbd> | next item in history
<kbd>C-k</kbd> | previous item in history
### Evilify buffers
@ -196,22 +230,3 @@ Example of _evilified_ buffers are `magit status`, `paradox buffer`.
The related functions are:
- `spacemacs/activate-evil-leader-for-maps` and `spacemacs/activate-evil-leader-for-map`
- `spacemacs/evilify`
### Navigation in `insert state` buffers
Navigation in buffers like `Helm` and `ido` which are in `insert state` should
be performed with <kbd>C-j</kbd> and <kbd>C-k</kbd> bindings for vertical
movements.
Key | Description
----------------|------------------------------------------------------------
<kbd>C-j</kbd> | go down
<kbd>C-k</kbd> | go up
History navigation in shells or REPLs buffers should be bound as well to
<kbd>C-j</kbd> and <kbd>C-k</kbd>.
Key | Description
----------------|------------------------------------------------------------
<kbd>C-j</kbd> | next item in history
<kbd>C-k</kbd> | previous item in history