Enabling a company backend for a specific mode was a tedious tasks with code scattered at different locations, one for local variable definitions, one for company hook function definitions and another where the backends were pushed to the local variables (which was problematic, since we ended up pushing the same backends over and over again with `SPC f e R`, pushes have been replaced by add-to-list calls in the new macro). All these steps are now put together at one place with the new macro spacemacs|add-company-backends, check its docstring for more info on its arguments. This macro also allows to define arbitrary buffer local variables to tune company for specific modes (similar to layer variables via a keyword :variables) The code related to company backends management has been moved to the auto-completion layer in the funcs.el file. A nice side effect of this move is that it enforces correct encapsulation of company backends related code. We can now easily detect if there is some configuration leakage when the auto-completion layer is not used. But we loose macro expansion at file loading time (not sue it is a big concern though). The function spacemacs|enable-auto-complete was never used so it has been deleted which led to the deletion of the now empty file core-auto-completion.el. The example in LAYERS.org regarding auto-completion is now out of date and has been deleted. An example to setup auto-completion is provided in the README.org file of the auto-completion layer. |
||
---|---|---|
.. | ||
img | ||
config.el | ||
funcs.el | ||
packages.el | ||
README.org |
Markdown layer
Description
This layer adds markdown support to Spacemacs.
Features
- markdown files support via markdown-mode
- Fast Github-flavored live preview via vmd-mode
- TOC generation via markdown-toc
- Completion of Emojis using company-emoji (still needs a way of showing, either
using the
emoji
layer or having a proper font) 👏
BibTeX
For more extensive support of references with BibTeX files, have a look at the BibTeX layer.
Install
To use this configuration layer, add it to your ~/.spacemacs
. You will need to
add markdown
to the existing dotspacemacs-configuration-layers
list in this
file.
Configuration
Live preview
By default the built-in Emacs web browser is used to live preview a markdown buffer.
To use vmd
(Github-flavored live preview) instead set the value of the
variable markdown-live-preview-engine
to vmd
:
dotspacemacs-configuration-layers '(
(markdown :variables markdown-live-preview-engine 'vmd))
And install the executable with:
npm install -g vmd
Usage
Generate a TOC
To generate a table of contents type on top of the buffer:
SPC SPC markdown-toc-generate-toc RET
Key bindings
Element insertion
Key Binding | Description |
---|---|
SPC m - |
insert horizontal line |
SPC m h i |
insert header dwim |
SPC m h I |
insert header setext dwim |
SPC m h 1 |
insert header atx 1 |
SPC m h 2 |
insert header atx 2 |
SPC m h 3 |
insert header atx 3 |
SPC m h 4 |
insert header atx 4 |
SPC m h 5 |
insert header atx 5 |
SPC m h 6 |
insert header atx 6 |
SPC m h ! |
insert header setext 1 |
SPC m h @ |
insert header setext 2 |
SPC m i l |
insert link |
SPC m i L |
insert reference link dwim |
SPC m i u |
insert uri |
SPC m i f |
insert footnote |
SPC m i w |
insert wiki link |
SPC m i i |
insert image |
SPC m i I |
insert reference image |
SPC m x b |
make region bold or insert bold |
SPC m x i |
make region italic or insert italic |
SPC m x c |
make region code or insert code |
SPC m x C |
make region code or insert code (Github Flavored Markdown format) |
SPC m x q |
make region blockquote or insert blockquote |
SPC m x Q |
blockquote region |
SPC m x p |
make region or insert pre |
SPC m x P |
pre region |
Element removal
Key Binding | Description |
---|---|
SPC m k |
kill thing at point |
Completion
Key Binding | Description |
---|---|
SPC m ] |
complete |
Following and Jumping
Key Binding | Description |
---|---|
SPC m o |
follow thing at point |
SPC m j |
jump |
Indentation
Key Binding | Description |
---|---|
SPC m \> |
indent region |
SPC m \< |
exdent region |
Header navigation
Key Binding | Description |
---|---|
gj |
outline forward same level |
gk |
outline backward same level |
gh |
outline up one level |
gl |
outline next visible heading |
Buffer-wide commands
Key Binding | Description |
---|---|
SPC m c ] |
complete buffer |
SPC m c m |
other window |
SPC m c p |
preview |
SPC m c P |
live preview using engine defined with layer variable markdown-live-preview-engine |
SPC m c e |
export |
SPC m c v |
export and preview |
SPC m c o |
open |
SPC m c w |
kill ring save |
SPC m c c |
check refs |
SPC m c n |
cleanup list numbers |
SPC m c r |
render buffer |
List editing
Key Binding | Description |
---|---|
SPC m l i |
insert list item |
Movement
Key Binding | Description |
---|---|
SPC m { |
backward paragraph |
SPC m } |
forward paragraph |
SPC m N |
next link |
SPC m P |
previous link |
Promotion, Demotion
Key Binding | Description |
---|---|
M-k |
markdown-move-up |
M-j |
markdown-move-down |
M-h |
markdown-promote |
M-l |
markdown-demote |