2015-10-30 11:20:58 +00:00
#+TITLE : Better Defaults layer
2015-06-10 16:44:30 +00:00
2019-05-02 21:49:30 +00:00
#+TAGS : emacs|layer
2015-06-10 16:44:30 +00:00
[[file:img/emacs.png ]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2017-08-06 02:14:10 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
- [[#configuration ][Configuration ]]
- [[#key-bindings ][Key bindings ]]
2015-06-10 16:44:30 +00:00
* Description
2015-06-10 21:16:01 +00:00
This layer enhances the default commands of Emacs and is primarily intended to
be used with the =emacs= editing style as it does not change anything in the Vim
key bindings.
2015-06-10 16:44:30 +00:00
2015-06-10 21:16:01 +00:00
However the =emacs= editing style is not required, you can still use this layer
while you are using the =vim= editing style if you have some kind of mixed
style.
2015-06-10 16:44:30 +00:00
2015-06-10 21:16:01 +00:00
The commands defined in this layer are taken from various sources like [[https://github.com/bbatsov/prelude ][Prelude ]].
2015-06-10 16:44:30 +00:00
2017-08-06 02:14:10 +00:00
** Features:
- Smart line navigation: Subsequent presses of ~C-a~ toggles between the beginning of the line and the first non-whitespace character. Similarly, subsequent presses of ~C-e~ will toggle between the end of the code and the end of the comments.
2019-05-26 20:58:52 +00:00
- =spacemacs/backward-kill-word-or-region= : A combination of =kill-region= and =backward-kill-word= , depending on whether there is an active region. If there's an active region kill that. If not kill the preceding word.
- Fill or unfill paragraph: Pressing ~M-q~ for the first time fills current paragraph and pressing ~M-q~ for the second time unfills it. Note that some modes override this key binding so it's not available everywhere. Due to implementation details unfilling doesn't work when called twice via ~M-x~ .
2016-06-17 15:07:45 +00:00
2015-06-10 16:44:30 +00:00
* Install
2016-01-06 05:21:55 +00:00
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
2016-06-27 12:21:31 +00:00
add =better-defaults= to the existing =dotspacemacs-configuration-layers= list in
this file.
2015-06-10 16:44:30 +00:00
2016-06-17 15:07:45 +00:00
* Configuration
2016-06-27 12:21:31 +00:00
Choose if ~C-a~ first brings you to the beginning of the line or the beginning of
the code (first non-whitespace character).
2016-06-17 15:07:45 +00:00
#+BEGIN_SRC emacs-lisp
2016-06-27 12:21:31 +00:00
(better-defaults :variables
better-defaults-move-to-beginning-of-code-first t)
2016-06-17 15:07:45 +00:00
#+END_SRC
2015-06-10 16:44:30 +00:00
2016-06-27 12:21:31 +00:00
Choose if ~C-e~ first brings you to the end of the line or the end of the code
(before or after comments).
2016-06-17 15:07:45 +00:00
#+BEGIN_SRC emacs-lisp
2016-06-27 12:21:31 +00:00
(better-defaults :variables
better-defaults-move-to-end-of-code-first nil)
2016-06-17 15:07:45 +00:00
#+END_SRC
2015-09-24 12:13:35 +00:00
2016-06-17 15:07:45 +00:00
* Key bindings
2015-06-10 16:44:30 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2016-09-01 06:37:28 +00:00
|-------------+----------------------------------------------------------------------------------|
| ~C-a~ | move to beginning of line or code |
| ~C-e~ | move to end of line or code |
| ~C-w~ | backward kill word or region |
| ~C-y~ | Automatically indenting after pasting. With prefix argument, paste text as it is |
| ~M-q~ | fill or unfill current paragraph |