Dual Journaling with Vimwiki: How to Separate Personal and Business Notes
Table of Contents ๐
In the previous post, we built a powerful journaling system using Vimwiki. Itโs a fantastic setup, but as you use it more, a common problem emerges: professional meeting notes mix with personal reflections, and work to-dos get tangled with weekend plans.
Changelog
Date | Change |
---|---|
2025-07-02 | Created a direct workflow for general notes: Added a new custom function (CreateGeneralNote ) and corresponding shortcuts (\nb , \np ) to directly create topic-based notes with a filename prompt, addressing a major workflow flaw. |
2025-06-20 | Major Revision: Clarified Wiki vs. Journal distinction, improved naming consistency for directories, and created more intuitive shortcuts. |
2025-06-19 | Initial version of the article. |
This guide will show you how to build a dual-wiki system to cleanly separate your personal and business notes. We will cover how to create both daily Journal Entries and topic-based General Notes in their correct contexts.
Step 1: Understanding the Structure
Before we configure anything, letโs understand the hierarchy we are building. A Wiki is the main container for a context (e.g., โBusinessโ). Within that wiki, there are two types of notes:
- General Notes: Topic-based pages like โProject Alpha Ideasโ or โMeeting Checklistsโ. They live in the root of the wiki.
- Journal Entries: Date-based, daily logs. They live in the
diary/
subdirectory.
This is the structure we will create:
~/Nextcloud/Notes/
โโโ wiki-business/
โ โโโ diary/
โ โ โโโ 2025-07-04.md
โ โโโ Project Alpha.md
โ โโโ index.md
โ โโโ template-business-journal.md
โ
โโโ wiki-personal/
โโโ diary/
โ โโโ 2025-07-04.md
โโโ Holiday Plans.md
โโโ index.md
โโโ template-personal-journal.md
This clean separation is the key to an organized system.
Step 2: Update Your Vimwiki Configuration
First, configure your ~/.vimrc
to define the two wikis. Using expand('~')
makes the configuration robust.
" Vimwiki Configuration for multiple wikis
let g:vimwiki_list = [
\ {
\ 'path': expand('~') . '/Nextcloud/Notes/wiki-business/',
\ 'diary_template': 'template-business-journal.md',
\ 'syntax': 'markdown', 'ext': '.md'
\ },
\ {
\ 'path': expand('~') . '/Nextcloud/Notes/wiki-personal/',
\ 'diary_template': 'template-personal-journal.md',
\ 'syntax': 'markdown', 'ext': '.md'
\ }
\]
" Optional: Set a default wiki (1=first, 2=second).
let g:vimwiki_start_wiki = 2 " Make the personal wiki the default
" These settings apply to all wikis in the list
let g:vimwiki_markdown_link_ext = 1
let g:vimwiki_auto_diary_index = 1
Next, create the necessary directories in your terminal:
mkdir -p ~/Nextcloud/Notes/wiki-business/diary
mkdir -p ~/Nextcloud/Notes/wiki-personal/diary
Step 3: Create Context-Specific Journal Templates
Create a unique template for each journal. Each template file must be placed in the root directory of its corresponding wiki.
Business Journal Template
Create the file ~/Nextcloud/Notes/wiki-business/template-business-journal.md
:
# %Y-%m-%d โ Business Journal
## ๐ฏ Today's Top 3 Priorities
- [ ]
- [ ]
- [ ]
Personal Journal Template
Create the file ~/Nextcloud/Notes/wiki-personal/template-personal-journal.md
:
# %Y-%m-%d โ Personal Journal
## ๐ Gratitude
-
## ๐ก Ideas & Thoughts
-
Step 4: The Core Solution: Custom Vim Functions
A standard Vimwiki installation has two limitations for our workflow:
:VimwikiMakeDiaryNote
does not automatically apply templates.- There is no direct command to create a new, named topic note.
We will solve both issues with two dedicated functions in our ~/.vimrc
.
In Your .vimrc
Add these two functions and their corresponding shortcuts to your Vim configuration.
" ----- FUNCTION 1: FOR DAILY JOURNAL ENTRIES -----
function! OpenJournalWithTemplate(wiki_index)
" Switch to the correct wiki context
execute 'VimwikiTabIndex ' . a:wiki_index
" Create or open today's diary note
VimwikiMakeDiaryNote
" CRITICAL: Force Vim to update its state before we check the file
redraw
" Check if the file is new and empty
if line('$') == 1 && getline(1) == ''
let l:wiki_config = g:vimwiki_list[a:wiki_index - 1]
let l:template_path = l:wiki_config.path . l:wiki_config.diary_template
" If the template file exists, read its content into our new file
if filereadable(l:template_path)
execute '0read ' . l:template_path
1delete " Delete the initial empty line
normal! gg " Go to the top
endif
endif
endfunction
" ----- FUNCTION 2: FOR GENERAL TOPIC NOTES -----
function! CreateGeneralNote(wiki_index)
" Switch to the correct wiki context
execute 'VimwikiTabIndex ' . a:wiki_index
" Open the index page of that wiki
VimwikiIndex
" Prompt the user for the name of the new note
let l:note_name = input('Enter name for new note: ')
" Proceed only if a name was entered
if !empty(l:note_name)
" Go to the end of the index file and add a new link
call append(line('$'), '* [[' . l:note_name . ']]')
" Move the cursor to the newly created line
call cursor(line('$'), 1)
" 'Press Enter' on the link to create and open the new file
VimwikiFollowLink
endif
endfunction
" ----- KEYBOARD SHORTCUTS -----
" For Journals (e.g., \jb for Journal-Business)
nnoremap <leader>jb :call OpenJournalWithTemplate(1)<CR>
nnoremap <leader>jp :call OpenJournalWithTemplate(2)<CR>
" For General Notes (e.g., \nb for Note-Business)
nnoremap <leader>nb :call CreateGeneralNote(1)<CR>
nnoremap <leader>np :call CreateGeneralNote(2)<CR>
In Your Shell (.bashrc
or .zshrc
)
Create a full set of aliases in your shell configuration to call these functions directly.
# Aliases for Journal Entries
alias journalb='vim -c "call OpenJournalWithTemplate(1)"'
alias journalp='vim -c "call OpenJournalWithTemplate(2)"'
# Aliases for General Topic Notes
alias noteb='vim -c "call CreateGeneralNote(1)"'
alias notep='vim -c "call CreateGeneralNote(2)"'
# Optional: Shorter aliases
alias jb='journalb'
alias jp='journalp'
alias nb='noteb'
alias np='notep'
Reload your shell (source ~/.bashrc
or source ~/.zshrc
) to activate them.
Step 5: How to Use Your Dual System
Your workflow is now clean, logical, and direct for both use cases.
Workflow 1: Create a Daily Journal Entry
Use this for date-based, chronological logs.
- From inside Vim: Press
\jb
(Business) or\jp
(Personal). - From your terminal: Run
journalb
orjb
(Business) /journalp
orjp
(Personal).
Result: Todayโs journal file is created in the diary/
folder, and the correct template is applied.
Workflow 2: Create a General Topic Note
Use this for any non-daily, topic-based note like a project plan, a checklist, or meeting notes.
- From inside Vim: Press
\nb
(Business) or\np
(Personal). - From your terminal: Run
noteb
ornb
(Business) /notep
ornp
(Personal).
Result: You will be prompted in Vim to enter a name for the new note. After you type a name and press Enter, the new file is created in the root of the correct wiki, and a link to it is automatically added to your index.md
.
Step 6: Linking Between Wikis
The concept of linking between wikis is now much clearer. Imagine youโre in your personal journal and have an idea for a business project.
In your personal journal file, you can write:
## ๐ก Ideas & Thoughts
- I just had an idea for work, I'll start a new note for it in my business wiki.
- To create it, I can just write the link here and press Enter: [[wiki1:My New Business Idea]]
wiki1:
tells Vimwiki to use the first wiki in your list (your business-wiki).
When you press Enter
, Vimwiki creates the file My New Business Idea.md
in the root of your wiki-business/
and opens it.
Summary
By creating two dedicated functions, you have built a powerful, intuitive, and robust system:
โ
A clean separation between your wiki-business and wiki-personal.
โ
A clear, direct workflow for creating both daily Journals and topic-based General Notes.
โ
Custom journal templates that are correctly and automatically applied.
โ
Lightning-fast, unambiguous shortcuts (jb
, jp
, nb
, np
) for both Vim and your shell.
โ
The power to intelligently link between worlds when needed.
This setup transforms a simple note-taking tool into a comprehensive life management system.
๐โน๏ธ WHAT'S NEXT? |
Now that your wikis are separated and working reliably, we can explore advanced task management. In a future post, weโll look at how to aggregate tasks from both journals into a single, unified dashboard. |