Transparent age encryption for markdown files in Vim/Neovim.
- Automatic decryption when opening markdown files
- Automatic encryption when saving
- Preserves all YAML frontmatter (not just age fields)
- ASCII-armored output for git-friendliness
- Supports age public keys, SSH keys, and recipient files
Using vim-plug:
Plug 'dannyob/md-age-vim'Using lazy.nvim:
{ 'dannyob/md-age-vim' }Using packer.nvim:
use 'dannyob/md-age-vim'Using native vim packages:
git clone https://github.com/dannyob/md-age-vim ~/.vim/pack/plugins/start/md-age-vimUsing native neovim packages:
git clone https://github.com/dannyob/md-age-vim ~/.local/share/nvim/site/pack/plugins/start/md-age-vimRequired - set your identity:
let g:md_age_identity = '-i ~/.age/identity.txt'Optional - use a different age command:
let g:md_age_command = 'rage'Optional - set default recipients for :MdAgeInit:
" Single recipient
let g:md_age_default_recipients = 'age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p'
" Multiple recipients
let g:md_age_default_recipients = [
\ 'age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p',
\ '~/.age/backup.pub'
\ ]Add frontmatter to your markdown file:
---
title: My Secret Notes
age-encrypt: yes
age-recipients:
- age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p
---Or use :MdAgeInit to insert a template.
The file will be automatically decrypted when opened and encrypted when saved.
:MdAgeInit- Insert frontmatter template:MdAgeStatus- Show encryption status
A standalone md-age script is included in bin/ for shell usage:
# Encrypt using recipients from frontmatter
md-age -e notes.md > notes.md.enc
# Encrypt with explicit recipient (creates frontmatter)
md-age -e -r age1... plaintext.md > encrypted.md
# Decrypt
md-age -d -i ~/.age/key.txt encrypted.md > decrypted.md
# See all options
md-age -hTransparent encryption in git repositories using smudge/clean filters.
- Initialize filters in your repository (also creates
.gitattributes):
md-age git init- Add your identity (for decryption):
md-age git config add -i ~/.age/key.txt- Commit
.gitattributesso other clones use the filter.
- On commit: The clean filter encrypts md-age files before storing in git
- On checkout: The smudge filter decrypts files in your working copy
- Non-md-age files: Pass through unchanged (safe for regular markdown)
Files with age-encrypt: yes in frontmatter are encrypted; others are untouched.
md-age git init # Set up filters in current repo
md-age git config add -i <path> # Add identity for decryption
md-age git config list # Show configured identities
md-age git config remove -i <path> # Remove identityAfter cloning a repo with md-age files:
cd repo
md-age git config add -i ~/.age/key.txt
git checkout . # Re-checkout to trigger decryptionAGPL-3.0-or-later