getreu / tp-note

Minimalistic note taking: save and edit your clipboard content as a note file (Gitlab mirror)
https://blog.getreu.net/projects/tp-note/
Apache License 2.0
116 stars 3 forks source link

default note storage location? #5

Closed rhaynes74 closed 3 years ago

rhaynes74 commented 3 years ago

Hi folks, is there a flag that I can set which changes the location to which notes are saved? ie. I would like to change the default setting which saves the note in the directory where the file that I am annotating is located.

getreu commented 3 years ago

When you are annotating a file with

tp-note ./path/to/myfile.pdf

the note is always stored in the same directory and its filename is by default

./path/to/myfile.pdf--Note.md

To change this behaviour, you can modify the template tmpl_annotate_filename and prepend for example notes-dir/ which will insert some relative path in between /to/ and /myfile.pdf --Note.md. It will then look like

./path/to/notes-dir/myfile.pdf--Note.md
rhaynes74 commented 3 years ago

Hi - thanks for the reply, here is the current portion of the config file (ignore the line numbers).    Could you provide the changes required if I wanted notes to be added to ~/Notes/ for example, and if I want the hyperlink to the file in the note file to still work?

[{{ path | filename }}](<{{ path | filename }}>)  85 {% if stdin ~ clipboard != '' %}{% if stdin ~ clipboard != stdin ~ clipboard | heading %}  86 ---  87 {% endif %}  88 {{ stdin ~ clipboard }}  89 {% endif %}  90 '''  91 tmpl_annotate_filename = '''{{ path | tag }}{{ fm_title | sanit(alpha=true) }}{% if fm_subtitle | default(value='') | sanit != '' %}--{% endif %}{{ fm_s ubtitle | default(value='') | sanit }}{{ extension_default | prepend_dot }}' ''

Sincerely,

Dr. Ronald D. Haynes Professor, Department of Mathematics and Statistics Chair, MSc and Phd Scientific Computing Programs Memorial University of Newfoundland

We acknowledge that the lands on which Memorial University’s campuses are situated are in the traditional territories of diverse Indigenous groups, and we acknowledge with respect the diverse histories and cultures of the Beothuk, Mi’kmaq, Innu, and Inuit of this province. On Jun 25, 2021, 12:45 PM -0230, Jens Getreu @.***>, wrote:

You may also want to change the tmpl_annotate_content template: replace [{{ path | filename }}](<{{ path | filename }}>) with [{{ path | filename }}](<../{{ path | filename }}>) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

getreu commented 3 years ago

if I wanted notes to be added to ~/Notes/ for example,

I took a step back to look at the broader picture:

  1. Relative links between the to be annotated file and the note file guarantee that it is possible to copy/move both without breaking their link.
  2. This is why the to be annotated file and the note file should be as close as possible (in the file system).

What comes the closest to what you want, is a collection of symbolic links from your note files into ~/Notes/. You can create the links automatically with a wrapper script that invokes tp-note.

NOTE="$(tp-note "$@")"
cd "~/Notes/"
ln -s  "$NOTE" .

No need to change anything in the templates.

getreu commented 3 years ago

Tp-Note version 1.13.1 supports storing new notes in a separate directory. Follow the instructions in the manual-page how to configure Tp-Note to do so:

Store new note files by default in a subdirectory

getreu commented 3 years ago

Addendum:

if I wanted notes to be added to ~/Notes/ for example

In addition to the above solution, the optional file manager integration allows to choose the location of the new note through the context menu (right click) in the file manager. The Windows installer package tpnote-latest-x86_64.msi configures this integration automatically. For MacOS, step by step instructions are still pending (volunteers welcome).

getreu commented 2 years ago

Some additional thoughts: Tp-Note is inspired by the Zettelkasten approach: a notes content is always related to a context which is expressed by the directory the note is placed in or by a certain file the note refers to.

I wanted notes to be added to ~/Notes/ for example...

Thus, if the above is a must have requirement, Tp-Note is probably not the right tool for you.