mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
- Add Japanese translations for documentation - Implement I18N framework - Update mkdocs.yml for multi-language support This commit significantly enhances the project's internationalization.
392 lines
20 KiB
HTML
392 lines
20 KiB
HTML
<!--
|
|
Copyright © 2012-2023 jrnl contributors
|
|
License: https://www.gnu.org/licenses/gpl-3.0.html
|
|
-->
|
|
|
|
<!DOCTYPE html>
|
|
<html class="writer-html5" lang="en" >
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="author" content="jrnl contributors" /><link rel="canonical" href="https://jrnl.sh/tips-and-tricks/" />
|
|
<link rel="shortcut icon" href="../img/favicon.ico" />
|
|
<title>Tips and Tricks - jrnl</title>
|
|
<link rel="stylesheet" href="../css/theme.css" />
|
|
<link rel="stylesheet" href="../css/theme_extra.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" />
|
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,600" rel="stylesheet" />
|
|
<link href="../assets/colors.css" rel="stylesheet" />
|
|
<link href="../assets/theme.css" rel="stylesheet" />
|
|
<link href="../assets/highlight.css" rel="stylesheet" />
|
|
|
|
<script>
|
|
// Current page data
|
|
var mkdocs_page_name = "Tips and Tricks";
|
|
var mkdocs_page_input_path = "tips-and-tricks.md";
|
|
var mkdocs_page_url = "/tips-and-tricks/";
|
|
</script>
|
|
|
|
<!--[if lt IE 9]>
|
|
<script src="../js/html5shiv.min.js"></script>
|
|
<![endif]-->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
|
|
<script>hljs.highlightAll();</script>
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav" role="document">
|
|
|
|
<div class="wy-grid-for-nav">
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search">
|
|
<a href=".." class="icon icon-home"> jrnl
|
|
</a>
|
|
|
|
<div role="search">
|
|
<form id ="rtd-search-form" class="wy-form mkdocs-search" action="../search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
|
|
<button class="icon icon-search" aria-label="submit"></button>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../overview/">Overview</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">User Guide</span></p>
|
|
<ul class="current">
|
|
<li class="toctree-l1"><a class="reference internal" href="../installation/">Quickstart</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../usage/">Basic Usage</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../encryption/">Encryption</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../journal-types/">Journal Types</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../privacy-and-security/">Privacy and Security</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../formats/">Formats</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../advanced/">Advanced Usage</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../external-editors/">External Editors</a>
|
|
</li>
|
|
<li class="toctree-l1 current"><a class="reference internal current" href="#">Tips and Tricks</a>
|
|
<ul class="current">
|
|
<li class="toctree-l2"><a class="reference internal" href="#co-occurrence-of-tags">Co-occurrence of tags</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#combining-filters">Combining filters</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#statistics">Statistics</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#importing-older-files">Importing older files</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#using-templates">Using Templates</a>
|
|
<ul>
|
|
<li class="toctree-l3"><a class="reference internal" href="#1-use-the-template-command-line-argument-and-the-default-xdg_data_homejrnltemplates-directory">1. Use the --template command line argument and the default $XDG_DATA_HOME/jrnl/templates directory</a>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#2-use-the-template-command-line-argument-with-a-local-absolute-path">2. Use the --template command line argument with a local / absolute path</a>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#3-set-a-default-template-file-in-jrnlyaml">3. Set a default template file in jrnl.yaml</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#prompts-on-shell-reload">Prompts on shell reload</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#display-random-entry">Display random entry</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#launch-a-terminal-for-rapid-logging">Launch a terminal for rapid logging</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#visualize-formatted-markdown-in-the-cli">Visualize Formatted Markdown in the CLI</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="#jump-to-end-of-buffer-with-vi">Jump to end of buffer (with vi)</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">Reference</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../reference-command-line/">Command Line</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../reference-config-file/">Configuration File</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">Contributing</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../contributing/">Contributing to jrnl</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">ja</span></p>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../ja/overview/">概要</a>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" >ユーザーガイド</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/installation/">クイックスタート</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/usage/">基本的な使い方</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/encryption/">暗号化</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/journal-types/">ジャーナルの種類</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/privacy-and-security/">プライバシーとセキュリティ</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/formats/">フォーマット</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/advanced/">高度な使い方</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/external-editors/">外部エディタ</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/tips-and-tricks/">ヒントとコツ</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" >リファレンス</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/reference-command-line/">コマンドライン</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/reference-config-file/">設定ファイル</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" >貢献</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../ja/contributing/">jrnlへの貢献</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="..">jrnl</a>
|
|
|
|
</nav>
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content"><!--
|
|
Copied from https://github.com/mkdocs/mkdocs/blob/master/mkdocs/themes/readthedocs/breadcrumbs.html
|
|
Then lightly modified for accessibility
|
|
-->
|
|
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href=".." class="icon icon-home" aria-label="Docs"></a> »</li>
|
|
<li>User Guide »</li>
|
|
<li>Tips and Tricks</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
<a href="https://github.com/jrnl-org/jrnl/edit/develop/docs/tips-and-tricks.md" class="icon icon-github"> Edit on GitHub</a>
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div class="section" itemprop="articleBody">
|
|
|
|
<!--
|
|
Copyright © 2012-2023 jrnl contributors
|
|
License: https://www.gnu.org/licenses/gpl-3.0.html
|
|
-->
|
|
|
|
<h1 id="tips-and-tricks">Tips and Tricks</h1>
|
|
<p>This page contains tips and tricks for using <code>jrnl</code>, often in conjunction
|
|
with other tools, including external editors.</p>
|
|
<h2 id="co-occurrence-of-tags">Co-occurrence of tags</h2>
|
|
<p>If I want to find out how often I mentioned my flatmates Alberto and
|
|
Melo in the same entry, I run</p>
|
|
<pre><code class="language-sh">jrnl @alberto --tags | grep @melo
|
|
</code></pre>
|
|
<p>And will get something like <code>@melo: 9</code>, meaning there are 9 entries
|
|
where both <code>@alberto</code> and <code>@melo</code> are tagged. How does this work? First,
|
|
<code>jrnl @alberto</code> will filter the journal to only entries containing the
|
|
tag <code>@alberto</code>, and then the <code>--tags</code> option will print out how often
|
|
each tag occurred in this filtered journal. Finally, we pipe this to
|
|
<code>grep</code> which will only display the line containing <code>@melo</code>.</p>
|
|
<h2 id="combining-filters">Combining filters</h2>
|
|
<p>You can do things like</p>
|
|
<pre><code class="language-sh">jrnl @fixed -starred -n 10 -to "jan 2013" --short
|
|
</code></pre>
|
|
<p>To get a short summary of the 10 most recent, favourite entries before
|
|
January 1, 2013 that are tagged with <code>@fixed</code>.</p>
|
|
<h2 id="statistics">Statistics</h2>
|
|
<p>How much did I write last year?</p>
|
|
<pre><code class="language-sh">jrnl -from "jan 1 2013" -to "dec 31 2013" | wc -w
|
|
</code></pre>
|
|
<p>Will give you the number of words you wrote in 2013. How long is my
|
|
average entry?</p>
|
|
<pre><code class="language-sh">expr $(jrnl --export text | wc -w) / $(jrnl --short | wc -l)
|
|
</code></pre>
|
|
<p>This will first get the total number of words in the journal and divide
|
|
it by the number of entries (this works because <code>jrnl --short</code> will
|
|
print exactly one line per entry).</p>
|
|
<h2 id="importing-older-files">Importing older files</h2>
|
|
<p>If you want to import a file as an entry to <code>jrnl</code>, you can just do <code>jrnl < entry.ext</code>. But what if you want the modification date of the file to
|
|
be the date of the entry in <code>jrnl</code>? Try this</p>
|
|
<pre><code class="language-sh">echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl
|
|
</code></pre>
|
|
<p>The first part will format the modification date of <code>entry.txt</code>, and
|
|
then combine it with the contents of the file before piping it to jrnl.
|
|
If you do that often, consider creating a function in your <code>.bashrc</code> or
|
|
<code>.bash_profile</code></p>
|
|
<pre><code class="language-sh">jrnlimport () {
|
|
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' $1` `cat $1` | jrnl
|
|
}
|
|
</code></pre>
|
|
<h2 id="using-templates">Using Templates</h2>
|
|
<div class="admonition note">
|
|
<p class="admonition-title">Note</p>
|
|
<p>Templates require an <a href="../advanced/">external editor</a> be configured.</p>
|
|
</div>
|
|
<p>Templates are text files that are used for creating structured journals.
|
|
There are three ways you can use templates:</p>
|
|
<h3 id="1-use-the-template-command-line-argument-and-the-default-xdg_data_homejrnltemplates-directory">1. Use the <code>--template</code> command line argument and the default $XDG_DATA_HOME/jrnl/templates directory</h3>
|
|
<p><code>$XDG_DATA_HOME/jrnl/templates</code> is created by default to store your templates! Create a template (like <code>default.md</code>) in this directory and pass <code>--template FILE_IN_DIR</code>.</p>
|
|
<pre><code class="language-sh">jrnl --template default.md
|
|
</code></pre>
|
|
<h3 id="2-use-the-template-command-line-argument-with-a-local-absolute-path">2. Use the <code>--template</code> command line argument with a local / absolute path</h3>
|
|
<p>You can create a template file with any text. Here is an example:</p>
|
|
<pre><code class="language-sh"># /tmp/template.txt
|
|
My Personal Journal
|
|
Title:
|
|
|
|
Body:
|
|
</code></pre>
|
|
<p>Then, pass the absolute or relative path to the template file as an argument, and your external
|
|
editor will open and have your template pre-populated.</p>
|
|
<pre><code class="language-sh">jrnl --template /tmp/template.md
|
|
</code></pre>
|
|
<h3 id="3-set-a-default-template-file-in-jrnlyaml">3. Set a default template file in <code>jrnl.yaml</code></h3>
|
|
<p>If you want a template by default, change the value of <code>template</code> in the <a href="../reference-config-file/">config file</a>
|
|
from <code>false</code> to the template file's path, wrapped in double quotes:</p>
|
|
<pre><code class="language-sh">...
|
|
template: "/path/to/template.txt"
|
|
...
|
|
</code></pre>
|
|
<div class="admonition tip">
|
|
<p class="admonition-title">Tip</p>
|
|
<p>To read your journal entry or to verify the entry saved, you can use this
|
|
command: <code>jrnl -n 1</code> (Check out <a href="../formats/">Formats</a> for more options).</p>
|
|
</div>
|
|
<pre><code class="language-sh">jrnl -n 1
|
|
</code></pre>
|
|
<h2 id="prompts-on-shell-reload">Prompts on shell reload</h2>
|
|
<p>If you'd like to be prompted each time you refresh your shell, you can include
|
|
this in your <code>.bash_profile</code>:</p>
|
|
<pre><code class="language-sh">function log_question()
|
|
{
|
|
echo $1
|
|
read
|
|
jrnl today: ${1}. $REPLY
|
|
}
|
|
log_question 'What did I achieve today?'
|
|
log_question 'What did I make progress with?'
|
|
</code></pre>
|
|
<p>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 <code>default_hour</code> and <code>default_minute</code> listed in your
|
|
<code>jrnl.yaml</code> <a href="../advanced/#configuration-file">config file</a>.</p>
|
|
<h2 id="display-random-entry">Display random entry</h2>
|
|
<p>You can use this to select one title at random and then display the whole
|
|
entry. The invocation of <code>cut</code> needs to match the format of the timestamp.
|
|
For timestamps that have a space between data and time components, select
|
|
fields 1 and 2 as shown. For timestamps that have no whitespace, select
|
|
only field 1.</p>
|
|
<pre><code class="language-sh">jrnl -on "$(jrnl --short | shuf -n 1 | cut -d' ' -f1,2)"
|
|
</code></pre>
|
|
<h2 id="launch-a-terminal-for-rapid-logging">Launch a terminal for rapid logging</h2>
|
|
<p>You can use this to launch a terminal that is the <code>jrnl</code> stdin prompt so you can start typing away immediately.</p>
|
|
<pre><code class="language-bash">jrnl --config-override editor ""
|
|
</code></pre>
|
|
<p>Bind this to a keyboard shortcut.</p>
|
|
<p>Map <code>Super+Alt+J</code> to launch the terminal with <code>jrnl</code> prompt</p>
|
|
<ul>
|
|
<li><strong>xbindkeys</strong>
|
|
In your <code>.xbindkeysrc</code></li>
|
|
</ul>
|
|
<pre><code class="language-ini">Mod4+Mod1+j
|
|
alacritty -t floating-jrnl -e jrnl --config-override editor "",
|
|
</code></pre>
|
|
<ul>
|
|
<li><strong>I3 WM</strong> Launch a floating terminal with the <code>jrnl</code> prompt</li>
|
|
</ul>
|
|
<pre><code class="language-ini">bindsym Mod4+Mod1+j exec --no-startup-id alacritty -t floating-jrnl -e jrnl --config-override editor ""
|
|
for_window[title="floating *"] floating enable
|
|
</code></pre>
|
|
<h2 id="visualize-formatted-markdown-in-the-cli">Visualize Formatted Markdown in the CLI</h2>
|
|
<p>Out of the box, <code>jrnl</code> can output journal entries in Markdown. To visualize it, you can pipe to <a href="https://github.com/ttscoff/mdless">mdless</a>, which is a <a href="https://en.wikipedia.org/wiki/Less_(Unix)">less</a>-like tool that allows you to visualize your Markdown text with formatting and syntax highlighting from the CLI. You can use this in any shell that supports piping.</p>
|
|
<p>The simplest way to visualize your Markdown output with <code>mdless</code> is as follows:</p>
|
|
<pre><code class="language-sh">jrnl --export md | mdless
|
|
</code></pre>
|
|
<p>This will render your Markdown output in the whole screen.</p>
|
|
<p>Fortunately, <code>mdless</code> has an option that allows you to adjust the screen width by using the <code>-w</code> option as follows:</p>
|
|
<pre><code class="language-sh">jrnl --export md | mdless -w 70
|
|
</code></pre>
|
|
<p>If you want Markdown to be your default display format, you can define this in your config file as follows:</p>
|
|
<pre><code class="language-yaml">display_format: md
|
|
# or
|
|
display_format: markdown
|
|
</code></pre>
|
|
<p>For more information on how <code>jrnl</code> outputs your entries in Markdown, please visit the <a href="../formats/">Formats</a> section.</p>
|
|
<h2 id="jump-to-end-of-buffer-with-vi">Jump to end of buffer (with vi)</h2>
|
|
<p>To cause vi to jump to the end of the last line of the entry you edit, in your config file set:</p>
|
|
<pre><code class="language-yaml">editor: vi + -c "call cursor('.',strwidth(getline('.')))"
|
|
</code></pre>
|
|
|
|
</div>
|
|
</div><footer>
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
|
|
<a href="../external-editors/" class="btn btn-neutral float-left" title="External Editors"><span class="icon icon-circle-arrow-left"></span> Previous</a>
|
|
<a href="../reference-command-line/" class="btn btn-neutral float-right" title="Command Line">Next <span class="icon icon-circle-arrow-right"></span></a>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<!-- Copyright etc -->
|
|
</div>
|
|
|
|
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
<div class="rst-versions" role="note" aria-label="Versions">
|
|
<span class="rst-current-version" data-toggle="rst-current-version">
|
|
|
|
<span>
|
|
<a href="https://github.com/jrnl-org/jrnl/" class="fa fa-github" style="color: #fcfcfc"> GitHub</a>
|
|
</span>
|
|
|
|
|
|
<span><a href="../external-editors/" style="color: #fcfcfc">« Previous</a></span>
|
|
|
|
|
|
<span><a href="../reference-command-line/" style="color: #fcfcfc">Next »</a></span>
|
|
|
|
</span>
|
|
</div>
|
|
<script src="../js/jquery-3.6.0.min.js"></script>
|
|
<script>var base_url = "..";</script>
|
|
<script src="../js/theme_extra.js"></script>
|
|
<script src="../js/theme.js"></script>
|
|
<script src="../search/main.js"></script>
|
|
<script>
|
|
jQuery(function () {
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|