I found this Getting started with Vimwiki blog post by Chris Mague a good and thorough guide to the installation and use of vimwiki. So, I will shamelessly emulate his approach and put together a similar guide for anyone who seeks to install and use vimwiki for RPG campaign detail management.
The goal of this document is to install vim, configure vim, and set up a pair of vimwiki installations. One vimwiki is labelled vimwiki and contains information for both players and the Gamemaster. The second wiki labelled private contains information intended only for the Gamemaster. The second wiki links to the first. There are no links from the first (public) wiki into the second (private) wiki.
Prerequisite: Install Vim
Everything after this assumes 1) you have already installed vim and 2) you are familiar with using vim.
If you run Mac OS X, you will probably prefer to use MacVim rather than fire up Terminal (or iTerm2) and work with vim inside the Command Line Interface (CLI).
If you run Linux yet the gvim
command does not work, you probably want to install vim-gtk
or vim-gnome
or a similar variant to get a vim GUI.
If you have vim, but you would appreciate a tutorial, try vimtutor
. On Linux, you can install vimtutor with yum install vim-enhanced
(RedHat) or apt-get install vim-runtime
(Ubuntu)
If you have questions, one place to find answers is the vi and vim site on the Stack Exchange collection of sites.
Install Vimwiki
- First, add these lines to your
~/.vimrc
file
set nocompatible
filetype plugin on
syntax on
Without them Vimwiki will not work properly.
There's at least three different ways to install vimwiki. Arguably the easiest way to get the most current copy is described on the vimwiki github page which I will reproduce here:
- download the zip archive and extract it in
~/.vim/bundle/
- Then launch Vim, run
:Helptags
and then:help vimwiki
to verify it was installed.
- download the zip archive and extract it in
The git archive does not work
If the git archive does not work, there's a vimball from 2013 on vim.org. Download this, and unpack it as says on that page:
- Open vimwiki-N-N.vba.gz with Vim. (N-N is version number i.e. 2-1)
- Source it with the command
:so %
- Run
:help vimwiki
to confirm that the plug-in loaded correctly.
Use vundle
Vundle is a plug-in manager for vim. The Getting started with Vimwiki blog has details about how to add both vimwiki and the Calendar plug-ins. The short summary:
- Install vundle
- Add Calendar and vimwiki to the vundle file. My vundle configuration is done from my
~/.vimrc
Bundle 'mattn/calendar-vim'
Bundle 'vimwiki'
- Run
:help vimwiki
to confirm that the plug-in loaded correctly.
Configure Vimwiki
- Many of the commands used by vimwiki start with the
leader
key. If you have not changed it, your leader key is most likely the backslash ("\"). You can find what it is, and remap it if you choose. - Put these lines in your .vimrc to set up the public and private wikis
" vimwiki
let wiki_1 = {}
let wiki_1.path = '~/vimwiki/'
let wiki_1.path_html = '~/vimwiki_html/'
let wiki_2 = {}
let wiki_2.path = '~/private/'
let wiki_2.path_html = '~/private_html/'
let g:vimwiki_list = [wiki_1, wiki_2]
You now have two wiki installations, the first labelled vimwiki
and the second labelled private
Use Vimwiki
- Start up vim.
- In the examples below, I use
gvim
. You can use vim from a terminal instead.
- In the examples below, I use
- You can use the Vimwiki menu to look at the links to the index pages. However, there's no data there yet, and the directories are not created yet. The commands in the next steps will build the directories and data.
- Type
\ws
to show the list of two wikis. Choose the first one, the public one named vimwiki
- The directory vimwiki does not exist. Vim can tell this, and prompts you to create it. Click 'Y'
- Enter the text of the index page. Be sure to add the search term Foobar for this page. We're going to want to search on a unique string in some but not all of the pages. That's what Foobar provides, here.
- To turn text into links, surround the text with a pair of square brackets [[ and ]]
- Save the file.
Move the cursor on to the link text. Press
<S + CR>
(Hold down the Shift key and press Return).- This opens the target of the link in a horizontal split window.
Add content to the new page in the split.
- I've added some population information to Capital City as an example.
- We want a second, Gamemaster only, wiki. To create this second wiki in a new tab, type
2\wt
You are prompted to create the second directory (namedprivate
here)
Add content to the second private wiki index page.
- In the image below, the private wiki is in a new tab.
Add a link to the first wiki by prefacing the link with the wiki number.
- The first wiki in the link list (the public wiki) is wiki0. This means the link starts with
wiki0
. - There's no problem with a space in the wiki text name between Capital and City
- The first wiki in the link list (the public wiki) is wiki0. This means the link starts with
- Save the file. Put the cursor on the interwiki link and press Return. This follows the link from the private wiki and takes you to the public wiki target.
- Press
Backspace
to go back a link. You return to the private Gamemaster page. - You can search one wiki with
:VWS /term/
but that search does not extend across multiple wikis. It only searches one wiki at a time.
Build a Chronicle using vimwiki diary function
The assumption here is that your <leader>
key is set to ("\")
\ws
lets you select1
to open the public wiki.- press
\w\w
to create a new chronicle entry.- This uses the vimwiki diary function and shows up in the subdirectory
vimwiki/diary
- The file name of the wiki chronicle entry is derived from the current date.
- This uses the vimwiki diary function and shows up in the subdirectory
- press
\wi
to go to the index of all chronicle entries. - press
\w\i
to update the links to of all chronicle entries.- You must be on the index page to run
\w\i
- You must be on the index page to run
No comments:
Post a Comment