conventions: better evilified buffers section

This commit is contained in:
syl20bnr 2015-09-29 21:35:21 -04:00
parent 96ef3d1e9a
commit ab6ebd0348
1 changed files with 54 additions and 45 deletions

View File

@ -1,40 +1,40 @@
* Spacemacs conventions * Spacemacs conventions
** Table of Contents :TOC@4: ** Table of Contents :TOC@4:
- [[#spacemacs-conventions][Spacemacs conventions]] - [[#spacemacs-conventions][Spacemacs conventions]]
- [[#code-guidelines][Code guidelines]] - [[#code-guidelines][Code guidelines]]
- [[#spacemacs-core-and-layer][Spacemacs core and layer]] - [[#spacemacs-core-and-layer][Spacemacs core and layer]]
- [[#all-layers][All layers]] - [[#all-layers][All layers]]
- [[#key-bindings-conventions][Key bindings conventions]] - [[#key-bindings-conventions][Key bindings conventions]]
- [[#reserved-prefix][Reserved prefix]] - [[#reserved-prefix][Reserved prefix]]
- [[#user-prefix][User prefix]] - [[#user-prefix][User prefix]]
- [[#major-mode-prefix][Major mode prefix]] - [[#major-mode-prefix][Major mode prefix]]
- [[#micro-state][Micro-state]] - [[#micro-state][Micro-state]]
- [[#evilify-buffers][Evilify buffers]] - [[#evilified-buffers][Evilified buffers]]
- [[#navigation][Navigation]] - [[#navigation][Navigation]]
- [[#n-and-n][n and N]] - [[#n-and-n][n and N]]
- [[#code-navigation][Code Navigation]] - [[#code-navigation][Code Navigation]]
- [[#insert-state-buffers][=insert state= buffers]] - [[#insert-state-buffers][=insert state= buffers]]
- [[#evaluation][Evaluation]] - [[#evaluation][Evaluation]]
- [[#repls][REPLs]] - [[#repls][REPLs]]
- [[#send-code][Send code]] - [[#send-code][Send code]]
- [[#in-terminal][In terminal]] - [[#in-terminal][In terminal]]
- [[#building-and-compilation][Building and Compilation]] - [[#building-and-compilation][Building and Compilation]]
- [[#debugging][Debugging]] - [[#debugging][Debugging]]
- [[#plain-text-markup-languages][Plain Text Markup Languages]] - [[#plain-text-markup-languages][Plain Text Markup Languages]]
- [[#headers][Headers]] - [[#headers][Headers]]
- [[#insertion-of-common-elements][Insertion of common elements]] - [[#insertion-of-common-elements][Insertion of common elements]]
- [[#text-manipulation][Text manipulation]] - [[#text-manipulation][Text manipulation]]
- [[#movement-in-normal-mode][Movement in normal mode]] - [[#movement-in-normal-mode][Movement in normal mode]]
- [[#promotion-demotion-and-element-movement][Promotion, Demotion and element movement]] - [[#promotion-demotion-and-element-movement][Promotion, Demotion and element movement]]
- [[#table-editing][Table editing]] - [[#table-editing][Table editing]]
- [[#tests][Tests]] - [[#tests][Tests]]
- [[#all-languages][All languages]] - [[#all-languages][All languages]]
- [[#language-specific][Language specific]] - [[#language-specific][Language specific]]
- [[#toggles][Toggles]] - [[#toggles][Toggles]]
- [[#refactoring][Refactoring]] - [[#refactoring][Refactoring]]
- [[#help-or-documentation][Help or Documentation]] - [[#help-or-documentation][Help or Documentation]]
- [[#writing-documentation][Writing documentation]] - [[#writing-documentation][Writing documentation]]
- [[#spacing-in-documentation][Spacing in documentation]] - [[#spacing-in-documentation][Spacing in documentation]]
** Code guidelines ** Code guidelines
*** Spacemacs core and layer *** Spacemacs core and layer
@ -71,25 +71,34 @@ buffers are good candidates to be put on ~M-SPC~ and ~s-M-SPC~.
It is recommended to add ~q~ to leave the micro-state. It is recommended to add ~q~ to leave the micro-state.
*** Evilify buffers *** Evilified buffers
=Spacemacs= offers convenient functions to /evilify/ a buffer.
/Evilifying/ a buffer is to set the =evilified state= as the default /Evilifying/ a buffer is to set the =evilified state= as the default
state for the major mode of the buffer. state for the major mode of the buffer.
The =evilified state= is derived from the =emacs state= and modify the The =evilified state= is derived from the =emacs state= and modify the
map to: - add ~hjkl~ navigation - add incremental search with ~/~, ~n~ map to:
and ~N~ - add =visual state= and =visual line state= - add yank (copy) - add ~hjkl~ navigation
with ~y~ - activate evil-leader key - add scrolling feature on ~C-f~, ~C-b~, ~C-d~ and ~C-u~
- ~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~
Setting the =evilified state= to a mode is done by calling the macro Setting the =evilified state= to a mode is done by calling the macro
=evilify= which takes optional parameters to fix the key bindings =spacemacs|evilify-map=.
shadowed by the above modifications.
To fix the shadowed bindings we capitalize them, for instance: shadowed /Evilification/ rebinds shadowed key bindings according to the following
~h~ is transposed to ~H~, if ~H~ is taken then it is transposed to ~C-h~ rules:
and so on... - alphabetic key bindings: ~x~ -> ~X~ -> ~C-x~ -> ~C-X~
- ~SPC~ -> ~'~
- ~/~ -> ~\~
- ~:~ -> ~|~
- ~C-g~ cannot be shadowed
Example of /evilified/ buffers are =magit status=, =paradox buffer=. If a key binding cannot be remapped then it is ignored and a warning message
is displayed in =*Messages*=.
*** Navigation *** Navigation
**** n and N **** n and N