Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6766c37ce0 | |||
| 5553cef249 | |||
| 7fbeea2c1e | |||
| 57385b29bb | |||
| d0e14dd11c | |||
| a5ef478750 | |||
| 605604fc23 | |||
| 7f98bfbe4b | |||
| 54d1a997d9 | |||
| 5ab8f8672e | |||
| 1b2643ea19 | |||
| e16dc41a50 | |||
| 19f1d36229 | |||
| b8d0cf377d | |||
| a7160310c9 | |||
| 0f38192b03 | |||
| 41199e6e3b | |||
| 69aa609941 | |||
| 72bbb1b740 | |||
| 7699967a99 | |||
| 394efe4312 | |||
| ea13b0e848 | |||
| daee3b4796 | |||
| bda3a59f91 | |||
| 417490f30b | |||
| 1cffbdbf3d | |||
| 28675698ad | |||
| 4e6db92d2c | |||
| aca8c2b8cc | |||
| fdc367f725 | |||
| 7ffc295094 | |||
| f882cf0152 | |||
| f55ec31675 | |||
| 9f797f6ad9 | |||
| 9f8b0082db | |||
| f60923eaa3 |
@@ -0,0 +1,11 @@
|
|||||||
|
# Issue Checks
|
||||||
|
|
||||||
|
Prior to submitting a new issue make sure to complete these steps:
|
||||||
|
|
||||||
|
1. Checkout the `dev` branch and confirm the issue is present there as well.
|
||||||
|
The `dev` branch contains fixes that may not have been merged to `master` yet.
|
||||||
|
2. Post the syntax you are using (default/mediawiki/markdown) **and** your vimwiki settings from your `.vimrc`
|
||||||
|
3. Provide a detailed description of the problem including **steps to reproduce the issue**.
|
||||||
|
4. Include the output of `:VimwikiShowVersion`.
|
||||||
|
|
||||||
|
**DELETE THIS TEMPLATE TEXT PRIOR TO SUBMITTING THE ISSUE**
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Pull Request Checks
|
||||||
|
|
||||||
|
1. **ALL** pull requests should be made against the `dev` branch!
|
||||||
|
2. Take a look at [CONTRIBUTING.MD](https://github.com/vimwiki/vimwiki/blob/dev/CONTRIBUTING.md)
|
||||||
|
3. Reference any related issues.
|
||||||
|
4. Provide a description of the proposed changes and any testing that was done.
|
||||||
|
5. Make sure to update the documentation in `doc/vimwiki.txt` if applicable.
|
||||||
|
|
||||||
|
**DELETE THIS TEMPLATE TEXT PRIOR TO SUBMITTING YOUR PULL REQUEST**
|
||||||
+11
-2
@@ -10,14 +10,23 @@ If you want to provide a pull request on GitHub, please start from the `dev` bra
|
|||||||
`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.)
|
`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.)
|
||||||
|
|
||||||
|
|
||||||
# More info for (aspiring) core developers
|
# 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 compatiblility. 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
|
## Git branching model
|
||||||
- there are two branches with eternal lifetime:
|
- 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
|
- `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
|
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
|
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).
|
unusable (or at least push these commits at one go).
|
||||||
- `master`: This branches is for released states only. Whenever a reasonable set of changes has
|
- `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,
|
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
|
`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
|
the version number in `plugin/vimwiki.vim` is updated. Apart from these commits and the merge
|
||||||
|
|||||||
+84
-54
@@ -1,63 +1,62 @@
|
|||||||
一个私人的维基——vim插件
|
VimWiki —— Vim 个人 Wiki 插件
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
[English](README.md)
|
||||||
|
|
||||||

|

|
||||||

|
 *
|
||||||
|
|
||||||
介绍
|
介绍
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
Vimwiki是私人维基的vim插件 -- 许多有自己代码高亮的text文件。
|
Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法高亮的文本文件。
|
||||||
|
|
||||||
通过 Vimwiki,你可以:
|
通过 Vimwiki,你可以:
|
||||||
|
|
||||||
* 组织笔记和想法
|
* 组织笔记和想法
|
||||||
* 制作代办事项表
|
* 管理待办事项
|
||||||
* 写文档
|
* 编写文档
|
||||||
|
* 坚持写日记
|
||||||
|
* 将这一切导出成 HTML 网页
|
||||||
|
|
||||||
一个快速的开始,通常使用`<Leader>ww`(一般是`\ww`),然后创建你的index wiki文件。
|
马上开始!按下 `<Leader>ww`(通常是 `\ww`)进入作为目录页的 wiki 文件,这个文件默认存放在 `~/vimwiki/index.wiki`。
|
||||||
通常,它在:
|
|
||||||
|
|
||||||
~/vimwiki/index.wiki
|
在该文件中输入以下示例:
|
||||||
|
|
||||||
在这个文件,输入如下的例子:
|
= 我的个人知识库 =
|
||||||
|
* 任务列表 -- _昨天_ 就该完成的事!!!
|
||||||
|
* Gutenberg 计划 -- 好书给我力量。
|
||||||
|
* 草稿 -- 临时记录一些东西。
|
||||||
|
|
||||||
= My knowledge base =
|
把光标移到 `任务` 二字上,按 Enter(回车)创建链接。按下后,`任务`二字会变成 `[[任务]]` —— 这是一个 Vimwiki 链接。再次按 Enter 即可进入这个链接(打开新的 wiki 文件)。编辑这个新文件,保存,然后按 Backspace(退格)就能回到目录页。
|
||||||
* Tasks -- things to be done _yesterday_!!!
|
|
||||||
* Project Gutenberg -- good books are power.
|
|
||||||
* Scratchpad -- various temporary stuff.
|
|
||||||
|
|
||||||
将你的光标放到`Tasks`(任务)上,并且按回车键去创建一个链接。一旦按下,`Task`将会
|
如果 Vimwiki 链接长度不止一个单词(指的是英文单词),只需在 Visual 模式选择这段文本后按 Enter 即可。用上面的 `Gutenberg 计划` 试试吧。最终结果是这样:
|
||||||
变成`[[Tasks]]` -- 一个vimwiki的链接。再按一次回车去打开它。编辑文件,保存它,
|
|
||||||
然后按backspace来返回你的index。
|
|
||||||
|
|
||||||
一个vimwiki链接可以一句话创建。只需要通过选择visual模式选择这个句子,然后按回车。
|
= 我的个人知识库 =
|
||||||
你可以通过选择`Project Gutenberg`来尝试。结果像是这个样子:
|
* [[任务列表]] -- _昨天_ 就该完成的事!!!
|
||||||
|
* [[Gutenberg 计划]] -- 好书给我力量。
|
||||||
= My knowledge base =
|
* 草稿 -- 临时记录一些东西。
|
||||||
* [[Tasks]] -- things to be done _yesterday_!!!
|
|
||||||
* [[Project Gutenberg]] -- good books are power.
|
|
||||||
* Scratchpad -- various temporary stuff.
|
|
||||||
|
|
||||||
|
|
||||||
基本标记
|
基本标记
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
= Header1 =
|
= 一级标题 =
|
||||||
== Header2 ==
|
== 二级标题 ==
|
||||||
=== Header3 ===
|
=== 三级标题 ===
|
||||||
|
|
||||||
|
|
||||||
*bold* -- bold text
|
*bold* -- 粗体文本
|
||||||
_italic_ -- italic text
|
_italic_ -- 斜体文本
|
||||||
|
(应用于句中的汉字文本时,必须在标记前后加空格,例如:一段 *中文* 文本)
|
||||||
|
|
||||||
[[wiki link]] -- wiki link
|
[[wiki link]] -- wiki 链接
|
||||||
[[wiki link|description]] -- wiki link with description
|
[[wiki link|description]] -- 带有描述文本的 wiki 链接
|
||||||
|
|
||||||
|
|
||||||
列表:
|
列表:
|
||||||
|
|
||||||
* bullet list item 1
|
* bullet list item 1(无编号列表)
|
||||||
- bullet list item 2
|
- bullet list item 2
|
||||||
- bullet list item 3
|
- bullet list item 3
|
||||||
* bullet list item 4
|
* bullet list item 4
|
||||||
@@ -67,13 +66,13 @@ Vimwiki是私人维基的vim插件 -- 许多有自己代码高亮的text文件
|
|||||||
- bullet list item 8
|
- bullet list item 8
|
||||||
- bullet list item 9
|
- bullet list item 9
|
||||||
|
|
||||||
1. numbered list item 1
|
1. numbered list item 1(有编号列表)
|
||||||
2. numbered list item 2
|
2. numbered list item 2
|
||||||
a) numbered list item 3
|
a) numbered list item 3
|
||||||
b) numbered list item 4
|
b) numbered list item 4
|
||||||
|
|
||||||
|
|
||||||
查看`:h vimwiki-syntax`
|
更多格式说明,请阅 `:h vimwiki-syntax`
|
||||||
|
|
||||||
|
|
||||||
键位绑定
|
键位绑定
|
||||||
@@ -81,46 +80,49 @@ Vimwiki是私人维基的vim插件 -- 许多有自己代码高亮的text文件
|
|||||||
|
|
||||||
normal 模式:
|
normal 模式:
|
||||||
|
|
||||||
* `<Leader>ww` -- 打开默认的wiki index文件
|
* `<Leader>ww` -- 打开默认的 wiki 目录文件
|
||||||
* `<Leader>wt` -- 通过tab实现上一个功能
|
* `<Leader>wt` -- 在新标签(Tab)中打开 wiki 目录文件
|
||||||
* `<Leader>ws` -- 选择并且打开index文件
|
* `<Leader>ws` -- 在多个 wiki 中选择并打开该 wiki 的目录文件
|
||||||
* `<Leader>wd` -- 删除进入的wiki文件
|
* `<Leader>wd` -- 删除当前 wiki 文件
|
||||||
* `<Leader>wr` -- 重命名你进入的wiki文件
|
* `<Leader>wr` -- 重命名当前 wiki 文件
|
||||||
* `<Enter>` -- 进入/创建 wiki 链接
|
* `<Enter>` -- 创建或打开 wiki 链接
|
||||||
* `<Shift-Enter>` -- 通过分屏模式sp,进入/创建wiki链接
|
* `<Shift-Enter>` -- 先上下分屏再打开 wiki 链接(若非链接则先创建)
|
||||||
* `<Ctrl-Enter>` -- 通过分屏模式vs,进入/创建wiki链接
|
* `<Ctrl-Enter>` -- 先左右分屏再打开 wiki 链接(若非链接则先创建)
|
||||||
* `<Backspace>` -- 返回父节点
|
* `<Backspace>` -- 返回之前浏览的 wiki 文件
|
||||||
* `<Tab>` -- 寻找下一个wiki链接
|
* `<Tab>` -- 跳到本文件中下一个 wiki 链接
|
||||||
* `<Shift-Tab>` -- 寻找上一个wiki链接
|
* `<Shift-Tab>` -- 跳到本文件中上一个 wiki 链接
|
||||||
|
|
||||||
查看`:h vimwiki-mappings`
|
更多快捷键说明,请阅 `:h vimwiki-mappings`
|
||||||
|
|
||||||
|
|
||||||
命令
|
命令
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
* `:Vimwiki2HTML` -- 转换当前wiki成为html
|
* `:Vimwiki2HTML` -- 将当前 wiki 文件转换成 HTML 网页
|
||||||
* `:VimwikiAll2HTML` -- 转化你的全部wiki到html
|
* `:VimwikiAll2HTML` -- 把所有 wiki 文件转换成 HTML 网页
|
||||||
* `:help vimwiki-commands` -- 显示全部命令
|
* `:help vimwiki-commands` -- 显示全部命令
|
||||||
|
|
||||||
|
|
||||||
安装细节
|
安装
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
在安装之前,你需要做的
|
准备工作
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
确定在`vimrc`中,你的设置是这样的。
|
确保在 `vimrc` 中加入了以下设置:
|
||||||
|
|
||||||
set nocompatible
|
set nocompatible
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
syntax on
|
syntax on
|
||||||
|
|
||||||
如果没有他们,Vimwiki将无法正常工作。
|
没有这些设置,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 )
|
通过 [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) 安装
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
cd ~/.vim
|
cd ~/.vim
|
||||||
@@ -128,4 +130,32 @@ normal 模式:
|
|||||||
cd bundle
|
cd bundle
|
||||||
git clone https://github.com/vimwiki/vimwiki.git
|
git clone https://github.com/vimwiki/vimwiki.git
|
||||||
|
|
||||||
然后启动vim,使用`:Helptags` 然后 `:help vimwiki`来确保他已经被安装了。
|
通过 [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) 插件。
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
A Personal Wiki For Vim
|
A Personal Wiki For Vim
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
[中文](README-cn.md)
|
||||||
|
|
||||||

|

|
||||||
 *
|
 *
|
||||||
|
|
||||||
@@ -105,6 +107,19 @@ Commands
|
|||||||
* `:Vimwiki2HTML` -- Convert current wiki link to HTML
|
* `:Vimwiki2HTML` -- Convert current wiki link to HTML
|
||||||
* `:VimwikiAll2HTML` -- Convert all your wiki links to HTML
|
* `:VimwikiAll2HTML` -- Convert all your wiki links to HTML
|
||||||
* `:help vimwiki-commands` -- list all commands
|
* `: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:
|
||||||
|
```
|
||||||
|
let g:vimwiki_list = [{'path': '~/vimwiki/',
|
||||||
|
\ 'syntax': 'markdown', 'ext': '.md'}]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
@@ -140,7 +155,7 @@ Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
|
|||||||
|
|
||||||
Add the following to the plugin-configuration in your vimrc:
|
Add the following to the plugin-configuration in your vimrc:
|
||||||
|
|
||||||
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
|
Plug 'vimwiki/vimwiki'
|
||||||
|
|
||||||
Then run `:PlugInstall`.
|
Then run `:PlugInstall`.
|
||||||
|
|
||||||
@@ -159,8 +174,13 @@ Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was insta
|
|||||||
Getting help
|
Getting help
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki))
|
Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki), also synced to Matrix/Riot: `#freenode_#vimwiki:matrix.org`) or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -152,7 +152,13 @@ function! vimwiki#base#resolve_link(link_text, ...)
|
|||||||
let link_infos.anchor = join(split_lnk[1:], '#')
|
let link_infos.anchor = join(split_lnk[1:], '#')
|
||||||
endif
|
endif
|
||||||
if link_text == '' " because the link was of the form '#anchor'
|
if link_text == '' " because the link was of the form '#anchor'
|
||||||
let link_text = fnamemodify(source_file, ':p:t:r')
|
let expected_ext = vimwiki#u#escape(vimwiki#vars#get_wikilocal('ext')).'$'
|
||||||
|
if source_file =~# expected_ext
|
||||||
|
" Source file has expected extension. Remove it, it will be added later on
|
||||||
|
let ext_len = strlen(vimwiki#vars#get_wikilocal('ext'))
|
||||||
|
let link_text = fnamemodify(source_file, ':p:t')[:-ext_len-1]
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1856,15 +1862,14 @@ function! vimwiki#base#table_of_contents(create)
|
|||||||
let indentstring = repeat(' ', vimwiki#u#sw())
|
let indentstring = repeat(' ', vimwiki#u#sw())
|
||||||
let bullet = vimwiki#lst#default_symbol().' '
|
let bullet = vimwiki#lst#default_symbol().' '
|
||||||
for [lvl, link, desc] in complete_header_infos
|
for [lvl, link, desc] in complete_header_infos
|
||||||
let esc_link = substitute(link, "'", "''", 'g')
|
|
||||||
let esc_desc = substitute(desc, "'", "''", 'g')
|
|
||||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
|
||||||
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
|
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
|
||||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||||
|
else
|
||||||
|
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||||
endif
|
endif
|
||||||
let link = s:safesubstitute(link_tpl, '__LinkUrl__',
|
let link = s:safesubstitute(link_tpl, '__LinkUrl__',
|
||||||
\ '#'.esc_link, '')
|
\ '#'.link, '')
|
||||||
let link = s:safesubstitute(link, '__LinkDescription__', esc_desc, '')
|
let link = s:safesubstitute(link, '__LinkDescription__', desc, '')
|
||||||
call add(lines, startindent.repeat(indentstring, lvl-1).bullet.link)
|
call add(lines, startindent.repeat(indentstring, lvl-1).bullet.link)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -886,8 +886,8 @@ function! s:process_tag_list(line, lists)
|
|||||||
let st_tag = '<li>'
|
let st_tag = '<li>'
|
||||||
let chk = matchlist(a:line, a:rx_list)
|
let chk = matchlist(a:line, a:rx_list)
|
||||||
if !empty(chk) && len(chk[1]) > 0
|
if !empty(chk) && len(chk[1]) > 0
|
||||||
let completion = index(vimwiki#vars#get_wikilocal('listsyms_list'), chk[1])
|
let completion = index(vimwiki#vars#get_syntaxlocal('listsyms_list'), chk[1])
|
||||||
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
|
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
|
||||||
if completion == 0
|
if completion == 0
|
||||||
let st_tag = '<li class="done0">'
|
let st_tag = '<li class="done0">'
|
||||||
elseif completion == -1 && chk[1] == vimwiki#vars#get_global('listsym_rejected')
|
elseif completion == -1 && chk[1] == vimwiki#vars#get_global('listsym_rejected')
|
||||||
@@ -1072,7 +1072,9 @@ function! s:process_tag_h(line, id)
|
|||||||
let h_text = num.' '.h_text
|
let h_text = num.' '.h_text
|
||||||
endif
|
endif
|
||||||
let h_complete_id = s:escape_html_attribute(h_complete_id)
|
let h_complete_id = s:escape_html_attribute(h_complete_id)
|
||||||
let h_part = '<div id="'.h_complete_id.'"><h'.h_level.' id="'.h_id.'"'
|
let h_part = '<div id="'.h_complete_id.'">'
|
||||||
|
let h_part .= '<h'.h_level.' id="'.h_id.'" class="header">'
|
||||||
|
let h_part .= '<a href="#'.h_complete_id.'"'
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -1088,7 +1090,7 @@ function! s:process_tag_h(line, id)
|
|||||||
|
|
||||||
let h_text = s:process_inline_tags(h_text, a:id)
|
let h_text = s:process_inline_tags(h_text, a:id)
|
||||||
|
|
||||||
let line = h_part.h_text.'</h'.h_level.'></div>'
|
let line = h_part.h_text.'</a></h'.h_level.'></div>'
|
||||||
|
|
||||||
let processed = 1
|
let processed = 1
|
||||||
endif
|
endif
|
||||||
@@ -1476,7 +1478,7 @@ function! s:convert_file(path_html, wikifile)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" prepare regexps for lists
|
" prepare regexps for lists
|
||||||
let s:bullets = vimwiki#vars#get_wikilocal('rx_bullet_char')
|
let s:bullets = '[*-]'
|
||||||
let s:numbers = '\C\%(#\|\d\+)\|\d\+\.\|[ivxlcdm]\+)\|[IVXLCDM]\+)\|\l\{1,2})\|\u\{1,2})\)'
|
let s:numbers = '\C\%(#\|\d\+)\|\d\+\.\|[ivxlcdm]\+)\|[IVXLCDM]\+)\|\l\{1,2})\|\u\{1,2})\)'
|
||||||
|
|
||||||
for line in lsource
|
for line in lsource
|
||||||
|
|||||||
+16
-17
@@ -137,7 +137,7 @@ endfunction
|
|||||||
"Returns: the column where the text of a line starts (possible list item
|
"Returns: the column where the text of a line starts (possible list item
|
||||||
"markers and checkboxes are skipped)
|
"markers and checkboxes are skipped)
|
||||||
function! s:text_begin(lnum)
|
function! s:text_begin(lnum)
|
||||||
return s:string_length(matchstr(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem')))
|
return s:string_length(matchstr(getline(a:lnum), vimwiki#vars#get_syntaxlocal('rxListItem')))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@@ -145,9 +145,9 @@ endfunction
|
|||||||
" 1 for a marker and no text
|
" 1 for a marker and no text
|
||||||
" 0 for no marker at all (empty line or only text)
|
" 0 for no marker at all (empty line or only text)
|
||||||
function! s:line_has_marker(lnum)
|
function! s:line_has_marker(lnum)
|
||||||
if getline(a:lnum) =~# vimwiki#vars#get_wikilocal('rxListItem').'\s*$'
|
if getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxListItem').'\s*$'
|
||||||
return 1
|
return 1
|
||||||
elseif getline(a:lnum) =~# vimwiki#vars#get_wikilocal('rxListItem').'\s*\S'
|
elseif getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxListItem').'\s*\S'
|
||||||
return 2
|
return 2
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
@@ -172,7 +172,7 @@ function! s:get_item(lnum)
|
|||||||
return item
|
return item
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem'))
|
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_syntaxlocal('rxListItem'))
|
||||||
if matches == [] ||
|
if matches == [] ||
|
||||||
\ (matches[1] == '' && matches[2] == '') ||
|
\ (matches[1] == '' && matches[2] == '') ||
|
||||||
\ (matches[1] != '' && matches[2] != '')
|
\ (matches[1] != '' && matches[2] != '')
|
||||||
@@ -209,7 +209,7 @@ function! s:get_level(lnum)
|
|||||||
let level = indent(a:lnum)
|
let level = indent(a:lnum)
|
||||||
else
|
else
|
||||||
let level = s:string_length(matchstr(getline(a:lnum),
|
let level = s:string_length(matchstr(getline(a:lnum),
|
||||||
\ vimwiki#vars#get_wikilocal(rx_bullet_chars)))-1
|
\ vimwiki#vars#get_syntaxlocal(rx_bullet_chars)))-1
|
||||||
if level < 0
|
if level < 0
|
||||||
let level = (indent(a:lnum) == 0) ? 0 : 9999
|
let level = (indent(a:lnum) == 0) ? 0 : 9999
|
||||||
endif
|
endif
|
||||||
@@ -744,8 +744,8 @@ function! s:get_rate(item)
|
|||||||
if state == vimwiki#vars#get_global('listsym_rejected')
|
if state == vimwiki#vars#get_global('listsym_rejected')
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
|
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
|
||||||
return index(vimwiki#vars#get_wikilocal('listsyms_list'), state) * 100/(n-1)
|
return index(vimwiki#vars#get_syntaxlocal('listsyms_list'), state) * 100/(n-1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ function! s:set_state_plus_children(item, new_rate, ...)
|
|||||||
if child_item.cb != vimwiki#vars#get_global('listsym_rejected')
|
if child_item.cb != vimwiki#vars#get_global('listsym_rejected')
|
||||||
let all_children_are_rejected = 0
|
let all_children_are_rejected = 0
|
||||||
endif
|
endif
|
||||||
if child_item.cb != vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
if child_item.cb != vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
|
||||||
let all_children_are_done = 0
|
let all_children_are_done = 0
|
||||||
endif
|
endif
|
||||||
if !all_children_are_done && !all_children_are_rejected
|
if !all_children_are_done && !all_children_are_rejected
|
||||||
@@ -820,7 +820,7 @@ endfunction
|
|||||||
|
|
||||||
"Returns: the appropriate symbol for a given percent rate
|
"Returns: the appropriate symbol for a given percent rate
|
||||||
function! s:rate_to_state(rate)
|
function! s:rate_to_state(rate)
|
||||||
let listsyms_list = vimwiki#vars#get_wikilocal('listsyms_list')
|
let listsyms_list = vimwiki#vars#get_syntaxlocal('listsyms_list')
|
||||||
let state = ''
|
let state = ''
|
||||||
let n = len(listsyms_list)
|
let n = len(listsyms_list)
|
||||||
if a:rate == 100
|
if a:rate == 100
|
||||||
@@ -997,7 +997,7 @@ function! vimwiki#lst#decrement_cb(from_line, to_line)
|
|||||||
|
|
||||||
"if from_line has CB, decrement it and set all siblings to the same new state
|
"if from_line has CB, decrement it and set all siblings to the same new state
|
||||||
let rate_first_line = s:get_rate(from_item)
|
let rate_first_line = s:get_rate(from_item)
|
||||||
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
|
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
|
||||||
let new_rate = max([rate_first_line - 100/(n-1)-1, 0])
|
let new_rate = max([rate_first_line - 100/(n-1)-1, 0])
|
||||||
|
|
||||||
call s:change_cb(a:from_line, a:to_line, new_rate)
|
call s:change_cb(a:from_line, a:to_line, new_rate)
|
||||||
@@ -1015,7 +1015,7 @@ function! vimwiki#lst#increment_cb(from_line, to_line)
|
|||||||
|
|
||||||
"if from_line has CB, increment it and set all siblings to the same new state
|
"if from_line has CB, increment it and set all siblings to the same new state
|
||||||
let rate_first_line = s:get_rate(from_item)
|
let rate_first_line = s:get_rate(from_item)
|
||||||
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
|
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
|
||||||
let new_rate = min([rate_first_line + 100/(n-1)+1, 100])
|
let new_rate = min([rate_first_line + 100/(n-1)+1, 100])
|
||||||
|
|
||||||
call s:change_cb(a:from_line, a:to_line, new_rate)
|
call s:change_cb(a:from_line, a:to_line, new_rate)
|
||||||
@@ -1034,7 +1034,6 @@ endfunction
|
|||||||
"in the lines of the given range
|
"in the lines of the given range
|
||||||
function! vimwiki#lst#toggle_rejected_cb(from_line, to_line)
|
function! vimwiki#lst#toggle_rejected_cb(from_line, to_line)
|
||||||
return s:toggle_create_cb(a:from_line, a:to_line, -1, 0, -1)
|
return s:toggle_create_cb(a:from_line, a:to_line, -1, 0, -1)
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@@ -1102,7 +1101,7 @@ endfunction
|
|||||||
function! s:decrease_level(item)
|
function! s:decrease_level(item)
|
||||||
let removed_indent = 0
|
let removed_indent = 0
|
||||||
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
|
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
|
||||||
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
|
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
|
||||||
\ s:first_char(a:item.mrkr)) > -1
|
\ s:first_char(a:item.mrkr)) > -1
|
||||||
if s:string_length(a:item.mrkr) >= 2
|
if s:string_length(a:item.mrkr) >= 2
|
||||||
call s:substitute_string_in_line(a:item.lnum, s:first_char(a:item.mrkr), '')
|
call s:substitute_string_in_line(a:item.lnum, s:first_char(a:item.mrkr), '')
|
||||||
@@ -1125,7 +1124,7 @@ endfunction
|
|||||||
function! s:increase_level(item)
|
function! s:increase_level(item)
|
||||||
let additional_indent = 0
|
let additional_indent = 0
|
||||||
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
|
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
|
||||||
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
|
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
|
||||||
\ s:first_char(a:item.mrkr)) > -1
|
\ s:first_char(a:item.mrkr)) > -1
|
||||||
call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:item.mrkr .
|
call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:item.mrkr .
|
||||||
\ s:first_char(a:item.mrkr))
|
\ s:first_char(a:item.mrkr))
|
||||||
@@ -1149,7 +1148,7 @@ endfunction
|
|||||||
function! s:indent_line_by(lnum, indent_by)
|
function! s:indent_line_by(lnum, indent_by)
|
||||||
let item = s:get_item(a:lnum)
|
let item = s:get_item(a:lnum)
|
||||||
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && item.type == 1 &&
|
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && item.type == 1 &&
|
||||||
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
|
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
|
||||||
\ s:first_char(item.mrkr)) > -1
|
\ s:first_char(item.mrkr)) > -1
|
||||||
if a:indent_by > 0
|
if a:indent_by > 0
|
||||||
call s:substitute_string_in_line(a:lnum, item.mrkr, item.mrkr . s:first_char(item.mrkr))
|
call s:substitute_string_in_line(a:lnum, item.mrkr, item.mrkr . s:first_char(item.mrkr))
|
||||||
@@ -1324,7 +1323,7 @@ function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
"handle markers like ***
|
"handle markers like ***
|
||||||
if index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'), s:first_char(new_mrkr)) > -1
|
if index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'), s:first_char(new_mrkr)) > -1
|
||||||
"use *** if the item above has *** too
|
"use *** if the item above has *** too
|
||||||
let item_above = s:get_prev_list_item(cur_item, 1)
|
let item_above = s:get_prev_list_item(cur_item, 1)
|
||||||
if item_above.type == 1 && s:first_char(item_above.mrkr) ==# s:first_char(new_mrkr)
|
if item_above.type == 1 && s:first_char(item_above.mrkr) ==# s:first_char(new_mrkr)
|
||||||
@@ -1395,7 +1394,7 @@ function! s:adjust_mrkr(item)
|
|||||||
|
|
||||||
"if possible, set e.g. *** if parent has ** as marker
|
"if possible, set e.g. *** if parent has ** as marker
|
||||||
if neighbor_item.type == 0 && a:item.type == 1 &&
|
if neighbor_item.type == 0 && a:item.type == 1 &&
|
||||||
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
|
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
|
||||||
\ s:first_char(a:item.mrkr)) > -1
|
\ s:first_char(a:item.mrkr)) > -1
|
||||||
let parent_item = s:get_parent(a:item)
|
let parent_item = s:get_parent(a:item)
|
||||||
if parent_item.type == 1 && s:first_char(parent_item.mrkr) ==# s:first_char(a:item.mrkr)
|
if parent_item.type == 1 && s:first_char(parent_item.mrkr) ==# s:first_char(a:item.mrkr)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ del {text-decoration: line-through; color: #777777;}
|
|||||||
.justcenter {text-align: center;}
|
.justcenter {text-align: center;}
|
||||||
.center {margin-left: auto; margin-right: auto;}
|
.center {margin-left: auto; margin-right: auto;}
|
||||||
.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
|
.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
|
||||||
|
.header a {text-decoration: none; color: inherit;}
|
||||||
|
|
||||||
/* classes for items of todo lists */
|
/* classes for items of todo lists */
|
||||||
.rejected {
|
.rejected {
|
||||||
|
|||||||
+251
-141
@@ -13,7 +13,7 @@
|
|||||||
" global user variables and syntax stuff which is the same for every syntax.
|
" 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
|
" - 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
|
" dictionaries, one dict for every registered wiki. The last dictionary contains default values
|
||||||
" (used for temporary wikis).
|
" (used for temporary wikis).
|
||||||
"
|
"
|
||||||
" - syntax variables. Stored in the dict g:vimwiki_syntax_variables which holds all the regexes and
|
" - syntax variables. Stored in the dict g:vimwiki_syntax_variables which holds all the regexes and
|
||||||
@@ -28,50 +28,10 @@
|
|||||||
|
|
||||||
function! s:populate_global_variables()
|
function! s:populate_global_variables()
|
||||||
|
|
||||||
let g:vimwiki_global_vars = {
|
let g:vimwiki_global_vars = {}
|
||||||
\ 'CJK_length': 0,
|
|
||||||
\ 'auto_chdir': 0,
|
|
||||||
\ 'autowriteall': 1,
|
|
||||||
\ 'conceallevel': 2,
|
|
||||||
\ 'diary_months':
|
|
||||||
\ {
|
|
||||||
\ 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': '',
|
|
||||||
\ 'ext2syntax': {},
|
|
||||||
\ 'folding': '',
|
|
||||||
\ 'global_ext': 1,
|
|
||||||
\ 'hl_cb_checked': 0,
|
|
||||||
\ 'hl_headers': 0,
|
|
||||||
\ 'html_header_numbering': 0,
|
|
||||||
\ 'html_header_numbering_sym': '',
|
|
||||||
\ 'list_ignore_newline': 1,
|
|
||||||
\ 'text_ignore_newline': 1,
|
|
||||||
\ 'listsyms': ' .oOX',
|
|
||||||
\ 'listsym_rejected': '-',
|
|
||||||
\ 'map_prefix': '<Leader>w',
|
|
||||||
\ 'menu': 'Vimwiki',
|
|
||||||
\ 'table_auto_fmt': 1,
|
|
||||||
\ 'table_mappings': 1,
|
|
||||||
\ 'toc_header': 'Contents',
|
|
||||||
\ 'url_maxsave': 15,
|
|
||||||
\ 'use_calendar': 1,
|
|
||||||
\ 'use_mouse': 0,
|
|
||||||
\ 'user_htmls': '',
|
|
||||||
\ 'valid_html_tags': 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em',
|
|
||||||
\ 'w32_dir_enc': '',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
" copy the user's settings from variables of the form g:vimwiki_<option> into the dict
|
call s:read_global_settings_from_user()
|
||||||
" g:vimwiki_global_vars (or set a default value)
|
call s:normalize_global_settings()
|
||||||
for key in keys(g:vimwiki_global_vars)
|
|
||||||
if exists('g:vimwiki_'.key)
|
|
||||||
let g:vimwiki_global_vars[key] = g:vimwiki_{key}
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
" non-configurable global variables:
|
" non-configurable global variables:
|
||||||
|
|
||||||
@@ -125,8 +85,8 @@ function! s:populate_global_variables()
|
|||||||
" this regexp defines what can form a link when the user presses <CR> in the
|
" 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
|
" buffer (and not on a link) to create a link
|
||||||
" basically, it's Ascii alphanumeric characters plus #|./@-_~ plus all
|
" basically, it's Ascii alphanumeric characters plus #|./@-_~ plus all
|
||||||
" non-Ascii characters
|
" non-Ascii characters, except that . is not accepted as the last character
|
||||||
let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]\+'
|
let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]*[^[:blank:]!"$%&''()*+.,:;<=>?\[\]\\^`{}]'
|
||||||
|
|
||||||
let g:vimwiki_global_vars.rx_wikilink_prefix1 = g:vimwiki_global_vars.rx_wikilink_prefix .
|
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
|
\ g:vimwiki_global_vars.rxWikiLinkUrl . g:vimwiki_global_vars.rx_wikilink_separator
|
||||||
@@ -179,34 +139,131 @@ function! s:populate_global_variables()
|
|||||||
endfunction
|
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()
|
function! s:populate_wikilocal_options()
|
||||||
let default_values = {
|
let default_values = {
|
||||||
\ 'auto_diary_index': 0,
|
\ 'auto_diary_index': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'auto_export': 0,
|
\ 'auto_export': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'auto_tags': 0,
|
\ 'auto_tags': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'auto_toc': 0,
|
\ 'auto_toc': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'automatic_nested_syntaxes': 1,
|
\ 'automatic_nested_syntaxes': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
||||||
\ 'css_name': 'style.css',
|
\ 'css_name': {'type': type(''), 'default': 'style.css', 'min_length': 1},
|
||||||
\ 'custom_wiki2html': '',
|
\ 'custom_wiki2html': {'type': type(''), 'default': ''},
|
||||||
\ 'custom_wiki2html_args': '',
|
\ 'custom_wiki2html_args': {'type': type(''), 'default': ''},
|
||||||
\ 'diary_header': 'Diary',
|
\ 'diary_header': {'type': type(''), 'default': 'Diary', 'min_length': 1},
|
||||||
\ 'diary_index': 'diary',
|
\ 'diary_index': {'type': type(''), 'default': 'diary', 'min_length': 1},
|
||||||
\ 'diary_rel_path': 'diary/',
|
\ 'diary_rel_path': {'type': type(''), 'default': 'diary/', 'min_length': 1},
|
||||||
\ 'diary_sort': 'desc',
|
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
|
||||||
\ 'ext': '.wiki',
|
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
|
||||||
\ 'index': 'index',
|
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
|
||||||
\ 'list_margin': -1,
|
\ 'list_margin': {'type': type(0), 'default': -1, 'min': -1},
|
||||||
\ 'maxhi': 0,
|
\ 'maxhi': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'nested_syntaxes': {},
|
\ 'nested_syntaxes': {'type': type({}), 'default': {}},
|
||||||
\ 'path': $HOME . '/vimwiki/',
|
\ 'path': {'type': type(''), 'default': $HOME . '/vimwiki/', 'min_length': 1},
|
||||||
\ 'path_html': '',
|
\ 'path_html': {'type': type(''), 'default': ''},
|
||||||
\ 'syntax': 'default',
|
\ 'syntax': {'type': type(''), 'default': 'default',
|
||||||
\ 'template_default': 'default',
|
\ 'possible_values': ['default', 'markdown', 'media', 'mediawiki']},
|
||||||
\ 'template_ext': '.tpl',
|
\ 'template_default': {'type': type(''), 'default': 'default', 'min_length': 1},
|
||||||
\ 'template_path': $HOME . '/vimwiki/templates/',
|
\ 'template_ext': {'type': type(''), 'default': '.tpl'},
|
||||||
\ 'bullet_types': [],
|
\ 'template_path': {'type': type(''), 'default': $HOME . '/vimwiki/templates/'},
|
||||||
\ 'listsyms': vimwiki#vars#get_global("listsyms"),
|
|
||||||
\ 'listsym_rejected': vimwiki#vars#get_global("listsym_rejected"),
|
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
let g:vimwiki_wikilocal_vars = []
|
let g:vimwiki_wikilocal_vars = []
|
||||||
@@ -214,9 +271,10 @@ function! s:populate_wikilocal_options()
|
|||||||
let default_wiki_settings = {}
|
let default_wiki_settings = {}
|
||||||
for key in keys(default_values)
|
for key in keys(default_values)
|
||||||
if exists('g:vimwiki_'.key)
|
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}
|
let default_wiki_settings[key] = g:vimwiki_{key}
|
||||||
else
|
else
|
||||||
let default_wiki_settings[key] = default_values[key]
|
let default_wiki_settings[key] = default_values[key].default
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -226,11 +284,10 @@ function! s:populate_wikilocal_options()
|
|||||||
let new_wiki_settings = {}
|
let new_wiki_settings = {}
|
||||||
for key in keys(default_values)
|
for key in keys(default_values)
|
||||||
if has_key(users_wiki_settings, key)
|
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]
|
let new_wiki_settings[key] = users_wiki_settings[key]
|
||||||
elseif exists('g:vimwiki_'.key)
|
|
||||||
let new_wiki_settings[key] = g:vimwiki_{key}
|
|
||||||
else
|
else
|
||||||
let new_wiki_settings[key] = default_values[key]
|
let new_wiki_settings[key] = default_wiki_settings[key]
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -249,19 +306,80 @@ function! s:populate_wikilocal_options()
|
|||||||
let temporary_wiki_settings = deepcopy(default_wiki_settings)
|
let temporary_wiki_settings = deepcopy(default_wiki_settings)
|
||||||
let temporary_wiki_settings.is_temporary_wiki = 1
|
let temporary_wiki_settings.is_temporary_wiki = 1
|
||||||
call add(g:vimwiki_wikilocal_vars, temporary_wiki_settings)
|
call add(g:vimwiki_wikilocal_vars, temporary_wiki_settings)
|
||||||
" Set up variables for the lists, depending on config and syntax
|
|
||||||
for wiki in g:vimwiki_wikilocal_vars
|
" check some values individually
|
||||||
if len(wiki.bullet_types) == 0
|
let key = 'nested_syntaxes'
|
||||||
let wiki.bullet_types = vimwiki#vars#get_syntaxlocal('bullet_types', wiki.syntax)
|
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
|
endif
|
||||||
call vimwiki#vars#populate_list_vars(wiki)
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call s:validate_settings()
|
call s:normalize_wikilocal_settings()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:validate_settings()
|
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
|
for wiki_settings in g:vimwiki_wikilocal_vars
|
||||||
let wiki_settings['path'] = s:normalize_path(wiki_settings['path'])
|
let wiki_settings['path'] = s:normalize_path(wiki_settings['path'])
|
||||||
|
|
||||||
@@ -280,6 +398,11 @@ function! s:validate_settings()
|
|||||||
if !empty(ext) && ext[0] != '.'
|
if !empty(ext) && ext[0] != '.'
|
||||||
let wiki_settings['ext'] = '.' . ext
|
let wiki_settings['ext'] = '.' . ext
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" for convenience, we also allow the term 'mediawiki'
|
||||||
|
if wiki_settings.syntax ==# 'mediawiki'
|
||||||
|
let wiki_settings.syntax = 'media'
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -353,6 +476,20 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
|
|||||||
let g:vimwiki_syntax_variables[a:syntax].rxMathEnd =
|
let g:vimwiki_syntax_variables[a:syntax].rxMathEnd =
|
||||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathEnd.'\s*$'
|
\ '^\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]\+',
|
let char_to_rx = {'1': '\d\+', 'i': '[ivxlcdm]\+', 'I': '[IVXLCDM]\+',
|
||||||
\ 'a': '\l\{1,2}', 'A': '\u\{1,2}'}
|
\ 'a': '\l\{1,2}', 'A': '\u\{1,2}'}
|
||||||
@@ -384,6 +521,36 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
|
|||||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '$^'
|
let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '$^'
|
||||||
endif
|
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))
|
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||||
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
||||||
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
||||||
@@ -432,63 +599,6 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#vars#populate_list_vars(wiki)
|
|
||||||
let syntax = a:wiki.syntax
|
|
||||||
|
|
||||||
let a:wiki.rx_bullet_char = '['.escape(join(a:wiki.bullet_types, ''), ']^-\').']'
|
|
||||||
let a:wiki.rx_bullet_chars = a:wiki.rx_bullet_char.'\+'
|
|
||||||
|
|
||||||
let recurring_bullets = vimwiki#vars#get_syntaxlocal('recurring_bullets')
|
|
||||||
let rxListNumber = vimwiki#vars#get_syntaxlocal('rxListNumber')
|
|
||||||
|
|
||||||
let a:wiki.multiple_bullet_chars =
|
|
||||||
\ recurring_bullets
|
|
||||||
\ ? a:wiki.bullet_types : []
|
|
||||||
|
|
||||||
"create regexp for bulleted list items
|
|
||||||
if !empty(a:wiki.bullet_types)
|
|
||||||
let rxListBullet =
|
|
||||||
\ join( map(a:wiki.bullet_types,
|
|
||||||
\'vimwiki#u#escape(v:val).'
|
|
||||||
\ .'repeat("\\+", recurring_bullets)'
|
|
||||||
\ ) , '\|')
|
|
||||||
else
|
|
||||||
"regex that matches nothing
|
|
||||||
let rxListBullet = '$^'
|
|
||||||
endif
|
|
||||||
|
|
||||||
"the user can set the listsyms as string, but vimwiki needs a list
|
|
||||||
let a:wiki.listsyms_list = split(a:wiki.listsyms, '\zs')
|
|
||||||
|
|
||||||
if match(a:wiki.listsyms, a:wiki.listsym_rejected) != -1
|
|
||||||
echomsg 'Vimwiki Warning: the value of listsym_rejected ('''
|
|
||||||
\ . a:wiki.listsym_rejected . ''') must not be a part of listsyms ('''
|
|
||||||
\ . a:wiki.listsyms . ''')'
|
|
||||||
endif
|
|
||||||
|
|
||||||
let a:wiki.rxListItemWithoutCB =
|
|
||||||
\ '^\s*\%(\('.rxListBullet.'\)\|\('
|
|
||||||
\ .rxListNumber.'\)\)\s'
|
|
||||||
let a:wiki.rxListItem =
|
|
||||||
\ a:wiki.rxListItemWithoutCB
|
|
||||||
\ . '\+\%(\[\(['.a:wiki.listsyms
|
|
||||||
\ . a:wiki.listsym_rejected.']\)\]\s\)\?'
|
|
||||||
if recurring_bullets
|
|
||||||
let a:wiki.rxListItemAndChildren =
|
|
||||||
\ '^\('.rxListBullet.'\)\s\+\[['
|
|
||||||
\ . a:wiki.listsyms_list[-1]
|
|
||||||
\ . a:wiki.listsym_rejected . ']\]\s.*\%(\n\%(\1\%('
|
|
||||||
\ .rxListBullet.'\).*\|^$\|\s.*\)\)*'
|
|
||||||
else
|
|
||||||
let a:wiki.rxListItemAndChildren =
|
|
||||||
\ '^\(\s*\)\%('.rxListBullet.'\|'
|
|
||||||
\ . rxListNumber.'\)\s\+\[['
|
|
||||||
\ . a:wiki.listsyms_list[-1]
|
|
||||||
\ . a:wiki.listsym_rejected . ']\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
function! s:populate_extra_markdown_vars()
|
function! s:populate_extra_markdown_vars()
|
||||||
let mkd_syntax = g:vimwiki_syntax_variables['markdown']
|
let mkd_syntax = g:vimwiki_syntax_variables['markdown']
|
||||||
|
|
||||||
@@ -729,7 +839,7 @@ function! vimwiki#vars#add_temporary_wiki(settings)
|
|||||||
let new_temp_wiki_settings[key] = value
|
let new_temp_wiki_settings[key] = value
|
||||||
endfor
|
endfor
|
||||||
call insert(g:vimwiki_wikilocal_vars, new_temp_wiki_settings, -1)
|
call insert(g:vimwiki_wikilocal_vars, new_temp_wiki_settings, -1)
|
||||||
call s:validate_settings()
|
call s:normalize_wikilocal_settings()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+35
-65
@@ -707,7 +707,7 @@ Vimwiki file.
|
|||||||
*:VimwikiGoto*
|
*:VimwikiGoto*
|
||||||
Goto link provided by an argument. For example: >
|
Goto link provided by an argument. For example: >
|
||||||
:VimwikiGoto HelloWorld
|
:VimwikiGoto HelloWorld
|
||||||
< opens opens/creates HelloWorld wiki page.
|
< opens/creates HelloWorld wiki page.
|
||||||
|
|
||||||
Supports |cmdline-completion| for link name.
|
Supports |cmdline-completion| for link name.
|
||||||
|
|
||||||
@@ -1423,7 +1423,7 @@ Hit |zr| one more time :
|
|||||||
|
|
||||||
Note: If you use the default Vimwiki syntax, folding on list items will work
|
Note: If you use the default Vimwiki syntax, folding on list items will work
|
||||||
properly only if all of them are indented using the current 'shiftwidth'.
|
properly only if all of them are indented using the current 'shiftwidth'.
|
||||||
For MediaWiki syntax, * or # should be in the first column.
|
For Markdown and MediaWiki syntax, * or # should be in the first column.
|
||||||
|
|
||||||
To turn folding on/off check |g:vimwiki_folding|.
|
To turn folding on/off check |g:vimwiki_folding|.
|
||||||
|
|
||||||
@@ -1656,7 +1656,7 @@ parent items: >
|
|||||||
|
|
||||||
Parent items should change when their child items change. If not, use
|
Parent items should change when their child items change. If not, use
|
||||||
|vimwiki_glr|. The symbol between [ ] depends on the percentage of toggled
|
|vimwiki_glr|. The symbol between [ ] depends on the percentage of toggled
|
||||||
child items (see also |vimwiki-listsyms|): >
|
child items (see also |g:vimwiki_listsyms|): >
|
||||||
[ ] -- 0%
|
[ ] -- 0%
|
||||||
[.] -- 1-33%
|
[.] -- 1-33%
|
||||||
[o] -- 34-66%
|
[o] -- 34-66%
|
||||||
@@ -2280,55 +2280,8 @@ local mappings |vimwiki_glstar|, |vimwiki_gl#| |vimwiki_gl-|, |vimwiki_gl-|,
|
|||||||
|vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI| and
|
|vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI| and
|
||||||
|vimwiki_i_<C-L>_<C-M>|.
|
|vimwiki_i_<C-L>_<C-M>|.
|
||||||
|
|
||||||
Note: if you use MediaWiki syntax, you probably would like to set this option
|
Note: if you use Markdown or MediaWiki syntax, you probably would like to set
|
||||||
to 0, because every indented line is considered verbatim text.
|
this option to 0, because every indented line is considered verbatim text.
|
||||||
|
|
||||||
|
|
||||||
*vimwiki-bullet_types*
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Key Default value~
|
|
||||||
bullet_types ['-', '*', '#'] (default-syntax)
|
|
||||||
['-', '*', '+'] (markdown-syntax)
|
|
||||||
['*', '#'] (mediawiki-syntax)
|
|
||||||
|
|
||||||
List of the characters that can be used as bullets of lists. The default value
|
|
||||||
depends on the chosen syntax.
|
|
||||||
|
|
||||||
You can set it to include more fancy symbols like this:
|
|
||||||
>
|
|
||||||
let g:vimwiki_list = [{'path': '~/path/', 'bullet_types' = ['-', '•', '→']}]
|
|
||||||
|
|
||||||
|
|
||||||
*vimwiki-listsyms*
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Key Default value~
|
|
||||||
listsyms ' .oOX'
|
|
||||||
|
|
||||||
String of at least two symbols to show the progression of todo list items.
|
|
||||||
Default value is ' .oOX'. This overwrites the global |g:vimwiki_listsyms| on a
|
|
||||||
per wiki base.
|
|
||||||
|
|
||||||
The first char is for 0% done items.
|
|
||||||
The last is for 100% done items.
|
|
||||||
|
|
||||||
You can set it to some more fancy symbols like this:
|
|
||||||
>
|
|
||||||
let g:vimwiki_list = [{'path': '~/path/', 'listsyms' = '✗○◐●✓'}]
|
|
||||||
|
|
||||||
|
|
||||||
*vimwiki-listsym_rejected*
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Character that is used to show that an item of a todo list will not be done.
|
|
||||||
Default value is '-'. This overwrites the global |g:vimwiki_listsym_rejected| on a
|
|
||||||
per wiki base.
|
|
||||||
|
|
||||||
|
|
||||||
The character used here must not be part of |vimwiki-listsyms|.
|
|
||||||
|
|
||||||
You can set it to a more fancy symbol like this:
|
|
||||||
>
|
|
||||||
let g:vimwiki_list = [{'path': '~/path/', 'listsym_rejected' = '✗'}]
|
|
||||||
|
|
||||||
|
|
||||||
*vimwiki-option-auto_tags*
|
*vimwiki-option-auto_tags*
|
||||||
@@ -2385,11 +2338,13 @@ Highlight checked list items with a special color:
|
|||||||
|
|
||||||
Value Description~
|
Value Description~
|
||||||
0 Don't highlight anything.
|
0 Don't highlight anything.
|
||||||
1 Highlight checked [X] list item with |group-name| "Comment".
|
1 Highlight only the first line of a checked [X] list item.
|
||||||
2 Highlight checked [X] list item and all its child items.
|
2 Highlight a complete checked list item and all its child items.
|
||||||
|
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
|
The |group-name| "Comment" is used for highlighting.
|
||||||
|
|
||||||
Note: Option 2 does not work perfectly. Specifically, it might break if the
|
Note: Option 2 does not work perfectly. Specifically, it might break if the
|
||||||
list item contains preformatted text or if you mix tabs and spaces for
|
list item contains preformatted text or if you mix tabs and spaces for
|
||||||
indenting. Also, indented headers can be highlighted erroneously.
|
indenting. Also, indented headers can be highlighted erroneously.
|
||||||
@@ -2456,8 +2411,7 @@ Default: 'Vimwiki'
|
|||||||
*g:vimwiki_listsyms*
|
*g:vimwiki_listsyms*
|
||||||
|
|
||||||
String of at least two symbols to show the progression of todo list items.
|
String of at least two symbols to show the progression of todo list items.
|
||||||
Default value is ' .oOX'. You can also set this on a per-wiki level with
|
Default value is ' .oOX'.
|
||||||
|vimwiki-listsyms|.
|
|
||||||
|
|
||||||
The first char is for 0% done items.
|
The first char is for 0% done items.
|
||||||
The last is for 100% done items.
|
The last is for 100% done items.
|
||||||
@@ -2471,9 +2425,7 @@ You can set it to some more fancy symbols like this:
|
|||||||
*g:vimwiki_listsym_rejected*
|
*g:vimwiki_listsym_rejected*
|
||||||
|
|
||||||
Character that is used to show that an item of a todo list will not be done.
|
Character that is used to show that an item of a todo list will not be done.
|
||||||
Default value is '-'. You can also set this on a per-wiki level with
|
Default value is '-'.
|
||||||
|vimwiki-listsym_rejected|.
|
|
||||||
|
|
||||||
|
|
||||||
The character used here must not be part of |g:vimwiki_listsyms|.
|
The character used here must not be part of |g:vimwiki_listsyms|.
|
||||||
|
|
||||||
@@ -3007,7 +2959,7 @@ Contributors and their Github usernames in roughly chronological order:
|
|||||||
- Daniel Trnka (@trnila)
|
- Daniel Trnka (@trnila)
|
||||||
- Yuchen Pei (@ycpei)
|
- Yuchen Pei (@ycpei)
|
||||||
- @maqiv
|
- @maqiv
|
||||||
- @dpc
|
- Dawid Ciężarkiewicz (@dpc)
|
||||||
- Drew Hays (@Dru89)
|
- Drew Hays (@Dru89)
|
||||||
- Daniel Etrata (@danetrata)
|
- Daniel Etrata (@danetrata)
|
||||||
- Keith Haber (@kjhaber)
|
- Keith Haber (@kjhaber)
|
||||||
@@ -3021,6 +2973,21 @@ Contributors and their Github usernames in roughly chronological order:
|
|||||||
- Zhuang Ma (@mzlogin)
|
- Zhuang Ma (@mzlogin)
|
||||||
- Huy Le (@huynle)
|
- Huy Le (@huynle)
|
||||||
- Nick Borden (@hcwndbyw)
|
- Nick Borden (@hcwndbyw)
|
||||||
|
- John Campbell (@johnmarcampbell)
|
||||||
|
- Petrus (@PetrusZ)
|
||||||
|
- Steven Stallion (@sstallion)
|
||||||
|
- Daniel Quomsieh (@DQuomsieh)
|
||||||
|
- Fredrik Arnerup (@farnerup)
|
||||||
|
- CUI Hao (@cuihaoleo)
|
||||||
|
- Benjamin Brandtner (@BenjaminBrandtner)
|
||||||
|
- @sreejith994
|
||||||
|
- Raphael Feng (@raphaelfeng)
|
||||||
|
- Kasper Socha (@fte10kso)
|
||||||
|
- Nicolas Brailovsky (@nicolasbrailo)
|
||||||
|
- @BenMcH
|
||||||
|
- Stefan Huber (@shuber2)
|
||||||
|
- Hugo Hörnquist (@HugoNikanor)
|
||||||
|
- Rane Brown (@ranebrown)
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
@@ -3033,7 +3000,7 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
|||||||
https://github.com/vimwiki-backup/vimwiki/issues.
|
https://github.com/vimwiki-backup/vimwiki/issues.
|
||||||
|
|
||||||
|
|
||||||
2.4 (not yet released)~
|
2.4 (2019-03-24)~
|
||||||
|
|
||||||
New:~
|
New:~
|
||||||
* Add the option |g:vimwiki_text_ignore_newline|.
|
* Add the option |g:vimwiki_text_ignore_newline|.
|
||||||
@@ -3041,9 +3008,6 @@ New:~
|
|||||||
* glx on a list item marks a checkbox as won't do, see |vimwiki_glx|.
|
* glx on a list item marks a checkbox as won't do, see |vimwiki_glx|.
|
||||||
* Add the option |g:vimwiki_listsym_rejected| to set the character used
|
* Add the option |g:vimwiki_listsym_rejected| to set the character used
|
||||||
for won't-do list items.
|
for won't-do list items.
|
||||||
* The effect of |g:vimwiki_listsyms| and |g:vimwiki_listsym_rejected| can
|
|
||||||
be set on a per wiki level, see |vimwiki-listsyms| and
|
|
||||||
|vimwili-listsym_rejected|
|
|
||||||
* gln and glp change the "done" status of a checkbox, see |vimwiki_gln|.
|
* gln and glp change the "done" status of a checkbox, see |vimwiki_gln|.
|
||||||
* |:VimwikiSplitLink| and |:VimwikiVSplitLink| can now reuse an existing
|
* |:VimwikiSplitLink| and |:VimwikiVSplitLink| can now reuse an existing
|
||||||
split window and not move the cursor.
|
split window and not move the cursor.
|
||||||
@@ -3056,6 +3020,8 @@ New:~
|
|||||||
* Add the %date placeholder, see |vimwiki-date|.
|
* Add the %date placeholder, see |vimwiki-date|.
|
||||||
* Add the option |vimwiki-option-custom_wiki2html_args|.
|
* Add the option |vimwiki-option-custom_wiki2html_args|.
|
||||||
* Add support for HTML-style comments when using markdown syntax.
|
* Add support for HTML-style comments when using markdown syntax.
|
||||||
|
* Made headings link to themselves in HTML output.
|
||||||
|
* Add |:VimwikiShowVersion| to check the version
|
||||||
|
|
||||||
Removed:~
|
Removed:~
|
||||||
* Remove the undocumented and buggy command :VimwikiReadLocalOptions
|
* Remove the undocumented and buggy command :VimwikiReadLocalOptions
|
||||||
@@ -3080,6 +3046,10 @@ Fixed:~
|
|||||||
* Opening the diary and wikis from the menu works correctly now.
|
* Opening the diary and wikis from the menu works correctly now.
|
||||||
* Issue #497: Make |:VimwikiMakeDiaryNote| work outside a wiki buffer.
|
* Issue #497: Make |:VimwikiMakeDiaryNote| work outside a wiki buffer.
|
||||||
* Use markdown syntax in the diary when appropriate.
|
* Use markdown syntax in the diary when appropriate.
|
||||||
|
* Improve handling of errors on opening files.
|
||||||
|
* Update links when renaming a page with |:VimwikiRenameLink|.
|
||||||
|
* Fix losing the highlighting in various situations.
|
||||||
|
* Improved link normalisation.
|
||||||
* Various other minor fixes.
|
* Various other minor fixes.
|
||||||
|
|
||||||
|
|
||||||
@@ -3302,7 +3272,7 @@ http://code.google.com/p/vimwiki/issues/list
|
|||||||
* Issue 210: HTML: para enclose header.
|
* Issue 210: HTML: para enclose header.
|
||||||
* Issue 214: External links containing Chinese characters get trimmed.
|
* Issue 214: External links containing Chinese characters get trimmed.
|
||||||
* Issue 218: Command to generate HTML file and open it in webbrowser. See
|
* Issue 218: Command to generate HTML file and open it in webbrowser. See
|
||||||
|:Vimwiki2HTMLBrowse|(bind to <leader>whh)
|
|:Vimwiki2HTMLBrowse|(bind to <Leader>whh)
|
||||||
* NEW: Added <Leader>wh mapping to call |:Vimwiki2HTML|
|
* NEW: Added <Leader>wh mapping to call |:Vimwiki2HTML|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ setlocal formatoptions-=o
|
|||||||
setlocal formatoptions-=2
|
setlocal formatoptions-=2
|
||||||
setlocal formatoptions+=n
|
setlocal formatoptions+=n
|
||||||
|
|
||||||
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')
|
let &formatlistpat = vimwiki#vars#get_syntaxlocal('rxListItem')
|
||||||
|
|
||||||
if !empty(&langmap)
|
if !empty(&langmap)
|
||||||
" Valid only if langmap is a comma separated pairs of chars
|
" Valid only if langmap is a comma separated pairs of chars
|
||||||
|
|||||||
+26
-2
@@ -9,6 +9,11 @@ if exists("g:loaded_vimwiki") || &cp
|
|||||||
endif
|
endif
|
||||||
let g:loaded_vimwiki = 1
|
let g:loaded_vimwiki = 1
|
||||||
|
|
||||||
|
" Set to version number for release, otherwise -1 for dev-branch
|
||||||
|
let s:plugin_vers = 2.4
|
||||||
|
|
||||||
|
" Get the directory the script is installed in
|
||||||
|
let s:plugin_dir = expand('<sfile>:p:h:h')
|
||||||
|
|
||||||
let s:old_cpo = &cpo
|
let s:old_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
@@ -31,7 +36,7 @@ function! s:setup_buffer_leave()
|
|||||||
|
|
||||||
let &autowriteall = s:vimwiki_autowriteall_saved
|
let &autowriteall = s:vimwiki_autowriteall_saved
|
||||||
|
|
||||||
if vimwiki#vars#get_global('menu') != ""
|
if !empty(vimwiki#vars#get_global('menu'))
|
||||||
exe 'nmenu disable '.vimwiki#vars#get_global('menu').'.Table'
|
exe 'nmenu disable '.vimwiki#vars#get_global('menu').'.Table'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -147,7 +152,7 @@ function! s:set_global_options()
|
|||||||
let s:vimwiki_autowriteall_saved = &autowriteall
|
let s:vimwiki_autowriteall_saved = &autowriteall
|
||||||
let &autowriteall = vimwiki#vars#get_global('autowriteall')
|
let &autowriteall = vimwiki#vars#get_global('autowriteall')
|
||||||
|
|
||||||
if vimwiki#vars#get_global('menu') !=# ''
|
if !empty(vimwiki#vars#get_global('menu'))
|
||||||
exe 'nmenu enable '.vimwiki#vars#get_global('menu').'.Table'
|
exe 'nmenu enable '.vimwiki#vars#get_global('menu').'.Table'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -188,6 +193,23 @@ function! s:set_windowlocal_options()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:get_version()
|
||||||
|
if s:plugin_vers != -1
|
||||||
|
echo "Stable version: " . s:plugin_vers
|
||||||
|
else
|
||||||
|
let a:plugin_rev = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --short HEAD")
|
||||||
|
let a:plugin_branch = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --abbrev-ref HEAD")
|
||||||
|
let a:plugin_date = system("git --git-dir " . s:plugin_dir . "/.git show -s --format=%ci")
|
||||||
|
if v:shell_error == 0
|
||||||
|
echo "Branch: " . a:plugin_branch
|
||||||
|
echo "Revision: " . a:plugin_rev
|
||||||
|
echo "Date: " . a:plugin_date
|
||||||
|
else
|
||||||
|
echo "Unknown version"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" Initialization of Vimwiki starts here. Make sure everything below does not
|
" Initialization of Vimwiki starts here. Make sure everything below does not
|
||||||
@@ -281,6 +303,8 @@ command! -count=1 VimwikiMakeTomorrowDiaryNote
|
|||||||
command! VimwikiDiaryGenerateLinks
|
command! VimwikiDiaryGenerateLinks
|
||||||
\ call vimwiki#diary#generate_diary_section()
|
\ call vimwiki#diary#generate_diary_section()
|
||||||
|
|
||||||
|
command! VimwikiShowVersion call s:get_version()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
|
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
|
||||||
|
|||||||
+5
-5
@@ -253,18 +253,18 @@ syntax match VimwikiCellSeparator
|
|||||||
|
|
||||||
|
|
||||||
" Lists
|
" Lists
|
||||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'/'
|
||||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
||||||
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
|
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
|
||||||
|
|
||||||
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
||||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
|
||||||
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
\ . '\s*\[['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
|
||||||
\ . vimwiki#vars#get_global('listsym_rejected')
|
\ . vimwiki#vars#get_global('listsym_rejected')
|
||||||
\ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
\ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||||
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
||||||
execute 'syntax match VimwikiCheckBoxDone /'
|
execute 'syntax match VimwikiCheckBoxDone /'
|
||||||
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
|
\ . vimwiki#vars#get_syntaxlocal('rxListItemAndChildren')
|
||||||
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user