zn/README.md

143 lines
3.6 KiB
Markdown

# YANA: zn
* (YANA: *Yet Another Note-taking Application*)
## Introduction
This repo contains zn, a simple note taking shell script. It is conceptually
inspired by zetz, written by Guy Valariola (kutacoder). His github gist page
for zetz is located at;
* https://gist.github.com/guychouk/de2c0e624477efce920904125f0fb7b0 (was previously https://gist.github.com/kutacoder/de2c0e624477efce920904125f0fb7b0)
## Prerequisites
This script requires the following programs;
* bat - https://github.com/sharkdp/bat
* fzf - https://github.com/junegunn/fzf
* rg - https://github.com/BurntSushi/ripgrep
* tmux - https://github.com/tmux/tmux
All of these should also be available via the package management system in
most distributions.
## Setup
### Note Directory
The first step to perform is creation of the note storage directory. This can
be nested or not, depending on your requirements. In my case I nest a number
of note storage directories under $HOME/.notes;
```
$ tree -d .notes
.notes
├── journal
└── notes
```
There is a variable in the script named "NOTEPATH" where you can set up a
default note storage directory.
### Git Setup
The next thing to do is set up git for revision control of your notes. You can
either set up a git repo for each note directory (if running with more than one)
or set up a git repo in the parent directory if using a nested directory setup.
Once you've identified where you'll place your git repo, simply cd into that
directory and run `git init`.
Using git for revision control of your notes can be disabled by commenting out
the line starting with `git add . && ...` in the script.
## Command Line Options
```
Usage: zn [-p <path to note directory>] [-t]
-p Path to desired note directory. Can be relative or absolute.
ie, "-p $HOME/.notes/notes"
-t Use tag search (default is to use title search)
```
## Bash Aliases
I use aliased commands to interact with my notebooks.
```
$ cat bash_aliases_clip
# zn aliases
alias zn="zn -p $HOME/.notes/notes"
alias znt="zn -p $HOME/.notes/notes -t"
alias zj="zn -p $HOME/.notes/journal"
alias zjt="zn -p $HOME/.notes/journal -t"
```
## Note File Format
This script is set up to work with Markdown formatted note files. There are
only two requirements that must be observed for the note files in order for the
zn script to function properly.
The first line of the note file is the title of the note, and should be written
as a level 1 header.
The other requirement is tags. You can have any number of tags in your note
files. Tags should be placed starting on line three, with a blank line
between the tags and the title, and another blank line between the tags and
the body of the note. Each tag should start with a "#" character with no space
between it and the tag itself.
In actuality, tags can be placed anywhere within the note file, and the script
will find them just fine. The above recommendation is for readability.
* Example Note File
```
$ cat 20220125141537.md
# LXD Documentation Links
#LXD
#Links
#Docs
* https://linuxcontainers.org/lxd/
* https://github.com/lxc/lxd
* https://ubuntu.com/server/docs/containers-lxd
* https://snapcraft.io/lxd
```
Note files are created with a date-time formatted filename, in the format
of 'YYYYMMDDHHMMSS.md'.
## Search List Format
Based on the previous example note file, these are examples of the search list
format for both title search, as well as tag search.
### Title Search
```
(20220125): LXD Documentation Links
1/1
>
```
### Tag Search
```
(20220125): #LXD: LXD Documentation Links
(20220125): #Links: LXD Documentation Links
(20220125): #Docs: LXD Documentation Links
3/3
>
```