A simple script to print the last 10 commands you ran in this directory
What was I doing the last time I was here?
We’re linking to the repo, but the idea is where it’s at. The code is a one-liner (if you’re using zsh
)
grep -v "jog" ~/.zsh_history_ext | grep -a --color=never "${PWD} " | cut -f1 -d"|" | tail
Then you add this to your .zshrc
function zshaddhistory() {
echo "${1%%$'\n'}|${PWD} " >> ~/.zsh_history_ext
}
Now you’re all set for the next time you need to jog
your memory!