spacemacs/layers/+emacs/better-defaults
Arif Er 00f9ab19ac chore: update copyright headers to 2022
The script used to identify and update the change is added into the GitHub
workflows script directory. A workflow action can be created to trigger the
script to update the headers on the first of every new year. Possibly a task for
a consequent PR.
2022-06-03 17:32:20 +02:00
..
img better-defaults layer: update emacs logo 2016-10-17 13:34:40 +02:00
README.org documentation formatting: Sat Feb 13 22:58:15 UTC 2021 2021-02-14 00:00:32 +01:00
config.el chore: update copyright headers to 2022 2022-06-03 17:32:20 +02:00
funcs.el chore: update copyright headers to 2022 2022-06-03 17:32:20 +02:00
keybindings.el chore: update copyright headers to 2022 2022-06-03 17:32:20 +02:00
packages.el chore: update copyright headers to 2022 2022-06-03 17:32:20 +02:00

README.org

Better Defaults layer

/TakeV/spacemacs/media/commit/00f9ab19ac8642d3256ea9b278e7d165a897c622/layers/+emacs/better-defaults/img/emacs.png

Description

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.

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, but some of the layer bindings might be shadowed by the evil key bindings.

The commands defined in this layer are taken from various sources like Prelude.

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.
  • 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.

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add better-defaults to the existing dotspacemacs-configuration-layers list in this file.

Configuration

Choose if C-a first brings you to the beginning of the line or the beginning of the code (first non-whitespace character).

  (better-defaults :variables
                   better-defaults-move-to-beginning-of-code-first t)

Choose if C-e first brings you to the end of the line or the end of the code (before or after comments).

  (better-defaults :variables
                   better-defaults-move-to-end-of-code-first nil)

Key bindings

Key binding Description
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