Neovim for journaling πŸ€“ πŸš€

Surya Reddy
4 min readApr 3, 2022

--

Photo by Thought Catalog on Unsplash

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 <space-l> .

Here is a sample πŸ“„

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 <space> 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 πŸ“– πŸ–Š

Pro tip πŸ’‘

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

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

If you are reading this and have never journaled before … Give it a try ❀️

During these unprecedented times, it is easy to feel that every day is just the same.

Journaling will help you slow down and reflect on life. It is great for one’s mental health πŸ€— πŸ’…

References:

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

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

--

--