Mastodon hachyterm.io

What is VimWiki?

VimWiki is a personal wiki for Vim. Thus, it’s ideal for a personal knowledge base.

With VimWiki you can:

  • Organize notes and ideas
  • Manage to-do lists
  • Write documentation
  • Maintain a diary
  • Export everything to HTML

We can use VimWiki as a powerful note-taking tool, which integrates well with an existing coding workflow in Vim/NeoVim.

How?

Install VimWiki with your favorite package manager.

For example, with minpac:

call minpac#add('vimwiki/vimwiki')

Minimal settings for Vim (vimrc):

set nocompatible
filetype plugin on
syntax on

NeoVim uses these settings as default options. You don’t have to change anything.

Syntax

VimWiki ships with its own syntax: VimWiki. But you can choose a different syntax (Markdown or MediaWiki).

I chose Markdown, because I’m more comfortable with it.

Add this to your vimrc:

let g:vimwiki_list = [{'path': '~/vimwiki/',
                      \ 'syntax': 'markdown', 'ext': '.wiki'}]

This will preserve the standard syntax for markdown files, and it will add VimWiki capabilities only to .wiki files.

You won’t be able to export your notes to HTML, but you can easily use a different tool for that. See :h vimwiki-syntax for more information.

Usage

Open Vim and use the key mapping <leader>ww to bring up the wiki index.
Create a wiki link by selecting text and hitting the Enter key (<cr).

More key bindings:

  • <Leader>ww – Open the default wiki index file
  • <Leader>ws – Select and open wiki index file
  • <Enter> – Follow/Create wiki link
  • <Backspace> – Go back to parent(previous) wiki link
  • <Tab> – Find next wiki link
  • <Shift-Tab>– Find previous wiki link

Further Reading