# Vim-Wiki ## TL;DR - keybindings - `ww` -- Open default wiki index file. - `wt` -- Open default wiki index file in a new tab. - `ws` -- Select and open wiki index file. - `wd` -- Delete wiki file you are in. - `wr` -- Rename wiki file you are in. - `` -- Follow/Create wiki link. - `` -- Split and follow/create wiki link. - `` -- Vertical split and follow/create wiki link. - `` -- Go back to parent(previous) wiki link. - `` -- Find next wiki link. - `` -- Find previous wiki link. ## General Vim wiki is a vim plugin making it possible to effectivly keep wiki-style knowledge sorted on your local machine. The single pages are written in Markdown and are interlinked. It can further be used as a Diary or to manage TODO lists, and to export the whole wiki in to a website, meaning single HTML files, which are interlinked and can be published. Since every entry is a simple markdown file, this makes it easy to collaborate on a common wiki using git. ### Installation The vim-wiki plugin can be installed like every vim plugin. To test if the installation was successful, execute `:VimwikiIndex` in the command prompt of vim. You have to add the following lines to your `.vimrc`, irrespective of the installation method used. ```vim set nocompatible filetype plugin on syntax on ``` #### [Vim-Plug](https://github.com/junegunn/vim-plug) Add `Plug 'vimwiki/vimwiki'` to the Plug-Section of your `init.vim` or `.vimrc`. Afterwords run `:PlugInstall` in the command prompt of vim. #### [Pathogen](https://www.vim.org/scripts/script.php?script_id=2332) Go to your vim config folder and clone the vimwiki gitHub repository into the `bundle` folder. ```sh cd $CONFIG/vim mkdir bundle cd bundle git clone https://github.com/vimwiki/vimwiki.git ``` Afterwords run `:Helptags` in the command prompt of vim. #### [Vundle](https://github.com/VundleVim/Vundle.vim) Add `Plugin 'vimwiki/vimwiki'` to the `init.vim` or `.vimrc`. Afterwords run `vim +PluginInstall +qall` in the shell to install it. ## Install of the mykb - vimwiki To install the _mykb_ version of vimwiki, clone [https://github.com/AlexBocken/mykb](https://github.com/AlexBocken/mykb) in to the folder of your preference and add ``` let g:vimwiki_list = [{'path': '/PATH/TO/DIRECTORY/mykb', 'syntax': 'markdown', 'ext': '.md'}] ``` to your `.vimrc`. To make the usage more userfriendly, add ``` alias mykb='nvim /PATH/index.md` ``` to your aliases. To then open it, just run `mykb`. ### Configuration To go to the index page you enter `ww`. For a bare vim-install this is `\ww`. To change this, put the following line to your `.vimrc`: ```vim map v :VimwikiIndex ``` On default the directory for the markdown files is `~/vimwiki/index.wiki`. To change this, add the following line to your `.vimrc`: ```vim let g:vimwiki_list = [{'path': '/PATH/TO/DIRECTORY/vimwiki', 'syntax': 'markdown', 'ext': '.md'}] ``` Here you can also add several wikis. Assuming you want to have one wiki exclusively for coding related matters and another one for everyday related knowledge, add ```vim let g:vimwiki_list = [ \ {'path': '/PATH/wiki_code', 'syntax': 'markdown', 'ext': '.md'}, \ {'path': '/PATH/wiki_household', 'syntax': 'markdown', 'ext': '.md'} ] ``` to your `.vimrc`. To then select the correct wiki to go to, use `ws` to select which wiki you want to choose. You can also use `[number] ww` to directly move to the corresponding wiki. All the key bindings and how to remap them are listed under `:h vimwiki-mappings`. ### Basic Usage #### Navigation To navigate the vimwiki you need to know 3 basic commands. 1. Add a new page - To add a new page, you write the name of the main wiki-index page. Visually select the title of the page and press ``. This creates a link to a new markdown file. 2. Go to a new page - To follow a link, press `` on the link again, this opens the new markdown file. 3. Go one page back - To go back to the previous page, press ``. #### Diary To keep a diary in your vimwiki, use the `:VimwikiMakeDiaryNote` command. This opens a markdown file with the current date as its name. Write your entry and save it. To link the new entry to the diary index page, use `:VimwikiDiaryIndex` to go to the index page itself. Then execute `:VimwikiDiaryGenerateLinks`. This adds all unlinked diary entries to the diary index page. The default keybindings for this are - `[number] wi`: Move to the diary index of wiki i. - `[number] w w`: Open today's diary file for wiki i. - `[number] w t`: Open today's diary file for wiki i in a new tab. #### Encryption of pages Using the [vim gnupg](https://github.com/jamessan/vim-gnupg) plugin, you can encrypt your pages. This is done by first adding the folling line to your `.vimrc`. ```vim let g:GPGFilePattern = '*.\(gpg\|asc\|pgp\)\(.md\)\=' ``` To then create an encrypted entry, you have to add `.asc` to your link. The new file will then be named `filename.asc.md`. Opening it initially, a prompt will ask you which key to choose. Select thee correct key and close the prompt. #### Conversion to HTML Vimwiki has the built-in feature to export your wiki in to an HTML wiki. The build in version only supports the vimwiki markup language. If you write in this language, you should change the `vimwiki_list` command such that it includes `'syntax': 'vimwiki', 'ext': '.wiki'`. Afterwords you can just run ``` :VimwikiAll2HTML ``` To only convert the current page to Html, use `:Vimwiki2HTML` which converts all existing `.wiki` files in to Html files and links them against each other. To expand this capability to Markdown, you have to include certain wrapper scripts. - TODO