Updating/expanding template explanation

Smoothing out formatting issues
This commit is contained in:
heymajor 2020-02-01 16:12:30 -05:00
parent 9b80d478c2
commit 7a1ee99863

View file

@ -70,17 +70,59 @@ jrnlimport () {
### Using templates ### Using templates
Say you always want to use the same template for creating new entries. !!! note
If you have an [external editor](../advanced) set up, you can use this: Templates require an [external editor](../advanced) be configured.
A template is a code snippet that makes it easier to enter use repeated text
each time a new journal entry is started. There are two ways you can utilize
templates in your entries.
#### 1. Command line arguments
If you had a `template.txt` file with the following contents:
```sh ```sh
jrnl < my_template.txt My Personal Journal
jrnl -1 --edit Title:
Body:
``` ```
Another nice solution that allows you to define individual prompts comes The `template.txt` file could be used to create a new entry with these
from [Jacobo de command line arguements:
Vera](https://github.com/maebert/jrnl/issues/194#issuecomment-47402869):
```sh
jrnl < template.txt # Imports template.txt as the most recent entry
jrnl -1 --edit # Opens the most recent entry in the editor
```
#### 2. Include the template file in `jrnl.yaml`
A more efficient way to work with a template file is to declare the file
in your config file by changing the `template` setting from `false` to the
template file's path in double quotes:
```sh
...
template: "/path/to/template.txt"
...
```
Changes can be saved as you continue writing the journal entry and will be
logged as a new entry in the journal you specified in the original argument.
!!! tip
To read your journal entry or to verify the entry saved, you can use this
command: `jrnl -n 1` (Check out [Import and Export](../export/#export-to-files) for more export options).
```sh
jrnl -n 1
```
### Prompts on shell reload
If you'd like to be prompted each time you refresh your shell, you can include
this in your `.bash_profile`:
```sh ```sh
function log_question() function log_question()
@ -93,6 +135,11 @@ log_question 'What did I achieve today?'
log_question 'What did I make progress with?' log_question 'What did I make progress with?'
``` ```
Whenever your shell is reloaded, you will be prompted to answer each of the
questions in the example above. Each answer will be logged as a separate
journal entry at the `default_hour` and `default_minute` listed in your
`jrnl.yaml` [config file](../advanced/#configuration-file).
### Display random entry ### Display random entry
You can use this to select one title at random and then display the whole You can use this to select one title at random and then display the whole
@ -107,10 +154,11 @@ jrnl -on "$(jrnl --short | shuf -n 1 | cut -d' ' -f1,2)"
## External editors ## External editors
To use external editors for writing and editing journal entries, set Configure your preferred external editor by updating the `editor` option
them up in your `jrnl.yaml` (see `advanced usage <advanced>` for in your `jrnl.yaml` file. (See [advanced usage](../advanced) for details).
details). Generally, after writing an entry, you will have to save and
close the file to save the changes to jrnl. !!! note
To save and log any entry edits, save and close the file.
### Sublime Text ### Sublime Text