A simple Zsh plugin that lets you attach notes to shell commands you have run. Handy for remembering what a oneliner was actually doing when you look back at it later.
You run a command like this:
$ ffmpeg -i input.mov -vf scale=1280:-2 output.mp4
Then right after:
$ note "Resize video to 720p width, preserve aspect ratio"
Now that command and your note are saved. You can list everything you've saved with:
$ notes
[1] ffmpeg -i input.mov -vf scale=1280:-2 output.mp4
→ Resize video to 720p width, preserve aspect ratio
That’s it.
Clone into Oh My Zsh's custom plugin directory:
git clone https://github.com/onurhanak/zsh-journal ~/.oh-my-zsh/custom/plugins/zsh-journal
Then add it to your plugins:
plugins=(git zsh-journal)
source ~/.zshrc
Add the plugin to your .zsh_plugins.txt file:
$ echo onurhanak/zsh-journal >> .zsh_plugins.txt
Rebuild and reload:
$ antidote bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.zsh
$ source ~/.zsh_plugins.zsh
Clone the repo somewhere:
$ git clone https://github.com/onurhanak/zsh-journal ~/.zsh-journal
Source it in your .zshrc:
source ~/.zsh-journal/zsh-journal.plugin.zsh
Restart your terminal or run source ~/.zshrc
and you're good to go.
-
$ note "your description"
Saves a note for the last command you ran. -
$ notes
Lists all saved command + note pairs.
If you try to note a command you have already saved before, it will ask if you want to overwrite the previous note.
By default, it saves everything to:
~/.zsh-journal.txt
You can change that by setting an environment variable in your .zshrc
:
export ZSH_JOURNAL_FILE="/path/to/.my_custom_journal_file.txt"
- You need to run
note
immediately after the command you want to save.
Because there is no way I'll remember all the different rsync
, ffmpeg
etc. flags.