Neovim for journaling πŸ€“Β πŸš€

Never leave your terminal ... even when journaling πŸ˜„

Β·

3 min read

Benefits of journaling.

This blog is not about that!

If you are like me, who loves Neovim and journaling, this blog is for you 😍


The Paradox of choice

I used to journal in Notion. It is a great tool with a lot of features, so much so, that I ended up spending more time beautifying my pages and playing around with features than writing my journal.

Learning to choose is hard. Learning to choose well is harder. And learning to choose well in a world of unlimited possibilities is harder still, perhaps too hard. – Barry Schwartz in his book The Paradox of Choice

I learned recently that I can write my journal using Neovim with "vimwiki"

Let's get started!

This is what your journal would look like if you follow the instructions.

Configuration:

You need 3 more plugins:

  • Goyo: For distraction-free writing.
  • Limelight: To highlight the area under the cursor.
  • Vim-lexical: Spell check and dictionary.

Of course, these are optional, but I recommend you to use them for a minimalistic and distraction-free experience. Apart from these plugins, you need some vim script to ease your journaling experience. (explanation below)

Separation of concerns.

We Software Engineers are fond of this concept and rightly so, you do not want to clutter your existing vimrc or init file with new plugins and scripts. You can do this by using a separate Neovim configuration file for journaling and loading it with -u flag. alias journal = "nvim -u ~/.config/nvim/journal.vim" Once this is added to your zshrc or bashrc , you can use the command journal to start journaling.

Pre-requisites

Before I explain the configuration there are a few things I keep in my journal directory.

  • A journal template as a markdown file.
  • A text file with some random quotes for daily motivation.

The configuration above would enable you to load a template for a new journal entry by pressing . Here is a sample πŸ“„

Sample template

Now the config πŸ₯

The actual config is from line 128. This is my current configuration file with some theme and key mappings which can be ignored.

Explanation:

  • LoadQuotes():Loads a random quote from a file named "quotes".
  • JournalHeader(): Creates a title for your journal entry in this format date mm/dd @ Title of your journal entry
  • Line 143: Sets markdown as the syntax. The default format for vimwiki is MediaWiki. Use this config if you are comfortable with markdowns.
  • Line 145: Spell check locale values for vim-lexical
  • Line 147–149: Automatically enables Vimwiki, Goyo and Limelight when you open Neovim.

Some useful shortcuts that I use:

  • \ww Opens the journal's index page. Think of this as a home page where you can write whatever you want. I use this to maintain my blog ideas and track the progress of my side projects.
  • \wi Opens the index page of the diary. This is where all the headings of your journal entries are placed. Think of this as a "Table of contents".
  • \w\w Creates a new journal entry.
  • \w\i Updates the Diary index page.
  • <space-l> Press followed by 'l' to load the template. enter on a selected word would create a link to another page. backspace brings you back to the parent page.

That's it! Enjoy journaling πŸ“– πŸ–Š


πŸ’‘ Protip

You can use Github as your online journal store. πŸ’β€β™‚

  • Create a private repo πŸ’ͺ
  • Use Git-crypt to encrypt your files. 😌

References:

Special thanks to the legend junegunn for the awesome contributions to the OSS community ❀️

Let me know if you have any feedback! 🍻 ✌️

Β