did.txt file

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

Update: check out this blog post from marmalab super nice extra features.

For more: why vim?

49 comments

  1. This is a neat idea to keep things in perspective, but for bigger plans and undertakings; I can recommend Trello. It lets you practice project management while keeping everything in place.

    1. trello is very fully featured and great for collaborating. My next favorite pure note taking software (after my did.txt file) is workflowy and maybe soon dynalist.io

      1. Hey, thanks for the suggestions. I’ll take a look at them. BTW, you do not have to collaborate to use Trello effectively. You can also track your own projects (or life) with it.

  2. This was real useful!
    Also I have extended the alias so that the cursor will Go to the last line after inserting the timestamp!

    alias did=”vim +’normal Go’ +’r!date’ +’normal Go’ /mnt/c/Users/raziones/Documents/did.txt”

  3. Personally using Emacs (also a WM via EXWM) I use Org-mode (org-capture, deft and org-agenda that read TODOs/DONE &c states in a super-flexible manner) for such notes however the point is the ancient “historia docet” (history teach) or “I do something wrong in the past, I forgot it and re-made the very same mistake. If I write it down perhaps in the future I’ll avoid repeating it” or also “if I note anything in the future perhaps it turn out useful and time/trouble-saving for reconstructing something and it take very little time now”.

  4. #> alias did=”vim +’normal Go’ +’r!date’ ~/did.txt”
    #> did
    Error detected while processing command line:
    E492: Not an editor command: rdate

    alias did=”vim +’normal Go’ +’r\!date’ ~/did.txt”
    #> did
    ok.

  5. great tip thanks! but please don’t allow ads with autoplay video with loud sound, it bothered my whole office open-space

    1. oops sorry! I never thought anyone would read this blog so I never bothered to pay for wordpress premium, but I guess now is the time 🙂

  6. what do you think of this variant: vim +’normal! Go’ +’r!date’ +’normal! Go- ‘ +’:startinsert’ ~/did.txt

    1. Thats pretty great! I would personally add another space after the dash `vim +’normal! Go’ +’r!date’ +’normal! Go- ‘ +’:startinsert’ ~/did.txt`

  7. til about this ‘normal Go’ thing. I’m all for activities that aim to organize or remember stuff so, bravo sir. I use some similar tooling, care to share any nice to have features you’ve considered adding? My next feature atm is tag addition (manual or auto) and then a graph visualization that allows for topically organized viewing and not just temporally organized viewing.

    1. This is totally minimal and good enough for me, but many people have recommended http://jrnl.sh/ and from the looks of it, its pretty well featured – if not to use, then to get ideas 🙂 My to-go for mind mapping type notes is currently workflowy (checking out dynalist.io)

  8. $ alias did=”vim +’normal Go’ +’r!date’ ~/did.txt”

    bash: !date’: event not found

    1. This is due to history expansion. You can turn this off with “set +h” or you can get around it in this instance (like i did) with `alias did=”vim +’normal Go’ +’r “‘!'”date’ ~/did.txt”`.

  9. I like the simplicity of this, but you could forgo vim by using echo and >> to append to the end of a file, just replace your alias with a little shell script, then you can “did insert your did text here” right from the CLI.

    1. Here it is as a one liner: echo “$(date)\n – show how to make did into a one-liner.” >> did.txt
      And if you put this in a script you could just do did “text to append” and it would do its thing. : echo “$(date)\n – $1” >> did.txt

    2. Yeah, for some reason I find the back scroll on my terminal distracting but it might be nice to have this option. My ideal would be to drop into an empty vim session and on save, have that appended to the text file.

  10. I’ve found that there’s very little need to be as heavyweight as this (load vim, have to save and exit it). Going into the editor fully should be a non-default choice. The simple script below is what I came up with about 8 years ago.

    1. It just appends what your arguments to an auto-dated (1 per day) file in a certain directory.
    2. If you pass it the lone argument “edit” you get thrown into today’s file (using whatever the standard environment variable $EDITOR is set to, vim or otherwise)
    3. If you pass no arguments, your current day’s file is displayed
    4. I have this script stored as as ~/bin/s
    5. “Did”-style usage: s meeting with XYZ product team

    #!/bin/sh

    DATE=$(date +%Y%m%d)
    STATUSFILE=”$HOME/Status/$DATE”
    if [ “$1″x = “x” ]; then
    cat “$STATUSFILE”
    elif [ “$1″x = “editx” ]; then
    “$EDITOR” “$STATUSFILE”
    else
    echo “$@” >> “$STATUSFILE”
    fi

    1. That’s pretty cool. I zero bash knowledge, so `[ “$1″x = “editx” ];` is lost on me but once I do, I’ll add these command line checks.

      1. Alfredworkflow files are renamed zip files that contain the underlying png and plist (=xml) files. They are also of very little use if you’re not using Alfred (alfredapp.com) already 😉

        If you’re just after the command:
        echo “$(date ‘+%Y-%m-%d %H:%M:%S’) – $query” >> ${filelocation}

  11. Pretty nice, you’d really like vimwiki which has a daily diary feature. I have gone from using it and not using it many times, but nothing is as easy as vimwiki as its right there in your editor

    1. These are pretty nice improvements! I’ve been sharing my blog post to friends who are interested in my workflow but I think I’ll just start sharing yours.

Comments are closed.