Sometimes you learn to love old tools and plugins only after a long time.
That's what happened to me with vimwiki.
I somehow always need the same information in everyday life. Be it coding, crafting, podcasting and so on.
What is useful here is your own knowledge base (which can be easily expanded and edited).
So basically a wiki to sort your own thoughts and ideally for the command line... This is where vimwiki comes into play.
vimwiki builds its own small local wiki that can be styled with Markdown in Vim and allows links within documents.
So everything you need to organize your own thoughts.
Installation
So how does vimwiki get into Vim.
vimwiki runs in every Vim from version 7.3 onwards
First of all, the following entries should be made or present in the "vimrc":
vimrc
set nocompatible
filetype plugin on
syntax on
Now vimwiki can be installed.
Vim packages
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
Pathogen
cd ~/.vim
mkdir bundle
cd bundle
git clone https://github.com/vimwiki/vimwiki.git
Vim Plug
Plug 'vimwiki/vimwiki'
:PlugInstall
After that, vimwiki can be used in Vim.
vimwiki can basically be formatted using three different syntaxes: vimwiki (default), Markdown and MediaWiki.
The syntax that vimwiki should use can also be defined in the ".vimrc".
.vimrc
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
In principle, it is also recommended to install the help files for vimwiki.
Terminal
vim -c 'helptags ~/.vim/pack/plugins/start/vimwiki/doc' -c quit
Once that's done, you can get started.
Usage
As Vim already does, vimwiki is also controlled purely by keyboard and key combinations.
The following keybindings help with control ([LEADER] is \ in the standard Vim config, if you have mapped the LEADER differently, you must of course use that):
KEYBINDINGS
[LEADER] ww -- opens the wiki index file
[LEADER] wt -- opens the index file in a new tab
[LEADER] ws -- opens selected index file
[LEADER] wd -- deletes the current wiki file
[LEADER] wr -- renames the current wiki file
[ENTER] -- follow link / create link
[BACKSPACE] -- return to the last wiki page
This means that vimwiki can now be used.
Now we can install vimwiki, configure it and use it.
But there is no content yet. Before the knowledge base is filled, the structure must be considered, which saves a lot of rework.
Once the rough structure is in place, the index file can be created.
The vimwiki syntax is relatively simple and not entirely dissimilar to Markdown.
vimwiki syntax
The following tags can be used to style the index file and the individual vimwiki pages:
= H1 =
== H2 ==
=== H3 ===
*bold* (bold)
_italic_ (italic)
[[Link]] (Simple internal link)
[[Link|Description]] (Simple internal link | Display name in the wiki file)
* List Pos 1
* List Pos 2
- List Pos 1
- List item 2
1. List item 1
2. List item 2
For all usable syntax tags, the internal help can always be used:
VIM
:h vimwiki-syntax
Another function is the export of the wiki files in HTML.
The following commands can be used in Vim:
VIM
:vimwiki2HTML (exports the current file as HTML)
:vimwikiAll2HTML (exports all files as HTML)
vimwiki makes everyday life a lot easier. With vimwiki you can organize almost anything:
- To-do lists
- Diaries
- Protocols
- Project planning
- Code documentation
and pretty much anything you can think of. The perfect plugin if you want to do without bloat-UI tools.
Now I need a practical calendar for Vim, but that's another story.