DEV Community

loading...
Cover image for πŸ“ƒ My journey into the plain text life - Intro

πŸ“ƒ My journey into the plain text life - Intro

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

Cover photo by Bram Naus on Unsplash

This is an ongoing series:


I’ve been using plain text for my notes since 2014, and for a journal since 2017. In that time I’ve experimented with the different ways I could use plain text to not only automate my life, but to also help me stay productive. And by productive I mean working on my productivity system instead of doing actual tasks. Be warned, once you start tweaking it’s really easy to procrastinate by β€œworking on your system”.

Please keep in mind, much like Frodo, this was my journey. And much like The Lord of the Rings Trilogy, it took me years to get to this spot. Your adventure with plain text will be different. Play around, try different things. As long as you got backups, what do you have to worry about?

Why plain text?

Plain text is simply a text file. Nothing more, nothing less. It’s about as sexy as going clothes shopping with your mother. You can edit a plain text file on just about any device you have. I have written some of my notes using my Atari 800 as the ultimate no-distraction writing device. Text files have been with us since the dawn of time, and will outlive any other format.

I keep my notes and a journal using Markdown for formatting. My tasks or to dos are also in plain text files using the Taskpaper format. I’m currently investigating the todo.txt format because I like the idea of having all the information for a task in the same line.

By using Markdown I can export my notes in a wide variety of formats, such as html or pdf. Just because I can doesn’t mean I do. It’s rare that I would need a paper copy.

Getting started

You know how you get started? You create a folder on your desktop called notes and start saving your notes into the folder. No fuss, no muss. To create or edit your notes, you can use any editor that can save as plain text. VS Code has many fans, along with Sublime Text, but I recommend the best editor ever, Vim.

Once you get more than a handful of notes you’re going to want to have some sort of organizational structure. Or not, I’m sure someone out there worships chaos theory when it comes to file organizing.

Here is how I have it set up:

.
β”œβ”€β”€ Archive -> I create a folder for each year
β”‚ β”œβ”€β”€ 2014 When I no longer need a note
β”‚ β”œβ”€β”€ 2015 or file, I put it in the
β”‚ β”œβ”€β”€ 2016 archive for that year
β”‚ β”œβ”€β”€ 2017
β”‚ β”œβ”€β”€ 2018
β”‚ β”œβ”€β”€ 2019
β”‚ β”œβ”€β”€ 2020
β”‚ └── 2021
β”œβ”€β”€ BlogPosts -> My drafts of BlogPosts
β”œβ”€β”€ Book Ideas -> Working on book ideas. 
β”œβ”€β”€ Books -> Reviews of books of read and notes
β”œβ”€β”€ Journal -> Each year gets a journal - 2021.md
β”œβ”€β”€ Lists -> My to do lists in .taskpaper format
β”œβ”€β”€ Notes -> All of the notes I write.
β”œβ”€β”€ Projects -> When I need to organize notes by project
β”œβ”€β”€ Research -> Folders of data that I am using for research

Enter fullscreen mode Exit fullscreen mode

How I create and name my files

I originally started out naming my files with YYMMDD-.markdown, but after reading a blogpost by Tyler Hall, I switched the naming to YYYY-MM-DD-.md. It does look better. I also add some YAML front matter to each note:

--------
Title: My Great Post
Author: gozar
date: 2021-04-23T12:14:00-04:00
Slug: my-great-post
Category: 
Tags:
...

Enter fullscreen mode Exit fullscreen mode

To automate this, I have the following script:

#!/bin/bash

## New Drafts

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"`
EDITOR="vim + +startinsert"
DEFAULTFOLDER="."
EXT="md"
#PREPEND="`date +%Y-%m-%d`-"
PREPEND=""
SLUG=$(echo -n "${TITLE}" | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)
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

Under Windows I run this in Windows Subsystem for Linux, and under macOS or Linux, you can use it in a terminal window.

I named it nn, and to create a new note I navigate to the destination folder and enter the following when I want to add the date to the front:

nn 2021-04-23 This is my note

Enter fullscreen mode Exit fullscreen mode

But sometimes I don’t want the date, so I’ll just use:

nn This is my note

Enter fullscreen mode Exit fullscreen mode

If the note doesn’t exists, it creates a note, otherwise, the note is opened in my preferred editor. The script creates a slug for the note and also names the note with the slug. My two examples above would result in the files 2021-04-23-this-is-my-note.md and this-is-my-note.md being created.

Stay tuned

Part II is now online
This is just the beginning of my plain text journey, more is to come!! I still need to share the tools I use, such as Git for syncing and espanso for text expansion. There are a few more scripts I use too because I force Bash into everything.

Discussion (0)