---
Title: Write your emails in markdown with vim
Date: 2019-04-22 19:00
Author: Fabrice
Category: tips
Slug: vim-md-emails
Header_Cover: images/cover_amsterdam.jpg
---

If you are like me and you don't like to spend time using <abbr title="What You See Is What You Get">WYSIWYG</abbr> tools to format your texts, you may be interested in this.

However, I'm using [thunderbird](https://www.thunderbird.net/) to handle my emails.
As you may have noticed, you can copy paste from some web page and paste it in thunderbird (which can cause invisible break in the styling).
Exploiting this, one can directly export html into the clipboard to past it in thunderbird.

The command is as simple as:
```sh
pandoc -t html5 -s <file> | xclip -selection clipboard
```

Therefore, adding:
```vim
map <your map> :w !pandoc -t html5 -s \| xclip -selection clipboard<cr>
```
in your vim `ftplugin/pandoc.vim` configuration file allows you to copy directly the output of [pandoc](https://pandoc.org/) on you opened buffer into your clipboard and thus past it directly into thunderbird.
Of course, you can customize this command line as you want. For instance my base-header-level is 4, as I think that first-level titles are a bit too much for emails.

**Note:** I'm using the [vim-pandoc](https://github.com/vim-pandoc/vim-pandoc) and the [vim-pandoc-syntax](https://github.com/vim-pandoc/vim-pandoc-syntax) plugins for vim.

Here follows a direct usecase of this: a GDPR death letter inspired from [aeris'](https://gist.github.com/aeris/675ffd5755f7570469448bb8b890f759) one.
```md
Dear Sir or Madam,

My personal data, such as my e-mail address, are protected under the
GDPR law since May 2016:\
<https://www.privacy-regulation.eu/en/>

As per article 3, all GDPR applies to you as I am an EU citizen, even
if you are outside EU:\
<https://www.privacy-regulation.eu/en/3.htm>

As per article 15, I request you to provide me all personal data you
have about myself, the purpose of the processing, why and **how** you
collect them, if you share my data with others people or countries,
and all other informations that are mentioned in the following:\
<https://www.privacy-regulation.eu/en/15.htm>

As per article 7, I request you to **prove** my **explicit** and
**positive** consent fr my personnal data to be collected and
processed:\
<https://www.privacy-regulation.eu/en/7.htm>

As per article 17, I also request all my personal data to be erased
from your databases (including backups), with a proof of erasure,
**but only once you provided me with all the aforementioned
information**:\
<https://www.privacy-regulation.eu/en/17.htm>

As per article 12, these requests have to be fulfilled within **a
month** from Today (April 4th 2019). Should this not be the case,
I will open a case with EU regulator:\
<https://www.privacy-regulation.eu/en/12.htm>

As per article 19, I have the same request to **all your partners** to
whom my personal data have been transfered to. These have to be
accompanied by an attestation of erasure from these partners as
well:\
<https://www.privacy-regulation.eu/en/19.htm>

This e-mail is signed under the GPG key
[`0x2C5033B228CFE4E7`](https://fmouhart.epheme.re/documents/pubkey.asc)
that also appears in the above website, which suffices to prove my
identity as the rightful owner of these personal data.

If you require further information to fulfill my requests, feel free
to contact me on this e-mail address.

Sincerely yours,  
```
