A collection of bash scripts for managing encrypted notes using GPG and Neovim.
A simple way to create and search encrypted notes through your terminal.
- gpg - GNU Privacy Guard for encryption/decryption
- neovim (nvim) - Text editor with GPG plugin support
- vim-gnupg plugin - Neovim plugin for transparent GPG encryption/decryption
- fzf - Required only for interactive file selection in
search-notes - trash - Used by
new-noteto safely delete empty notes (falls back tormif not available)
-
Install dependencies:
# On Arch Linux sudo pacman -S gnupg neovim fzf trash-cli # On Ubuntu/Debian sudo apt install gnupg neovim fzf trash-cli # On macOS with Homebrew brew install gnupg neovim fzf trash
-
Install vim-gnupg plugin for Neovim. With vim-plug:
Plug 'jamessan/vim-gnupg' -
Make scripts executable:
chmod +x new-note search-notes
-
Add scripts to your PATH
Configuration is managed through the safenotes-config file. You can customize:
NOTES_DIR- Directory where notes are stored (default:$HOME/Private/notes)GPG_RECIPIENT- Email address for GPG encryption
FILE_EXTENSION- File extension before.gpg(txtormd)TIMESTAMP_FORMAT- Date/time format for filenames
Example configuration:
export NOTES_DIR="$HOME/Documents/encrypted-notes"
export GPG_RECIPIENT="your-email@example.com"Creates and opens a new encrypted note with Neovim.
# Create note with timestamp only
new-note
# Create note with custom name prefix
new-note "meeting"Filename format: {optional-name}-{timestamp}.{extension}.gpg
Examples:
2024-01-15-143052.txt.gpgmeeting-2024-01-15-143052.txt.gpg
Searches through all encrypted notes for a given string (case-insensitive).
# Interactive mode - search and select file to edit
search-notes "project deadline"
# Files-only mode - just list matching filenames
search-notes -f "project deadline"
search-notes --files-only "project deadline"Interactive mode: Uses fzf to display matching files with preview, allows selection for editing.
Files-only mode: Simply prints the filenames that contain matches.
new-note- Script to create new encrypted notessearch-notes- Script to search through encrypted notessafenotes-config- Shared configuration fileREADME.md- This documentation
- Notes are encrypted with GPG using the configured recipient
- The vim-gnupg plugin handles transparent encryption/decryption in Neovim
- Empty notes are automatically deleted after editing