Neovim for journaling 🤓 🚀
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.
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
alias journal = "nvim -u ~/.config/nvim/journal.vim"
Once this is added to your
bashrc , you can use the command
journal to start journaling.
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 📄
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.
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:
\wwOpens 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.
\wiOpens 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\wCreates a new journal entry.
\w\iUpdates the Diary index page.
<space-l>Press <space> followed by ‘l’ to load the template.
enteron a selected word would create a link to another page.
backspacebrings 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 🤗 💅