zshell folder reminder

λ September 23, 2019
Tags: zsh, shell

Today I wished for the means to leave myself reminders in folders so that as I navigate around, as I landed in each folder, that somehow I could have a “message of the day” type feature.

I use zshell, and today I learned about the “chpwd” hook.

Here is my code that lives in my ~/.zshrc file:

function chpwd() {
    if [ -f ncd.md ]; then
        cat ncd.md
    fi
}

What does it do ?

After changing into the new folder it looks to see if there is a file called “ncd.txt” and if so, dumps it to standard out. You can call the file whataver you like so long as you change the above code.

That’s it. Simple. Never forget what you had to do next!

Comments