Usage


Adding notes

The first thing you should do is to save a note. This may be done interactively with e.g.

nota -a

which will launch an editor (as defined in your EDITOR shell variable) that invites you to fill in some content. The file contains comments that explain where you should enter a title, keywords, and content; you can also enter a due date, if you like. If you prefer to add the note entirely from the commandline, use e.g.

nota -a -t="First note" -c="Say something wise." -k="test,silly"

Here, -t indicates a title, -c some content, and -k a comma-separated list of keywords.

With either entry method, nota will tell you the name of the database it created for you. This file will be used in future calls, unless you tell nota to use another file with the --database argument (or in the configuration file ~/.notarc).

If we add a second note

nota -a -t="Second note" -c="Something wiser." -k="test,wiser"

we have enough to move on to listing and editing notes.

Listing notes

Typing

nota

displays the notes we just added. It will look similar to

d: First note [test, silly]
6: Second note [test, wiser]
The trash contains 0 notes.
Hint: add a note: 'nota -a' (opens EDITOR)

At the start of the display is an abbreviation for a 64-character ``hash'' code that identifies each note. This hash will be different for notes you provide. At this stage, your display will be show either 1 or 2 characters in the hash, since nota presents hash abbreviations when listing multiple notes. These abbreviations may be used to look at individual notes, e.g.

nota d

displays something like

d93e188: First note [test, silly]
  created 2015-03-01 13:35:34 
  Say something wise.

The trash is empty.
Hint: list note with hash 'ab...': 'nota ab'

Notice in all these displays that a hint is given at the end; these are randomly chosen, and so yours will not likely be the same as shown here. These hints are a reasonably good way to learn how to use nota, or to be reminded on the syntax, but you can always use

nota -h

to get more help.

Notes can be listed by keyword, e.g.

nota -k test

displays both notes (in summary format), while

nota -k silly

details just the first note. It is important to think about the keywords you use, since they may end up being important to you, as you sift through hundreds of notes you've taken.

The keyword-search method involves two steps. First, a search is done for notes that have keywords whose initial letters exactly match the given string. If none is found, then the second step is to do a ``fuzzy'' string comparision with the ``difflib.get_close_matches`` function. This second step can yield surprising results, owing

Editing notes

Of course, your notes won't be perfect, and you may want to edit them to fix errors or add new material. This is done with e.g.

nota -e d

to revise the first note. If the hash code corresponds to just one note, this will open up a text editor, in which you will be able to change the note title, contents, keywords, etc. There is also a DUE item that you can set, for notes that are plans.

Deleting notes

A note may be deleted by e.g.

nota -d d

and, again, this works only if the hash identifies only one note. If so, the note is moved to the trash, where it may be seen with

nota --trash

and possibly undeleted with

nota --undelete d

The trash may be emptied with

nota --emptytrash

although this is not to be done lightly, because this is a permanent operation.

Organizing notes into books

When a database is created, it has two books: one named Default and another named Trash. Adding a note puts it into the first of these, and deleting it puts it into the second. The Trash book cannot be renamed, but the Default one can, with e.g.

nota --rename-book Default Poems

if you're storing poems there. A new book can be created with e.g.

nota --create-book Recipes

Once there are two non-trash notebooks, nota will start displaying the book names in listings. You can restrict a listing to a particular book with the -b argument, e.g. poems about ham might be recovered with

nota -b Poems -k ham

Books can be specified when notes are added, either with the -b argument or in the text editor. The book in which a note resides can be changed easily, too. If a note with abbreviated hash abc was put into the Recipe book by mistake instead of in the Poem book, the mistake can be rectified with

nota --change-book Recipes Poems abc

Sharing notes

Notes may be shared by a combination of --export and --import operations. To share a note with hash ab, use

nota --export ab > ab.json

and email or otherwise provide the new (textual) file named ab.json to another person, who may then execute

nota --import ab.json

to insert the note into his/her database. A similar procedure permits a single user to copy notes between databases. Using - for the note hash means to use all notes (except those in the trash). In any case, the newly-created note will have new hashes.

It should be noted that exported notes lose some information, e.g. the book in which they reside, because such things are likely to be different in a recipient database.

Customizing nota

nota may be customized with commandline arguments, and also with entries in a resource file named ~/.notarc, which can contain various customization features. For example, including the following in that file changes the default color theme

color = "forest"

and writing

database = ~/nota.db

indicates to use a database in the top directory, instead of the Dropbox one. Users who want to see just their notes, without the information on the trash and the hint that nota normally prints at the end, can put

verbose = 0

in their ~/.notarc file.

Running nota

Many users will find it convenient to alias nota to a shorter name, e.g. the author uses

alias n='nota'

so he can type just n to use the program. This sort of scheme can help in working with separate databases, too, e.g.

alias nw='nota --database=~/Dropbox/nota-work.db'
alias np='nota --database=~/Dropbox/nota-personal.db'

means that nw uses a work-oriented database, while np uses a personal one.

Task count in bash prompt

To get a list of notes that are due today, put the following in your ~/.bash_profile file:

function nota_count {
    nota --due today --count
}
PS1="\h:\W"
export PS1="$PS1<\$(nota_count)> "

Learning more

Use

nota -h

to get more help on nota. The hints given in nota output can also be quite helpful.

This website is written in Jekyll, and the source is available on GitHub.