45 changed files with 17959 additions and 3820 deletions
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
# Filing a bug |
||||
|
||||
Before filing a bug or starting to write a patch, check the latest development version from |
||||
https://github.com/vimwiki/vimwiki/tree/dev to see if your problem is already fixed. |
||||
|
||||
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/ . |
||||
|
||||
# Creating a pull request |
||||
|
||||
If you want to provide a pull request on GitHub, please start from the `dev` branch, not from the |
||||
`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.) |
||||
|
||||
Make sure to update `doc/vimwiki.txt` with the following information: |
||||
|
||||
1. Update the changelog to include information on the new feature the PR introduces or the bug it |
||||
is fixing. |
||||
2. Add a help section to describe any new features or options. |
||||
2. If you are a first time contributor add your name to the list of contributors. |
||||
|
||||
# More info and advice for (aspiring) core developers |
||||
|
||||
- Before implementing a non-trivial feature, think twice what it means for the user. We should |
||||
always try to keep backward compatibility. If you are not sure, discuss it on GitHub. |
||||
- Also, when thinking about adding a new feature, it should be something which fits into the |
||||
overall design of Vimwiki and which a significant portion of the users may like. Keep in mind |
||||
that everybody has their own way to use Vimwiki. |
||||
- Keep the coding style consistent. |
||||
- Test your changes. Keep in mind that Vim has a ton of options and the users tons of different |
||||
setups. Take a little time to think about under which circumstances your changes could break. |
||||
|
||||
## Git branching model |
||||
|
||||
- there are two branches with eternal lifetime: |
||||
- `dev`: This is where the main development happens. Tasks which are done in one or only a few |
||||
commits go here directly. Always try to keep this branch in a working state, that is, if the |
||||
task you work on requires multiple commits, make sure intermediate commits don't make Vimwiki |
||||
unusable (or at least push these commits at one go). |
||||
- `master`: This branch is for released states only. Whenever a reasonable set of changes has |
||||
piled up in the `dev` branch, a [release is done](#Preparing a release). After a release, |
||||
`dev` has been merged into `master` and `master` got exactly one additional commit in which |
||||
the version number in `plugin/vimwiki.vim` is updated. Apart from these commits and the merge |
||||
commit from `dev`, nothing happens on `master`. Never should `master` merge into `dev`. When |
||||
the users ask, we should recommend this branch for them to use. |
||||
- Larger changes which require multiple commits are done in feature branches. They are based on |
||||
`dev` and merge into `dev` when the work is done. |
||||
|
||||
## Preparing a release |
||||
|
||||
1. `git checkout dev` |
||||
2. Update the changelog in the doc, nicely grouped, with a new version number and release date. |
||||
3. Update the list of contributors. |
||||
4. Update the version number at the top of the doc file. |
||||
5. If necessary, update the Readme and the home page. |
||||
6. `git checkout master && git merge dev` |
||||
7. Update the version number at the top of plugin/vimwiki.vim. |
||||
8. Set a tag with the version number in Git: `git tag vX.Y` |
||||
9. `git push --tags` |
||||
10. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag, convert the changelog from the |
||||
doc to markdown and post it there. Make plans to build an automatic converter and immediately |
||||
forget this plan. |
||||
11. Tell the world. |
||||
|
||||
%% vim:tw=99 |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
MIT License |
||||
|
||||
Copyright (c) 2008-2010 Maxim Kim |
||||
2013-2017 Daniel Schemala |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,161 @@
@@ -0,0 +1,161 @@
|
||||
VimWiki —— Vim 个人 Wiki 插件 |
||||
============================================================================== |
||||
|
||||
[English](README.md) |
||||
|
||||
 |
||||
 * |
||||
|
||||
介绍 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法高亮的文本文件。 |
||||
|
||||
通过 Vimwiki,你可以: |
||||
|
||||
* 组织笔记和想法 |
||||
* 管理待办事项 |
||||
* 编写文档 |
||||
* 坚持写日记 |
||||
* 将这一切导出成 HTML 网页 |
||||
|
||||
马上开始!按下 `<Leader>ww`(通常是 `\ww`)进入作为目录页的 wiki 文件,这个文件默认存放在 `~/vimwiki/index.wiki`。 |
||||
|
||||
在该文件中输入以下示例: |
||||
|
||||
= 我的个人知识库 = |
||||
* 任务列表 -- _昨天_ 就该完成的事!!! |
||||
* Gutenberg 计划 -- 好书给我力量。 |
||||
* 草稿 -- 临时记录一些东西。 |
||||
|
||||
把光标移到 `任务` 二字上,按 Enter(回车)创建链接。按下后,`任务`二字会变成 `[[任务]]` —— 这是一个 Vimwiki 链接。再次按 Enter 即可进入这个链接(打开新的 wiki 文件)。编辑这个新文件,保存,然后按 Backspace(退格)就能回到目录页。 |
||||
|
||||
如果 Vimwiki 链接长度不止一个单词(指的是英文单词),只需在 Visual 模式选择这段文本后按 Enter 即可。用上面的 `Gutenberg 计划` 试试吧。最终结果是这样: |
||||
|
||||
= 我的个人知识库 = |
||||
* [[任务列表]] -- _昨天_ 就该完成的事!!! |
||||
* [[Gutenberg 计划]] -- 好书给我力量。 |
||||
* 草稿 -- 临时记录一些东西。 |
||||
|
||||
|
||||
基本标记 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
= 一级标题 = |
||||
== 二级标题 == |
||||
=== 三级标题 === |
||||
|
||||
|
||||
*bold* -- 粗体文本 |
||||
_italic_ -- 斜体文本 |
||||
(应用于句中的汉字文本时,必须在标记前后加空格,例如:一段 *中文* 文本) |
||||
|
||||
[[wiki link]] -- wiki 链接 |
||||
[[wiki link|description]] -- 带有描述文本的 wiki 链接 |
||||
|
||||
|
||||
列表: |
||||
|
||||
* bullet list item 1(无编号列表) |
||||
- bullet list item 2 |
||||
- bullet list item 3 |
||||
* bullet list item 4 |
||||
* bullet list item 5 |
||||
* bullet list item 6 |
||||
* bullet list item 7 |
||||
- bullet list item 8 |
||||
- bullet list item 9 |
||||
|
||||
1. numbered list item 1(有编号列表) |
||||
2. numbered list item 2 |
||||
a) numbered list item 3 |
||||
b) numbered list item 4 |
||||
|
||||
|
||||
更多格式说明,请阅 `:h vimwiki-syntax` |
||||
|
||||
|
||||
键位绑定 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
normal 模式: |
||||
|
||||
* `<Leader>ww` -- 打开默认的 wiki 目录文件 |
||||
* `<Leader>wt` -- 在新标签(Tab)中打开 wiki 目录文件 |
||||
* `<Leader>ws` -- 在多个 wiki 中选择并打开该 wiki 的目录文件 |
||||
* `<Leader>wd` -- 删除当前 wiki 文件 |
||||
* `<Leader>wr` -- 重命名当前 wiki 文件 |
||||
* `<Enter>` -- 创建或打开 wiki 链接 |
||||
* `<Shift-Enter>` -- 先上下分屏再打开 wiki 链接(若非链接则先创建) |
||||
* `<Ctrl-Enter>` -- 先左右分屏再打开 wiki 链接(若非链接则先创建) |
||||
* `<Backspace>` -- 返回之前浏览的 wiki 文件 |
||||
* `<Tab>` -- 跳到本文件中下一个 wiki 链接 |
||||
* `<Shift-Tab>` -- 跳到本文件中上一个 wiki 链接 |
||||
|
||||
更多快捷键说明,请阅 `:h vimwiki-mappings` |
||||
|
||||
|
||||
命令 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
* `:Vimwiki2HTML` -- 将当前 wiki 文件转换成 HTML 网页 |
||||
* `:VimwikiAll2HTML` -- 把所有 wiki 文件转换成 HTML 网页 |
||||
* `:help vimwiki-commands` -- 显示全部命令 |
||||
|
||||
|
||||
安装 |
||||
============================================================================== |
||||
|
||||
准备工作 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
确保在 `vimrc` 中加入了以下设置: |
||||
|
||||
set nocompatible |
||||
filetype plugin on |
||||
syntax on |
||||
|
||||
没有这些设置,Vimwiki 将无法正常工作。 |
||||
|
||||
通过 [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) 安装(Vim 7.4.1528 后) |
||||
------------------------------------------------------------------------------ |
||||
|
||||
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki |
||||
|
||||
通过 [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) 安装 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
cd ~/.vim |
||||
mkdir bundle |
||||
cd bundle |
||||
git clone https://github.com/vimwiki/vimwiki.git |
||||
|
||||
通过 [Vim-Plug](https://github.com/junegunn/vim-plug) 安装 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
在 `vimrc` 中加入以下插件设置: |
||||
|
||||
Plug 'vimwiki/vimwiki' |
||||
|
||||
然后运行 `:PlugInstall`。 |
||||
|
||||
通过 [Vundle](https://github.com/VundleVim/Vundle.vim) 安装 |
||||
------------------------------------------------------------------------------ |
||||
|
||||
在 `vimrc` 中加入 `Plugin 'vimwiki/vimwiki'`,然后执行: |
||||
|
||||
vim +PluginInstall +qall |
||||
|
||||
或者下载 [zip 压缩包](https://github.com/vimwiki/vimwiki/archive/master.zip)然后解压到 `~/.vim/bundle/` 目录下。 |
||||
|
||||
安装后,启动 Vim 并执行 `:Helptags` 以及 `:help vimwiki`,检查安装是否成功。 |
||||
|
||||
|
||||
获取帮助 |
||||
============================================================================== |
||||
|
||||
遇到问题?在 Freenode 的 IRC 频道 `#vimwiki`([网页聊天](https://webchat.freenode.net/?channels=#vimwiki))提问,或者发送问题到[邮件列表](https://groups.google.com/forum/#!forum/vimwiki)上吧。 |
||||
|
||||
|
||||
---- |
||||
\* 前面截图中用的是 [solarized 配色方案](https://github.com/altercation/vim-colors-solarized)以及 [lightline](https://github.com/itchyny/lightline.vim) 插件。 |
@ -0,0 +1,250 @@
@@ -0,0 +1,250 @@
|
||||
# VimWiki: A Personal Wiki For Vim |
||||
|
||||
[中文](README-cn.md) |
||||
|
||||
- [Intro](#intro) |
||||
- [Installation](#installation) |
||||
- [Prerequisites](#prerequisites) |
||||
- [VIM Packages](#installation-using-vim-packages-since-vim-741528) |
||||
- [Pathogen](#installation-using-pathogen) |
||||
- [Vim-Plug](#installation-using-vim-plug) |
||||
- [Vundle](#installation-using-vundle) |
||||
- [Basic Markup](#basic-markup) |
||||
- [Lists](#lists) |
||||
- [Key Bindings](#key-bindings) |
||||
- [Commands](#commands) |
||||
- [Changing Wiki Syntax](#changing-wiki-syntax) |
||||
- [Getting Help](#getting-help) |
||||
- [Helping VimWiki](#helping-vimwiki) |
||||
- [Wiki](https://github.com/vimwiki/vimwiki/wiki) |
||||
- [License](#license) |
||||
|
||||
## Intro |
||||
|
||||
VimWiki is a personal wiki for Vim -- a number of linked text files that have |
||||
their own syntax highlighting. |
||||
|
||||
With VimWiki you can: |
||||
|
||||
* Organize notes and ideas |
||||
* Manage to-do lists |
||||
* Write documentation |
||||
* Maintain a diary |
||||
* Export everything to HTML |
||||
|
||||
To do a quick start press `<Leader>ww` (this is usually `\ww`) to go to your |
||||
index wiki file. By default it is located in `~/vimwiki/index.wiki`. |
||||
|
||||
Feed it with the following example: |
||||
|
||||
``` |
||||
|
||||
= My knowledge base = |
||||
* Tasks -- things to be done _yesterday_!!! |
||||
* Project Gutenberg -- good books are power. |
||||
* Scratchpad -- various temporary stuff. |
||||
|
||||
``` |
||||
|
||||
Place your cursor on `Tasks` and press Enter to create a link. Once pressed, |
||||
`Tasks` will become `[[Tasks]]` -- a VimWiki link. Press Enter again to |
||||
open it. Edit the file, save it, and then press Backspace to jump back to your |
||||
index. |
||||
|
||||
A VimWiki link can be constructed from more than one word. Just visually |
||||
select the words to be linked and press Enter. Try it with `Project Gutenberg`. |
||||
The result should look something like: |
||||
|
||||
``` |
||||
|
||||
= My knowledge base = |
||||
* [[Tasks]] -- things to be done _yesterday_!!! |
||||
* [[Project Gutenberg]] -- good books are power. |
||||
* Scratchpad -- various temporary stuff. |
||||
|
||||
``` |
||||
|
||||
## Screenshots |
||||
|
||||
 |
||||
 |
||||
 |
||||
 |
||||
|
||||
## Installation |
||||
|
||||
### Prerequisites |
||||
|
||||
Make sure you have these settings in your vimrc file: |
||||
|
||||
```vim |
||||
|
||||
set nocompatible |
||||
filetype plugin on |
||||
syntax on |
||||
|
||||
``` |
||||
|
||||
Without them VimWiki will not work properly. |
||||
|
||||
|
||||
#### Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528) |
||||
|
||||
```sh |
||||
|
||||
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki |
||||
|
||||
``` |
||||
|
||||
#### Installation using [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) |
||||
|
||||
```sh |
||||
|
||||
cd ~/.vim |
||||
mkdir bundle |
||||
cd bundle |
||||
git clone https://github.com/vimwiki/vimwiki.git |
||||
|
||||
``` |
||||
|
||||
#### Installation using [Vim-Plug](https://github.com/junegunn/vim-plug) |
||||
|
||||
Add the following to the plugin-configuration in your vimrc: |
||||
|
||||
```vim |
||||
|
||||
Plug 'vimwiki/vimwiki' |
||||
|
||||
``` |
||||
|
||||
Then run `:PlugInstall`. |
||||
|
||||
#### Installation using [Vundle](https://github.com/VundleVim/Vundle.vim) |
||||
|
||||
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run |
||||
|
||||
```sh |
||||
|
||||
vim +PluginInstall +qall |
||||
|
||||
``` |
||||
|
||||
Or download the [zip |
||||
archive](https://github.com/vimwiki/vimwiki/archive/master.zip) and extract it |
||||
in `~/.vim/bundle/` |
||||
|
||||
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was |
||||
installed. |
||||
|
||||
## Basic Markup |
||||
|
||||
``` |
||||
= Header1 = |
||||
== Header2 == |
||||
=== Header3 === |
||||
|
||||
|
||||
*bold* -- bold text |
||||
_italic_ -- italic text |
||||
|
||||
[[wiki link]] -- wiki link |
||||
[[wiki link|description]] -- wiki link with description |
||||
``` |
||||
|
||||
### Lists: |
||||
|
||||
``` |
||||
* bullet list item 1 |
||||
- bullet list item 2 |
||||
- bullet list item 3 |
||||
* bullet list item 4 |
||||
* bullet list item 5 |
||||
* bullet list item 6 |
||||
* bullet list item 7 |
||||
- bullet list item 8 |
||||
- bullet list item 9 |
||||
|
||||
1. numbered list item 1 |
||||
2. numbered list item 2 |
||||
a) numbered list item 3 |
||||
b) numbered list item 4 |
||||
``` |
||||
|
||||
For other syntax elements, see `:h vimwiki-syntax` |
||||
|
||||
## Key bindings |
||||
|
||||
Normal mode: |
||||
|
||||
* `<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>` -- Follow/Create wiki link |
||||
* `<Shift-Enter>` -- Split and follow/create wiki link |
||||
* `<Ctrl-Enter>` -- Vertical split and follow/create wiki link |
||||
* `<Backspace>` -- Go back to parent(previous) wiki link |
||||
* `<Tab>` -- Find next wiki link |
||||
* `<Shift-Tab>` -- Find previous wiki link |
||||
|
||||
For more keys, see `:h vimwiki-mappings` |
||||
|
||||
## Commands |
||||
|
||||
* `:Vimwiki2HTML` -- Convert current wiki link to HTML |
||||
* `:VimwikiAll2HTML` -- Convert all your wiki links to HTML |
||||
* `:help vimwiki-commands` -- list all commands |
||||
* `:help vimwiki` -- General vimwiki help docs |
||||
|
||||
## Changing Wiki Syntax |
||||
|
||||
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown |
||||
(markdown), and MediaWiki (media) |
||||
|
||||
If you would prefer to use either Markdown or MediaWiki syntaxes, set the |
||||
following option in your .vimrc: |
||||
|
||||
```vim |
||||
|
||||
let g:vimwiki_list = [{'path': '~/vimwiki/', |
||||
\ 'syntax': 'markdown', 'ext': '.md'}] |
||||
|
||||
``` |
||||
|
||||
## Getting help |
||||
|
||||
**Have a question?** |
||||
Visit the IRC channel [`#vimwiki`](https://webchat.freenode.net/?channels=#vimwiki) on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki), also synced to Matrix/Riot: `#vimwiki:matrix.org`) or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki). |
||||
|
||||
## Helping VimWiki |
||||
|
||||
VimWiki has a lot of users but only very few recurring developers or people |
||||
helping the community. Your help is therefore appreciated. Everyone can help! |
||||
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on |
||||
how you can help. |
||||
|
||||
## License |
||||
|
||||
MIT License |
||||
|
||||
Copyright (c) 2008-2010 Maxim Kim |
||||
2013-2017 Daniel Schemala |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash |
||||
|
||||
# |
||||
# This script converts markdown into html, to be used with vimwiki's |
||||
# "customwiki2html" option. Experiment with the two proposed methods by |
||||
# commenting / uncommenting the relevant lines below. |
||||
# |
||||
# NEW! An alternative converter was developed by Jason6Anderson, and can |
||||
# be located at https://github.com/vimwiki-backup/vimwiki/issues/384 |
||||
# |
||||
# |
||||
# To use this script, you must have the Discount converter installed. |
||||
# |
||||
# http://www.pell.portland.or.us/~orc/Code/discount/ |
||||
# |
||||
# To verify your installation, check that the commands markdown and mkd2text, |
||||
# are on your path. |
||||
# |
||||
# Also verify that this file is executable. |
||||
# |
||||
# Then, in your .vimrc file, set: |
||||
# |
||||
# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh' |
||||
# |
||||
# On your next restart, Vimwiki will run this script instead of using the |
||||
# internal wiki2html converter. |
||||
# |
||||
|
||||
MARKDOWN=markdown |
||||
MKD2HTML=mkd2html |
||||
|
||||
|
||||
FORCE="$1" |
||||
SYNTAX="$2" |
||||
EXTENSION="$3" |
||||
OUTPUTDIR="$4" |
||||
INPUT="$5" |
||||
CSSFILE="$6" |
||||
|
||||
FORCEFLAG= |
||||
|
||||
[ $FORCE -eq 0 ] || { FORCEFLAG="-f"; }; |
||||
[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; }; |
||||
|
||||
OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html |
||||
|
||||
# # Method 1: |
||||
# # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile] |
||||
# |
||||
# URLBASE=http://example.com |
||||
# $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT |
||||
|
||||
|
||||
# Method 2: |
||||
# mkd2html [-css file] [-header string] [-footer string] [file] |
||||
|
||||
$MKD2HTML -css "$CSSFILE" "$INPUT" |
||||
OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html |
||||
mv -f "$OUTPUTTMP" "$OUTPUT" |
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
@@ -0,0 +1,150 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki autoload plugin file |
||||
" Description: Link functions for markdown syntax |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
|
||||
function! s:safesubstitute(text, search, replace, mode) |
||||
" Substitute regexp but do not interpret replace |
||||
let escaped = escape(a:replace, '\&') |
||||
return substitute(a:text, a:search, escaped, a:mode) |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#markdown_base#scan_reflinks() |
||||
let mkd_refs = {} |
||||
" construct list of references using vimgrep |
||||
try |
||||
" Why noautocmd? Because https://github.com/vimwiki/vimwiki/issues/121 |
||||
noautocmd execute 'vimgrep #'.vimwiki#vars#get_syntaxlocal('rxMkdRef').'#j %' |
||||
catch /^Vim\%((\a\+)\)\=:E480/ " No Match |
||||
"Ignore it, and move on to the next file |
||||
endtry |
||||
|
||||
for d in getqflist() |
||||
let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ') |
||||
let descr = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchDescr')) |
||||
let url = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchUrl')) |
||||
if descr != '' && url != '' |
||||
let mkd_refs[descr] = url |
||||
endif |
||||
endfor |
||||
call vimwiki#vars#set_bufferlocal('markdown_refs', mkd_refs) |
||||
return mkd_refs |
||||
endfunction |
||||
|
||||
|
||||
" try markdown reference links |
||||
function! vimwiki#markdown_base#open_reflink(link) |
||||
" echom "vimwiki#markdown_base#open_reflink" |
||||
let link = a:link |
||||
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs') |
||||
if has_key(mkd_refs, link) |
||||
let url = mkd_refs[link] |
||||
call vimwiki#base#system_open_link(url) |
||||
return 1 |
||||
else |
||||
return 0 |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! s:normalize_link_syntax_n() |
||||
let lnum = line('.') |
||||
|
||||
" try WikiIncl |
||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl')) |
||||
if !empty(lnk) |
||||
" NO-OP !! |
||||
return |
||||
endif |
||||
|
||||
" try WikiLink0: replace with WikiLink1 |
||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0')) |
||||
if !empty(lnk) |
||||
let sub = vimwiki#base#normalize_link_helper(lnk, |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'), |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'), |
||||
\ vimwiki#vars#get_syntaxlocal('WikiLink1Template2')) |
||||
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'), sub) |
||||
return |
||||
endif |
||||
|
||||
" try WikiLink1: replace with WikiLink0 |
||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1')) |
||||
if !empty(lnk) |
||||
let sub = vimwiki#base#normalize_link_helper(lnk, |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'), |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'), |
||||
\ vimwiki#vars#get_global('WikiLinkTemplate2')) |
||||
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), sub) |
||||
return |
||||
endif |
||||
|
||||
" try Weblink |
||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink')) |
||||
if !empty(lnk) |
||||
let sub = vimwiki#base#normalize_link_helper(lnk, |
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'), |
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchDescr'), |
||||
\ vimwiki#vars#get_syntaxlocal('Weblink1Template')) |
||||
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'), sub) |
||||
return |
||||
endif |
||||
|
||||
" try Word (any characters except separators) |
||||
" rxWord is less permissive than rxWikiLinkUrl which is used in |
||||
" normalize_link_syntax_v |
||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord')) |
||||
if !empty(lnk) |
||||
let sub = vimwiki#base#normalize_link_helper(lnk, |
||||
\ vimwiki#vars#get_global('rxWord'), '', |
||||
\ vimwiki#vars#get_syntaxlocal('Weblink1Template')) |
||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub) |
||||
return |
||||
endif |
||||
|
||||
endfunction |
||||
|
||||
|
||||
function! s:normalize_link_syntax_v() |
||||
let lnum = line('.') |
||||
let sel_save = &selection |
||||
let &selection = "old" |
||||
let rv = @" |
||||
let rt = getregtype('"') |
||||
let done = 0 |
||||
|
||||
try |
||||
norm! gvy |
||||
let visual_selection = @" |
||||
let link = s:safesubstitute(vimwiki#vars#get_syntaxlocal('Weblink1Template'), |
||||
\ '__LinkUrl__', visual_selection, '') |
||||
let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '') |
||||
|
||||
call setreg('"', substitute(link, '\n', '', ''), visualmode()) |
||||
|
||||
" paste result |
||||
norm! `>""pgvd |
||||
|
||||
finally |
||||
call setreg('"', rv, rt) |
||||
let &selection = sel_save |
||||
endtry |
||||
|
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#markdown_base#normalize_link(is_visual_mode) |
||||
if 0 |
||||
" Syntax-specific links |
||||
else |
||||
if !a:is_visual_mode |
||||
call s:normalize_link_syntax_n() |
||||
elseif line("'<") == line("'>") |
||||
" action undefined for multi-line visual mode selections |
||||
call s:normalize_link_syntax_v() |
||||
endif |
||||
endif |
||||
endfunction |
||||
|
@ -0,0 +1,183 @@
@@ -0,0 +1,183 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki autoload plugin file |
||||
" Description: Path manipulation functions |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
|
||||
function! vimwiki#path#chomp_slash(str) |
||||
return substitute(a:str, '[/\\]\+$', '', '') |
||||
endfunction |
||||
|
||||
|
||||
" Define path-compare function, either case-sensitive or not, depending on OS. |
||||
if vimwiki#u#is_windows() |
||||
function! vimwiki#path#is_equal(p1, p2) |
||||
return a:p1 ==? a:p2 |
||||
endfunction |
||||
else |
||||
function! vimwiki#path#is_equal(p1, p2) |
||||
return a:p1 ==# a:p2 |
||||
endfunction |
||||
endif |
||||
|
||||
|
||||
" collapse sections like /a/b/../c to /a/c |
||||
function! vimwiki#path#normalize(path) |
||||
let path = a:path |
||||
while 1 |
||||
let result = substitute(path, '/[^/]\+/\.\.', '', '') |
||||
if result ==# path |
||||
break |
||||
endif |
||||
let path = result |
||||
endwhile |
||||
return result |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#path#path_norm(path) |
||||
" /-slashes |
||||
if a:path !~# '^scp:' |
||||
let path = substitute(a:path, '\', '/', 'g') |
||||
" treat multiple consecutive slashes as one path separator |
||||
let path = substitute(path, '/\+', '/', 'g') |
||||
" ensure that we are not fooled by a symbolic link |
||||
return resolve(path) |
||||
else |
||||
return a:path |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#path#is_link_to_dir(link) |
||||
" Check if link is to a directory. |
||||
" It should be ended with \ or /. |
||||
return a:link =~# '\m[/\\]$' |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#path#abs_path_of_link(link) |
||||
return vimwiki#path#normalize(expand("%:p:h").'/'.a:link) |
||||
endfunction |
||||
|
||||
|
||||
" return longest common path prefix of 2 given paths. |
||||
" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki' |
||||
function! vimwiki#path#path_common_pfx(path1, path2) |
||||
let p1 = split(a:path1, '[/\\]', 1) |
||||
let p2 = split(a:path2, '[/\\]', 1) |
||||
|
||||
let idx = 0 |
||||
let minlen = min([len(p1), len(p2)]) |
||||
while (idx < minlen) && vimwiki#path#is_equal(p1[idx], p2[idx]) |
||||
let idx = idx + 1 |
||||
endwhile |
||||
if idx == 0 |
||||
return '' |
||||
else |
||||
return join(p1[: idx-1], '/') |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#path#wikify_path(path) |
||||
let result = resolve(fnamemodify(a:path, ':p')) |
||||
if vimwiki#u#is_windows() |
||||
let result = substitute(result, '\\', '/', 'g') |
||||
endif |
||||
let result = vimwiki#path#chomp_slash(result) |
||||
return result |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#path#current_wiki_file() |
||||
return vimwiki#path#wikify_path(expand('%:p')) |
||||
endfunction |
||||
|
||||
|
||||
" Returns: the relative path from a:dir to a:file |
||||
function! vimwiki#path#relpath(dir, file) |
||||
let result = [] |
||||
let dir = split(a:dir, '/') |
||||
let file = split(a:file, '/') |
||||
while (len(dir) > 0 && len(file) > 0) && vimwiki#path#is_equal(dir[0], file[0]) |
||||
call remove(dir, 0) |
||||
call remove(file, 0) |
||||
endwhile |
||||
if empty(dir) && empty(file) |
||||
return './' |
||||
endif |
||||
for segment in dir |
||||
let result += ['..'] |
||||
endfor |
||||
for segment in file |
||||
let result += [segment] |
||||
endfor |
||||
let result_path = join(result, '/') |
||||
if a:file =~ '\m/$' |
||||
let result_path .= '/' |
||||
endif |
||||
return result_path |
||||
endfunction |
||||
|
||||
|
||||
" If the optional argument provided and nonzero, |
||||
" it will ask before creating a directory |
||||
" Returns: 1 iff directory exists or successfully created |
||||
function! vimwiki#path#mkdir(path, ...) |
||||
let path = expand(a:path) |
||||
|
||||
if path =~# '^scp:' |
||||
" we can not do much, so let's pretend everything is ok |
||||
return 1 |
||||
endif |
||||
|
||||
if isdirectory(path) |
||||
return 1 |
||||
else |
||||
if !exists("*mkdir") |
||||
return 0 |
||||
endif |
||||
|
||||
let path = vimwiki#path#chomp_slash(path) |
||||
if vimwiki#u#is_windows() && !empty(vimwiki#vars#get_global('w32_dir_enc')) |
||||
let path = iconv(path, &enc, vimwiki#vars#get_global('w32_dir_enc')) |
||||
endif |
||||
|
||||
if a:0 && a:1 && input("Vimwiki: Make new directory: ".path."\n [y]es/[N]o? ") !~? '^y' |
||||
return 0 |
||||
endif |
||||
|
||||
call mkdir(path, "p") |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#path#is_absolute(path) |
||||
if vimwiki#u#is_windows() |
||||
return a:path =~? '\m^\a:' |
||||
else |
||||
return a:path =~# '\m^/\|\~/' |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
" Combine a directory and a file into one path, doesn't generate duplicate |
||||
" path separator in case the directory is also having an ending / or \. This |
||||
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a |
||||
" valid path. |
||||
if vimwiki#u#is_windows() |
||||
function! vimwiki#path#join_path(directory, file) |
||||
let directory = vimwiki#path#chomp_slash(a:directory) |
||||
let file = substitute(a:file, '\m^[\\/]\+', '', '') |
||||
return directory . '/' . file |
||||
endfunction |
||||
else |
||||
function! vimwiki#path#join_path(directory, file) |
||||
let directory = substitute(a:directory, '\m/\+$', '', '') |
||||
let file = substitute(a:file, '\m^/\+', '', '') |
||||
return directory . '/' . file |
||||
endfunction |
||||
endif |
||||
|
@ -0,0 +1,342 @@
@@ -0,0 +1,342 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki autoload plugin file |
||||
|
||||
|
||||
let s:TAGS_METADATA_FILE_NAME = '.tags' |
||||
|
||||
|
||||
|
||||
" Tags metadata in-memory format: |
||||
" metadata := { 'pagename': [entries, ...] } |
||||
" entry := { 'tagname':..., 'lineno':..., 'link':... } |
||||
|
||||
" Tags metadata in-file format: |
||||
" |
||||
" Is based on CTags format (see |tags-file-format|). |
||||
" |
||||
" {tagaddress} is set to lineno. We'll let vim search by exact line number; we |
||||
" can afford that, we assume metadata file is always updated before use. |
||||
" |
||||
" Pagename and link are not saved in standard ctags fields, so we'll add |
||||
" an optional field, "vimwiki:". In this field, we encode tab-separated values |
||||
" of missing parameters -- "pagename" and "link". |
||||
|
||||
|
||||
|
||||
" Update tags metadata. |
||||
" a:full_rebuild == 1: re-scan entire wiki |
||||
" a:full_rebuild == 0: only re-scan current page |
||||
" a:all_files == '': only if the file is newer than .tags |
||||
function! vimwiki#tags#update_tags(full_rebuild, all_files) |
||||
let all_files = a:all_files != '' |
||||
if !a:full_rebuild |
||||
" Updating for one page (current) |
||||
let page_name = vimwiki#vars#get_bufferlocal('subdir') . expand('%:t:r') |
||||
" Collect tags in current file |
||||
let tags = s:scan_tags(getline(1, '$'), page_name) |
||||
" Load metadata file |
||||
let metadata = s:load_tags_metadata() |
||||
" Drop old tags |
||||
let metadata = s:remove_page_from_tags(metadata, page_name) |
||||
" Merge in the new ones |
||||
let metadata = s:merge_tags(metadata, page_name, tags) |
||||
" Save |
||||
call s:write_tags_metadata(metadata) |
||||
else " full rebuild |
||||
let files = vimwiki#base#find_files(vimwiki#vars#get_bufferlocal('wiki_nr'), 0) |
||||
let wiki_base_dir = vimwiki#vars#get_wikilocal('path') |
||||
let tags_file_last_modification = getftime(vimwiki#tags#metadata_file_path()) |
||||
let metadata = s:load_tags_metadata() |
||||
for file in files |
||||
if all_files || getftime(file) >= tags_file_last_modification |
||||
let subdir = vimwiki#base#subdir(wiki_base_dir, file) |
||||
let page_name = subdir . fnamemodify(file, ':t:r') |
||||
let tags = s:scan_tags(readfile(file), page_name) |
||||
let metadata = s:remove_page_from_tags(metadata, page_name) |
||||
let metadata = s:merge_tags(metadata, page_name, tags) |
||||
endif |
||||
endfor |
||||
call s:write_tags_metadata(metadata) |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
" Scans the list of text lines (argument) and produces tags metadata as a list of tag entries. |
||||
function! s:scan_tags(lines, page_name) |
||||
|
||||
let entries = [] |
||||
|
||||
" Code wireframe to scan for headers -- borrowed from |
||||
" vimwiki#base#get_anchors(), with minor modifications. |
||||
|
||||
let rxheader = vimwiki#vars#get_syntaxlocal('header_search') |
||||
let rxtag = vimwiki#vars#get_syntaxlocal('tag_search') |
||||
|
||||
let anchor_level = ['', '', '', '', '', '', ''] |
||||
let current_complete_anchor = '' |
||||
|
||||
let PROXIMITY_LINES_NR = 2 |
||||
let header_line_nr = - (2 * PROXIMITY_LINES_NR) |
||||
|
||||
for line_nr in range(1, len(a:lines)) |
||||
let line = a:lines[line_nr - 1] |
||||
|
||||
" process headers |
||||
let h_match = matchlist(line, rxheader) |
||||
if !empty(h_match) " got a header |
||||
let header_line_nr = line_nr |
||||
let header = vimwiki#u#trim(h_match[2]) |
||||
let level = len(h_match[1]) |
||||
let anchor_level[level-1] = header |
||||
for l in range(level, 6) |
||||
let anchor_level[l] = '' |
||||
endfor |
||||
if level == 1 |
||||
let current_complete_anchor = header |
||||
else |
||||
let current_complete_anchor = '' |
||||
for l in range(level-1) |
||||
if anchor_level[l] != '' |
||||
let current_complete_anchor .= anchor_level[l].'#' |
||||
endif |
||||
endfor |
||||
let current_complete_anchor .= header |
||||
endif |
||||
continue " tags are not allowed in headers |
||||
endif |
||||
|
||||
" TODO ignore verbatim blocks |
||||
|
||||
" Scan line for tags. There can be many of them. |
||||
let str = line |
||||
while 1 |
||||
let tag_group = matchstr(str, rxtag) |
||||
if tag_group == '' |
||||
break |
||||
endif |
||||
let tagend = matchend(str, rxtag) |
||||
let str = str[(tagend):] |
||||
for tag in split(tag_group, ':') |
||||
" Create metadata entry |
||||
let entry = {} |
||||
let entry.tagname = tag |
||||
let entry.lineno = line_nr |
||||
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0 |
||||
" Tag appeared at the top of the file |
||||
let entry.link = a:page_name |
||||
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR) |
||||
" Tag appeared right below a header |
||||
let entry.link = a:page_name . '#' . current_complete_anchor |
||||
else |
||||
" Tag stands on its own |
||||
let entry.link = a:page_name . '#' . tag |
||||
endif |
||||
call add(entries, entry) |
||||
endfor |
||||
endwhile |
||||
|
||||
endfor " loop over lines |
||||
return entries |
||||
endfunction |
||||
|
||||
|
||||
" Returns tags metadata file path |
||||
function! vimwiki#tags#metadata_file_path() abort |
||||
return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'), |
||||
\ s:TAGS_METADATA_FILE_NAME), ':p') |
||||
endfunction |
||||
|
||||
|
||||
" Loads tags metadata from file, returns a dictionary |
||||
function! s:load_tags_metadata() abort |
||||
let metadata_path = vimwiki#tags#metadata_file_path() |
||||
if !filereadable(metadata_path) |
||||
return {} |
||||
endif |
||||
let metadata = {} |
||||
for line in readfile(metadata_path) |
||||
if line =~ '^!_TAG_FILE_' |
||||
continue |
||||
endif |
||||
let parts = matchlist(line, '^\(.\{-}\);"\(.*\)$') |
||||
if parts[0] == '' || parts[1] == '' || parts[2] == '' |
||||
throw 'VimwikiTags1: Metadata file corrupted' |
||||
endif |
||||
let std_fields = split(parts[1], '\t') |
||||
if len(std_fields) != 3 |
||||
throw 'VimwikiTags2: Metadata file corrupted' |
||||
endif |
||||
let vw_part = parts[2] |
||||
if vw_part[0] != "\t" |
||||
throw 'VimwikiTags3: Metadata file corrupted' |
||||
endif |
||||
let vw_fields = split(vw_part[1:], "\t") |
||||
if len(vw_fields) != 1 || vw_fields[0] !~ '^vimwiki:' |
||||
throw 'VimwikiTags4: Metadata file corrupted' |
||||
endif |
||||
let vw_data = substitute(vw_fields[0], '^vimwiki:', '', '') |
||||
let vw_data = substitute(vw_data, '\\n', "\n", 'g') |
||||
let vw_data = substitute(vw_data, '\\r', "\r", 'g') |
||||
let vw_data = substitute(vw_data, '\\t', "\t", 'g') |
||||
let vw_data = substitute(vw_data, '\\\\', "\\", 'g') |
||||
let vw_fields = split(vw_data, "\t") |
||||
if len(vw_fields) != 2 |
||||
throw 'VimwikiTags5: Metadata file corrupted' |
||||
endif |
||||
let pagename = vw_fields[0] |
||||
let entry = {} |
||||
let entry.tagname = std_fields[0] |
||||
let entry.lineno = std_fields[2] |
||||
let entry.link = vw_fields[1] |
||||
if has_key(metadata, pagename) |
||||
call add(metadata[pagename], entry) |
||||
else |
||||
let metadata[pagename] = [entry] |
||||
endif |
||||
endfor |
||||
return metadata |
||||
endfunction |
||||
|
||||
|
||||
" Removes all entries for given page from metadata in-place. Returns updated |
||||
" metadata (just in case). |
||||
function! s:remove_page_from_tags(metadata, page_name) |
||||
if has_key(a:metadata, a:page_name) |
||||
call remove(a:metadata, a:page_name) |
||||
return a:metadata |
||||
else |
||||
return a:metadata |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
" Merges metadata of one file into a:metadata |
||||
function! s:merge_tags(metadata, pagename, file_metadata) |
||||
let metadata = a:metadata |
||||
let metadata[a:pagename] = a:file_metadata |
||||
return metadata |
||||
endfunction |
||||
|
||||
|
||||
" Compares two actual lines from tags file. Return value is in strcmp style. |
||||
" See help on sort() -- that's what this function is going to be used for. |
||||
" See also s:write_tags_metadata below -- that's where we compose these tags |
||||
" file lines. |
||||
" |
||||
" This function is needed for tags sorting, since plain sort() compares line |
||||
" numbers as strings, not integers, and so, for example, tag at line 14 |
||||
" preceeds the same tag on the same page at line 9. (Because string "14" is |
||||
" alphabetically 'less than' string "9".) |
||||
function! s:tags_entry_cmp(i1, i2) |
||||
let items = [] |
||||
for orig_item in [a:i1, a:i2] |
||||
let fields = split(orig_item, "\t") |
||||
let item = {} |
||||
let item.text = fields[0]."\t".fields[1] |
||||
let item.lineno = 0 + matchstr(fields[2], '\m\d\+') |
||||
call add(items, item) |
||||
endfor |
||||
if items[0].text ># items[1].text |
||||
return 1 |
||||
elseif items[0].text <# items[1].text |
||||
return -1 |
||||
elseif items[0].lineno > items[1].lineno |
||||
return 1 |
||||
elseif items[0].lineno < items[1].lineno |
||||
return -1 |
||||
else |
||||
return 0 |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
" Saves metadata object into a file. Throws exceptions in case of problems. |
||||
function! s:write_tags_metadata(metadata) |
||||
let metadata_path = vimwiki#tags#metadata_file_path() |
||||
let tags = [] |
||||
for pagename in keys(a:metadata) |
||||
for entry in a:metadata[pagename] |
||||
let entry_data = pagename . "\t" . entry.link |
||||
let entry_data = substitute(entry_data, "\\", '\\\\', 'g') |
||||
let entry_data = substitute(entry_data, "\t", '\\t', 'g') |
||||
let entry_data = substitute(entry_data, "\r", '\\r', 'g') |
||||
let entry_data = substitute(entry_data, "\n", '\\n', 'g') |
||||
call add(tags, |
||||
\ entry.tagname . "\t" |
||||
\ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t" |
||||
\ . entry.lineno |
||||
\ . ';"' |
||||
\ . "\t" . "vimwiki:" . entry_data |
||||
\) |
||||
endfor |
||||
endfor |
||||
call sort(tags, "s:tags_entry_cmp") |
||||
call insert(tags, "!_TAG_FILE_SORTED\t1\t") |
||||
call writefile(tags, metadata_path) |
||||
endfunction |
||||
|
||||
|
||||
" Returns list of unique tags found in the .tags file |
||||
function! vimwiki#tags#get_tags() |
||||
let metadata = s:load_tags_metadata() |
||||
let tags = {} |
||||
for entries in values(metadata) |
||||
for entry in entries |
||||
let tags[entry.tagname] = 1 |
||||
endfor |
||||
endfor |
||||
return keys(tags) |
||||
endfunction |
||||
|
||||
|
||||
" Similar to vimwiki#base#generate_links. In the current buffer, appends |
||||
" tags and references to all their instances. If no arguments (tags) are |
||||
" specified, outputs all tags. |
||||
function! vimwiki#tags#generate_tags(...) abort |
||||
let need_all_tags = (a:0 == 0) |
||||
let specific_tags = a:000 |
||||
|
||||
let metadata = s:load_tags_metadata() |
||||
|
||||
" make a dictionary { tag_name: [tag_links, ...] } |
||||
let tags_entries = {} |
||||
for entries in values(metadata) |
||||
for entry in entries |
||||
if has_key(tags_entries, entry.tagname) |
||||
call add(tags_entries[entry.tagname], entry.link) |
||||
else |
||||
let tags_entries[entry.tagname] = [entry.link] |
||||
endif |
||||
endfor |
||||
endfor |
||||
|
||||
let lines = [] |
||||
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' ' |
||||
for tagname in sort(keys(tags_entries)) |
||||
if need_all_tags || index(specific_tags, tagname) != -1 |
||||
call extend(lines, [ |
||||
\ '', |
||||
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', tagname, ''), |
||||
\ '' ]) |
||||
for taglink in sort(tags_entries[tagname]) |
||||
call add(lines, bullet . substitute(vimwiki#vars#get_global('WikiLinkTemplate1'), |
||||
\ '__LinkUrl__', taglink, '')) |
||||
endfor |
||||
endif |
||||
endfor |
||||
|
||||
let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*' |
||||
\ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' ' |
||||
\ .vimwiki#vars#get_syntaxlocal('rxWikiLink').'$\)' |
||||
|
||||
call vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx, line('$')+1, 1) |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort |
||||
" We can safely ignore args if we use -custom=complete option, Vim engine |
||||
" will do the job of filtering. |
||||
let taglist = vimwiki#tags#get_tags() |
||||
return join(taglist, "\n") |
||||
endfunction |
||||
|
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki autoload plugin file |
||||
" Description: Utility functions |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
function! vimwiki#u#trim(string, ...) |
||||
let chars = '' |
||||
if a:0 > 0 |
||||
let chars = a:1 |
||||
endif |
||||
let res = substitute(a:string, '^[[:space:]'.chars.']\+', '', '') |
||||
let res = substitute(res, '[[:space:]'.chars.']\+$', '', '') |
||||
return res |
||||
endfunction |
||||
|
||||
|
||||
" Builtin cursor doesn't work right with unicode characters. |
||||
function! vimwiki#u#cursor(lnum, cnum) |
||||
exe a:lnum |
||||
exe 'normal! 0'.a:cnum.'|' |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#u#is_windows() |
||||
return has("win32") || has("win64") || has("win95") || has("win16") |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#u#is_macos() |
||||
if has("mac") || has("macunix") || has("gui_mac") |
||||
return 1 |
||||
endif |
||||
" that still doesn't mean we are not on Mac OS |
||||
let os = substitute(system('uname'), '\n', '', '') |
||||
return os == 'Darwin' || os == 'Mac' |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#u#count_first_sym(line) |
||||
let first_sym = matchstr(a:line, '\S') |
||||
return len(matchstr(a:line, first_sym.'\+')) |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#u#escape(string) |
||||
return escape(a:string, '~.*[]\^$') |
||||
endfunction |
||||
|
||||
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links |
||||
function vimwiki#u#reload_regexes() |
||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim' |
||||
endfunction |
||||
|
||||
|
||||
" Load syntax-specific functionality |
||||
function vimwiki#u#reload_regexes_custom() |
||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim' |
||||
endfunction |
||||
|
||||
|
||||
" Backward compatible version of the built-in function shiftwidth() |
||||
if exists('*shiftwidth') |
||||
func vimwiki#u#sw() |
||||
return shiftwidth() |
||||
endfunc |
||||
else |
||||
func vimwiki#u#sw() |
||||
return &sw |
||||
endfunc |
||||
endif |
||||
|
@ -0,0 +1,850 @@
@@ -0,0 +1,850 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki autoload plugin file |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
|
||||
|
||||
" ------------------------------------------------------------------------------------------------ |
||||
" This file provides functions to manage the various state variables which are needed during a |
||||
" Vimwiki session. |
||||
" They consist of: |
||||
" |
||||
" - global variables. These are stored in the dict g:vimwiki_global_vars. They consist mainly of |
||||
" global user variables and syntax stuff which is the same for every syntax. |
||||
" |
||||
" - wiki-local variables. They are stored in g:vimwiki_wikilocal_vars which is a list of |
||||
" dictionaries, one dict for every registered wiki. The last dictionary contains default values |
||||
" (used for temporary wikis). |
||||
" |
||||
" - syntax variables. Stored in the dict g:vimwiki_syntax_variables which holds all the regexes and |
||||
" other stuff which is needed for highlighting. |
||||
" |
||||
" - buffer-local variables. They are stored as buffer variables directly (b:foo) |
||||
|
||||
" As a developer, you should, if possible, only use the get_ and set_ functions for these types of |
||||
" variables, not the underlying dicts! |
||||
" ------------------------------------------------------------------------------------------------ |
||||
|
||||
|
||||
function! s:populate_global_variables() |
||||
|
||||
let g:vimwiki_global_vars = {} |
||||
|
||||
call s:read_global_settings_from_user() |
||||
call s:normalize_global_settings() |
||||
|
||||
" non-configurable global variables: |
||||
|
||||
" Scheme regexes must be defined even if syntax file is not loaded yet cause users should be |
||||
" able to <leader>w<leader>w without opening any vimwiki file first |
||||
let g:vimwiki_global_vars.schemes = join(['wiki\d\+', 'diary', 'local'], '\|') |
||||
let g:vimwiki_global_vars.web_schemes1 = join(['http', 'https', 'file', 'ftp', 'gopher', |
||||
\ 'telnet', 'nntp', 'ldap', 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh', |
||||
\ 'git', 'ssh', 'fish', 'sftp'], '\|') |
||||
let web_schemes2 = |
||||
\ join(['mailto', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data'], '\|') |
||||
|
||||
let g:vimwiki_global_vars.rxSchemes = '\%('. |
||||
\ g:vimwiki_global_vars.schemes . '\|'. |
||||
\ g:vimwiki_global_vars.web_schemes1 . '\|'. |
||||
\ web_schemes2 . |
||||
\ '\)' |
||||
|
||||
" match URL for common protocols; see http://en.wikipedia.org/wiki/URI_scheme |
||||
" http://tools.ietf.org/html/rfc3986 |
||||
let rxWebProtocols = |
||||
\ '\%('. |
||||
\ '\%('. |
||||
\ '\%('.g:vimwiki_global_vars.web_schemes1 . '\):'. |
||||
\ '\%(//\)'. |
||||
\ '\)'. |
||||
\ '\|'. |
||||
\ '\%('.web_schemes2.'\):'. |
||||
\ '\)' |
||||
|
||||
let g:vimwiki_global_vars.rxWeblinkUrl = rxWebProtocols . '\S\{-1,}'. '\%(([^ \t()]*)\)\=' |
||||
|
||||
let wikilink_prefix = '[[' |
||||
let wikilink_suffix = ']]' |
||||
let wikilink_separator = '|' |
||||
let g:vimwiki_global_vars.rx_wikilink_prefix = vimwiki#u#escape(wikilink_prefix) |
||||
let g:vimwiki_global_vars.rx_wikilink_suffix = vimwiki#u#escape(wikilink_suffix) |
||||
let g:vimwiki_global_vars.rx_wikilink_separator = vimwiki#u#escape(wikilink_separator) |
||||
|
||||
" templates for the creation of wiki links |
||||
" [[URL]] |
||||
let g:vimwiki_global_vars.WikiLinkTemplate1 = wikilink_prefix . '__LinkUrl__'. wikilink_suffix |
||||
" [[URL|DESCRIPTION]] |
||||
let g:vimwiki_global_vars.WikiLinkTemplate2 = wikilink_prefix . '__LinkUrl__'. wikilink_separator |
||||
\ . '__LinkDescription__' . wikilink_suffix |
||||
|
||||
let valid_chars = '[^\\\]]' |
||||
let g:vimwiki_global_vars.rxWikiLinkUrl = valid_chars.'\{-}' |
||||
let g:vimwiki_global_vars.rxWikiLinkDescr = valid_chars.'\{-}' |
||||
|
||||
" this regexp defines what can form a link when the user presses <CR> in the |
||||
" buffer (and not on a link) to create a link |
||||
" basically, it's Ascii alphanumeric characters plus #|./@-_~ plus all |
||||
" non-Ascii characters, except that . is not accepted as the last character |
||||
let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]*[^[:blank:]!"$%&''()*+.,:;<=>?\[\]\\^`{}]' |
||||
|
||||
let g:vimwiki_global_vars.rx_wikilink_prefix1 = g:vimwiki_global_vars.rx_wikilink_prefix . |
||||
\ g:vimwiki_global_vars.rxWikiLinkUrl . g:vimwiki_global_vars.rx_wikilink_separator |
||||
let g:vimwiki_global_vars.rx_wikilink_suffix1 = g:vimwiki_global_vars.rx_wikilink_suffix |
||||
|
||||
let g:vimwiki_global_vars.rxWikiInclPrefix = '{{' |
||||
let g:vimwiki_global_vars.rxWikiInclSuffix = '}}' |
||||
let g:vimwiki_global_vars.rxWikiInclSeparator = '|' |
||||
" '{{__LinkUrl__}}' |
||||
let g:vimwiki_global_vars.WikiInclTemplate1 = g:vimwiki_global_vars.rxWikiInclPrefix |
||||
\ .'__LinkUrl__'. g:vimwiki_global_vars.rxWikiInclSuffix |
||||
" '{{__LinkUrl____LinkDescription__}}' |
||||
let g:vimwiki_global_vars.WikiInclTemplate2 = g:vimwiki_global_vars.rxWikiInclPrefix |
||||
\ . '__LinkUrl__' . g:vimwiki_global_vars.rxWikiInclSeparator . '__LinkDescription__' |
||||
\ . g:vimwiki_global_vars.rxWikiInclSuffix |
||||
|
||||
let valid_chars = '[^\\\}]' |
||||
let g:vimwiki_global_vars.rxWikiInclUrl = valid_chars.'\{-}' |
||||
let g:vimwiki_global_vars.rxWikiInclArg = valid_chars.'\{-}' |
||||
let g:vimwiki_global_vars.rxWikiInclArgs = '\%('. g:vimwiki_global_vars.rxWikiInclSeparator. |
||||
\ g:vimwiki_global_vars.rxWikiInclArg. '\)'.'\{-}' |
||||
|
||||
" *. {{URL}[{...}]} - i.e. {{URL}}, {{URL|ARG1}}, {{URL|ARG1|ARG2}}, etc. |
||||
" *a) match {{URL}[{...}]} |
||||
let g:vimwiki_global_vars.rxWikiIncl = g:vimwiki_global_vars.rxWikiInclPrefix. |
||||
\ g:vimwiki_global_vars.rxWikiInclUrl. |
||||
\ g:vimwiki_global_vars.rxWikiInclArgs. g:vimwiki_global_vars.rxWikiInclSuffix |
||||
" *b) match URL within {{URL}[{...}]} |
||||
let g:vimwiki_global_vars.rxWikiInclMatchUrl = g:vimwiki_global_vars.rxWikiInclPrefix. |
||||
\ '\zs'. g:vimwiki_global_vars.rxWikiInclUrl . '\ze'. |
||||
\ g:vimwiki_global_vars.rxWikiInclArgs . g:vimwiki_global_vars.rxWikiInclSuffix |
||||
|
||||
let g:vimwiki_global_vars.rxWikiInclPrefix1 = g:vimwiki_global_vars.rxWikiInclPrefix. |
||||
\ g:vimwiki_global_vars.rxWikiInclUrl . g:vimwiki_global_vars.rxWikiInclSeparator |
||||
let g:vimwiki_global_vars.rxWikiInclSuffix1 = g:vimwiki_global_vars.rxWikiInclArgs. |
||||
\ g:vimwiki_global_vars.rxWikiInclSuffix |
||||
|
||||
let g:vimwiki_global_vars.rxTodo = '\C\<\%(TODO\|DONE\|STARTED\|FIXME\|FIXED\|XXX\)\>' |
||||
|
||||
" default colors when headers of different levels are highlighted differently |
||||
" not making it yet another option; needed by ColorScheme autocommand |
||||
let g:vimwiki_global_vars.hcolor_guifg_light = ['#aa5858', '#507030', '#1030a0', '#103040' |
||||
\ , '#505050', '#636363'] |
||||
let g:vimwiki_global_vars.hcolor_ctermfg_light = ['DarkRed', 'DarkGreen', 'DarkBlue', 'Black' |
||||
\ , 'Black', 'Black'] |
||||
let g:vimwiki_global_vars.hcolor_guifg_dark = ['#e08090', '#80e090', '#6090e0', '#c0c0f0' |
||||
\ , '#e0e0f0', '#f0f0f0'] |
||||
let g:vimwiki_global_vars.hcolor_ctermfg_dark = ['Red', 'Green', 'Blue', 'White', 'White' |
||||
\ , 'White'] |
||||
endfunction |
||||
|
||||
|
||||
function! s:read_global_settings_from_user() |
||||
let global_settings = { |
||||
\ 'CJK_length': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'auto_chdir': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'autowriteall': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'conceallevel': {'type': type(0), 'default': 2, 'min': 0, 'max': 3}, |
||||
\ 'diary_months': {'type': type({}), 'default': |
||||
\ { |
||||
\ 1: 'January', 2: 'February', 3: 'March', |
||||
\ 4: 'April', 5: 'May', 6: 'June', |
||||
\ 7: 'July', 8: 'August', 9: 'September', |
||||
\ 10: 'October', 11: 'November', 12: 'December' |
||||
\ }}, |
||||
\ 'dir_link': {'type': type(''), 'default': ''}, |
||||
\ 'ext2syntax': {'type': type({}), 'default': {}}, |
||||
\ 'folding': {'type': type(''), 'default': '', 'possible_values': ['', 'expr', 'syntax', |
||||
\ 'list', 'custom', ':quick', 'expr:quick', 'syntax:quick', 'list:quick', |
||||
\ 'custom:quick']}, |
||||
\ 'global_ext': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'hl_cb_checked': {'type': type(0), 'default': 0, 'min': 0, 'max': 2}, |
||||
\ 'hl_headers': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'html_header_numbering': {'type': type(0), 'default': 0, 'min': 0, 'max': 6}, |
||||
\ 'html_header_numbering_sym': {'type': type(''), 'default': ''}, |
||||
\ 'list_ignore_newline': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'text_ignore_newline': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'listsyms': {'type': type(''), 'default': ' .oOX', 'min_length': 2}, |
||||
\ 'listsym_rejected': {'type': type(''), 'default': '-', 'length': 1}, |
||||
\ 'map_prefix': {'type': type(''), 'default': '<Leader>w'}, |
||||
\ 'menu': {'type': type(''), 'default': 'Vimwiki'}, |
||||
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'table_mappings': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'toc_header': {'type': type(''), 'default': 'Contents', 'min_length': 1}, |
||||
\ 'url_maxsave': {'type': type(0), 'default': 15, 'min': 0}, |
||||
\ 'use_calendar': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'use_mouse': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'user_htmls': {'type': type(''), 'default': ''}, |
||||
\ 'valid_html_tags': {'type': type(''), 'default': |
||||
\ 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em'}, |
||||
\ 'w32_dir_enc': {'type': type(''), 'default': ''}, |
||||
\ } |
||||
|
||||
" copy the user's settings from variables of the form g:vimwiki_<option> into the dict |
||||
" g:vimwiki_global_vars (or set a default value) |
||||
for key in keys(global_settings) |
||||
if exists('g:vimwiki_'.key) |
||||
let users_value = g:vimwiki_{key} |
||||
let value_infos = global_settings[key] |
||||
|
||||
call s:check_users_value(key, users_value, value_infos, 1) |
||||
|
||||
let g:vimwiki_global_vars[key] = users_value |
||||
else |
||||
let g:vimwiki_global_vars[key] = global_settings[key].default |
||||
endif |
||||
endfor |
||||
|
||||
" validate some settings individually |
||||
|
||||
let key = 'diary_months' |
||||
let users_value = g:vimwiki_global_vars[key] |
||||
for month in range(1, 12) |
||||
if !has_key(users_value, month) || type(users_value[month]) != type('') || |
||||
\ empty(users_value[month]) |
||||
echom printf('Vimwiki Error: The provided value ''%s'' of the option ''g:vimwiki_%s'' is' |
||||
\ . ' invalid. See '':h g:vimwiki_%s''.', string(users_value), key, key) |
||||
break |
||||
endif |
||||
endfor |
||||
|
||||
let key = 'ext2syntax' |
||||
let users_value = g:vimwiki_global_vars[key] |
||||
for ext in keys(users_value) |
||||
if empty(ext) || index(['markdown', 'media', 'mediawiki', 'default'], users_value[ext]) == -1 |
||||
echom printf('Vimwiki Error: The provided value ''%s'' of the option ''g:vimwiki_%s'' is' |
||||
\ . ' invalid. See '':h g:vimwiki_%s''.', string(users_value), key, key) |
||||
break |
||||
endif |
||||
endfor |
||||
|
||||
endfunction |
||||
|
||||
|
||||
function! s:normalize_global_settings() |
||||
let keys = keys(g:vimwiki_global_vars.ext2syntax) |
||||
for ext in keys |
||||
" ensure the file extensions in ext2syntax start with a dot |
||||
if ext[0] != '.' |
||||
let new_ext = '.' . ext |
||||
let g:vimwiki_global_vars.ext2syntax[new_ext] = g:vimwiki_global_vars.ext2syntax[ext] |
||||
call remove(g:vimwiki_global_vars.ext2syntax, ext) |
||||
endif |
||||
" for convenience, we also allow the term 'mediawiki' |
||||
if g:vimwiki_global_vars.ext2syntax[ext] ==# 'mediawiki' |
||||
let g:vimwiki_global_vars.ext2syntax[ext] = 'media' |
||||
endif |
||||
endfor |
||||
endfunction |
||||
|
||||
|
||||
function! s:populate_wikilocal_options() |
||||
let default_values = { |
||||
\ 'auto_diary_index': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'auto_export': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'auto_tags': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'auto_toc': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'automatic_nested_syntaxes': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, |
||||
\ 'css_name': {'type': type(''), 'default': 'style.css', 'min_length': 1}, |
||||
\ 'custom_wiki2html': {'type': type(''), 'default': ''}, |
||||
\ 'custom_wiki2html_args': {'type': type(''), 'default': ''}, |
||||
\ 'diary_header': {'type': type(''), 'default': 'Diary', 'min_length': 1}, |
||||
\ 'diary_index': {'type': type(''), 'default': 'diary', 'min_length': 1}, |
||||
\ 'diary_rel_path': {'type': type(''), 'default': 'diary/', 'min_length': 1}, |
||||
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']}, |
||||
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1}, |
||||
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1}, |
||||
\ 'list_margin': {'type': type(0), 'default': -1, 'min': -1}, |
||||
\ 'maxhi': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, |
||||
\ 'nested_syntaxes': {'type': type({}), 'default': {}}, |
||||
\ 'path': {'type': type(''), 'default': $HOME . '/vimwiki/', 'min_length': 1}, |
||||
\ 'path_html': {'type': type(''), 'default': ''}, |
||||
\ 'syntax': {'type': type(''), 'default': 'default', |
||||
\ 'possible_values': ['default', 'markdown', 'media', 'mediawiki']}, |
||||
\ 'template_default': {'type': type(''), 'default': 'default', 'min_length': 1}, |
||||
\ 'template_ext': {'type': type(''), 'default': '.tpl'}, |
||||
\ 'template_path': {'type': type(''), 'default': $HOME . '/vimwiki/templates/'}, |
||||
\ } |
||||
|
||||
let g:vimwiki_wikilocal_vars = [] |
||||
|
||||
let default_wiki_settings = {} |
||||
for key in keys(default_values) |
||||
if exists('g:vimwiki_'.key) |
||||
call s:check_users_value(key, g:vimwiki_{key}, default_values[key], 1) |
||||
let default_wiki_settings[key] = g:vimwiki_{key} |
||||
else |
||||
let default_wiki_settings[key] = default_values[key].default |
||||
endif |
||||
endfor |
||||
|
||||
" set the wiki-local variables according to g:vimwiki_list (or the default settings) |
||||
if exists('g:vimwiki_list') |
||||
for users_wiki_settings in g:vimwiki_list |
||||
let new_wiki_settings = {} |
||||
for key in keys(default_values) |
||||
if has_key(users_wiki_settings, key) |
||||
call s:check_users_value(key, users_wiki_settings[key], default_values[key], 0) |
||||
let new_wiki_settings[key] = users_wiki_settings[key] |
||||
else |
||||
let new_wiki_settings[key] = default_wiki_settings[key] |
||||
endif |
||||
endfor |
||||
|
||||
let new_wiki_settings.is_temporary_wiki = 0 |
||||
|
||||
call add(g:vimwiki_wikilocal_vars, new_wiki_settings) |
||||
endfor |
||||
else |
||||
" if the user hasn't registered any wiki, we register one wiki using the default values |
||||
let new_wiki_settings = deepcopy(default_wiki_settings) |
||||
let new_wiki_settings.is_temporary_wiki = 0 |
||||
call add(g:vimwiki_wikilocal_vars, new_wiki_settings) |
||||
endif |
||||
|
||||
" default values for temporary wikis |
||||
let temporary_wiki_settings = deepcopy(default_wiki_settings) |
||||
let temporary_wiki_settings.is_temporary_wiki = 1 |
||||
call add(g:vimwiki_wikilocal_vars, temporary_wiki_settings) |
||||
|
||||
" check some values individually |
||||
let key = 'nested_syntaxes' |
||||
for wiki_settings in g:vimwiki_wikilocal_vars |
||||
let users_value = wiki_settings[key] |
||||
for keyword in keys(users_value) |
||||
if type(keyword) != type('') || empty(keyword) || type(users_value[keyword]) != type('') || |
||||
\ empty(users_value[keyword]) |
||||
echom printf('Vimwiki Error: The provided value ''%s'' of the option ''g:vimwiki_%s'' is' |
||||
\ . ' invalid. See '':h g:vimwiki_%s''.', string(users_value), key, key) |
||||
break |
||||
endif |
||||
endfor |
||||
endfor |
||||
|
||||
call s:normalize_wikilocal_settings() |
||||
endfunction |
||||
|
||||
|
||||
function! s:check_users_value(key, users_value, value_infos, comes_from_global_variable) |
||||
let type_code_to_name = { |
||||
\ type(0): 'number', |
||||
\ type(''): 'string', |
||||
\ type([]): 'list', |
||||
\ type({}): 'dictionary'} |
||||
|
||||
let setting_origin = a:comes_from_global_variable ? |
||||
\ printf('''g:vimwiki_%s''', a:key) : |
||||
\ printf('''%s'' in g:vimwiki_list', a:key) |
||||
|
||||
if has_key(a:value_infos, 'type') && type(a:users_value) != a:value_infos.type |
||||
echom printf('Vimwiki Error: The provided value of the option %s is a %s, ' . |
||||
\ 'but expected is a %s. See '':h g:vimwiki_%s''.', setting_origin, |
||||
\ type_code_to_name[type(a:users_value)], type_code_to_name[a:value_infos.type], a:key) |
||||
endif |
||||
|
||||
if a:value_infos.type == type(0) && has_key(a:value_infos, 'min') && |
||||
\ a:users_value < a:value_infos.min |
||||
echom printf('Vimwiki Error: The provided value ''%i'' of the option %s is' |
||||
\ . ' too small. The minimum value is %i. See '':h g:vimwiki_%s''.', a:users_value, |
||||
\ setting_origin, a:value_infos.min, a:key) |
||||
endif |
||||
|
||||
if a:value_infos.type == type(0) && has_key(a:value_infos, 'max') && |
||||
\ a:users_value > a:value_infos.max |
||||
echom printf('Vimwiki Error: The provided value ''%i'' of the option %s is' |
||||
\ . ' too large. The maximum value is %i. See '':h g:vimwiki_%s''.', a:users_value, |
||||
\ setting_origin, a:value_infos.max, a:key) |
||||
endif |
||||
|
||||
if has_key(a:value_infos, 'possible_values') && |
||||
\ index(a:value_infos.possible_values, a:users_value) == -1 |
||||
echom printf('Vimwiki Error: The provided value ''%s'' of the option %s is' |
||||
\ . ' invalid. Allowed values are %s. See ''g:vimwiki_%s''.', a:users_value, |
||||
\ setting_origin, string(a:value_infos.possible_values), a:key) |
||||
endif |
||||
|
||||
if a:value_infos.type == type('') && has_key(a:value_infos, 'length') && |
||||
\ strwidth(a:users_value) != a:value_infos.length |
||||
echom printf('Vimwiki Error: The provided value ''%s'' of the option %s must' |
||||
\ . ' contain exactly %i character(s) but has %i. See '':h g:vimwiki_%s''.', |
||||
\ a:users_value, setting_origin, a:value_infos.length, strwidth(a:users_value), a:key) |
||||
endif |
||||
|
||||
if a:value_infos.type == type('') && has_key(a:value_infos, 'min_length') && |
||||
\ strwidth(a:users_value) < a:value_infos.min_length |
||||
echom printf('Vimwiki Error: The provided value ''%s'' of the option %s must' |
||||
\ . ' have at least %d character(s) but has %d. See '':h g:vimwiki_%s''.', a:users_value, |
||||
\ setting_origin, a:value_infos.min_length, strwidth(a:users_value), a:key) |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! s:normalize_wikilocal_settings() |
||||
for wiki_settings in g:vimwiki_wikilocal_vars |
||||
let wiki_settings['path'] = s:normalize_path(wiki_settings['path']) |
||||
|
||||
let path_html = wiki_settings['path_html'] |
||||
if !empty(path_html) |
||||
let wiki_settings['path_html'] = s:normalize_path(path_html) |
||||
else |
||||
let wiki_settings['path_html'] = s:normalize_path( |
||||
\ substitute(wiki_settings['path'], '[/\\]\+$', '', '').'_html/') |
||||
endif |
||||
|
||||
let wiki_settings['template_path'] = s:normalize_path(wiki_settings['template_path']) |
||||
let wiki_settings['diary_rel_path'] = s:normalize_path(wiki_settings['diary_rel_path']) |
||||
|
||||
let ext = wiki_settings['ext'] |
||||
if !empty(ext) && ext[0] != '.' |
||||
let wiki_settings['ext'] = '.' . ext |
||||
endif |
||||
|
||||
" for convenience, we also allow the term 'mediawiki' |
||||
if wiki_settings.syntax ==# 'mediawiki' |
||||
let wiki_settings.syntax = 'media' |
||||
endif |
||||
endfor |
||||
endfunction |
||||
|
||||
|
||||
function! s:normalize_path(path) |
||||
" trim trailing / and \ because otherwise resolve() doesn't work quite right |
||||
let path = substitute(a:path, '[/\\]\+$', '', '') |
||||
if path !~# '^scp:' |
||||
return resolve(expand(path)).'/' |
||||
else |
||||
return path.'/' |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#populate_syntax_vars(syntax) |
||||
if !exists('g:vimwiki_syntax_variables') |
||||
let g:vimwiki_syntax_variables = {} |
||||
endif |
||||
|
||||
if has_key(g:vimwiki_syntax_variables, a:syntax) |
||||
return |
||||
endif |
||||
|
||||
let g:vimwiki_syntax_variables[a:syntax] = {} |
||||
|
||||
execute 'runtime! syntax/vimwiki_'.a:syntax.'.vim' |
||||
|
||||
" generic stuff |
||||
let header_symbol = g:vimwiki_syntax_variables[a:syntax].rxH |
||||
if g:vimwiki_syntax_variables[a:syntax].symH |
||||
" symmetric headers |
||||
for i in range(1,6) |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Template'] = |
||||
\ repeat(header_symbol, i).' __Header__ '.repeat(header_symbol, i) |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i] = |
||||
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']' |
||||
\ .header_symbol.'\{'.i.'}\s*$' |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Start'] = |
||||
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']' |
||||
\ .header_symbol.'\{'.i.'}\s*$' |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_End'] = |
||||
\ '^\s*'.header_symbol.'\{1,'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']' |
||||
\ .header_symbol.'\{1,'.i.'}\s*$' |
||||
endfor |
||||
let g:vimwiki_syntax_variables[a:syntax].rxHeader = |
||||
\ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*[^'.header_symbol.']\ze\1\s*$' |
||||
else |
||||
" asymmetric |
||||
for i in range(1,6) |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Template'] = |
||||
\ repeat(header_symbol, i).' __Header__' |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i] = |
||||
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*$' |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Start'] = |
||||
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*$' |
||||
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_End'] = |
||||
\ '^\s*'.header_symbol.'\{1,'.i.'}[^'.header_symbol.'].*$' |
||||
endfor |
||||
let g:vimwiki_syntax_variables[a:syntax].rxHeader = |
||||
\ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*\ze$' |
||||
endif |
||||
|
||||
let g:vimwiki_syntax_variables[a:syntax].rxPreStart = |
||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxPreStart |
||||
let g:vimwiki_syntax_variables[a:syntax].rxPreEnd = |
||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxPreEnd.'\s*$' |
||||
|
||||
let g:vimwiki_syntax_variables[a:syntax].rxMathStart = |
||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathStart |
||||
let g:vimwiki_syntax_variables[a:syntax].rxMathEnd = |
||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathEnd.'\s*$' |
||||
|
||||
" list stuff |
||||
let g:vimwiki_syntax_variables[a:syntax].rx_bullet_chars = |
||||
\ '['.join(g:vimwiki_syntax_variables[a:syntax].bullet_types, '').']\+' |
||||
|
||||
let g:vimwiki_syntax_variables[a:syntax].multiple_bullet_chars = |
||||
\ g:vimwiki_syntax_variables[a:syntax].recurring_bullets |
||||
\ ? g:vimwiki_syntax_variables[a:syntax].bullet_types : [] |
||||
|
||||
let g:vimwiki_syntax_variables[a:syntax].number_kinds = [] |
||||
let g:vimwiki_syntax_variables[a:syntax].number_divisors = '' |
||||
for i in g:vimwiki_syntax_variables[a:syntax].number_types |
||||
call add(g:vimwiki_syntax_variables[a:syntax].number_kinds, i[0]) |
||||
let g:vimwiki_syntax_variables[a:syntax].number_divisors .= vimwiki#u#escape(i[1]) |
||||
endfor |
||||
|
||||
let char_to_rx = {'1': '\d\+', 'i': '[ivxlcdm]\+', 'I': '[IVXLCDM]\+', |
||||
\ 'a': '\l\{1,2}', 'A': '\u\{1,2}'} |
||||
|
||||
"create regexp for bulleted list items |
||||
if !empty(g:vimwiki_syntax_variables[a:syntax].bullet_types) |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListBullet = |
||||
\ join( map(copy(g:vimwiki_syntax_variables[a:syntax].bullet_types), |
||||
\'vimwiki#u#escape(v:val).' |
||||
\ .'repeat("\\+", g:vimwiki_syntax_variables[a:syntax].recurring_bullets)' |
||||
\ ) , '\|') |
||||
else |
||||
"regex that matches nothing |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListBullet = '$^' |
||||
endif |
||||
|
||||
"create regex for numbered list items |
||||
if !empty(g:vimwiki_syntax_variables[a:syntax].number_types) |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '\C\%(' |
||||
for type in g:vimwiki_syntax_variables[a:syntax].number_types[:-2] |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber .= char_to_rx[type[0]] . |
||||
\ vimwiki#u#escape(type[1]) . '\|' |
||||
endfor |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber .= |
||||
\ char_to_rx[g:vimwiki_syntax_variables[a:syntax].number_types[-1][0]]. |
||||
\ vimwiki#u#escape(g:vimwiki_syntax_variables[a:syntax].number_types[-1][1]) . '\)' |
||||
else |
||||
"regex that matches nothing |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '$^' |
||||
endif |
||||
|
||||
"the user can set the listsyms as string, but vimwiki needs a list |
||||
let g:vimwiki_syntax_variables[a:syntax].listsyms_list = |
||||
\ split(vimwiki#vars#get_global('listsyms'), '\zs') |
||||
if match(vimwiki#vars#get_global('listsyms'), vimwiki#vars#get_global('listsym_rejected')) != -1 |
||||
echomsg 'Vimwiki Warning: the value of g:vimwiki_listsym_rejected (''' |
||||
\ . vimwiki#vars#get_global('listsym_rejected') |
||||
\ . ''') must not be a part of g:vimwiki_listsyms (''' . |
||||
\ . vimwiki#vars#get_global('listsyms') . ''')' |
||||
endif |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListItemWithoutCB = |
||||
\ '^\s*\%(\('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\)\|\(' |
||||
\ .g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\)\s' |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListItem = |
||||
\ g:vimwiki_syntax_variables[a:syntax].rxListItemWithoutCB |
||||
\ . '\+\%(\[\(['.vimwiki#vars#get_global('listsyms') |
||||
\ . vimwiki#vars#get_global('listsym_rejected').']\)\]\s\)\?' |
||||
if g:vimwiki_syntax_variables[a:syntax].recurring_bullets |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren = |
||||
\ '^\('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\)\s\+\[[' |
||||
\ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[-1] |
||||
\ . vimwiki#vars#get_global('listsym_rejected') . ']\]\s.*\%(\n\%(\1\%(' |
||||
\ .g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\).*\|^$\|\s.*\)\)*' |
||||
else |
||||
let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren = |
||||
\ '^\(\s*\)\%('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\|' |
||||
\ . g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\s\+\[[' |
||||
\ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[-1] |
||||
\ . vimwiki#vars#get_global('listsym_rejected') . ']\]\s.*\%(\n\%(\1\s.*\|^$\)\)*' |
||||
endif |
||||
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L)) |
||||
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl . |
||||
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@=' |
||||
let g:vimwiki_syntax_variables[a:syntax].rxWeblink = |
||||
\ '\<'. g:vimwiki_global_vars.rxWeblinkUrl . '\S*' |
||||
" 0a) match URL within URL |
||||
let g:vimwiki_syntax_variables[a:syntax].rxWeblinkMatchUrl = |
||||
\ g:vimwiki_syntax_variables[a:syntax].rxWeblink |
||||
" 0b) match DESCRIPTION within URL |
||||
let g:vimwiki_syntax_variables[a:syntax].rxWeblinkMatchDescr = '' |
||||
|
||||
" template for matching all wiki links with a given target file |
||||
let g:vimwiki_syntax_variables[a:syntax].WikiLinkMatchUrlTemplate = |
||||
\ g:vimwiki_global_vars.rx_wikilink_prefix . |
||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' . |
||||
\ g:vimwiki_global_vars.rx_wikilink_suffix . |
||||
\ '\|' . |
||||
\ g:vimwiki_global_vars.rx_wikilink_prefix . |
||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' . |
||||
\ g:vimwiki_global_vars.rx_wikilink_separator . |
||||
\ '.*' . |
||||
\ g:vimwiki_global_vars.rx_wikilink_suffix |
||||
|
||||
" a) match [[URL|DESCRIPTION]] |
||||
let g:vimwiki_syntax_variables[a:syntax].rxWikiLink = g:vimwiki_global_vars.rx_wikilink_prefix. |
||||
\ g:vimwiki_global_vars.rxWikiLinkUrl.'\%('.g:vimwiki_global_vars.rx_wikilink_separator. |
||||
\ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix |
||||
let g:vimwiki_syntax_variables[a:syntax].rxAnyLink = |
||||
\ g:vimwiki_syntax_variables[a:syntax].rxWikiLink.'\|'. |
||||
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.g:vimwiki_syntax_variables[a:syntax].rxWeblink |
||||
" b) match URL within [[URL|DESCRIPTION]] |
||||
let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchUrl = |
||||
\ g:vimwiki_global_vars.rx_wikilink_prefix . '\zs'. g:vimwiki_global_vars.rxWikiLinkUrl |
||||
\ .'\ze\%('. g:vimwiki_global_vars.rx_wikilink_separator |
||||
\ . g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix |
||||
" c) match DESCRIPTION within [[URL|DESCRIPTION]] |
||||
let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchDescr = |
||||
\ g:vimwiki_global_vars.rx_wikilink_prefix . g:vimwiki_global_vars.rxWikiLinkUrl |
||||
\ . g:vimwiki_global_vars.rx_wikilink_separator.'\%(\zs' |
||||
\ . g:vimwiki_global_vars.rxWikiLinkDescr. '\ze\)\?' |
||||
\ . g:vimwiki_global_vars.rx_wikilink_suffix |
||||
|
||||
if a:syntax ==# 'markdown' |
||||
call s:populate_extra_markdown_vars() |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! s:populate_extra_markdown_vars() |
||||
let mkd_syntax = g:vimwiki_syntax_variables['markdown'] |
||||
|
||||
" 0a) match [[URL|DESCRIPTION]] |
||||
let mkd_syntax.rxWikiLink0 = mkd_syntax.rxWikiLink |
||||
" 0b) match URL within [[URL|DESCRIPTION]] |
||||
let mkd_syntax.rxWikiLink0MatchUrl = mkd_syntax.rxWikiLinkMatchUrl |
||||
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]] |
||||
let mkd_syntax.rxWikiLink0MatchDescr = mkd_syntax.rxWikiLinkMatchDescr |
||||
|
||||
let wikilink_md_prefix = '[' |
||||
let wikilink_md_suffix = ']' |
||||
let wikilink_md_separator = '][' |
||||
let rx_wikilink_md_separator = vimwiki#u#escape(wikilink_md_separator) |
||||
let mkd_syntax.rx_wikilink_md_prefix = vimwiki#u#escape(wikilink_md_prefix) |
||||
let mkd_syntax.rx_wikilink_md_suffix = vimwiki#u#escape(wikilink_md_suffix) |
||||
|
||||
" [URL][] |
||||
let mkd_syntax.WikiLink1Template1 = wikilink_md_prefix . '__LinkUrl__'. |
||||
\ wikilink_md_separator. wikilink_md_suffix |
||||
" [DESCRIPTION][URL] |
||||
let mkd_syntax.WikiLink1Template2 = wikilink_md_prefix. '__LinkDescription__'. |
||||
\ wikilink_md_separator. '__LinkUrl__'. wikilink_md_suffix |
||||
let mkd_syntax.WikiLinkMatchUrlTemplate .= |
||||
\ '\|' . |
||||
\ mkd_syntax.rx_wikilink_md_prefix . |
||||
\ '.*' . |
||||
\ rx_wikilink_md_separator . |
||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' . |
||||
\ mkd_syntax.rx_wikilink_md_suffix . |
||||
\ '\|' . |
||||
\ mkd_syntax.rx_wikilink_md_prefix . |
||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' . |
||||
\ rx_wikilink_md_separator . |
||||
\ mkd_syntax.rx_wikilink_md_suffix |
||||
|
||||
let valid_chars = '[^\\\[\]]' |
||||
let mkd_syntax.rxWikiLink1Url = valid_chars.'\{-}' |
||||
let mkd_syntax.rxWikiLink1Descr = valid_chars.'\{-}' |
||||
let mkd_syntax.rxWikiLink1InvalidPrefix = '[\]\[]\@<!' |
||||
let mkd_syntax.rxWikiLink1InvalidSuffix = '[\]\[]\@!' |
||||
let mkd_syntax.rx_wikilink_md_prefix = mkd_syntax.rxWikiLink1InvalidPrefix. |
||||
\ mkd_syntax.rx_wikilink_md_prefix |
||||
let mkd_syntax.rx_wikilink_md_suffix = mkd_syntax.rx_wikilink_md_suffix. |
||||
\ mkd_syntax.rxWikiLink1InvalidSuffix |
||||
|
||||
" 1. match [URL][], [DESCRIPTION][URL] |
||||
let mkd_syntax.rxWikiLink1 = mkd_syntax.rx_wikilink_md_prefix. |
||||
\ mkd_syntax.rxWikiLink1Url. rx_wikilink_md_separator. |
||||
\ mkd_syntax.rx_wikilink_md_suffix. |
||||
\ '\|'. mkd_syntax.rx_wikilink_md_prefix. |
||||
\ mkd_syntax.rxWikiLink1Descr . rx_wikilink_md_separator. |
||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix |
||||
" 2. match URL within [URL][], [DESCRIPTION][URL] |
||||
let mkd_syntax.rxWikiLink1MatchUrl = mkd_syntax.rx_wikilink_md_prefix. |
||||
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. rx_wikilink_md_separator. |
||||
\ mkd_syntax.rx_wikilink_md_suffix. |
||||
\ '\|'. mkd_syntax.rx_wikilink_md_prefix. |
||||
\ mkd_syntax.rxWikiLink1Descr. rx_wikilink_md_separator. |
||||
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_suffix |
||||
" 3. match DESCRIPTION within [DESCRIPTION][URL] |
||||
let mkd_syntax.rxWikiLink1MatchDescr = mkd_syntax.rx_wikilink_md_prefix. |
||||
\ '\zs'. mkd_syntax.rxWikiLink1Descr.'\ze'. rx_wikilink_md_separator. |
||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix |
||||
|
||||
let mkd_syntax.rxWikiLink1Prefix1 = mkd_syntax.rx_wikilink_md_prefix |
||||
let mkd_syntax.rxWikiLink1Suffix1 = rx_wikilink_md_separator. |
||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix |
||||
|
||||
" 1. match ANY wikilink |
||||
let mkd_syntax.rxWikiLink = mkd_syntax.rxWikiLink0 . '\|' . mkd_syntax.rxWikiLink1 |
||||
" 2. match URL within ANY wikilink |
||||
let mkd_syntax.rxWikiLinkMatchUrl = mkd_syntax.rxWikiLink0MatchUrl . '\|' . |
||||
\ mkd_syntax.rxWikiLink1MatchUrl |
||||
" 3. match DESCRIPTION within ANY wikilink |
||||
let mkd_syntax.rxWikiLinkMatchDescr = mkd_syntax.rxWikiLink0MatchDescr . '\|' . |
||||
\ mkd_syntax.rxWikiLink1MatchDescr |
||||
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L)) |
||||
let mkd_syntax.rxWeblink0 = mkd_syntax.rxWeblink |
||||
" 0a) match URL within URL |
||||
let mkd_syntax.rxWeblinkMatchUrl0 = mkd_syntax.rxWeblinkMatchUrl |
||||
" 0b) match DESCRIPTION within URL |
||||
let mkd_syntax.rxWeblinkMatchDescr0 = mkd_syntax.rxWeblinkMatchDescr |
||||
|
||||
let mkd_syntax.rxWeblink1Prefix = '[' |
||||
let mkd_syntax.rxWeblink1Suffix = ')' |
||||
let mkd_syntax.rxWeblink1Separator = '](' |
||||
" [DESCRIPTION](URL) |
||||
let mkd_syntax.Weblink1Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'. |
||||
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. |
||||
\ mkd_syntax.rxWeblink1Suffix |
||||
|
||||
let valid_chars = '[^\\]' |
||||
|
||||
let mkd_syntax.rxWeblink1Prefix = vimwiki#u#escape(mkd_syntax.rxWeblink1Prefix) |
||||
let mkd_syntax.rxWeblink1Suffix = vimwiki#u#escape(mkd_syntax.rxWeblink1Suffix) |
||||
let mkd_syntax.rxWeblink1Separator = vimwiki#u#escape(mkd_syntax.rxWeblink1Separator) |
||||
let mkd_syntax.rxWeblink1Url = valid_chars.'\{-}' |
||||
let mkd_syntax.rxWeblink1Descr = valid_chars.'\{-}' |
||||
|
||||
" 1. [DESCRIPTION](URL) |
||||
" 1a) match [DESCRIPTION](URL) |
||||
let mkd_syntax.rxWeblink1 = mkd_syntax.rxWeblink1Prefix. |
||||
\ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Separator. |
||||
\ mkd_syntax.rxWeblink1Descr . mkd_syntax.rxWeblink1Suffix |
||||
" 1b) match URL within [DESCRIPTION](URL) |
||||
let mkd_syntax.rxWeblink1MatchUrl = mkd_syntax.rxWeblink1Prefix. |
||||
\ mkd_syntax.rxWeblink1Descr. mkd_syntax.rxWeblink1Separator. |
||||
\ '\zs' . mkd_syntax.rxWeblink1Url . '\ze' . mkd_syntax.rxWeblink1Suffix |
||||
" 1c) match DESCRIPTION within [DESCRIPTION](URL) |
||||
let mkd_syntax.rxWeblink1MatchDescr = mkd_syntax.rxWeblink1Prefix. |
||||
\ '\zs'.mkd_syntax.rxWeblink1Descr.'\ze'. mkd_syntax.rxWeblink1Separator. |
||||
\ mkd_syntax.rxWeblink1Url. mkd_syntax.rxWeblink1Suffix |
||||
|
||||
" TODO: image links too !! |
||||
let mkd_syntax.rxWeblink1Prefix1 = mkd_syntax.rxWeblink1Prefix |
||||
let mkd_syntax.rxWeblink1Suffix1 = mkd_syntax.rxWeblink1Separator. |
||||
\ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Suffix |
||||
|
||||
" *a) match ANY weblink |
||||
let mkd_syntax.rxWeblink = ''. |
||||
\ mkd_syntax.rxWeblink1.'\|'. |
||||
\ mkd_syntax.rxWeblink0 |
||||
" *b) match URL within ANY weblink |
||||
let mkd_syntax.rxWeblinkMatchUrl = ''. |
||||
\ mkd_syntax.rxWeblink1MatchUrl.'\|'. |
||||
\ mkd_syntax.rxWeblinkMatchUrl0 |
||||
" *c) match DESCRIPTION within ANY weblink |
||||
let mkd_syntax.rxWeblinkMatchDescr = ''. |
||||
\ mkd_syntax.rxWeblink1MatchDescr.'\|'. |
||||
\ mkd_syntax.rxWeblinkMatchDescr0 |
||||
|
||||
let mkd_syntax.rxAnyLink = mkd_syntax.rxWikiLink.'\|'. |
||||
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.mkd_syntax.rxWeblink |
||||
|
||||
let mkd_syntax.rxMkdRef = '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)'. |
||||
\ mkd_syntax.rxWeblink0 |
||||
let mkd_syntax.rxMkdRefMatchDescr = |
||||
\ '\[\zs'.g:vimwiki_global_vars.rxWikiLinkDescr.'\ze]:\%(\s\+\|\n\)'. mkd_syntax.rxWeblink0 |
||||
let mkd_syntax.rxMkdRefMatchUrl = |
||||
\ '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)\zs'. |
||||
\ mkd_syntax.rxWeblink0.'\ze' |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#init() |
||||
call s:populate_global_variables() |
||||
call s:populate_wikilocal_options() |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#get_syntaxlocal(key, ...) |
||||
if a:0 |
||||
let syntax = a:1 |
||||
else |
||||
let syntax = vimwiki#vars#get_wikilocal('syntax') |
||||
endif |
||||
if !exists('g:vimwiki_syntax_variables') || !has_key(g:vimwiki_syntax_variables, syntax) |
||||
call vimwiki#vars#populate_syntax_vars(syntax) |
||||
endif |
||||
|
||||
return g:vimwiki_syntax_variables[syntax][a:key] |
||||
endfunction |
||||
|
||||
|
||||
" Get a variable for the buffer we are currently in or for the given buffer (number or name). |
||||
" Populate the variable, if it doesn't exist. |
||||
function! vimwiki#vars#get_bufferlocal(key, ...) |
||||
let buffer = a:0 ? a:1 : '%' |
||||
|
||||
let value = getbufvar(buffer, 'vimwiki_'.a:key, '/\/\') |
||||
if type(value) != 1 || value !=# '/\/\' |
||||
return value |
||||
elseif a:key ==# 'wiki_nr' |
||||
call setbufvar(buffer, 'vimwiki_wiki_nr', vimwiki#base#find_wiki(expand('%:p'))) |
||||
elseif a:key ==# 'subdir' |
||||
call setbufvar(buffer, 'vimwiki_subdir', vimwiki#base#current_subdir()) |
||||
elseif a:key ==# 'invsubdir' |
||||
let subdir = vimwiki#vars#get_bufferlocal('subdir') |
||||
call setbufvar(buffer, 'vimwiki_invsubdir', vimwiki#base#invsubdir(subdir)) |
||||
elseif a:key ==# 'existing_wikifiles' |
||||
call setbufvar(buffer, 'vimwiki_existing_wikifiles', |
||||
\ vimwiki#base#get_wikilinks(vimwiki#vars#get_bufferlocal('wiki_nr'), 1)) |
||||
elseif a:key ==# 'existing_wikidirs' |
||||
call setbufvar(buffer, 'vimwiki_existing_wikidirs', |
||||
\ vimwiki#base#get_wiki_directories(vimwiki#vars#get_bufferlocal('wiki_nr'))) |
||||
elseif a:key ==# 'prev_link' |
||||
call setbufvar(buffer, 'vimwiki_prev_link', []) |
||||
elseif a:key ==# 'markdown_refs' |
||||
call setbufvar(buffer, 'vimwiki_markdown_refs', vimwiki#markdown_base#scan_reflinks()) |
||||
else |
||||
echoerr 'Vimwiki Error: unknown buffer variable ' . string(a:key) |
||||
endif |
||||
|
||||
return getbufvar(buffer, 'vimwiki_'.a:key) |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#set_bufferlocal(key, value, ...) |
||||
let buffer = a:0 ? a:1 : '%' |
||||
call setbufvar(buffer, 'vimwiki_' . a:key, a:value) |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#get_global(key) |
||||
return g:vimwiki_global_vars[a:key] |
||||
endfunction |
||||
|
||||
|
||||
" the second argument can be a wiki number. When absent, the wiki of the currently active buffer is |
||||
" used |
||||
function! vimwiki#vars#get_wikilocal(key, ...) |
||||
if a:0 |
||||
return g:vimwiki_wikilocal_vars[a:1][a:key] |
||||
else |
||||
return g:vimwiki_wikilocal_vars[vimwiki#vars#get_bufferlocal('wiki_nr')][a:key] |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#get_wikilocal_default(key) |
||||
return g:vimwiki_wikilocal_vars[-1][a:key] |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#set_wikilocal(key, value, wiki_nr) |
||||
if a:wiki_nr == len(g:vimwiki_wikilocal_vars) - 1 |
||||
call insert(g:vimwiki_wikilocal_vars, {}, -1) |
||||
endif |
||||
let g:vimwiki_wikilocal_vars[a:wiki_nr][a:key] = a:value |
||||
endfunction |
||||
|
||||
|
||||
function! vimwiki#vars#add_temporary_wiki(settings) |
||||
let new_temp_wiki_settings = copy(g:vimwiki_wikilocal_vars[-1]) |
||||
for [key, value] in items(a:settings) |
||||
let new_temp_wiki_settings[key] = value |
||||
endfor |
||||
call insert(g:vimwiki_wikilocal_vars, new_temp_wiki_settings, -1) |
||||
call s:normalize_wikilocal_settings() |
||||
endfunction |
||||
|
||||
|
||||
" number of registered wikis + temporary |
||||
function! vimwiki#vars#number_of_wikis() |
||||
return len(g:vimwiki_wikilocal_vars) - 1 |
||||
endfunction |
||||
|
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 276 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 249 KiB |
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 305 KiB |
@ -1,85 +1,110 @@
@@ -1,85 +1,110 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki syntax file |
||||
" Default syntax |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
" Description: Defines default syntax |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
|
||||
" s:default_syntax is kind of a reference to the dict in |
||||
" g:vimwiki_syntax_variables['default']. It is used here simply as an |
||||
" abbreviation for the latter. |
||||
let s:default_syntax = g:vimwiki_syntax_variables['default'] |
||||
|
||||
|
||||
|
||||
" text: $ equation_inline $ |
||||
let s:default_syntax.rxEqIn = '\$[^$`]\+\$' |
||||
let s:default_syntax.char_eqin = '\$' |
||||
|
||||
" text: *strong* |
||||
" let g:vimwiki_rxBold = '\*[^*]\+\*' |
||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
" let s:default_syntax.rxBold = '\*[^*]\+\*' |
||||
let s:default_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'\*'. |
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'. |
||||
\'\*'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_bold = '*' |
||||
let s:default_syntax.char_bold = '*' |
||||
|
||||
" text: _emphasis_ |
||||
" let g:vimwiki_rxItalic = '_[^_]\+_' |
||||
let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
" let s:default_syntax.rxItalic = '_[^_]\+_' |
||||
let s:default_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'_'. |
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'. |
||||
\'_'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_italic = '_' |
||||
let s:default_syntax.char_italic = '_' |
||||
|
||||
" text: *_bold italic_* or _*italic bold*_ |
||||
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
let s:default_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'\*_'. |
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. |
||||
\'_\*'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_bolditalic = '\*_' |
||||
let s:default_syntax.char_bolditalic = '\*_' |
||||
|
||||
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
let s:default_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'_\*'. |
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. |
||||
\'\*_'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_italicbold = '_\*' |
||||
let s:default_syntax.char_italicbold = '_\*' |
||||
|
||||
" text: `code` |
||||
let g:vimwiki_rxCode = '`[^`]\+`' |
||||
let g:vimwiki_char_code = '`' |
||||
let s:default_syntax.rxCode = '`[^`]\+`' |
||||
let s:default_syntax.char_code = '`' |
||||
|
||||
" text: ~~deleted text~~ |
||||
let g:vimwiki_rxDelText = '\~\~[^~`]\+\~\~' |
||||
let g:vimwiki_char_deltext = '\~\~' |
||||
let s:default_syntax.rxDelText = '\~\~[^~`]\+\~\~' |
||||
let s:default_syntax.char_deltext = '\~\~' |
||||
|
||||
" text: ^superscript^ |
||||
let g:vimwiki_rxSuperScript = '\^[^^`]\+\^' |
||||
let g:vimwiki_char_superscript = '^' |
||||
let s:default_syntax.rxSuperScript = '\^[^^`]\+\^' |
||||
let s:default_syntax.char_superscript = '^' |
||||
|
||||
" text: ,,subscript,, |
||||
let g:vimwiki_rxSubScript = ',,[^,`]\+,,' |
||||
let g:vimwiki_char_subscript = ',,' |
||||
|
||||
" Header levels, 1-6 |
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$' |
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$' |
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$' |
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$' |
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$' |
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$' |
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH6.'\)' |
||||
|
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)' |
||||
let s:default_syntax.rxSubScript = ',,[^,`]\+,,' |
||||
let s:default_syntax.char_subscript = ',,' |
||||
|
||||
" generic headers |
||||
let s:default_syntax.rxH = '=' |
||||
let s:default_syntax.symH = 1 |
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule |
||||
let g:vimwiki_rxHR = '^----.*$' |
||||
let s:default_syntax.rxHR = '^-----*$' |
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '# ' |
||||
let g:vimwiki_rxListBullet = '^\s*\%(\*\|-\)\s' |
||||
let g:vimwiki_rxListNumber = '^\s*#\s' |
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|' |
||||
let s:default_syntax.rxTableSep = '|' |
||||
|
||||
let g:vimwiki_rxListDefine = '::\(\s\|$\)' |
||||
" Lists |
||||
let s:default_syntax.bullet_types = ['-', '*', '#'] |
||||
" 1 means the bullets can be repeatet to indicate the level, like * ** *** |
||||
" 0 means the bullets stand on their own and the level is indicated by the indentation |
||||
let s:default_syntax.recurring_bullets = 0 |
||||
let s:default_syntax.number_types = ['1)', '1.', 'i)', 'I)', 'a)', 'A)'] |
||||
"this should contain at least one element |
||||
"it is used for i_<C-L><C-J> among other things |
||||
let s:default_syntax.list_markers = ['-', '1.', '*', 'I)', 'a)'] |
||||
let s:default_syntax.rxListDefine = '::\(\s\|$\)' |
||||
|
||||
" Preformatted text |
||||
let g:vimwiki_rxPreStart = '{{{' |
||||
let g:vimwiki_rxPreEnd = '}}}' |
||||
let s:default_syntax.rxPreStart = '{{{' |
||||
let s:default_syntax.rxPreEnd = '}}}' |
||||
|
||||
" Math block |
||||
let s:default_syntax.rxMathStart = '{{\$' |
||||
let s:default_syntax.rxMathEnd = '}}\$' |
||||
|
||||
let s:default_syntax.rxComment = '^\s*%%.*$' |
||||
let s:default_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:''[:space:]]\+:\)\+\%(\s\|$\)\@=' |
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$' |
||||
let s:default_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$' |
||||
let s:default_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$' |
||||
let s:default_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*'. |
||||
\ '[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:default_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'. |
||||
\ '\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:default_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]' |
||||
let s:default_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)' |
||||
let s:default_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'. |
||||
\ '\([^:[:space:]]\+:\)*\(\s\|$\)' |
||||
|
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki syntax file |
||||
" Description: Defines markdown syntax |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
|
||||
" see the comments in vimwiki_default.vim for some info about this file |
||||
|
||||
|
||||
let s:markdown_syntax = g:vimwiki_syntax_variables['markdown'] |
||||
|
||||
" text: $ equation_inline $ |
||||
let s:markdown_syntax.rxEqIn = '\$[^$`]\+\$' |
||||
let s:markdown_syntax.char_eqin = '\$' |
||||
|
||||
" text: *strong* |
||||
" let s:markdown_syntax.rxBold = '\*[^*]\+\*' |
||||
let s:markdown_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'\*'. |
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'. |
||||
\'\*'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:markdown_syntax.char_bold = '*' |
||||
|
||||
" text: _emphasis_ |
||||
" let s:markdown_syntax.rxItalic = '_[^_]\+_' |
||||
let s:markdown_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'_'. |
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'. |
||||
\'_'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:markdown_syntax.char_italic = '_' |
||||
|
||||
" text: *_bold italic_* or _*italic bold*_ |
||||
let s:markdown_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'\*_'. |
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. |
||||
\'_\*'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:markdown_syntax.char_bolditalic = '\*_' |
||||
|
||||
let s:markdown_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'_\*'. |
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. |
||||
\'\*_'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:markdown_syntax.char_italicbold = '_\*' |
||||
|
||||
" text: `code` |
||||
let s:markdown_syntax.rxCode = '`[^`]\+`' |
||||
let s:markdown_syntax.char_code = '`' |
||||
|
||||
" text: ~~deleted text~~ |
||||
let s:markdown_syntax.rxDelText = '\~\~[^~`]\+\~\~' |
||||
let s:markdown_syntax.char_deltext = '\~\~' |
||||
|
||||
" text: ^superscript^ |
||||
let s:markdown_syntax.rxSuperScript = '\^[^^`]\+\^' |
||||
let s:markdown_syntax.char_superscript = '^' |
||||
|
||||
" text: ,,subscript,, |
||||
let s:markdown_syntax.rxSubScript = ',,[^,`]\+,,' |
||||
let s:markdown_syntax.char_subscript = ',,' |
||||
|
||||
" generic headers |
||||
let s:markdown_syntax.rxH = '#' |
||||
let s:markdown_syntax.symH = 0 |
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule |
||||
let s:markdown_syntax.rxHR = '^-----*$' |
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|' |
||||
let s:markdown_syntax.rxTableSep = '|' |
||||
|
||||
" Lists |
||||
let s:markdown_syntax.bullet_types = ['-', '*', '+'] |
||||
let s:markdown_syntax.recurring_bullets = 0 |
||||
let s:markdown_syntax.number_types = ['1.'] |
||||
let s:markdown_syntax.list_markers = ['-', '*', '+', '1.'] |
||||
let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)' |
||||
|
||||
" Preformatted text |
||||
let s:markdown_syntax.rxPreStart = '```' |
||||
let s:markdown_syntax.rxPreEnd = '```' |
||||
|
||||
" Math block |
||||
let s:markdown_syntax.rxMathStart = '\$\$' |
||||
let s:markdown_syntax.rxMathEnd = '\$\$' |
||||
|
||||
let s:markdown_syntax.rxComment = '^\s*%%.*$\|<!--[^>]*-->' |
||||
let s:markdown_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@=' |
||||
|
||||
let s:markdown_syntax.header_search = '^\s*\(#\{1,6}\)\([^#].*\)$' |
||||
let s:markdown_syntax.header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$' |
||||
let s:markdown_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs'. |
||||
\ '\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:markdown_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'. |
||||
\ '\%([[:punct:]]\|\s\|$\)\@=' |
||||
let s:markdown_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]' |
||||
let s:markdown_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)' |
||||
let s:markdown_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'. |
||||
\ '\([^:[:space:]]\+:\)*\(\s\|$\)' |
@ -0,0 +1,194 @@
@@ -0,0 +1,194 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:add_target_syntax_ON(target, type) |
||||
let prefix0 = 'syntax match '.a:type.' `' |
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' |
||||
let prefix1 = 'syntax match '.a:type.'T `' |
||||
let suffix1 = '` display contained' |
||||
execute prefix0. a:target. suffix0 |
||||
execute prefix1. a:target. suffix1 |
||||
endfunction |
||||
|
||||
|
||||
function! s:add_target_syntax_OFF(target, type) |
||||
let prefix0 = 'syntax match VimwikiNoExistsLink `' |
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' |
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `' |
||||
let suffix1 = '` display contained' |
||||
execute prefix0. a:target. suffix0 |
||||
execute prefix1. a:target. suffix1 |
||||
endfunction |
||||
|
||||
|
||||
function! s:wrap_wikilink1_rx(target) |
||||
return vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidPrefix') . a:target. |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidSuffix') |
||||
endfunction |
||||
|
||||
|
||||
function! s:existing_mkd_refs() |
||||
return keys(vimwiki#markdown_base#scan_reflinks()) |
||||
endfunction |
||||
|
||||
|
||||
function! s:highlight_existing_links() |
||||
" Wikilink1 |
||||
" Conditional highlighting that depends on the existence of a wiki file or |
||||
" directory is only available for *schemeless* wiki links |
||||
" Links are set up upon BufEnter (see plugin/...) |
||||
let safe_links = '\%('. |
||||
\ vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikifiles')) . |
||||
\ '\%(#[^|]*\)\?\|#[^|]*\)' |
||||
" Wikilink1 Dirs set up upon BufEnter (see plugin/...) |
||||
let safe_dirs = vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikidirs')) |
||||
" Ref links are cached |
||||
let safe_reflinks = vimwiki#base#file_pattern(s:existing_mkd_refs()) |
||||
|
||||
|
||||
" match [URL][] |
||||
let target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), |
||||
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') |
||||
" match [DESCRIPTION][URL] |
||||
let target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), |
||||
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') |
||||
|
||||
" match [DIRURL][] |
||||
let target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), |
||||
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') |
||||
" match [DESCRIPTION][DIRURL] |
||||
let target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), |
||||
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') |
||||
|
||||
" match [MKDREF][] |
||||
let target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), |
||||
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') |
||||
" match [DESCRIPTION][MKDREF] |
||||
let target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), |
||||
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') |
||||
endfunction |
||||
|
||||
|
||||
" use max highlighting - could be quite slow if there are too many wikifiles |
||||
if vimwiki#vars#get_wikilocal('maxhi') |
||||
" WikiLink |
||||
call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), 'VimwikiWikiLink1') |
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing |
||||
call s:highlight_existing_links() |
||||
else |
||||
" Wikilink |
||||
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), 'VimwikiWikiLink1') |
||||
endif |
||||
|
||||
|
||||
" Weblink |
||||
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink1'), 'VimwikiWeblink1') |
||||
|
||||
|
||||
" WikiLink |
||||
" All remaining schemes are highlighted automatically |
||||
let s:rxSchemes = '\%('. |
||||
\ vimwiki#vars#get_global('schemes') . '\|'. |
||||
\ vimwiki#vars#get_global('web_schemes1'). |
||||
\ '\):' |
||||
|
||||
" a) match [nonwiki-scheme-URL] |
||||
let s:target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), |
||||
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'), |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1') |
||||
" b) match [DESCRIPTION][nonwiki-scheme-URL] |
||||
let s:target = vimwiki#base#apply_template( |
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), |
||||
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'), |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '') |
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1') |
||||
|
||||
|
||||
|
||||
" Header levels, 1-6 |
||||
for s:i in range(1,6) |
||||
execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i). |
||||
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'. |
||||
\ 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell' |
||||
endfor |
||||
|
||||
|
||||
|
||||
" concealed chars |
||||
if exists("+conceallevel") |
||||
syntax conceal on |
||||
endif |
||||
|
||||
syntax spell toplevel |
||||
|
||||
" VimwikiWikiLink1Char is for syntax markers (and also URL when a description |
||||
" is present) and may be concealed |
||||
let s:options = ' contained transparent contains=NONE' |
||||
" conceal wikilink1 |
||||
execute 'syn match VimwikiWikiLink1Char /'. |
||||
\ vimwiki#vars#get_syntaxlocal('rx_wikilink_md_prefix').'/'.s:options |
||||
execute 'syn match VimwikiWikiLink1Char /'. |
||||
\ vimwiki#vars#get_syntaxlocal('rx_wikilink_md_suffix').'/'.s:options |
||||
execute 'syn match VimwikiWikiLink1Char /'. |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Prefix1').'/'.s:options |
||||
execute 'syn match VimwikiWikiLink1Char /'. |
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Suffix1').'/'.s:options |
||||
|
||||
" conceal weblink1 |
||||
execute 'syn match VimwikiWeblink1Char "'. |
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options |
||||
execute 'syn match VimwikiWeblink1Char "'. |
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options |
||||
|
||||
if exists("+conceallevel") |
||||
syntax conceal off |
||||
endif |
||||
|
||||
|
||||
|
||||
" Tables |
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/ |
||||
\ transparent contains=VimwikiCellSeparator, |
||||
\ VimwikiLinkT, |
||||
\ VimwikiWeblink1T, |
||||
\ VimwikiWikiLink1T, |
||||
\ VimwikiNoExistsLinkT, |
||||
\ VimwikiTodo, |
||||
\ VimwikiBoldT, |
||||
\ VimwikiItalicT, |
||||
\ VimwikiBoldItalicT, |
||||
\ VimwikiItalicBoldT, |
||||
\ VimwikiDelTextT, |
||||
\ VimwikiSuperScriptT, |
||||
\ VimwikiSubScriptT, |
||||
\ VimwikiCodeT, |
||||
\ VimwikiEqInT, |
||||
\ @Spell |
||||
|
||||
|
||||
|
||||
" syntax group highlighting |
||||
hi def link VimwikiWeblink1 VimwikiLink |
||||
hi def link VimwikiWeblink1T VimwikiLink |
||||
|
||||
hi def link VimwikiWikiLink1 VimwikiLink |
||||
hi def link VimwikiWikiLink1T VimwikiLink |
||||
|
@ -1,69 +1,85 @@
@@ -1,69 +1,85 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 |
||||
" Vimwiki syntax file |
||||
" MediaWiki syntax |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
" Description: Defines mediaWiki syntax |
||||
" Home: https://github.com/vimwiki/vimwiki/ |
||||
|
||||
|
||||
" see the comments in vimwiki_default.vim for some info about this file |
||||
|
||||
|
||||
let s:media_syntax = g:vimwiki_syntax_variables['media'] |
||||
|
||||
" text: $ equation_inline $ |
||||
let s:media_syntax.rxEqIn = '\$[^$`]\+\$' |
||||
let s:media_syntax.char_eqin = '\$' |
||||
|
||||
" text: '''strong''' |
||||
let g:vimwiki_rxBold = "'''[^']\\+'''" |
||||
let g:vimwiki_char_bold = "'''" |
||||
let s:media_syntax.rxBold = "'''[^']\\+'''" |
||||
let s:media_syntax.char_bold = "'''" |
||||
|
||||
" text: ''emphasis'' |
||||
let g:vimwiki_rxItalic = "''[^']\\+''" |
||||
let g:vimwiki_char_italic = "''" |
||||
let s:media_syntax.rxItalic = "''[^']\\+''" |
||||
let s:media_syntax.char_italic = "''" |
||||
|
||||
" text: '''''strong italic''''' |
||||
let g:vimwiki_rxBoldItalic = "'''''[^']\\+'''''" |
||||
let g:vimwiki_rxItalicBold = g:vimwiki_rxBoldItalic |
||||
let g:vimwiki_char_bolditalic = "'''''" |
||||
let g:vimwiki_char_italicbold = g:vimwiki_char_bolditalic |
||||
let s:media_syntax.rxBoldItalic = "'''''[^']\\+'''''" |
||||
let s:media_syntax.rxItalicBold = s:media_syntax.rxBoldItalic |
||||
let s:media_syntax.char_bolditalic = "'''''" |
||||
let s:media_syntax.char_italicbold = s:media_syntax.char_bolditalic |
||||
|
||||
" text: `code` |
||||
let g:vimwiki_rxCode = '`[^`]\+`' |
||||
let g:vimwiki_char_code = '`' |
||||
let s:media_syntax.rxCode = '`[^`]\+`' |
||||
let s:media_syntax.char_code = '`' |
||||
|
||||
" text: ~~deleted text~~ |
||||
let g:vimwiki_rxDelText = '\~\~[^~]\+\~\~' |
||||
let g:vimwiki_char_deltext = '\~\~' |
||||
let s:media_syntax.rxDelText = '\~\~[^~]\+\~\~' |
||||
let s:media_syntax.char_deltext = '\~\~' |
||||
|
||||
" text: ^superscript^ |
||||
let g:vimwiki_rxSuperScript = '\^[^^]\+\^' |
||||
let g:vimwiki_char_superscript = '^' |
||||
let s:media_syntax.rxSuperScript = '\^[^^]\+\^' |
||||
let s:media_syntax.char_superscript = '^' |
||||
|
||||
" text: ,,subscript,, |
||||
let g:vimwiki_rxSubScript = ',,[^,]\+,,' |
||||
let g:vimwiki_char_subscript = ',,' |
||||
|
||||
" Header levels, 1-6 |
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$' |
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$' |
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$' |
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$' |
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$' |
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$' |
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH6.'\)' |
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)' |
||||
let s:media_syntax.rxSubScript = ',,[^,]\+,,' |
||||
let s:media_syntax.char_subscript = ',,' |
||||
|
||||
" <hr>, horizontal rule |
||||
let g:vimwiki_rxHR = '^----.*$' |
||||
" generic headers |
||||
let s:media_syntax.rxH = '=' |
||||
let s:media_syntax.symH = 1 |
||||
|
||||
" Tables. Each line starts and ends with '||'; each cell is separated by '||' |
||||
let g:vimwiki_rxTable = '||' |
||||
|
||||
" Bulleted list items start with whitespace(s), then '*' |
||||
" highlight only bullets and digits. |
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\([^*]*$\)\@=' |
||||
let g:vimwiki_rxListNumber = '^\s*#\+' |
||||
|
||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s' |
||||
" <hr>, horizontal rule |
||||
let s:media_syntax.rxHR = '^-----*$' |
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|' |
||||
let s:media_syntax.rxTableSep = '|' |
||||
|
||||
" Lists |
||||
let s:media_syntax.bullet_types = ['*', '#'] |
||||
let s:media_syntax.recurring_bullets = 1 |
||||
let s:media_syntax.number_types = [] |
||||
let s:media_syntax.list_markers = ['*', '#'] |
||||
let s:media_syntax.rxListDefine = '^\%(;\|:\)\s' |
||||
|
||||
" Preformatted text |
||||
let g:vimwiki_rxPreStart = '<pre>' |
||||
let g:vimwiki_rxPreEnd = '<\/pre>' |
||||
let s:media_syntax.rxPreStart = '<pre>' |
||||
let s:media_syntax.rxPreEnd = '<\/pre>' |
||||
|
||||
" Math block |
||||
let s:media_syntax.rxMathStart = '{{\$' |
||||
let s:media_syntax.rxMathEnd = '}}\$' |
||||
|
||||
let s:media_syntax.rxComment = '^\s*%%.*$' |
||||
let s:media_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@=' |
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$' |
||||
let s:media_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$' |
||||
let s:media_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$' |
||||
let s:media_syntax.bold_search = "'''\\zs[^']\\+\\ze'''" |
||||
let s:media_syntax.bold_match = '''''''__Text__''''''' |
||||
" ^- this strange looking thing is equivalent to "'''__Text__'''" but since we later |
||||
" want to call escape() on this string, we must keep it in single quotes |
||||
let s:media_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]' |
||||
let s:media_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)' |
||||
let s:media_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'. |
||||
\ '\([^:[:space:]]\+:\)*\(\s\|$\)' |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
||||
<html> |
||||
<head> |
||||
<link rel="Stylesheet" type="text/css" href="%root_path%%css%"> |
||||
<title>%title%</title> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%"> |
||||
</head> |
||||
<body> |
||||
%content% |
||||
</body> |
||||
</html> |
@ -0,0 +1,286 @@
@@ -0,0 +1,286 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki autoload plugin file |
||||
" Desc: Handle diary notes |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
" Load only once {{{ |
||||
if exists("g:loaded_vimwiki_diary_auto") || &cp |
||||
finish |
||||
endif |
||||
let g:loaded_vimwiki_diary_auto = 1 |
||||
"}}} |
||||
|
||||
function! s:prefix_zero(num) "{{{ |
||||
if a:num < 10 |
||||
return '0'.a:num |
||||
endif |
||||
return a:num |
||||
endfunction "}}} |
||||
|
||||
function! s:desc(d1, d2) "{{{ |
||||
return a:d1 == a:d2 ? 0 : a:d1 < a:d2 ? 1 : -1 |
||||
endfunction "}}} |
||||
|
||||
function! s:get_date_link(fmt) "{{{ |
||||
return strftime(a:fmt) |
||||
endfunction "}}} |
||||
|
||||
function! s:link_exists(lines, link) "{{{ |
||||
let link_exists = 0 |
||||
for line in a:lines |
||||
if line =~ escape(a:link, '[]\') |
||||
let link_exists = 1 |
||||
break |
||||
endif |
||||
endfor |
||||
return link_exists |
||||
endfunction "}}} |
||||
|
||||
function! s:diary_path() "{{{ |
||||
return VimwikiGet('path').VimwikiGet('diary_rel_path') |
||||
endfunction "}}} |
||||
|
||||
function! s:diary_index() "{{{ |
||||
return s:diary_path().VimwikiGet('diary_index').VimwikiGet('ext') |
||||
endfunction "}}} |
||||
|
||||
function! s:get_diary_range(lines, header) "{{{ |
||||
let rx = '\[\[\d\{4}-\d\d-\d\d\]\]' |
||||
let idx = 0 |
||||
let ln_start = -1 |
||||
let ln_end = -1 |
||||
for line in a:lines |
||||
if ln_start != -1 |
||||
if line =~ '^\s*\(=\)\+.*\1\s*$' || (line !~ rx && line !~ '^\s*$') |
||||
break |
||||
endif |
||||
endif |
||||
if line =~ '^\s*\(=\)\+\s*'.a:header.'\s*\1\s*$' |
||||
let ln_start = idx + 1 |
||||
endif |
||||
let idx += 1 |
||||
endfor |
||||
|
||||
let ln_end = idx |
||||
return [ln_start, ln_end] |
||||
endfunction "}}} |
||||
|
||||
function! s:diary_date_link() "{{{ |
||||
return s:get_date_link(VimwikiGet('diary_link_fmt')) |
||||
endfunction "}}} |
||||
|
||||
function! s:get_file_contents(file_name) "{{{ |
||||
let lines = [] |
||||
let bufnr = bufnr(expand(a:file_name)) |
||||
if bufnr != -1 |
||||
let lines = getbufline(bufnr, 1, '$') |
||||
else |
||||
try |
||||
let lines = readfile(expand(a:file_name)) |
||||
catch |
||||
endtry |
||||
endif |
||||
return [lines, bufnr] |
||||
endfunction "}}} |
||||
|
||||
function! s:get_links() "{{{ |
||||
let rx = '\d\{4}-\d\d-\d\d' |
||||
let s_links = glob(VimwikiGet('path').VimwikiGet('diary_rel_path'). |
||||
\ '*'.VimwikiGet('ext')) |
||||
|
||||
let s_links = substitute(s_links, '\'.VimwikiGet('ext'), "", "g") |
||||
let links = split(s_links, '\n') |
||||
|
||||
" remove backup files (.wiki~) |
||||
call filter(links, 'v:val !~ ''.*\~$''') |
||||
|
||||
" remove paths |
||||
call map(links, 'fnamemodify(v:val, ":t")') |
||||
|
||||
call filter(links, 'v:val =~ "'.escape(rx, '\').'"') |
||||
return links |
||||
endfunction "}}} |
||||
|
||||
function! s:get_position_links(link) "{{{ |
||||
let idx = -1 |
||||
let links = [] |
||||
if a:link =~ '\d\{4}-\d\d-\d\d' |
||||
let links = s:get_links() |
||||
" include 'today' into links |
||||
if index(links, s:diary_date_link()) == -1 |
||||
call add(links, s:diary_date_link()) |
||||
endif |
||||
call sort(links) |
||||
let idx = index(links, a:link) |
||||
endif |
||||
return [idx, links] |
||||
endfunction "}}} |
||||
|
||||
function! s:format_links(links) "{{{ |
||||
let lines = [] |
||||
let line = '| ' |
||||
let idx = 0 |
||||
let trigger = 0 |
||||
while idx < len(a:links) |
||||
if idx/VimwikiGet('diary_link_count') > trigger |
||||
let trigger = idx/VimwikiGet('diary_link_count') |
||||
call add(lines, substitute(line, '\s\+$', '', '')) |
||||
let line = '| ' |
||||
endif |
||||
let line .= a:links[idx].' | ' |
||||
let idx += 1 |
||||
endwhile |
||||
call add(lines, substitute(line, '\s\+$', '', '')) |
||||
call extend(lines, ['']) |
||||
|
||||
return lines |
||||
endfunction "}}} |
||||
|
||||
function! s:add_link(page, header, link) "{{{ |
||||
let [lines, bufnr] = s:get_file_contents(a:page) |
||||
|
||||
let [ln_start, ln_end] = s:get_diary_range(lines, a:header) |
||||
|
||||
let link = '[['.a:link.']]' |
||||
|
||||
let link_exists = s:link_exists(lines[ln_start : ln_end], link) |
||||
|
||||
if !link_exists |
||||
|
||||
if ln_start == -1 |
||||
call insert(lines, '= '.a:header.' =') |
||||
let ln_start = 1 |
||||
let ln_end = 1 |
||||
endif |
||||
|
||||
" removing 'old' links |
||||
let idx = ln_end - ln_start |
||||
while idx > 0 |
||||
call remove(lines, ln_start) |
||||
let idx -= 1 |
||||
endwhile |
||||
|
||||
" get all diary links from filesystem |
||||
let links = s:get_links() |
||||
call map(links, '"[[".v:val."]]"') |
||||
|
||||
" add current link |
||||
if index(links, link) == -1 |
||||
call add(links, link) |
||||
endif |
||||
|
||||
let links = sort(links, 's:desc') |
||||
call extend(lines, s:format_links(links), ln_start) |
||||
|
||||
if bufnr != -1 |
||||
exe 'buffer '.bufnr |
||||
if !&readonly |
||||
1,$delete _ |
||||
call append(1, lines) |
||||
1,1delete _ |
||||
endif |
||||
else |
||||
call writefile(lines, expand(a:page)) |
||||
endif |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! s:make_date_link(...) "{{{ |
||||
if a:0 |
||||
let link = a:1 |
||||
else |
||||
let link = s:diary_date_link() |
||||
endif |
||||
let header = VimwikiGet('diary_header') |
||||
call s:add_link(s:diary_index(), header, link) |
||||
return VimwikiGet('diary_rel_path').link |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#diary#make_note(index, ...) "{{{ |
||||
call vimwiki#base#select(a:index) |
||||
call vimwiki#base#mkdir(VimwikiGet('path').VimwikiGet('diary_rel_path')) |
||||
if a:0 |
||||
let link = s:make_date_link(a:1) |
||||
else |
||||
let link = s:make_date_link() |
||||
endif |
||||
call vimwiki#base#open_link(':e ', link, s:diary_index()) |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#diary#goto_index(index) "{{{ |
||||
call vimwiki#base#select(a:index) |
||||
call vimwiki#base#edit_file(':e', s:diary_index()) |
||||
endfunction "}}} |
||||
|
||||
" Calendar.vim callback function. |
||||
function! vimwiki#diary#calendar_action(day, month, year, week, dir) "{{{ |
||||
let day = s:prefix_zero(a:day) |
||||
let month = s:prefix_zero(a:month) |
||||
|
||||
let link = a:year.'-'.month.'-'.day |
||||
if winnr('#') == 0 |
||||
if a:dir == 'V' |
||||
vsplit |
||||
else |
||||
split |
||||
endif |
||||
else |
||||
wincmd p |
||||
if !&hidden && &modified |
||||
new |
||||
endif |
||||
endif |
||||
|
||||
" Create diary note for a selected date in default wiki. |
||||
call vimwiki#diary#make_note(1, link) |
||||
endfunction "}}} |
||||
|
||||
" Calendar.vim sign function. |
||||
function vimwiki#diary#calendar_sign(day, month, year) "{{{ |
||||
let day = s:prefix_zero(a:day) |
||||
let month = s:prefix_zero(a:month) |
||||
let sfile = VimwikiGet('path').VimwikiGet('diary_rel_path'). |
||||
\ a:year.'-'.month.'-'.day.VimwikiGet('ext') |
||||
return filereadable(expand(sfile)) |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#diary#goto_next_day() "{{{ |
||||
let link = '' |
||||
let [idx, links] = s:get_position_links(expand('%:t:r')) |
||||
|
||||
if idx == (len(links) - 1) |
||||
return |
||||
endif |
||||
|
||||
if idx != -1 && idx < len(links) - 1 |
||||
let link = VimwikiGet('diary_rel_path').links[idx+1] |
||||
else |
||||
" goto today |
||||
let link = VimwikiGet('diary_rel_path').s:diary_date_link() |
||||
endif |
||||
|
||||
if len(link) |
||||
call vimwiki#base#open_link(':e ', link) |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#diary#goto_prev_day() "{{{ |
||||
let link = '' |
||||
let [idx, links] = s:get_position_links(expand('%:t:r')) |
||||
|
||||
if idx == 0 |
||||
return |
||||
endif |
||||
|
||||
if idx > 0 |
||||
let link = VimwikiGet('diary_rel_path').links[idx-1] |
||||
else |
||||
" goto today |
||||
let link = VimwikiGet('diary_rel_path').s:diary_date_link() |
||||
endif |
||||
|
||||
if len(link) |
||||
call vimwiki#base#open_link(':e ', link) |
||||
endif |
||||
endfunction "}}} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,369 @@
@@ -0,0 +1,369 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki autoload plugin file |
||||
" Todo lists related stuff here. |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
if exists("g:loaded_vimwiki_list_auto") || &cp |
||||
finish |
||||
endif |
||||
let g:loaded_vimwiki_lst_auto = 1 |
||||
|
||||
" Script variables {{{ |
||||
let s:rx_li_box = '\[.\?\]' |
||||
" }}} |
||||
|
||||
" Script functions {{{ |
||||
|
||||
" Get checkbox regexp |
||||
function! s:rx_li_symbol(rate) "{{{ |
||||
let result = '' |
||||
if a:rate == 100 |
||||
let result = g:vimwiki_listsyms[4] |
||||
elseif a:rate == 0 |
||||
let result = g:vimwiki_listsyms[0] |
||||
elseif a:rate >= 67 |
||||
let result = g:vimwiki_listsyms[3] |
||||
elseif a:rate >= 34 |
||||
let result = g:vimwiki_listsyms[2] |
||||
else |
||||
let result = g:vimwiki_listsyms[1] |
||||
endif |
||||
|
||||
return '\['.result.'\]' |
||||
endfunction "}}} |
||||
|
||||
" Get regexp of the list item. |
||||
function! s:rx_list_item() "{{{ |
||||
return '\('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)' |
||||
endfunction "}}} |
||||
|
||||
" Get regexp of the list item with checkbox. |
||||
function! s:rx_cb_list_item() "{{{ |
||||
return s:rx_list_item().'\s*\zs\[.\?\]' |
||||
endfunction "}}} |
||||
|
||||
" Get level of the list item. |
||||
function! s:get_level(lnum) "{{{ |
||||
if VimwikiGet('syntax') == 'media' |
||||
let level = vimwiki#base#count_first_sym(getline(a:lnum)) |
||||
else |
||||
let level = indent(a:lnum) |
||||
endif |
||||
return level |
||||
endfunction "}}} |
||||
|
||||
" Get previous list item. |
||||
" Returns: line number or 0. |
||||
function! s:prev_list_item(lnum) "{{{ |
||||
let c_lnum = a:lnum - 1 |
||||
while c_lnum >= 1 |
||||
let line = getline(c_lnum) |
||||
if line =~ s:rx_list_item() |
||||
return c_lnum |
||||
endif |
||||
if line =~ '^\s*$' |
||||
return 0 |
||||
endif |
||||
let c_lnum -= 1 |
||||
endwhile |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
" Get next list item in the list. |
||||
" Returns: line number or 0. |
||||
function! s:next_list_item(lnum) "{{{ |
||||
let c_lnum = a:lnum + 1 |
||||
while c_lnum <= line('$') |
||||
let line = getline(c_lnum) |
||||
if line =~ s:rx_list_item() |
||||
return c_lnum |
||||
endif |
||||
if line =~ '^\s*$' |
||||
return 0 |
||||
endif |
||||
let c_lnum += 1 |
||||
endwhile |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
" Find next list item in the buffer. |
||||
" Returns: line number or 0. |
||||
function! s:find_next_list_item(lnum) "{{{ |
||||
let c_lnum = a:lnum + 1 |
||||
while c_lnum <= line('$') |
||||
let line = getline(c_lnum) |
||||
if line =~ s:rx_list_item() |
||||
return c_lnum |
||||
endif |
||||
let c_lnum += 1 |
||||
endwhile |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
" Set state of the list item on line number "lnum" to [ ] or [x] |
||||
function! s:set_state(lnum, rate) "{{{ |
||||
let line = getline(a:lnum) |
||||
let state = s:rx_li_symbol(a:rate) |
||||
let line = substitute(line, s:rx_li_box, state, '') |
||||
call setline(a:lnum, line) |
||||
endfunction "}}} |
||||
|
||||
" Get state of the list item on line number "lnum" |
||||
function! s:get_state(lnum) "{{{ |
||||
let state = 0 |
||||
let line = getline(a:lnum) |
||||
let opt = matchstr(line, s:rx_cb_list_item()) |
||||
if opt =~ s:rx_li_symbol(100) |
||||
let state = 100 |
||||
elseif opt =~ s:rx_li_symbol(0) |
||||
let state = 0 |
||||
elseif opt =~ s:rx_li_symbol(25) |
||||
let state = 25 |
||||
elseif opt =~ s:rx_li_symbol(50) |
||||
let state = 50 |
||||
elseif opt =~ s:rx_li_symbol(75) |
||||
let state = 75 |
||||
endif |
||||
return state |
||||
endfunction "}}} |
||||
|
||||
" Returns 1 if there is checkbox on a list item, 0 otherwise. |
||||
function! s:is_cb_list_item(lnum) "{{{ |
||||
return getline(a:lnum) =~ s:rx_cb_list_item() |
||||
endfunction "}}} |
||||
|
||||
" Returns start line number of list item, 0 if it is not a list. |
||||
function! s:is_list_item(lnum) "{{{ |
||||
let c_lnum = a:lnum |
||||
while c_lnum >= 1 |
||||
let line = getline(c_lnum) |
||||
if line =~ s:rx_list_item() |
||||
return c_lnum |
||||
endif |
||||
if line =~ '^\s*$' |
||||
return 0 |
||||
endif |
||||
if indent(c_lnum) > indent(a:lnum) |
||||
return 0 |
||||
endif |
||||
let c_lnum -= 1 |
||||
endwhile |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
" Returns char column of checkbox. Used in parent/child checks. |
||||
function! s:get_li_pos(lnum) "{{{ |
||||
return stridx(getline(a:lnum), '[') |
||||
endfunction "}}} |
||||
|
||||
" Returns list of line numbers of parent and all its child items. |
||||
function! s:get_child_items(lnum) "{{{ |
||||
let result = [] |
||||
let lnum = a:lnum |
||||
let p_pos = s:get_level(lnum) |
||||
|
||||
" add parent |
||||
call add(result, lnum) |
||||
|
||||
let lnum = s:next_list_item(lnum) |
||||
while lnum != 0 && s:is_list_item(lnum) && s:get_level(lnum) > p_pos |
||||
call add(result, lnum) |
||||
let lnum = s:next_list_item(lnum) |
||||
endwhile |
||||
|
||||
return result |
||||
endfunction "}}} |
||||
|
||||
" Returns list of line numbers of all items of the same level. |
||||
function! s:get_sibling_items(lnum) "{{{ |
||||
let result = [] |
||||
let lnum = a:lnum |
||||
let ind = s:get_level(lnum) |
||||
|
||||
while lnum != 0 && s:get_level(lnum) >= ind |
||||
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum) |
||||
call add(result, lnum) |
||||
endif |
||||
let lnum = s:next_list_item(lnum) |
||||
endwhile |
||||
|
||||
let lnum = s:prev_list_item(a:lnum) |
||||
while lnum != 0 && s:get_level(lnum) >= ind |
||||
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum) |
||||
call add(result, lnum) |
||||
endif |
||||
let lnum = s:prev_list_item(lnum) |
||||
endwhile |
||||
|
||||
return result |
||||
endfunction "}}} |
||||
|
||||
" Returns line number of the parent of lnum item |
||||
function! s:get_parent_item(lnum) "{{{ |
||||
let lnum = a:lnum |
||||
let ind = s:get_level(lnum) |
||||
|
||||
let lnum = s:prev_list_item(lnum) |
||||
while lnum != 0 && s:is_list_item(lnum) && s:get_level(lnum) >= ind |
||||
let lnum = s:prev_list_item(lnum) |
||||
endwhile |
||||
|
||||
if s:is_cb_list_item(lnum) |
||||
return lnum |
||||
else |
||||
return a:lnum |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
" Creates checkbox in a list item. |
||||
function! s:create_cb_list_item(lnum) "{{{ |
||||
let line = getline(a:lnum) |
||||
let m = matchstr(line, s:rx_list_item()) |
||||
if m != '' |
||||
let li_content = substitute(strpart(line, len(m)), '^\s*', '', '') |
||||
let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content |
||||
call setline(a:lnum, line) |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
" Tells if all of the sibling list items are checked or not. |
||||
function! s:all_siblings_checked(lnum) "{{{ |
||||
let result = 0 |
||||
let cnt = 0 |
||||
let siblings = s:get_sibling_items(a:lnum) |
||||
for lnum in siblings |
||||
let cnt += s:get_state(lnum) |
||||
endfor |
||||
let result = cnt/len(siblings) |
||||
return result |
||||
endfunction "}}} |
||||
|
||||
" Creates checkbox on a list item if there is no one. |
||||
function! s:TLI_create_checkbox(lnum) "{{{ |
||||
if a:lnum && !s:is_cb_list_item(a:lnum) |
||||
if g:vimwiki_auto_checkbox |
||||
call s:create_cb_list_item(a:lnum) |
||||
endif |
||||
return 1 |
||||
endif |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
" Switch state of the child list items. |
||||
function! s:TLI_switch_child_state(lnum) "{{{ |
||||
let current_state = s:get_state(a:lnum) |
||||
if current_state == 100 |
||||
let new_state = 0 |
||||
else |
||||
let new_state = 100 |
||||
endif |
||||
for lnum in s:get_child_items(a:lnum) |
||||
call s:set_state(lnum, new_state) |
||||
endfor |
||||
endfunction "}}} |
||||
|
||||
" Switch state of the parent list items. |
||||
function! s:TLI_switch_parent_state(lnum) "{{{ |
||||
let c_lnum = a:lnum |
||||
while s:is_cb_list_item(c_lnum) |
||||
let parent_lnum = s:get_parent_item(c_lnum) |
||||
if parent_lnum == c_lnum |
||||
break |
||||
endif |
||||
call s:set_state(parent_lnum, s:all_siblings_checked(c_lnum)) |
||||
|
||||
let c_lnum = parent_lnum |
||||
endwhile |
||||
endfunction "}}} |
||||
|
||||
function! s:TLI_toggle(lnum) "{{{ |
||||
if !s:TLI_create_checkbox(a:lnum) |
||||
call s:TLI_switch_child_state(a:lnum) |
||||
endif |
||||
call s:TLI_switch_parent_state(a:lnum) |
||||
endfunction "}}} |
||||
|
||||
" Script functions }}} |
||||
|
||||
" Toggle list item between [ ] and [X] |
||||
function! vimwiki#lst#ToggleListItem(line1, line2) "{{{ |
||||
let line1 = a:line1 |
||||
let line2 = a:line2 |
||||
|
||||
if line1 != line2 && !s:is_list_item(line1) |
||||
let line1 = s:find_next_list_item(line1) |
||||
endif |
||||
|
||||
let c_lnum = line1 |
||||
while c_lnum != 0 && c_lnum <= line2 |
||||
let li_lnum = s:is_list_item(c_lnum) |
||||
|
||||
if li_lnum |
||||
let li_level = s:get_level(li_lnum) |
||||
if c_lnum == line1 |
||||
let start_li_level = li_level |
||||
endif |
||||
|
||||
if li_level <= start_li_level |
||||
call s:TLI_toggle(li_lnum) |
||||
let start_li_level = li_level |
||||
endif |
||||
endif |
||||
|
||||
let c_lnum = s:find_next_list_item(c_lnum) |
||||
endwhile |
||||
|
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#lst#kbd_cr() "{{{ |
||||
" This function is heavily relies on proper 'set comments' option. |
||||
let cr = "\<CR>" |
||||
if getline('.') =~ s:rx_cb_list_item() |
||||
let cr .= '[ ] ' |
||||
endif |
||||
return cr |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#lst#kbd_oO(cmd) "{{{ |
||||
" cmd should be 'o' or 'O' |
||||
|
||||
let l:count = v:count1 |
||||
while l:count > 0 |
||||
|
||||
let beg_lnum = foldclosed('.') |
||||
let end_lnum = foldclosedend('.') |
||||
if end_lnum != -1 && a:cmd ==# 'o' |
||||
let lnum = end_lnum |
||||
let line = getline(beg_lnum) |
||||
else |
||||
let line = getline('.') |
||||
let lnum = line('.') |
||||
endif |
||||
|
||||
" let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content |
||||
let m = matchstr(line, s:rx_list_item()) |
||||
let res = '' |
||||
if line =~ s:rx_cb_list_item() |
||||
let res = substitute(m, '\s*$', ' ', '').'[ ] ' |
||||
elseif line =~ s:rx_list_item() |
||||
let res = substitute(m, '\s*$', ' ', '') |
||||
elseif &autoindent || &smartindent |
||||
let res = matchstr(line, '^\s*') |
||||
endif |
||||
|
||||
if a:cmd ==# 'o' |
||||
call append(lnum, res) |
||||
call cursor(lnum + 1, col('$')) |
||||
else |
||||
call append(lnum - 1, res) |
||||
call cursor(lnum, col('$')) |
||||
endif |
||||
|
||||
let l:count -= 1 |
||||
endwhile |
||||
|
||||
startinsert! |
||||
|
||||
endfunction "}}} |
||||
|
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;} |
||||
h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;} |
||||
h1 {font-size: 2.6em; color: #000000;} |
||||
h2 {font-size: 2.2em; color: #404040;} |
||||
h3 {font-size: 1.8em; color: #707070;} |
||||
h4 {font-size: 1.4em; color: #909090;} |
||||
h5 {font-size: 1.3em; color: #989898;} |
||||
h6 {font-size: 1.2em; color: #9c9c9c;} |
||||
p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;} |
||||
ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;} |
||||
li {margin: 0.3em auto;} |
||||
ul {margin-left: 2em; padding-left: 0.5em;} |
||||
dt {font-weight: bold;} |
||||
img {border: none;} |
||||
pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;} |
||||
blockquote {padding: 0.4em; background-color: #f6f5eb;} |
||||
th, td {border: 1px solid #ccc; padding: 0.3em;} |
||||
th {background-color: #f0f0f0;} |
||||
hr {border: none; border-top: 1px solid #ccc; width: 100%;} |
||||
del {text-decoration: line-through; color: #777777;} |
||||
.toc li {list-style-type: none;} |
||||
.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;} |
||||
.justleft {text-align: left;} |
||||
.justright {text-align: right;} |
||||
.justcenter {text-align: center;} |
||||
.center {margin-left: auto; margin-right: auto;} |
||||
/* classes for items of todo lists */ |
||||
.done0:before {content: "\2592\2592\2592\2592"; color: SkyBlue;} |
||||
.done1:before {content: "\2588\2592\2592\2592"; color: SkyBlue;} |
||||
.done2:before {content: "\2588\2588\2592\2592"; color: SkyBlue;} |
||||
.done3:before {content: "\2588\2588\2588\2592"; color: SkyBlue;} |
||||
.done4:before {content: "\2588\2588\2588\2588"; color: SkyBlue;} |
||||
/* comment the next four or five lines out * |
||||
* if you do not want color-coded todo lists */ |
||||
.done0 {color: #c00000;} |
||||
.done1 {color: #c08000;} |
||||
.done2 {color: #80a000;} |
||||
.done3 {color: #00c000;} |
||||
.done4 {color: #7f7f7f; text-decoration: line-through;} |
@ -0,0 +1,510 @@
@@ -0,0 +1,510 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki autoload plugin file |
||||
" Desc: Tables |
||||
" | Easily | manageable | text | tables | ! | |
||||
" |--------+------------+-------+--------+---------| |
||||
" | Have | fun! | Drink | tea | Period. | |
||||
" |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
" Load only once {{{ |
||||
if exists("g:loaded_vimwiki_tbl_auto") || &cp |
||||
finish |
||||
endif |
||||
let g:loaded_vimwiki_tbl_auto = 1 |
||||
"}}} |
||||
|
||||
let s:textwidth = &tw |
||||
|
||||
" Misc functions {{{ |
||||
function! s:wide_len(str) "{{{ |
||||
" vim73 has new function that gives correct string width. |
||||
if exists("*strdisplaywidth") |
||||
return strdisplaywidth(a:str) |
||||
endif |
||||
|
||||
" get str display width in vim ver < 7.2 |
||||
if !g:vimwiki_CJK_length |
||||
let ret = strlen(substitute(a:str, '.', 'x', 'g')) |
||||
else |
||||
let savemodified = &modified |
||||
let save_cursor = getpos('.') |
||||
exe "norm! o\<esc>" |
||||
call setline(line("."), a:str) |
||||
let ret = virtcol("$") - 1 |
||||
d |
||||
call setpos('.', save_cursor) |
||||
let &modified = savemodified |
||||
endif |
||||
return ret |
||||
endfunction "}}} |
||||
|
||||
function! s:is_table(line) "{{{ |
||||
return a:line =~ '^\s*\%(|[^|]\+\)\+|\s*$' || s:is_separator(a:line) |
||||
endfunction "}}} |
||||
|
||||
function! s:is_separator(line) "{{{ |
||||
return a:line =~ '^\s*[|+]\s*--[-|+]\+' |
||||
endfunction "}}} |
||||
|
||||
function! s:is_last_column(lnum, cnum) "{{{ |
||||
return strpart(getline(a:lnum), a:cnum - 1) =~ '^[^|]*|\s*$' |
||||
endfunction "}}} |
||||
|
||||
function! s:is_first_column(lnum, cnum) "{{{ |
||||
let line = strpart(getline(a:lnum), 0, a:cnum - 1) |
||||
return line =~ '^\s*|[^|]*$' || line =~ '^\s*$' |
||||
endfunction "}}} |
||||
|
||||
function! s:count_separators_up(lnum) "{{{ |
||||
let lnum = a:lnum - 1 |
||||
while lnum > 1 |
||||
if !s:is_separator(getline(lnum)) |
||||
break |
||||
endif |
||||
let lnum -= 1 |
||||
endwhile |
||||
|
||||
return (a:lnum-lnum) |
||||
endfunction "}}} |
||||
|
||||
function! s:count_separators_down(lnum) "{{{ |
||||
let lnum = a:lnum + 1 |
||||
while lnum < line('$') |
||||
if !s:is_separator(getline(lnum)) |
||||
break |
||||
endif |
||||
let lnum += 1 |
||||
endwhile |
||||
|
||||
return (lnum-a:lnum) |
||||
endfunction "}}} |
||||
|
||||
function! s:create_empty_row(cols) "{{{ |
||||
let first_cell = "| |" |
||||
let cell = " |" |
||||
let row = first_cell |
||||
|
||||
for c in range(a:cols - 1) |
||||
let row .= cell |
||||
endfor |
||||
|
||||
return row |
||||
endfunction "}}} |
||||
|
||||
function! s:create_row_sep(cols) "{{{ |
||||
let first_cell = "|---+" |
||||
let cell = "---+" |
||||
let last_cell = "---|" |
||||
|
||||
if a:cols < 2 |
||||
return "|---|" |
||||
endif |
||||
|
||||
let row = first_cell |
||||
|
||||
for c in range(a:cols - 2) |
||||
let row .= cell |
||||
endfor |
||||
|
||||
let row .= last_cell |
||||
|
||||
return row |
||||
endfunction "}}} |
||||
|
||||
function! s:get_values(line) "{{{ |
||||
return split(a:line, '\s*|\s*', 1)[1:-2] |
||||
endfunction "}}} |
||||
|
||||
function! s:col_count(lnum) "{{{ |
||||
let line = getline(a:lnum) |
||||
if !s:is_separator(line) |
||||
return len(split(line, '\s*|\s*', 1)[1:-2]) |
||||
else |
||||
return len(split(line, '-+-', 1)) |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! s:get_indent(lnum) "{{{ |
||||
if !s:is_table(getline(a:lnum)) |
||||
return |
||||
endif |
||||
|
||||
let indent = 0 |
||||
|
||||
let lnum = a:lnum - 1 |
||||
while lnum > 1 |
||||
let line = getline(lnum) |
||||
if !s:is_table(line) |
||||
let indent = indent(lnum+1) |
||||
break |
||||
endif |
||||
let lnum -= 1 |
||||
endwhile |
||||
|
||||
return indent |
||||
endfunction " }}} |
||||
|
||||
function! s:get_rows(lnum) "{{{ |
||||
if !s:is_table(getline(a:lnum)) |
||||
return |
||||
endif |
||||
|
||||
let upper_rows = [] |
||||
let lower_rows = [] |
||||
|
||||
let lnum = a:lnum - 1 |
||||
while lnum > 1 |
||||
let line = getline(lnum) |
||||
if s:is_table(line) |
||||
call add(upper_rows, [lnum, line]) |
||||
else |
||||
break |
||||
endif |
||||
let lnum -= 1 |
||||
endwhile |
||||
call reverse(upper_rows) |
||||
|
||||
let lnum = a:lnum |
||||
while lnum <= line('$') |
||||
let line = getline(lnum) |
||||
if s:is_table(line) |
||||
call add(lower_rows, [lnum, line]) |
||||
else |
||||
break |
||||
endif |
||||
let lnum += 1 |
||||
endwhile |
||||
|
||||
return upper_rows + lower_rows |
||||
endfunction "}}} |
||||
|
||||
function! s:get_cell_max_lens(lnum) "{{{ |
||||
let max_lens = {} |
||||
for [lnum, row] in s:get_rows(a:lnum) |
||||
if s:is_separator(row) |
||||
continue |
||||
endif |
||||
let cells = s:get_values(row) |
||||
for idx in range(len(cells)) |
||||
let value = cells[idx] |
||||
if has_key(max_lens, idx) |
||||
let max_lens[idx] = max([s:wide_len(value), max_lens[idx]]) |
||||
else |
||||
let max_lens[idx] = s:wide_len(value) |
||||
endif |
||||
endfor |
||||
endfor |
||||
return max_lens |
||||
endfunction "}}} |
||||
|
||||
function! s:get_aligned_rows(lnum, col1, col2) "{{{ |
||||
let max_lens = s:get_cell_max_lens(a:lnum) |
||||
let rows = [] |
||||
for [lnum, row] in s:get_rows(a:lnum) |
||||
if s:is_separator(row) |
||||
let new_row = s:fmt_sep(max_lens, a:col1, a:col2) |
||||
else |
||||
let new_row = s:fmt_row(row, max_lens, a:col1, a:col2) |
||||
endif |
||||
call add(rows, [lnum, new_row]) |
||||
endfor |
||||
return rows |
||||
endfunction "}}} |
||||
|
||||
" Number of the current column. Starts from 0. |
||||
function! s:cur_column() "{{{ |
||||
let line = getline('.') |
||||
if !s:is_table(line) |
||||
return -1 |
||||
endif |
||||
if s:is_separator(line) |
||||
let sep = '[+|]' |
||||
else |
||||
let sep = '|' |
||||
endif |
||||
|
||||
let curs_pos = col('.') |
||||
let mpos = match(line, '|', 0) |
||||
let col = -1 |
||||
while mpos < curs_pos && mpos != -1 |
||||
let mpos = match(line, sep, mpos+1) |
||||
if mpos != -1 |
||||
let col += 1 |
||||
endif |
||||
endwhile |
||||
return col |
||||
endfunction "}}} |
||||
|
||||
" }}} |
||||
|
||||
" Format functions {{{ |
||||
function! s:fmt_cell(cell, max_len) "{{{ |
||||
let cell = ' '.a:cell.' ' |
||||
|
||||
let diff = a:max_len - s:wide_len(a:cell) |
||||
if diff == 0 && empty(a:cell) |
||||
let diff = 1 |
||||
endif |
||||
|
||||
let cell .= repeat(' ', diff) |
||||
return cell |
||||
endfunction "}}} |
||||
|
||||
function! s:fmt_row(line, max_lens, col1, col2) "{{{ |
||||
let new_line = '|' |
||||
let cells = s:get_values(a:line) |
||||
for idx in range(len(cells)) |
||||
if idx == a:col1 |
||||
let idx = a:col2 |
||||
elseif idx == a:col2 |
||||
let idx = a:col1 |
||||
endif |
||||
let value = cells[idx] |
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx]).'|' |
||||
endfor |
||||
|
||||
let idx = len(cells) |
||||
while idx < len(a:max_lens) |
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).'|' |
||||
let idx += 1 |
||||
endwhile |
||||
return new_line |
||||
endfunction "}}} |
||||
|
||||
function! s:fmt_cell_sep(max_len) "{{{ |
||||
if a:max_len == 0 |
||||
return repeat('-', 3) |
||||
else |
||||
return repeat('-', a:max_len+2) |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! s:fmt_sep(max_lens, col1, col2) "{{{ |
||||
let sep = '|' |
||||
for idx in range(len(a:max_lens)) |
||||
if idx == a:col1 |
||||
let idx = a:col2 |
||||
elseif idx == a:col2 |
||||
let idx = a:col1 |
||||
endif |
||||
let sep .= s:fmt_cell_sep(a:max_lens[idx]).'+' |
||||
endfor |
||||
let sep = substitute(sep, '+$', '|', '') |
||||
return sep |
||||
endfunction "}}} |
||||
"}}} |
||||
|
||||
" Keyboard functions "{{{ |
||||
function! s:kbd_create_new_row(cols, goto_first) "{{{ |
||||
let cmd = "\<ESC>o".s:create_empty_row(a:cols) |
||||
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>" |
||||
if a:goto_first |
||||
let cmd .= "\<ESC>0:call search('|', 'c', line('.'))\<CR>la" |
||||
else |
||||
let cmd .= "0".(col('.')-1)."lT|a" |
||||
endif |
||||
return cmd |
||||
endfunction "}}} |
||||
|
||||
function! s:kbd_goto_next_row() "{{{ |
||||
let cmd = "\<ESC>jt|T|a" |
||||
return cmd |
||||
endfunction "}}} |
||||
|
||||
function! s:kbd_goto_prev_row() "{{{ |
||||
let cmd = "\<ESC>jt|T|a" |
||||
return cmd |
||||
endfunction "}}} |
||||
|
||||
function! s:kbd_goto_next_col(last) "{{{ |
||||
if a:last |
||||
let seps = s:count_separators_down(line('.')) |
||||
let cmd = "\<ESC>".seps."j0:call search('|', 'c', line('.'))\<CR>la" |
||||
else |
||||
let cmd = "\<ESC>:call search('|', 'c', line('.'))\<CR>la" |
||||
endif |
||||
return cmd |
||||
endfunction "}}} |
||||
|
||||
function! s:kbd_goto_prev_col(first) "{{{ |
||||
if a:first |
||||
let seps = s:count_separators_up(line('.')) |
||||
let cmd = "\<ESC>".seps."k$:call search('|', 'b', line('.'))\<CR>la" |
||||
else |
||||
let cmd = "\<ESC>2F|la" |
||||
endif |
||||
return cmd |
||||
endfunction "}}} |
||||
|
||||
"}}} |
||||
|
||||
" Global functions {{{ |
||||
function! vimwiki#tbl#kbd_cr() "{{{ |
||||
let lnum = line('.') |
||||
if !s:is_table(getline(lnum)) |
||||
return "\<CR>" |
||||
endif |
||||
|
||||
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1)) |
||||
let cols = len(s:get_values(getline(lnum))) |
||||
return s:kbd_create_new_row(cols, 0) |
||||
else |
||||
return s:kbd_goto_next_row() |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#kbd_tab() "{{{ |
||||
let lnum = line('.') |
||||
if !s:is_table(getline(lnum)) |
||||
return "\<Tab>" |
||||
endif |
||||
|
||||
let last = s:is_last_column(lnum, col('.')) |
||||
if last && !s:is_table(getline(lnum+1)) |
||||
let cols = len(s:get_values(getline(lnum))) |
||||
return s:kbd_create_new_row(cols, 1) |
||||
endif |
||||
return s:kbd_goto_next_col(last) |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#kbd_shift_tab() "{{{ |
||||
let lnum = line('.') |
||||
if !s:is_table(getline(lnum)) |
||||
return "\<S-Tab>" |
||||
endif |
||||
|
||||
let first = s:is_first_column(lnum, col('.')) |
||||
if first && !s:is_table(getline(lnum-1)) |
||||
return "" |
||||
endif |
||||
return s:kbd_goto_prev_col(first) |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#format(lnum, ...) "{{{ |
||||
let line = getline(a:lnum) |
||||
if !s:is_table(line) |
||||
return |
||||
endif |
||||
|
||||
if a:0 == 2 |
||||
let col1 = a:1 |
||||
let col2 = a:2 |
||||
else |
||||
let col1 = 0 |
||||
let col2 = 0 |
||||
endif |
||||
|
||||
let indent = s:get_indent(a:lnum) |
||||
|
||||
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2) |
||||
let row = repeat(' ', indent).row |
||||
call setline(lnum, row) |
||||
endfor |
||||
|
||||
let &tw = s:textwidth |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#create(...) "{{{ |
||||
if a:0 > 1 |
||||
let cols = a:1 |
||||
let rows = a:2 |
||||
elseif a:0 == 1 |
||||
let cols = a:1 |
||||
let rows = 2 |
||||
elseif a:0 == 0 |
||||
let cols = 5 |
||||
let rows = 2 |
||||
endif |
||||
|
||||
if cols < 1 |
||||
let cols = 5 |
||||
endif |
||||
|
||||
if rows < 1 |
||||
let rows = 2 |
||||
endif |
||||
|
||||
let lines = [] |
||||
let row = s:create_empty_row(cols) |
||||
|
||||
call add(lines, row) |
||||
if rows > 1 |
||||
call add(lines, s:create_row_sep(cols)) |
||||
endif |
||||
|
||||
for r in range(rows - 1) |
||||
call add(lines, row) |
||||
endfor |
||||
|
||||
call append(line('.'), lines) |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#align_or_cmd(cmd) "{{{ |
||||
if s:is_table(getline('.')) |
||||
call vimwiki#tbl#format(line('.')) |
||||
else |
||||
exe 'normal! '.a:cmd |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#reset_tw(lnum) "{{{ |
||||
let line = getline(a:lnum) |
||||
if !s:is_table(line) |
||||
return |
||||
endif |
||||
|
||||
let s:textwidth = &tw |
||||
let &tw = 0 |
||||
endfunction "}}} |
||||
|
||||
" TODO: move_column_left and move_column_right are good candidates to be |
||||
" refactored. |
||||
function! vimwiki#tbl#move_column_left() "{{{ |
||||
if !s:is_table(getline('.')) |
||||
return |
||||
endif |
||||
|
||||
let cur_col = s:cur_column() |
||||
if cur_col == -1 |
||||
return |
||||
endif |
||||
|
||||
if cur_col > 0 |
||||
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col) |
||||
call cursor(line('.'), 1) |
||||
if !s:is_separator(getline('.')) |
||||
call search('\%(|[^|]\+\)\{'.(cur_col-1).'}| .', 'eW') |
||||
else |
||||
call search('|\%([^+]\++\)\{'.(cur_col-1).'}--', 'eW') |
||||
endif |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#move_column_right() "{{{ |
||||
if !s:is_table(getline('.')) |
||||
return |
||||
endif |
||||
|
||||
let cur_col = s:cur_column() |
||||
if cur_col == -1 |
||||
return |
||||
endif |
||||
|
||||
if cur_col < s:col_count(line('.'))-1 |
||||
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1) |
||||
call cursor(line('.'), 1) |
||||
if !s:is_separator(getline('.')) |
||||
call search('\%(|[^|]\+\)\{'.(cur_col+1).'}| .', 'eW') |
||||
else |
||||
call search('|\%([^+]\++\)\{'.(cur_col+1).'}--', 'eW') |
||||
endif |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! vimwiki#tbl#get_rows(lnum) "{{{ |
||||
return s:get_rows(a:lnum) |
||||
endfunction "}}} |
||||
|
||||
"}}} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,418 @@
@@ -0,0 +1,418 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki filetype plugin file |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
if exists("b:did_ftplugin") |
||||
finish |
||||
endif |
||||
let b:did_ftplugin = 1 " Don't load another plugin for this buffer |
||||
|
||||
" UNDO list {{{ |
||||
" Reset the following options to undo this plugin. |
||||
let b:undo_ftplugin = "setlocal ". |
||||
\ "suffixesadd< isfname< comments< ". |
||||
\ "autowriteall< ". |
||||
\ "formatoptions< foldtext< ". |
||||
\ "foldmethod< foldexpr< commentstring< " |
||||
" UNDO }}} |
||||
|
||||
" MISC STUFF {{{ |
||||
|
||||
setlocal autowriteall |
||||
setlocal commentstring=%%%s |
||||
|
||||
if g:vimwiki_conceallevel && exists("+conceallevel") |
||||
let &conceallevel = g:vimwiki_conceallevel |
||||
endif |
||||
|
||||
" MISC }}} |
||||
|
||||
" GOTO FILE: gf {{{ |
||||
execute 'setlocal suffixesadd='.VimwikiGet('ext') |
||||
setlocal isfname-=[,] |
||||
" gf}}} |
||||
|
||||
" Autocreate list items {{{ |
||||
" for list items, and list items with checkboxes |
||||
if VimwikiGet('syntax') == 'default' |
||||
setl comments=b:*,b:#,b:- |
||||
setl formatlistpat=^\\s*[*#-]\\s* |
||||
else |
||||
setl comments=n:*,n:# |
||||
endif |
||||
setlocal formatoptions=tnro |
||||
|
||||
if !empty(&langmap) |
||||
" Valid only if langmap is a comma separated pairs of chars |
||||
let l_o = matchstr(&langmap, '\C,\zs.\zeo,') |
||||
if l_o |
||||
exe 'nnoremap <buffer> '.l_o.' :call vimwiki#lst#kbd_oO("o")<CR>a' |
||||
endif |
||||
|
||||
let l_O = matchstr(&langmap, '\C,\zs.\zeO,') |
||||
if l_O |
||||
exe 'nnoremap <buffer> '.l_O.' :call vimwiki#lst#kbd_oO("O")<CR>a' |
||||
endif |
||||
endif |
||||
|
||||
" COMMENTS }}} |
||||
|
||||
" FOLDING for headers and list items using expr fold method. {{{ |
||||
function! VimwikiFoldLevel(lnum) "{{{ |
||||
let line = getline(a:lnum) |
||||
|
||||
" Header folding... |
||||
if line =~ g:vimwiki_rxHeader |
||||
let n = vimwiki#base#count_first_sym(line) |
||||
return '>'.n |
||||
endif |
||||
|
||||
if g:vimwiki_fold_trailing_empty_lines == 0 && line =~ '^\s*$' |
||||
let nnline = getline(nextnonblank(a:lnum + 1)) |
||||
else |
||||
let nnline = getline(a:lnum + 1) |
||||
endif |
||||
if nnline =~ g:vimwiki_rxHeader |
||||
let n = vimwiki#base#count_first_sym(nnline) |
||||
return '<'.n |
||||
endif |
||||
|
||||
" List item folding... |
||||
if g:vimwiki_fold_lists |
||||
let base_level = s:get_base_level(a:lnum) |
||||
|
||||
let rx_list_item = '\('. |
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber. |
||||
\ '\)' |
||||
|
||||
|
||||
if line =~ rx_list_item |
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum) |
||||
let level = s:get_li_level(a:lnum) |
||||
let leveln = s:get_li_level(nnum) |
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, a:lnum)) |
||||
|
||||
if leveln > level |
||||
return ">".(base_level+leveln-adj) |
||||
else |
||||
return (base_level+level-adj) |
||||
endif |
||||
else |
||||
" process multilined list items |
||||
let [pnum, pline] = s:find_backward(rx_list_item, a:lnum) |
||||
if pline =~ rx_list_item |
||||
if indent(a:lnum) > indent(pnum) |
||||
let level = s:get_li_level(pnum) |
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, pnum)) |
||||
|
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum) |
||||
if nline =~ rx_list_item |
||||
let leveln = s:get_li_level(nnum) |
||||
if leveln > level |
||||
return (base_level+leveln-adj) |
||||
endif |
||||
endif |
||||
|
||||
return (base_level+level-adj) |
||||
endif |
||||
endif |
||||
endif |
||||
|
||||
return base_level |
||||
endif |
||||
|
||||
return -1 |
||||
endfunction "}}} |
||||
|
||||
function! s:get_base_level(lnum) "{{{ |
||||
let lnum = a:lnum - 1 |
||||
while lnum > 0 |
||||
if getline(lnum) =~ g:vimwiki_rxHeader |
||||
return vimwiki#base#count_first_sym(getline(lnum)) |
||||
endif |
||||
let lnum -= 1 |
||||
endwhile |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
function! s:find_forward(rx_item, lnum) "{{{ |
||||
let lnum = a:lnum + 1 |
||||
|
||||
while lnum <= line('$') |
||||
let line = getline(lnum) |
||||
if line =~ a:rx_item |
||||
\ || line =~ '^\S' |
||||
\ || line =~ g:vimwiki_rxHeader |
||||
break |
||||
endif |
||||
let lnum += 1 |
||||
endwhile |
||||
|
||||
return [lnum, getline(lnum)] |
||||
endfunction "}}} |
||||
|
||||
function! s:find_backward(rx_item, lnum) "{{{ |
||||
let lnum = a:lnum - 1 |
||||
|
||||
while lnum > 1 |
||||
let line = getline(lnum) |
||||
if line =~ a:rx_item |
||||
\ || line =~ '^\S' |
||||
break |
||||
endif |
||||
let lnum -= 1 |
||||
endwhile |
||||
|
||||
return [lnum, getline(lnum)] |
||||
endfunction "}}} |
||||
|
||||
function! s:get_li_level(lnum) "{{{ |
||||
if VimwikiGet('syntax') == 'media' |
||||
let level = vimwiki#base#count_first_sym(getline(a:lnum)) |
||||
else |
||||
let level = (indent(a:lnum) / &sw) |
||||
endif |
||||
return level |
||||
endfunction "}}} |
||||
|
||||
function! s:get_start_list(rx_item, lnum) "{{{ |
||||
let lnum = a:lnum |
||||
while lnum >= 1 |
||||
let line = getline(lnum) |
||||
if line !~ a:rx_item && line =~ '^\S' |
||||
return nextnonblank(lnum + 1) |
||||
endif |
||||
let lnum -= 1 |
||||
endwhile |
||||
return 0 |
||||
endfunction "}}} |
||||
|
||||
function! VimwikiFoldText() "{{{ |
||||
let line = substitute(getline(v:foldstart), '\t', |
||||
\ repeat(' ', &tabstop), 'g') |
||||
return line.' ['.(v:foldend - v:foldstart).']' |
||||
endfunction "}}} |
||||
|
||||
" FOLDING }}} |
||||
|
||||
" COMMANDS {{{ |
||||
command! -buffer Vimwiki2HTML |
||||
\ w <bar> call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), |
||||
\ expand('%')) |
||||
command! -buffer Vimwiki2HTMLBrowse |
||||
\ w <bar> call VimwikiWeblinkHandler( |
||||
\ vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), |
||||
\ expand('%'))) |
||||
command! -buffer VimwikiAll2HTML |
||||
\ call vimwiki#html#WikiAll2HTML(expand(VimwikiGet('path_html'))) |
||||
|
||||
command! -buffer VimwikiNextLink call vimwiki#base#find_next_link() |
||||
command! -buffer VimwikiPrevLink call vimwiki#base#find_prev_link() |
||||
command! -buffer VimwikiDeleteLink call vimwiki#base#delete_link() |
||||
command! -buffer VimwikiRenameLink call vimwiki#base#rename_link() |
||||
command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit') |
||||
command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link() |
||||
command! -buffer VimwikiSplitLink call vimwiki#base#follow_link('split') |
||||
command! -buffer VimwikiVSplitLink call vimwiki#base#follow_link('vsplit') |
||||
|
||||
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tabnew') |
||||
|
||||
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#ToggleListItem(<line1>, <line2>) |
||||
|
||||
command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links() |
||||
|
||||
exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '. |
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') |
||||
|
||||
exe 'command! -buffer -nargs=* VWS lvimgrep <args> '. |
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') |
||||
|
||||
command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("<args>") |
||||
|
||||
" table commands |
||||
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>) |
||||
command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq') |
||||
command! -buffer VimwikiTableAlignW call vimwiki#tbl#align_or_cmd('gww') |
||||
command! -buffer VimwikiTableMoveColumnLeft call vimwiki#tbl#move_column_left() |
||||
command! -buffer VimwikiTableMoveColumnRight call vimwiki#tbl#move_column_right() |
||||
|
||||
" diary commands |
||||
command! -buffer VimwikiDiaryNextDay call vimwiki#diary#goto_next_day() |
||||
command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day() |
||||
|
||||
" COMMANDS }}} |
||||
|
||||
" KEYBINDINGS {{{ |
||||
if g:vimwiki_use_mouse |
||||
nmap <buffer> <S-LeftMouse> <NOP> |
||||
nmap <buffer> <C-LeftMouse> <NOP> |
||||
nnoremap <silent><buffer> <2-LeftMouse> :VimwikiFollowLink<CR> |
||||
nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR> |
||||
nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR> |
||||
nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR> |
||||
endif |
||||
|
||||
|
||||
if !hasmapto('<Plug>Vimwiki2HTML') |
||||
nmap <buffer> <Leader>wh <Plug>Vimwiki2HTML |
||||
endif |
||||
nnoremap <script><buffer> |
||||
\ <Plug>Vimwiki2HTML :Vimwiki2HTML<CR> |
||||
|
||||
if !hasmapto('<Plug>Vimwiki2HTMLBrowse') |
||||
nmap <buffer> <Leader>whh <Plug>Vimwiki2HTMLBrowse |
||||
endif |
||||
nnoremap <script><buffer> |
||||
\ <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiFollowLink') |
||||
nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiFollowLink :VimwikiFollowLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiSplitLink') |
||||
nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiSplitLink :VimwikiSplitLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiVSplitLink') |
||||
nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiTabnewLink') |
||||
nmap <silent><buffer> <D-CR> <Plug>VimwikiTabnewLink |
||||
nmap <silent><buffer> <C-S-CR> <Plug>VimwikiTabnewLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiTabnewLink :VimwikiTabnewLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiGoBackLink') |
||||
nmap <silent><buffer> <BS> <Plug>VimwikiGoBackLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiNextLink') |
||||
nmap <silent><buffer> <TAB> <Plug>VimwikiNextLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiNextLink :VimwikiNextLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiPrevLink') |
||||
nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiPrevLink :VimwikiPrevLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiDeleteLink') |
||||
nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiRenameLink') |
||||
nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameLink |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiToggleListItem') |
||||
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem |
||||
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem |
||||
if has("unix") |
||||
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem |
||||
endif |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryNextDay') |
||||
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryPrevDay') |
||||
nmap <silent><buffer> <C-Up> <Plug>VimwikiDiaryPrevDay |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR> |
||||
|
||||
function! s:CR() "{{{ |
||||
let res = vimwiki#lst#kbd_cr() |
||||
if res == "\<CR>" && g:vimwiki_table_auto_fmt |
||||
let res = vimwiki#tbl#kbd_cr() |
||||
endif |
||||
return res |
||||
endfunction "}}} |
||||
|
||||
" List and Table <CR> mapping |
||||
inoremap <buffer> <expr> <CR> <SID>CR() |
||||
|
||||
" List mappings |
||||
nnoremap <buffer> o :<C-U>call vimwiki#lst#kbd_oO('o')<CR> |
||||
nnoremap <buffer> O :<C-U>call vimwiki#lst#kbd_oO('O')<CR> |
||||
|
||||
" Table mappings |
||||
if g:vimwiki_table_auto_fmt |
||||
inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab() |
||||
inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab() |
||||
endif |
||||
|
||||
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR> |
||||
nnoremap <buffer> gww :VimwikiTableAlignW<CR> |
||||
if !hasmapto('<Plug>VimwikiTableMoveColumnLeft') |
||||
nmap <silent><buffer> <A-Left> <Plug>VimwikiTableMoveColumnLeft |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiTableMoveColumnLeft :VimwikiTableMoveColumnLeft<CR> |
||||
if !hasmapto('<Plug>VimwikiTableMoveColumnRight') |
||||
nmap <silent><buffer> <A-Right> <Plug>VimwikiTableMoveColumnRight |
||||
endif |
||||
nnoremap <silent><script><buffer> |
||||
\ <Plug>VimwikiTableMoveColumnRight :VimwikiTableMoveColumnRight<CR> |
||||
|
||||
" Misc mappings |
||||
inoremap <buffer> <S-CR> <br /><CR> |
||||
|
||||
|
||||
" Text objects {{{ |
||||
onoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 0)<CR> |
||||
vnoremap <silent><buffer> ah :<C-U>call vimwiki#base#TO_header(0, 1)<CR> |
||||
|
||||
onoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 0)<CR> |
||||
vnoremap <silent><buffer> ih :<C-U>call vimwiki#base#TO_header(1, 1)<CR> |
||||
|
||||
onoremap <silent><buffer> a\ :<C-U>call vimwiki#base#TO_table_cell(0, 0)<CR> |
||||
vnoremap <silent><buffer> a\ :<C-U>call vimwiki#base#TO_table_cell(0, 1)<CR> |
||||
|
||||
onoremap <silent><buffer> i\ :<C-U>call vimwiki#base#TO_table_cell(1, 0)<CR> |
||||
vnoremap <silent><buffer> i\ :<C-U>call vimwiki#base#TO_table_cell(1, 1)<CR> |
||||
|
||||
onoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 0)<CR> |
||||
vnoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR> |
||||
|
||||
onoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 0)<CR> |
||||
vnoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 1)<CR> |
||||
|
||||
nnoremap <silent><buffer> = :call vimwiki#base#AddHeaderLevel()<CR> |
||||
nnoremap <silent><buffer> - :call vimwiki#base#RemoveHeaderLevel()<CR> |
||||
|
||||
" }}} |
||||
|
||||
" KEYBINDINGS }}} |
||||
|
||||
" AUTOCOMMANDS {{{ |
||||
if VimwikiGet('auto_export') |
||||
" Automatically generate HTML on page write. |
||||
augroup vimwiki |
||||
au BufWritePost <buffer> Vimwiki2HTML |
||||
augroup END |
||||
endif |
||||
|
||||
" AUTOCOMMANDS }}} |
@ -0,0 +1,445 @@
@@ -0,0 +1,445 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki plugin file |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki |
||||
|
||||
if exists("loaded_vimwiki") || &cp |
||||
finish |
||||
endif |
||||
let loaded_vimwiki = 1 |
||||
|
||||
let s:old_cpo = &cpo |
||||
set cpo&vim |
||||
|
||||
" HELPER functions {{{ |
||||
function! s:default(varname, value) "{{{ |
||||
if !exists('g:vimwiki_'.a:varname) |
||||
let g:vimwiki_{a:varname} = a:value |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
" return longest common path prefix of 2 given paths. |
||||
" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki' |
||||
function! s:path_common_pfx(path1, path2) "{{{ |
||||
let p1 = split(a:path1, '[/\\]', 1) |
||||
let p2 = split(a:path2, '[/\\]', 1) |
||||
|
||||
let idx = 0 |
||||
let minlen = min([len(p1), len(p2)]) |
||||
while (idx < minlen) && (p1[idx] ==? p2[idx]) |
||||
let idx = idx + 1 |
||||
endwhile |
||||
if idx == 0 |
||||
return '' |
||||
else |
||||
return join(p1[: idx-1], '/') |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
function! s:find_wiki(path) "{{{ |
||||
let idx = 0 |
||||
while idx < len(g:vimwiki_list) |
||||
let path = vimwiki#base#chomp_slash(expand(VimwikiGet('path', idx))) |
||||
let path = vimwiki#base#path_norm(path) |
||||
if s:path_common_pfx(path, a:path) == path |
||||
return idx |
||||
endif |
||||
let idx += 1 |
||||
endwhile |
||||
return -1 |
||||
endfunction "}}} |
||||
|
||||
function! s:setup_buffer_leave()"{{{ |
||||
if &filetype == 'vimwiki' && !exists("b:vimwiki_idx") |
||||
let b:vimwiki_idx = g:vimwiki_current_idx |
||||
endif |
||||
|
||||
" Set up menu |
||||
if g:vimwiki_menu != "" |
||||
exe 'nmenu disable '.g:vimwiki_menu.'.Table' |
||||
endif |
||||
endfunction"}}} |
||||
|
||||
function! s:setup_filetype() "{{{ |
||||
" Find what wiki current buffer belongs to. |
||||
let path = expand('%:p:h') |
||||
let ext = '.'.expand('%:e') |
||||
let idx = s:find_wiki(path) |
||||
|
||||
if idx == -1 && g:vimwiki_global_ext == 0 |
||||
return |
||||
endif |
||||
|
||||
set filetype=vimwiki |
||||
endfunction "}}} |
||||
|
||||
function! s:setup_buffer_enter() "{{{ |
||||
if exists("b:vimwiki_idx") |
||||
let g:vimwiki_current_idx = b:vimwiki_idx |
||||
else |
||||
" Find what wiki current buffer belongs to. |
||||
" If wiki does not exist in g:vimwiki_list -- add new wiki there with |
||||
" buffer's path and ext. |
||||
" Else set g:vimwiki_current_idx to that wiki index. |
||||
let path = expand('%:p:h') |
||||
let ext = '.'.expand('%:e') |
||||
let idx = s:find_wiki(path) |
||||
|
||||
" The buffer's file is not in the path and user do not want his wiki |
||||
" extension to be global -- do not add new wiki. |
||||
if idx == -1 && g:vimwiki_global_ext == 0 |
||||
return |
||||
endif |
||||
|
||||
if idx == -1 |
||||
call add(g:vimwiki_list, {'path': path, 'ext': ext, 'temp': 1}) |
||||
let g:vimwiki_current_idx = len(g:vimwiki_list) - 1 |
||||
else |
||||
let g:vimwiki_current_idx = idx |
||||
endif |
||||
|
||||
let b:vimwiki_idx = g:vimwiki_current_idx |
||||
endif |
||||
|
||||
" If you have |
||||
" au GUIEnter * VimwikiIndex |
||||
" Then change it to |
||||
" au GUIEnter * nested VimwikiIndex |
||||
if &filetype == '' |
||||
set filetype=vimwiki |
||||
endif |
||||
|
||||
" Update existed/non-existed links highlighting. |
||||
call vimwiki#base#highlight_links() |
||||
|
||||
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a |
||||
" new tab with the same buffer folding is reset to vim defaults. So we |
||||
" insist vimwiki folding here. |
||||
if g:vimwiki_folding == 1 && &fdm != 'expr' |
||||
setlocal fdm=expr |
||||
setlocal foldexpr=VimwikiFoldLevel(v:lnum) |
||||
setlocal foldtext=VimwikiFoldText() |
||||
endif |
||||
|
||||
" And conceal level too. |
||||
if g:vimwiki_conceallevel && exists("+conceallevel") |
||||
let &conceallevel = g:vimwiki_conceallevel |
||||
endif |
||||
|
||||
" Set up menu |
||||
if g:vimwiki_menu != "" |
||||
exe 'nmenu enable '.g:vimwiki_menu.'.Table' |
||||
endif |
||||
endfunction "}}} |
||||
|
||||
" OPTION get/set functions {{{ |
||||
" return value of option for current wiki or if second parameter exists for |
||||
" wiki with a given index. |
||||
function! VimwikiGet(option, ...) "{{{ |
||||
if a:0 == 0 |
||||
let idx = g:vimwiki_current_idx |
||||
else |
||||
let idx = a:1 |
||||
endif |
||||
if !has_key(g:vimwiki_list[idx], a:option) && |
||||
\ has_key(s:vimwiki_defaults, a:option) |
||||
if a:option == 'path_html' |
||||
let g:vimwiki_list[idx][a:option] = |
||||
\VimwikiGet('path', idx)[:-2].'_html/' |
||||
else |
||||
let g:vimwiki_list[idx][a:option] = |
||||
\s:vimwiki_defaults[a:option] |
||||
endif |
||||
endif |
||||
|
||||
" if path's ending is not a / or \ |
||||
" then add it |
||||
if a:option == 'path' || a:option == 'path_html' |
||||
let p = g:vimwiki_list[idx][a:option] |
||||
" resolve doesn't work quite right with symlinks ended with / or \ |
||||
let p = substitute(p, '[/\\]\+$', '', '') |
||||
let p = resolve(expand(p)) |
||||
let g:vimwiki_list[idx][a:option] = p.'/' |
||||
endif |
||||
|
||||
return g:vimwiki_list[idx][a:option] |
||||
endfunction "}}} |
||||
|
||||
" set option for current wiki or if third parameter exists for |
||||
" wiki with a given index. |
||||
function! VimwikiSet(option, value, ...) "{{{ |
||||
if a:0 == 0 |
||||
let idx = g:vimwiki_current_idx |
||||
else |
||||
let idx = a:1 |
||||
endif |
||||
let g:vimwiki_list[idx][a:option] = a:value |
||||
endfunction "}}} |
||||
" }}} |
||||
|
||||
" }}} |
||||
|
||||
" CALLBACK function "{{{ |
||||
" User can redefine it. |
||||
if !exists("*VimwikiWeblinkHandler") "{{{ |
||||
function VimwikiWeblinkHandler(weblink) |
||||
for browser in g:vimwiki_browsers |
||||
if executable(browser) |
||||
if has("win32") |
||||
execute '!start "'.browser.'" "' . a:weblink . '"' |
||||
else |
||||
execute '!'.browser.' "' . a:weblink . '"' |
||||
endif |
||||
return |
||||
endif |
||||
endfor |
||||
endfunction |
||||
endif "}}} |
||||
" CALLBACK }}} |
||||
|
||||
" DEFAULT wiki {{{ |
||||
let s:vimwiki_defaults = {} |
||||
let s:vimwiki_defaults.path = '~/vimwiki/' |
||||
let s:vimwiki_defaults.path_html = '~/vimwiki_html/' |
||||
let s:vimwiki_defaults.css_name = 'style.css' |
||||
let s:vimwiki_defaults.index = 'index' |
||||
let s:vimwiki_defaults.ext = '.wiki' |
||||
let s:vimwiki_defaults.maxhi = 1 |
||||
let s:vimwiki_defaults.syntax = 'default' |
||||
|
||||
let s:vimwiki_defaults.template_path = '~/vimwiki/templates/' |
||||
let s:vimwiki_defaults.template_default = 'default' |
||||
let s:vimwiki_defaults.template_ext = '.html' |
||||
|
||||
let s:vimwiki_defaults.nested_syntaxes = {} |
||||
let s:vimwiki_defaults.auto_export = 0 |
||||
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki |
||||
" file. |
||||
let s:vimwiki_defaults.temp = 0 |
||||
|
||||
" diary |
||||
let s:vimwiki_defaults.diary_rel_path = 'diary/' |
||||
let s:vimwiki_defaults.diary_index = 'diary' |
||||
let s:vimwiki_defaults.diary_header = 'Diary' |
||||
|
||||
" Do not change this! Will wait till vim become more datetime awareable. |
||||
let s:vimwiki_defaults.diary_link_fmt = '%Y-%m-%d' |
||||
|
||||
let s:vimwiki_defaults.diary_link_count = 4 |
||||
|
||||
"}}} |
||||
|
||||
" DEFAULT options {{{ |
||||
call s:default('list', [s:vimwiki_defaults]) |
||||
if &encoding == 'utf-8' |
||||
call s:default('upper', 'A-Z\u0410-\u042f') |
||||
call s:default('lower', 'a-z\u0430-\u044f') |
||||
else |
||||
call s:default('upper', 'A-Z') |
||||
call s:default('lower', 'a-z') |
||||
endif |
||||
call s:default('other', '0-9') |
||||
call s:default('stripsym', '_') |
||||
call s:default('badsyms', '') |
||||
call s:default('auto_checkbox', 1) |
||||
call s:default('use_mouse', 0) |
||||
call s:default('folding', 0) |
||||
call s:default('fold_trailing_empty_lines', 0) |
||||
call s:default('fold_lists', 0) |
||||
call s:default('menu', 'Vimwiki') |
||||
call s:default('global_ext', 1) |
||||
call s:default('hl_headers', 0) |
||||
call s:default('hl_cb_checked', 0) |
||||
call s:default('camel_case', 1) |
||||
call s:default('list_ignore_newline', 1) |
||||
call s:default('listsyms', ' .oOX') |
||||
if has("win32") |
||||
call s:default('browsers', |
||||
\ [ |
||||
\ expand('~').'\Local Settings\Application Data\Google\Chrome\Application\chrome.exe', |
||||
\ 'C:\Program Files\Opera\opera.exe', |
||||
\ 'C:\Program Files\Mozilla Firefox\firefox.exe', |
||||
\ 'C:\Program Files\Internet Explorer\iexplore.exe', |
||||
\ ]) |
||||
else |
||||
call s:default('browsers', |
||||
\ [ |
||||
\ 'chromium-browser', |
||||
\ 'opera', |
||||
\ 'firefox', |
||||
\ 'konqueror', |
||||
\ ]) |
||||
endif |
||||
|
||||
call s:default('use_calendar', 1) |
||||
call s:default('table_auto_fmt', 1) |
||||
call s:default('w32_dir_enc', '') |
||||
call s:default('CJK_length', 0) |
||||
call s:default('dir_link', '') |
||||
call s:default('file_exts', 'pdf,txt,doc,rtf,xls,php,zip,rar,7z,html,gz') |
||||
call s:default('valid_html_tags', 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em') |
||||
call s:default('user_htmls', '') |
||||
|
||||
call s:default('html_header_numbering', 0) |
||||
call s:default('html_header_numbering_sym', '') |
||||
call s:default('conceallevel', 3) |
||||
|
||||
call s:default('current_idx', 0) |
||||
|
||||
let upp = g:vimwiki_upper |
||||
let low = g:vimwiki_lower |
||||
let oth = g:vimwiki_other |
||||
let nup = low.oth |
||||
let nlo = upp.oth |
||||
let any = upp.nup |
||||
|
||||
let wword = '\C\<['.upp.']['.nlo.']*['.low.']['.nup.']*['.upp.']['.any.']*\>' |
||||
let g:vimwiki_rxWikiWord = '!\@<!'.wword |
||||
let g:vimwiki_rxNoWikiWord = '!'.wword |
||||
|
||||
let g:vimwiki_rxWikiLink1 = '\[\[[^\]]\+\]\]' |
||||
let g:vimwiki_rxWikiLink2 = '\[\[[^\]]\+\]\[[^\]]\+\]\]' |
||||
if g:vimwiki_camel_case |
||||
let g:vimwiki_rxWikiLink = g:vimwiki_rxWikiWord.'\|'. |
||||
\ g:vimwiki_rxWikiLink1.'\|'.g:vimwiki_rxWikiLink2 |
||||
else |
||||
let g:vimwiki_rxWikiLink = g:vimwiki_rxWikiLink1.'\|'.g:vimwiki_rxWikiLink2 |
||||
endif |
||||
let g:vimwiki_rxWeblink = '\%("[^"(]\+\((\([^)]\+\))\)\?":\)\?'. |
||||
\'\%('. |
||||
\'\%('. |
||||
\'\%(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):'. |
||||
\'\%(\%(//\)\|\%(\\\\\)\)'. |
||||
\'\)'. |
||||
\'\|\%(mailto:\)'. |
||||
\'\)'. |
||||
\'\+\S\+'. |
||||
\'[().,?\]]\@<!' |
||||
"}}} |
||||
|
||||
" AUTOCOMMANDS for all known wiki extensions {{{ |
||||
" Getting all extensions that different wikies could have |
||||
let extensions = {} |
||||
for wiki in g:vimwiki_list |
||||
if has_key(wiki, 'ext') |
||||
let extensions[wiki.ext] = 1 |
||||
else |
||||
let extensions['.wiki'] = 1 |
||||
endif |
||||
endfor |
||||
|
||||
augroup filetypedetect |
||||
" clear FlexWiki's stuff |
||||
au! * *.wiki |
||||
augroup end |
||||
|
||||
augroup vimwiki |
||||
autocmd! |
||||
for ext in keys(extensions) |
||||
exe 'autocmd BufWinEnter *'.ext.' call s:setup_buffer_enter()' |
||||
exe 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()' |
||||
exe 'autocmd BufNewFile,BufRead, *'.ext.' call s:setup_filetype()' |
||||
|
||||
" ColorScheme could have or could have not a |
||||
" VimwikiHeader1..VimwikiHeader6 highlight groups. We need to refresh |
||||
" syntax after colorscheme change. |
||||
exe 'autocmd ColorScheme *'.ext.' syntax enable'. |
||||
\ ' | call vimwiki#base#highlight_links()' |
||||
|
||||
" Format tables when exit from insert mode. Do not use textwidth to |
||||
" autowrap tables. |
||||
if g:vimwiki_table_auto_fmt |
||||
exe 'autocmd InsertLeave *'.ext.' call vimwiki#tbl#format(line("."))' |
||||
exe 'autocmd InsertEnter *'.ext.' call vimwiki#tbl#reset_tw(line("."))' |
||||
endif |
||||
endfor |
||||
augroup END |
||||
"}}} |
||||
|
||||
" COMMANDS {{{ |
||||
command! VimwikiUISelect call vimwiki#base#ui_select() |
||||
command! -count VimwikiIndex |
||||
\ call vimwiki#base#goto_index(v:count1) |
||||
command! -count VimwikiTabIndex tabedit <bar> |
||||
\ call vimwiki#base#goto_index(v:count1) |
||||
|
||||
command! -count VimwikiDiaryIndex |
||||
\ call vimwiki#diary#goto_index(v:count1) |
||||
command! -count VimwikiMakeDiaryNote |
||||
\ call vimwiki#diary#make_note(v:count1) |
||||
command! -count VimwikiTabMakeDiaryNote tabedit <bar> |
||||
\ call vimwiki#diary#make_note(v:count1) |
||||
"}}} |
||||
|
||||
" MAPPINGS {{{ |
||||
if !hasmapto('<Plug>VimwikiIndex') |
||||
nmap <silent><unique> <Leader>ww <Plug>VimwikiIndex |
||||
endif |
||||
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiTabIndex') |
||||
nmap <silent><unique> <Leader>wt <Plug>VimwikiTabIndex |
||||
endif |
||||
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiUISelect') |
||||
nmap <silent><unique> <Leader>ws <Plug>VimwikiUISelect |
||||
endif |
||||
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryIndex') |
||||
nmap <silent><unique> <Leader>wi <Plug>VimwikiDiaryIndex |
||||
endif |
||||
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiMakeDiaryNote') |
||||
nmap <silent><unique> <Leader>w<Leader>w <Plug>VimwikiMakeDiaryNote |
||||
endif |
||||
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR> |
||||
|
||||
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote') |
||||
nmap <silent><unique> <Leader>w<Leader>t <Plug>VimwikiTabMakeDiaryNote |
||||
endif |
||||
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote |
||||
\ :VimwikiTabMakeDiaryNote<CR> |
||||
|
||||
"}}} |
||||
|
||||
" MENU {{{ |
||||
function! s:build_menu(topmenu) |
||||
let idx = 0 |
||||
while idx < len(g:vimwiki_list) |
||||
let norm_path = fnamemodify(VimwikiGet('path', idx), ':h:t') |
||||
let norm_path = escape(norm_path, '\ \.') |
||||
execute 'menu '.a:topmenu.'.Open\ index.'.norm_path. |
||||
\ ' :call vimwiki#base#goto_index('.(idx + 1).')<CR>' |
||||
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path. |
||||
\ ' :call vimwiki#diary#make_note('.(idx + 1).')<CR>' |
||||
let idx += 1 |
||||
endwhile |
||||
endfunction |
||||
|
||||
function! s:build_table_menu(topmenu) |
||||
exe 'menu '.a:topmenu.'.-Sep- :' |
||||
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable ' |
||||
exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq' |
||||
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ left<tab><A-Left> :VimwikiTableMoveColumnLeft<CR>' |
||||
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ right<tab><A-Right> :VimwikiTableMoveColumnRight<CR>' |
||||
exe 'nmenu disable '.a:topmenu.'.Table' |
||||
endfunction |
||||
|
||||
if !empty(g:vimwiki_menu) |
||||
call s:build_menu(g:vimwiki_menu) |
||||
call s:build_table_menu(g:vimwiki_menu) |
||||
endif |
||||
" }}} |
||||
|
||||
" CALENDAR Hook "{{{ |
||||
if g:vimwiki_use_calendar |
||||
let g:calendar_action = 'vimwiki#diary#calendar_action' |
||||
let g:calendar_sign = 'vimwiki#diary#calendar_sign' |
||||
endif |
||||
"}}} |
||||
|
||||
let &cpo = s:old_cpo |
@ -0,0 +1,407 @@
@@ -0,0 +1,407 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki syntax file |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
" Quit if syntax file is already loaded |
||||
if version < 600 |
||||
syntax clear |
||||
elseif exists("b:current_syntax") |
||||
finish |
||||
endif |
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" NOTE.VIM |
||||
" |
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
" Vim syntax file |
||||
" Language: general note for plain text |
||||
" Maintainer: Jihang Li <LeeJihg@gmail.com> |
||||
" Last Change: 2017 Jul 28 |
||||
|
||||
" Quit when a (custom) syntax file was already loaded |
||||
if exists("b:current_syntax") |
||||
finish |
||||
endif |
||||
|
||||
"=============================================================================== match |
||||
" Block |
||||
" {dark asterisk} |
||||
syn match noteBlock /^*.*/ |
||||
"hi noteBlock guifg=#808080 |
||||
"hi noteBlock ctermfg=244 |
||||
hi noteBlock guifg=#3A3A3A |
||||
hi noteBlock ctermfg=237 |
||||
|
||||
" Ignore Linux terminal command lines spelling checking |
||||
"syn match noteCommand /^\$.*$/ contains=@NoSpell |
||||
|
||||
" Comment |
||||
syn match noteComment /^\#.*/ contains=ALLBUT,noteBlock,noteCommand |
||||
hi noteComment guifg=#666666 |
||||
hi noteComment ctermfg=242 |
||||
|
||||
"=============================================================================== delimit |
||||
syn match noteDelimite_1 /\[[A-Za-z0-9]\s/ conceal contained |
||||
syn match noteDelimite_2 /\]/ conceal contained |
||||
"syn match noteDelimite /\[[A-Za-z0-9]\]/ conceal contained |
||||
|
||||
"=============================================================================== Capital Tags |
||||
" {dark text, blue box, bold} |
||||
syn match noteTagCapB /\[B .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagCapB guifg=#262626 guibg=#00D7FF gui=bold |
||||
hi noteTagCapB ctermfg=235 ctermbg=45 cterm=bold |
||||
|
||||
" {dark text, green box, bold} |
||||
syn match noteTagCapG /\[G .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagCapG guifg=#262626 guibg=#87D700 gui=bold |
||||
hi noteTagCapG ctermfg=235 ctermbg=112 cterm=bold |
||||
|
||||
" {dark text, orange box, bold} |
||||
syn match noteTagCapO /\[O .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
"syn match noteTagCapO /\[O\].*\s/me=e-1 contains=noteDelimite |
||||
hi noteTagCapO guifg=#262626 guibg=#FFAF00 gui=bold |
||||
hi noteTagCapO ctermfg=235 ctermbg=214 cterm=bold |
||||
|
||||
" {dark text, purple box, bold} |
||||
syn match noteTagCapP /\[P .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagCapP guifg=#262626 guibg=#AF00FF gui=bold |
||||
hi noteTagCapP ctermfg=235 ctermbg=129 cterm=bold |
||||
|
||||
" {dark text, red box, bold} |
||||
syn match noteTagCapR /\[R .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagCapR guifg=#262626 guibg=#FF5FAF gui=bold |
||||
hi noteTagCapR ctermfg=235 ctermbg=160 cterm=bold |
||||
|
||||
" {dark text, yellow box, bold} |
||||
syn match noteTagCapY /\[Y .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagCapY guifg=#262626 guibg=#FF5FAF gui=bold |
||||
hi noteTagCapY ctermfg=235 ctermbg=226 cterm=bold |
||||
|
||||
" {dark text, cyan box, bold} |
||||
syn match noteTagCapC /\[C .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagCapC guifg=#262626 guibg=#FF5FAF gui=bold |
||||
hi noteTagCapC ctermfg=123 ctermbg=226 cterm=bold |
||||
|
||||
"=============================================================================== Small Tags |
||||
" {blue text} |
||||
syn match noteTagSmlb /\[b .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlb guifg=#00D7FF |
||||
hi noteTagSmlb ctermfg=45 |
||||
|
||||
" {green text} |
||||
syn match noteTagSmlg /\[g .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlg guifg=#87D700 |
||||
hi noteTagSmlg ctermfg=112 |
||||
|
||||
" {black text} |
||||
syn match noteTagSmlk /\[k .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlk guifg=#000000 |
||||
hi noteTagSmlk ctermfg=0 |
||||
|
||||
" {orange text} |
||||
syn match noteTagSmlo /\[o .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlo guifg=#FFAF00 |
||||
hi noteTagSmlo ctermfg=214 |
||||
" |
||||
" {purple text} |
||||
syn match noteTagSmlp /\[p .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlp guifg=#AF00FF |
||||
hi noteTagSmlp ctermfg=129 |
||||
|
||||
" {red text} |
||||
syn match noteTagSmlr /\[r .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlr guifg=#FF5FAF |
||||
hi noteTagSmlr ctermfg=160 |
||||
|
||||
" {yellow text} |
||||
syn match noteTagSmly /\[y .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmly guifg=#FF5FAF |
||||
hi noteTagSmly ctermfg=226 |
||||
|
||||
" {cyan text} |
||||
syn match noteTagSmlc /\[c .\{-}\]/ contains=noteDelimite_1,noteDelimite_2 containedin=noteComment |
||||
hi noteTagSmlc guifg=#FF5FAF |
||||
hi noteTagSmlc ctermfg=123 |
||||
|
||||
"=============================================================================== region |
||||
" Include Programming Syntax Highlight |
||||
"syn include @codeSnippet syntax/cpp.vim |
||||
"syn region bugFunction start=+\/\/codebegin+ keepend end=+\/\/codeend+ contains=@codeSnippet |
||||
"syn region bugDataType start=/</ end=/>/ contains=@codeSnippet |
||||
|
||||
|
||||
"=============================================================================== set behavior |
||||
" Set to read-only by default |
||||
" setlocal ro |
||||
|
||||
" Conceal highlighting controlling syntax |
||||
if has("conceal") |
||||
setlocal cole=2 cocu=nc |
||||
endif |
||||
" |
||||
"if has("conceal") |
||||
" if has("ro") |
||||
" setlocal cole=2 cocu=n |
||||
" else |
||||
" setlocal cole=2 |
||||
" endif |
||||
"endif |
||||
|
||||
"if has("conceal") |
||||
" "setlocal cole=2 cocu=nc |
||||
" "setlocal cole=2 cocu=n |
||||
" setlocal cole=2 |
||||
"endif |
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" / NOTE.VIM |
||||
" |
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
" Links highlighting is controlled by vimwiki#base#highlight_links() function. |
||||
" It is called from setup_buffer_enter() function in the BufEnter autocommand. |
||||
|
||||
" Load concrete Wiki syntax |
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim' |
||||
|
||||
syntax spell toplevel |
||||
|
||||
syn match VimwikiLinkChar contained /\[\[/ |
||||
syn match VimwikiLinkChar contained /\]\]/ |
||||
syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.\{-}]]/ |
||||
syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.\{-}]]/ |
||||
|
||||
syn match VimwikiNoLinkChar contained /\[\[/ |
||||
syn match VimwikiNoLinkChar contained /\]\]/ |
||||
syn match VimwikiNoLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.*]]/ |
||||
syn match VimwikiNoLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.*]]/ |
||||
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/' |
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/' |
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/' |
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/' |
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/' |
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/' |
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/' |
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/' |
||||
if exists("+conceallevel") |
||||
syntax conceal off |
||||
endif |
||||
|
||||
" Non concealed chars |
||||
syn match VimwikiHeaderChar contained /\%(^\s*=\+\)\|\%(=\+\s*$\)/ |
||||
execute 'syn match VimwikiBoldCharT contained /'.g:vimwiki_char_bold.'/' |
||||
execute 'syn match VimwikiItalicCharT contained /'.g:vimwiki_char_italic.'/' |
||||
execute 'syn match VimwikiBoldItalicCharT contained /'.g:vimwiki_char_bolditalic.'/' |
||||
execute 'syn match VimwikiItalicBoldCharT contained /'.g:vimwiki_char_italicbold.'/' |
||||
execute 'syn match VimwikiCodeCharT contained /'.g:vimwiki_char_code.'/' |
||||
execute 'syn match VimwikiDelTextCharT contained /'.g:vimwiki_char_deltext.'/' |
||||
execute 'syn match VimwikiSuperScriptT contained /'.g:vimwiki_char_superscript.'/' |
||||
execute 'syn match VimwikiSubScriptT contained /'.g:vimwiki_char_subscript.'/' |
||||
|
||||
|
||||
" Emoticons |
||||
syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/ |
||||
|
||||
let g:vimwiki_rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)' |
||||
execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/' |
||||
|
||||
|
||||
" Tables |
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/ |
||||
\ transparent contains=VimwikiCellSeparator,VimwikiLinkT, |
||||
\ VimwikiNoExistsLinkT,VimwikiEmoticons,VimwikiTodo, |
||||
\ VimwikiBoldT,VimwikiItalicT,VimwikiBoldItalicT,VimwikiItalicBoldT, |
||||
\ VimwikiDelTextT,VimwikiSuperScriptT,VimwikiSubScriptT,VimwikiCodeT, |
||||
\ @Spell |
||||
syntax match VimwikiCellSeparator |
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained |
||||
|
||||
" List items |
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/' |
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/' |
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/' |
||||
|
||||
execute 'syntax match VimwikiBold /'.g:vimwiki_rxBold.'/ contains=VimwikiBoldChar,@Spell' |
||||
execute 'syntax match VimwikiBoldT /'.g:vimwiki_rxBold.'/ contained contains=VimwikiBoldCharT,@Spell' |
||||
|
||||
execute 'syntax match VimwikiItalic /'.g:vimwiki_rxItalic.'/ contains=VimwikiItalicChar,@Spell' |
||||
execute 'syntax match VimwikiItalicT /'.g:vimwiki_rxItalic.'/ contained contains=VimwikiItalicCharT,@Spell' |
||||
|
||||
execute 'syntax match VimwikiBoldItalic /'.g:vimwiki_rxBoldItalic.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell' |
||||
execute 'syntax match VimwikiBoldItalicT /'.g:vimwiki_rxBoldItalic.'/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell' |
||||
|
||||
execute 'syntax match VimwikiItalicBold /'.g:vimwiki_rxItalicBold.'/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell' |
||||
execute 'syntax match VimwikiItalicBoldT /'.g:vimwiki_rxItalicBold.'/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell' |
||||
|
||||
execute 'syntax match VimwikiDelText /'.g:vimwiki_rxDelText.'/ contains=VimwikiDelTextChar,@Spell' |
||||
execute 'syntax match VimwikiDelTextT /'.g:vimwiki_rxDelText.'/ contained contains=VimwikiDelTextChar,@Spell' |
||||
|
||||
execute 'syntax match VimwikiSuperScript /'.g:vimwiki_rxSuperScript.'/ contains=VimwikiSuperScriptChar,@Spell' |
||||
execute 'syntax match VimwikiSuperScriptT /'.g:vimwiki_rxSuperScript.'/ contained contains=VimwikiSuperScriptCharT,@Spell' |
||||
|
||||
execute 'syntax match VimwikiSubScript /'.g:vimwiki_rxSubScript.'/ contains=VimwikiSubScriptChar,@Spell' |
||||
execute 'syntax match VimwikiSubScriptT /'.g:vimwiki_rxSubScript.'/ contained contains=VimwikiSubScriptCharT,@Spell' |
||||
|
||||
execute 'syntax match VimwikiCode /'.g:vimwiki_rxCode.'/ contains=VimwikiCodeChar' |
||||
execute 'syntax match VimwikiCodeT /'.g:vimwiki_rxCode.'/ contained contains=VimwikiCodeCharT' |
||||
|
||||
|
||||
" <hr> horizontal rule |
||||
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/' |
||||
|
||||
execute 'syntax region VimwikiPre start=/^\s*'.g:vimwiki_rxPreStart. |
||||
\ '/ end=/^\s*'.g:vimwiki_rxPreEnd.'\s*$/ contains=@Spell' |
||||
|
||||
" List item checkbox |
||||
syntax match VimwikiCheckBox /\[.\?\]/ |
||||
if g:vimwiki_hl_cb_checked |
||||
execute 'syntax match VimwikiCheckBoxDone /'. |
||||
\ g:vimwiki_rxListBullet.'\s*\['.g:vimwiki_listsyms[4].'\].*$/'. |
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink' |
||||
execute 'syntax match VimwikiCheckBoxDone /'. |
||||
\ g:vimwiki_rxListNumber.'\s*\['.g:vimwiki_listsyms[4].'\].*$/'. |
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink' |
||||
endif |
||||
|
||||
" placeholders |
||||
syntax match VimwikiPlaceholder /^\s*%toc\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam |
||||
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/ |
||||
syntax match VimwikiPlaceholder /^\s*%title\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam |
||||
syntax match VimwikiPlaceholder /^\s*%template\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam |
||||
syntax match VimwikiPlaceholderParam /\s.*/ contained |
||||
|
||||
" html tags |
||||
let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|') |
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#' |
||||
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag' |
||||
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag' |
||||
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag' |
||||
|
||||
execute 'syntax match VimwikiComment /'.g:vimwiki_rxComment.'/ contains=@Spell' |
||||
|
||||
" Header levels, 1-6 |
||||
execute 'syntax match VimwikiHeader1 /'.g:vimwiki_rxH1.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell' |
||||
execute 'syntax match VimwikiHeader2 /'.g:vimwiki_rxH2.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell' |
||||
execute 'syntax match VimwikiHeader3 /'.g:vimwiki_rxH3.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell' |
||||
execute 'syntax match VimwikiHeader4 /'.g:vimwiki_rxH4.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell' |
||||
execute 'syntax match VimwikiHeader5 /'.g:vimwiki_rxH5.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell' |
||||
execute 'syntax match VimwikiHeader6 /'.g:vimwiki_rxH6.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell' |
||||
|
||||
" group names "{{{ |
||||
|
||||
if g:vimwiki_hl_headers == 0 |
||||
hi link VimwikiHeader1 Title |
||||
hi link VimwikiHeader2 Title |
||||
hi link VimwikiHeader3 Title |
||||
hi link VimwikiHeader4 Title |
||||
hi link VimwikiHeader5 Title |
||||
hi link VimwikiHeader6 Title |
||||
else |
||||
if &background == 'light' |
||||
hi def VimwikiHeader1 guibg=bg guifg=#aa5858 gui=bold ctermfg=DarkRed term=bold cterm=bold |
||||
hi def VimwikiHeader2 guibg=bg guifg=#507030 gui=bold ctermfg=DarkGreen term=bold cterm=bold |
||||
hi def VimwikiHeader3 guibg=bg guifg=#1030a0 gui=bold ctermfg=DarkBlue term=bold cterm=bold |
||||
hi def VimwikiHeader4 guibg=bg guifg=#103040 gui=bold ctermfg=Black term=bold cterm=bold |
||||
hi def VimwikiHeader5 guibg=bg guifg=#505050 gui=bold ctermfg=Black term=bold cterm=bold |
||||
hi def VimwikiHeader6 guibg=bg guifg=#636363 gui=bold ctermfg=Black term=bold cterm=bold |
||||
else |
||||
hi def VimwikiHeader1 guibg=bg guifg=#e08090 gui=bold ctermfg=Red term=bold cterm=bold |
||||
hi def VimwikiHeader2 guibg=bg guifg=#80e090 gui=bold ctermfg=Green term=bold cterm=bold |
||||
hi def VimwikiHeader3 guibg=bg guifg=#6090e0 gui=bold ctermfg=Blue term=bold cterm=bold |
||||
hi def VimwikiHeader4 guibg=bg guifg=#c0c0f0 gui=bold ctermfg=White term=bold cterm=bold |
||||
hi def VimwikiHeader5 guibg=bg guifg=#e0e0f0 gui=bold ctermfg=White term=bold cterm=bold |
||||
hi def VimwikiHeader6 guibg=bg guifg=#f0f0f0 gui=bold ctermfg=White term=bold cterm=bold |
||||
endif |
||||
endif |
||||
|
||||
hi def link VimwikiMarkers Normal |
||||
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold |
||||
hi def link VimwikiBoldT VimwikiBold |
||||
|
||||
hi def VimwikiItalic term=italic cterm=italic gui=italic |
||||
hi def link VimwikiItalicT VimwikiItalic |
||||
|
||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic |
||||
hi def link VimwikiItalicBold VimwikiBoldItalic |
||||
hi def link VimwikiBoldItalicT VimwikiBoldItalic |
||||
hi def link VimwikiItalicBoldT VimwikiBoldItalic |
||||
|
||||
hi def VimwikiUnderline gui=underline |
||||
|
||||
hi def link VimwikiCode PreProc |
||||
hi def link VimwikiCodeT VimwikiCode |
||||
|
||||
hi def link VimwikiPre PreProc |
||||
hi def link VimwikiPreT VimwikiPre |
||||
|
||||
hi def link VimwikiNoExistsLink SpellBad |
||||
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink |
||||
|
||||
hi def link VimwikiLink Underlined |
||||
hi def link VimwikiLinkT VimwikiLink |
||||
|
||||
hi def link VimwikiList Identifier |
||||
hi def link VimwikiCheckBox VimwikiList |
||||
hi def link VimwikiCheckBoxDone Comment |
||||
hi def link VimwikiEmoticons Character |
||||
|
||||
hi def link VimwikiDelText Constant |
||||
hi def link VimwikiDelTextT VimwikiDelText |
||||
|
||||
hi def link VimwikiSuperScript Number |
||||
hi def link VimwikiSuperScriptT VimwikiSuperScript |
||||
|
||||
hi def link VimwikiSubScript Number |
||||
hi def link VimwikiSubScriptT VimwikiSubScript |
||||
|
||||
hi def link VimwikiTodo Todo |
||||
hi def link VimwikiComment Comment |
||||
|
||||
hi def link VimwikiPlaceholder SpecialKey |
||||
hi def link VimwikiPlaceholderParam String |
||||
hi def link VimwikiHTMLtag SpecialKey |
||||
|
||||
hi def link VimwikiCellSeparator VimwikiMarkers |
||||
hi def link VimwikiBoldChar VimwikiMarkers |
||||
hi def link VimwikiItalicChar VimwikiMarkers |
||||
hi def link VimwikiBoldItalicChar VimwikiMarkers |
||||
hi def link VimwikiItalicBoldChar VimwikiMarkers |
||||
hi def link VimwikiDelTextChar VimwikiMarkers |
||||
hi def link VimwikiSuperScriptChar VimwikiMarkers |
||||
hi def link VimwikiSubScriptChar VimwikiMarkers |
||||
hi def link VimwikiCodeChar VimwikiMarkers |
||||
hi def link VimwikiHeaderChar VimwikiMarkers |
||||
hi def link VimwikiLinkChar VimwikiLink |
||||
hi def link VimwikiNoLinkChar VimwikiNoExistsLink |
||||
|
||||
hi def link VimwikiBoldCharT VimwikiMarkers |
||||
hi def link VimwikiItalicCharT VimwikiMarkers |
||||
hi def link VimwikiBoldItalicCharT VimwikiMarkers |
||||
hi def link VimwikiItalicBoldCharT VimwikiMarkers |
||||
hi def link VimwikiDelTextCharT VimwikiMarkers |
||||
hi def link VimwikiSuperScriptCharT VimwikiMarkers |
||||
hi def link VimwikiSubScriptCharT VimwikiMarkers |
||||
hi def link VimwikiCodeCharT VimwikiMarkers |
||||
hi def link VimwikiHeaderCharT VimwikiMarkers |
||||
hi def link VimwikiLinkCharT VimwikiLinkT |
||||
hi def link VimwikiNoLinkCharT VimwikiNoExistsLinkT |
||||
"}}} |
||||
|
||||
let b:current_syntax="vimwiki" |
||||
|
||||
" EMBEDDED syntax setup "{{{ |
||||
let nested = VimwikiGet('nested_syntaxes') |
||||
if !empty(nested) |
||||
for [hl_syntax, vim_syntax] in items(nested) |
||||
call vimwiki#base#nested_syntax(vim_syntax, |
||||
\ '^\s*{{{\%(.*[[:blank:][:punct:]]\)\?'. |
||||
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?', |
||||
\ '^\s*}}}', 'VimwikiPre') |
||||
endfor |
||||
endif |
||||
"}}} |
||||
|
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki syntax file |
||||
" Default syntax |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
" text: *strong* |
||||
" let g:vimwiki_rxBold = '\*[^*]\+\*' |
||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'\*'. |
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'. |
||||
\'\*'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_bold = '*' |
||||
|
||||
" text: _emphasis_ |
||||
" let g:vimwiki_rxItalic = '_[^_]\+_' |
||||
let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'_'. |
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'. |
||||
\'_'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_italic = '_' |
||||
|
||||
" text: *_bold italic_* or _*italic bold*_ |
||||
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'\*_'. |
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. |
||||
\'_\*'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_bolditalic = '\*_' |
||||
|
||||
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='. |
||||
\'_\*'. |
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'. |
||||
\'\*_'. |
||||
\'\%([[:punct:]]\|\s\|$\)\@=' |
||||
let g:vimwiki_char_italicbold = '_\*' |
||||
|
||||
" text: `code` |
||||
let g:vimwiki_rxCode = '`[^`]\+`' |
||||
let g:vimwiki_char_code = '`' |
||||
|
||||
" text: ~~deleted text~~ |
||||
let g:vimwiki_rxDelText = '\~\~[^~`]\+\~\~' |
||||
let g:vimwiki_char_deltext = '\~\~' |
||||
|
||||
" text: ^superscript^ |
||||
let g:vimwiki_rxSuperScript = '\^[^^`]\+\^' |
||||
let g:vimwiki_char_superscript = '^' |
||||
|
||||
" text: ,,subscript,, |
||||
let g:vimwiki_rxSubScript = ',,[^,`]\+,,' |
||||
let g:vimwiki_char_subscript = ',,' |
||||
|
||||
" Header levels, 1-6 |
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$' |
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$' |
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$' |
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$' |
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$' |
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$' |
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH6.'\)' |
||||
|
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)' |
||||
|
||||
" <hr>, horizontal rule |
||||
let g:vimwiki_rxHR = '^----.*$' |
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '# ' |
||||
let g:vimwiki_rxListBullet = '^\s*\%(\*\|-\)\s' |
||||
let g:vimwiki_rxListNumber = '^\s*#\s' |
||||
|
||||
let g:vimwiki_rxListDefine = '::\(\s\|$\)' |
||||
|
||||
" Preformatted text |
||||
let g:vimwiki_rxPreStart = '{{{' |
||||
let g:vimwiki_rxPreEnd = '}}}' |
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$' |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 |
||||
" Vimwiki syntax file |
||||
" MediaWiki syntax |
||||
" Author: Maxim Kim <habamax@gmail.com> |
||||
" Home: http://code.google.com/p/vimwiki/ |
||||
|
||||
" text: '''strong''' |
||||
let g:vimwiki_rxBold = "'''[^']\\+'''" |
||||
let g:vimwiki_char_bold = "'''" |
||||
|
||||
" text: ''emphasis'' |
||||
let g:vimwiki_rxItalic = "''[^']\\+''" |
||||
let g:vimwiki_char_italic = "''" |
||||
|
||||
" text: '''''strong italic''''' |
||||
let g:vimwiki_rxBoldItalic = "'''''[^']\\+'''''" |
||||
let g:vimwiki_rxItalicBold = g:vimwiki_rxBoldItalic |
||||
let g:vimwiki_char_bolditalic = "'''''" |
||||
let g:vimwiki_char_italicbold = g:vimwiki_char_bolditalic |
||||
|
||||
" text: `code` |
||||
let g:vimwiki_rxCode = '`[^`]\+`' |
||||
let g:vimwiki_char_code = '`' |
||||
|
||||
" text: ~~deleted text~~ |
||||
let g:vimwiki_rxDelText = '\~\~[^~]\+\~\~' |
||||
let g:vimwiki_char_deltext = '\~\~' |
||||
|
||||
" text: ^superscript^ |
||||
let g:vimwiki_rxSuperScript = '\^[^^]\+\^' |
||||
let g:vimwiki_char_superscript = '^' |
||||
|
||||
" text: ,,subscript,, |
||||
let g:vimwiki_rxSubScript = ',,[^,]\+,,' |
||||
let g:vimwiki_char_subscript = ',,' |
||||
|
||||
" Header levels, 1-6 |
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$' |
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$' |
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$' |
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$' |
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$' |
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$' |
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'. |
||||
\ '\%('.g:vimwiki_rxH6.'\)' |
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)' |
||||
|
||||
" <hr>, horizontal rule |
||||
let g:vimwiki_rxHR = '^----.*$' |
||||
|
||||
" Tables. Each line starts and ends with '||'; each cell is separated by '||' |
||||
let g:vimwiki_rxTable = '||' |
||||
|
||||
" Bulleted list items start with whitespace(s), then '*' |
||||
" highlight only bullets and digits. |
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\([^*]*$\)\@=' |
||||
let g:vimwiki_rxListNumber = '^\s*#\+' |
||||
|
||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s' |
||||
|
||||
" Preformatted text |
||||
let g:vimwiki_rxPreStart = '<pre>' |
||||
let g:vimwiki_rxPreEnd = '<\/pre>' |
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$' |
Loading…
Reference in new issue