Add lua remap in emails-md

This commit is contained in:
Fabrice Mouhartem 2023-10-14 19:07:34 +02:00
parent 03987fea67
commit 41b4bba16b
2 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,7 @@
---
Title: Écrire son courriel en markdown avec vim
Date: 2019-04-22 19:00
Modified: 2019-04-24 09:35
Modified: 2023-10-14 19:00
Author: Fabrice
Category: astuces
Tags: emails, pandoc, Vim
@ -24,7 +24,11 @@ pandoc -t html5 -s <fichier> | xclip -selection clipboard
Ainsi, en ajoutant ce raccourci dans votre fichier de configuration pour les markdown dans vim (pour ma part il est dans `ftplugin/pandoc.vim`):
```vim
map <raccourcis> :w !pandoc -t html5 -s \| xclip -selection clipboard<cr>
map <raccourci> :w !pandoc -t html5 -s \| xclip -selection clipboard<cr>
```
ou en version plus moderne (lua + wayland):
```lua
vim.keymap.set('n', <raccourci>, ':w !pandoc -t html5 -s | wl-copy<CR><CR>', { noremap = true, silent = true })
```
on peut alors directement coller le contenu du *buffer* courant formatée par [pandoc](https://pandoc.org/) dans thunderbird.
Bien entendu, vous pouvez décorer cette commande à laide de vos options favorites.

View File

@ -1,7 +1,7 @@
---
Title: Write your emails in markdown with vim
Date: 2019-04-22 19:00
Modified: 2019-04-24 09:35
Modified: 2023-10-14 19:00
Author: Fabrice
Category: tips
Tags: emails, pandoc, Vim
@ -26,6 +26,10 @@ Therefore, adding:
```vim
map <your map> :w !pandoc -t html5 -s \| xclip -selection clipboard<cr>
```
or a more modern version using `lua` and `wayland`:
```lua
vim.keymap.set('n', <your map>, ':w !pandoc -t html5 -s | wl-copy<CR><CR>', { noremap = true, silent = true })
```
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.
You can even use some simple [css rules](https://perfectmotherfuckingwebsite.com/) in a separated style sheet along with the `--self-contained` option of pandoc to be able to do basic general formating (for a newsletter for instance).