DEV Community

loading...
Cover image for ✍ Keeping Notes My Plain Text Journey Part V

✍ Keeping Notes My Plain Text Journey Part V

Ryan Collins
Just a geek developing through life.
Originally published at gozgeek.com on ・4 min read

This is an ongoing series:


My notes are not fancy

This article can be condensed to “all of my notes are in my Notes folder”. Well, that isn’t quite correct, I do keep a Projects folder for notes that have a project in common.

All of my notes are in Markdown format. Plain Jane, vanilla markdown. It does everything that I need, and nothing more. I also don’t have pictures or drawings in my notes. You could add them, but since git doesn’t really like binary files and I store my notes in git, I try to limit the amount of binary files I’ve added.

My notes/Notes folder

If you’ve been following along with my plain text journey, you know that I keep everything in a folder unsurprisingly named notes. So, to make things confusing, I put my plain text notes into a Notes folder. Note the capital N. This folder contains files for each note that I take. Every 6 months to a year, I go in and archive notes that aren’t relevant anymore.

Each note is a separate file in Notes for the most part. I do have some notes such as ideas.md in which I list different ideas. There is also a tips.md file where I keep track of all sorts of cli/app/program tips. This file is a life saver, before I would have to Google each time I needed to do something I couldn’t remember.

Creating a note

I use the following script named nn to create a note:

#!/bin/bash

## New Drafts
## Modified from GozNote
## Quickly create notes from the commandline or something like Alfred

if [$# -eq 0]; then
    echo "NewNote v.02"
    echo "Enter the name of the note as the argument"
    exit
fi

TITLE="$@"
AUTHOR="`whoami`"
DATE=`date +"%Y-%m-%d %H:%M"`

# Parameters for Vim to jump to the bottom of the file 
# and start in Insert mode
EDITOR="vim + +startinsert"
DEFAULTFOLDER="."
EXT="md"

# I originally prepended the date, but now I don't.
#PREPEND="`date +%Y-%m-%d`-"
PREPEND=""
SLUG=$(echo -n "${TITLE}" | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)

#If the title begins with a 2, assume that it's a date 
#and set the title to everything after the first 11 characters.
if [["${TITLE:0:1}" == "2"]]; then TITLE=${TITLE:11}; fi

if [[! -f ${DEFAULTFOLDER}/${PREPEND}${SLUG}.${EXT}]]; then
    echo -e "---\nTitle: ${TITLE}\nAuthor: ${AUTHOR}\nDate: ${DATE}\nSlug: ${SLUG}\nCategory: \nTags:\nStatus: draft\n---\n\n" > "${DEFAULTFOLDER}/${PREPEND}${SLUG}.${EXT}"
fi

${EDITOR} "${DEFAULTFOLDER}/${PREPEND}${SLUG}.${EXT}"

Enter fullscreen mode Exit fullscreen mode

Originally, I was setting the default folder in the script so I could create a note at the command line from anywhere, but I’ve switched it to making the note in the current folder. I run the script with the name of the note as the parameters: nn Indepth review of the Atari Computer. The script creates a slug for a file name based on the name of the note and adds some frontmatter to the note. After running that command I could get a note named indepth-review-of-the-atari-computer.md that looks like this:

--------
Title: Indepth review of the Atari Computer
Author: goz
date: 2021-06-11T08:21:00-04:00
Slug: indepth-review-of-the-atari-computer
Category:
Tags:
--------

Enter fullscreen mode Exit fullscreen mode

Mobile

On my iPhone I created a Shortcut that mimics my new note script. Once the note is created, I can open and edit it in iA Writer. Under Android, I do everything under Termux, so it works the same as if I was on my Linux box.

Finding and linking notes

I don’t bother with linking between notes or dealing with searches. The default OS searches work well, or a simple grep can be used to find a particular note.

Managing and archiving Notes folder

Every so often I go through my Notes folder and move things to an Archive. In notes/Archive I have a folder for each year, and I’ll move notes I no longer need into the archive folder of the year the note was created. There may be hundreds of notes, but I don’t really care. I can grep or search for old notes that I may need.

Works on my system

This works well for me. I can create or access my notes from any platform. What do you think?

Discussion (0)