VimWiki

Table of Contents

安装篇

简介

http://code.google.com/p/vimwiki/给出的解释:

Vimwiki is a personal wiki for Vim -- a number of linked text files that have their own syntax highlighting.

通过VimWiki,你可以:

安装

首先下载插件(http://www.vim.org/scripts/script.php?script_id=2226http://code.google.com/p/vimwiki/),然后:

Windows: 
======== 
1. Unpack. 
2. Open vimwiki-N-N.vba with Vim. (N-N is version number ie 1-1) 
3. Source it with :so % command

Linux: 
====== 
1. Open vimwiki-N-N.vba.gz with Vim. (N-N is version number ie 1-1) 
2. Source it with :so % command

配置

官方建议在.vimrc中添加以下代码:

set nocompatible 
filetype plugin on 
syntax on

然后继续做其他配置:

" vimwiki
let g:vimwiki_list = [{'path': '~/vimwiki/',
    \ 'path_html': '~/vimwiki/html/',
    \ 'template_path': '~/vimwiki/template/',
    \ 'template_default': 'template',
    \ 'template_ext': '.html'}]

let g:vimwiki_camel_case = 0

map <F4> <Plug>Vimwiki2HTML
map <S-F4> <Plug>VimwikiAll2HTML

使用

打开wiki

<Leader>键一般是\

<Leader>ww -- Open default wiki index file. 
<Leader>wt -- Open default wiki index file in a new tab. 
<Leader>ws -- Select and open wiki index file. 
<Leader>wd -- Delete wiki file you are in. 
<Leader>wr -- [[Rename]] wiki file you are in. 
<Enter> -- Folow/Create wiki link 
<Shift-Enter> -- Split and folow/create wiki link 
<Ctrl-Enter> -- Vertical split and folow/create wiki link 
<Backspace> -- Go back to parent(previous) wiki link 
<Tab> -- Find next wiki link 
<Shift-Tab> -- Find previous wiki link

语法

可以:h vimwiki 或者看这个[http://vimwiki.googlecode.com/hg/misc/Vimwiki1.1.1QR.pdf|vimwiki quick reference card]

参考的文章

实用篇

记录Vimwiki的各种小技巧

wiki文件中代码高亮

使用nested_syntaxes选项,比如我的.vimrc文件:

class="brush: shell"
    'nested_syntaxes' : {'python': 'python', 'c++': 'cpp', 'shell': 'sh'}}]

里面保存的是键值对,键是brush调用时的name,值是vim filetype
然后在{{{code}}}里就可以按filetype来高亮代码了, Example:

XXXclass="brush: c++"
#include "helloworld.h"
int helloworld()
{
    printf("hello world");
}
XXX

注:XXX代表花括号

更多可以help vimwiki,然后搜vimwiki-option-nested_syntaxes

More:如果考虑在html时对<pre>代码高亮,可以考虑syntaxhighlight插件

History

Create 2012/05/08

Modify 2013/05/28


title: VimWiki
date: 2012-05-08 14:19
author: None
site: 帐号、业务安全|岂安