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?
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.
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
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.
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”
You can also type “o” to start insert mode on the next line.
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”.
I only hear good things about Emacs, and I rarely hear someone going from Emacs back to VIM (except maybe Spacemacs)
#> 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.
I also take notes but more as a pointer technical issues I solved, for later blogging or searching when doing next project. So I developed cnote https://github.com/angsuman/cnote which is similar but allows searching. Would love your thoughts on it.
*obligatory comments mention of emacs org-mode*
Nice little trick. Going to try it!
Nice! You might consider using Vimwiki diaries (http://vimwiki.github.io/). This comes in very handy for quick, unstructured notes. Assuming the default install, you just need to use ww to drop into the diary page for the day and hack away!
hmm, i think i could really like this.
great tip thanks! but please don’t allow ads with autoplay video with loud sound, it bothered my whole office open-space
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 🙂
This is awesome. I’ve been wanting to keep a similar journal.
What if I wanted to format the date in iso8601?
alias did=”vim +’normal Go’ +’r!date \”+\%Y-\%m-\%d \%H:\%M:\%S\”‘ ~/did.txt”
You inspired me to make something similar: https://gist.github.com/mrpoptart/bca664a99534a001fc78d65bc1330b51
I’ve had many suggestions of building bash scripts, so this is inspiring me to learn how to harness bash.
what do you think of this variant: vim +’normal! Go’ +’r!date’ +’normal! Go- ‘ +’:startinsert’ ~/did.txt
Thats pretty great! I would personally add another space after the dash `vim +’normal! Go’ +’r!date’ +’normal! Go- ‘ +’:startinsert’ ~/did.txt`
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.
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)
$ alias did=”vim +’normal Go’ +’r!date’ ~/did.txt”
bash: !date’: event not found
If you can type `which date` and have a date returned in your command line, you should have that command.
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”`.
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.
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
I like this, for some reason “\n” the text actually prints to the file instead of a new line. I
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.
Or use jrnl for that…
This is a really good idea, thanks for sharing!
I love little snippets like this, thanks for sharing
A somewhat similar approach to yours is jrnl: http://jrnl.sh
Just wanted to add that I wrote a little script inspired by your did-file. Thanks for the idea!
https://github.com/schrer/did-journal
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
Also at https://gist.github.com/jblaine/5ea96a64f705f8192005d919aacbf460 in a much more readable format.
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.
Great idea. I recreated the same thing as an Alfred Workflow: https://github.com/geberl/alfred-did-txt
Awesome, I can’t seem to see Did.txt.alfredworkflow. Is that compiled or txt?
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}
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
This is a great idea! I’ve been using it for a while, and have changed some things to better fit my workflow (http://www.automaticowl.net/posts/did-txt-complications/), like saving keystrokes and easily seeing what I did yesterday.
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.
Awesome, glad you like it 🙂
Beware name collision: https://github.com/psss/did
…which allows collecting status reports from various ticket systems you might be using at work (bugzilla, Jira, github, …)
Oh interesting! That sounds like a neat tool for engineer management