Hacker News new | ask | show | jobs
by lwerdna 3051 days ago
Here's a poor man's version of dnote in my .bashrc. It's the only thing I've used consistently:

  notes() {
  	local fpath=$HOME/notes.md
  	if [ "$1" == "gvim" ]; then
  		gvim + $fpath
  	elif [ "$1" == "vim" ]; then
  		gvim + $fpath
  	elif [ "$1" == "date" ]; then
  		echo '' >> $fpath
  		echo '# '`date +"%m-%d-%Y-%T"` >> $fpath
  		echo '---------------------' >> $fpath
  	elif [ "$1" == "" ]; then
  		less +G $fpath
  	else
  		echo '' >> $fpath
  	    echo $@ >> $fpath
  	fi
  }
Insert the current date with `notes date`. Store a note with `notes the earth is about 25k miles around` or `notes dentist appointment Thursday` or `notes purfunctory - carried out with a minimum of effort or reflection #vocab`. Look up recent notes with `notes` or read/search the entire notes database with `notes vim`.
3 comments

I really appreciate the minimalism of this approach. Going to give this a try, thanks for sharing!
Yeah, this is really useful. I think it'll break on single quotes: `notes we'll need oranges tomorrow`, but otherwise, it's a very low-friction method, to me.
Yeah, had a similar issue with parentheses while using it today (but escaping them with '\' worked just fine).
Can this be used with nano as well?
Yes, if you change all references of "gvim" to "nano".
Why not just use Notes.app?
> Why not just use Notes.app?

Because not everyone uses macOS.

This shell script works on most Unix-like systems unlike Notes.app

Notes will try to insert smart quotes in your code and other silent changes (made to improve text notes but catastrophic for code.)