Chris's Blog

Devops Shokunin

Getting started with VimWiki

2 Comments »

VimWiki is an excellent tool for creating both a personal knowledgebase and journal.  I use it everyday to keep track of new techniques that I learn as well as to keep notes on how I perform tasks everyday.  Because it is completely text based with minimal formatting, it is possible to share easily and keep in git version control for a full history of how and what I learn.  In addition, the search feature allows me to quickly recall how to perform a task or find the information I need quickly.

Installation

1) Install vundle or download my dotfiles to get started with managing vim plugins

2) Install the VimWiki and Calendar plugins for vim by adding the following to your vundle file

Bundle 'mattn/calendar-vim'
Bundle 'vimwiki'

3) update all of your plugins

vim +BundleInstall +qall
mkdir -p ~/Documents/VimWiki/

4)  Remap your leader key in your .vimrc . I set mine to ,

:let mapleader=","

To find your current leader key run

:echo mapleader

and it will appear in the bottom left

5) Add the the following to your .vimrc to get started

" vimwiki stuff "
" Run multiple wikis "
let g:vimwiki_list = [
                        \{'path': '~/Documents/VimWiki/personal.wiki'},
                        \{'path': '~/Documents/VimWiki/tech.wiki'}
                \]
au BufRead,BufNewFile *.wiki set filetype=vimwiki
:autocmd FileType vimwiki map d :VimwikiMakeDiaryNote
function! ToggleCalendar()
  execute ":Calendar"
  if exists("g:calendar_open")
    if g:calendar_open == 1
      execute "q"
      unlet g:calendar_open
    else
      g:calendar_open = 1
    end
  else
    let g:calendar_open = 1
  end
endfunction
:autocmd FileType vimwiki map c :call ToggleCalendar()

 

Using the Wiki Features

 

1)  Start up Vim

ss1

 

2)  The following command will take you to the top page of your wiki

,ww

ss2

3) select yes to create the new directory and it will take you to your new Wiki index

 

4) enter information

ss3

5) to make the text actual links surround with [[ ]]

ss4

6) Move up and down when the cursor is on the link you want Company Information in this case hit return and it will generate a new wiki page

ss5

7) add data to the page

ss6

8) go back to the main page by pressing the backspace key

ss3

Searching the Wiki

1) Search for the term “blog” by running the following command

:VWS /blog/

ss8

shows (1 of 2)

ss9

2) show all of the matches

:lopen

ss10

3)  navigate up and down and hit return to select that file

ss11
Using diary

1) create a new diary entry and add data.  If you add the == Title == at the top it will be visible in the index (next step)

,w,w

ss12

2) go to the diary index

,wi

ss13

3) build a diary index

:VimwikiDiaryGenerateLinks

ss14
4) using the calendar plugin to toggle on/off

,c

ss15

5) you can navigate to the date and hit return on that date and the diary entry for that date will open!

ss16

Resources

VimWiki Quick Reference Guide  

VimWiki on Github