Goal: create an insanely simple “did” file accessible by terminal
Time flies by when you’re learning how to code. Its super important to take a second every once in a while to simple write down what you did during the past mental sprint. Writing down what you learned solidifies the knowledge.
Cue the did.txt file
This file is simply an ongoing timestamped list of what you’ve done. There are many other options, “Notes” on Mac, OneNote but since we do not want to lose the flow of coding, we need this in the terminal
Version 1. A simple txt file
Type in command into your terminal and simply type out what you did.
$ vim ~/did.txt
example did.txt file
Version 2. A simple txt file with time stamps
vim on your command line allows options and this includes running “ex commands”. Here we run the r read command and read the date command into the file as a timestamp at the top of the file.
$ vim +'r!date' ~/did.txt
Version 3. A simple txt file with natural time stamps
Its likely more natural for you to type at the bottom of the file so with normal Go we move the cursor to the bottom before reading from the date command.
$ vim +'normal Go' +'r!date' ~/did2.txt
example did.txt file
Final Version. An alias to open did.txt
Final Step: Create your alias and add this to your .bash_profile.
alias did="vim +'normal Go' +'r!date' ~/did.txt"
Congrats!
Now running $ did in your terminal will bring you to your very own did file!
example did.txt file
For more about vim