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

|
||||
 *
|
||||
|
||||
@@ -105,6 +107,19 @@ 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:
|
||||
```
|
||||
let g:vimwiki_list = [{'path': '~/vimwiki/',
|
||||
\ 'syntax': 'markdown', 'ext': '.md'}]
|
||||
```
|
||||
|
||||
|
||||
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:
|
||||
|
||||
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
|
||||
Plug 'vimwiki/vimwiki'
|
||||
|
||||
Then run `:PlugInstall`.
|
||||
|
||||
@@ -159,8 +174,13 @@ Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was insta
|
||||
Getting help
|
||||
==============================================================================
|
||||
|
||||
Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki))
|
||||
or post to the [mailing list](https://groups.google.com/forum/#!forum/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).
|
||||
|
||||
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:], '#')
|
||||
endif
|
||||
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
|
||||
|
||||
@@ -1856,15 +1862,14 @@ function! vimwiki#base#table_of_contents(create)
|
||||
let indentstring = repeat(' ', vimwiki#u#sw())
|
||||
let bullet = vimwiki#lst#default_symbol().' '
|
||||
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'
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||
else
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||
endif
|
||||
let link = s:safesubstitute(link_tpl, '__LinkUrl__',
|
||||
\ '#'.esc_link, '')
|
||||
let link = s:safesubstitute(link, '__LinkDescription__', esc_desc, '')
|
||||
\ '#'.link, '')
|
||||
let link = s:safesubstitute(link, '__LinkDescription__', desc, '')
|
||||
call add(lines, startindent.repeat(indentstring, lvl-1).bullet.link)
|
||||
endfor
|
||||
|
||||
|
||||
@@ -1072,7 +1072,9 @@ function! s:process_tag_h(line, id)
|
||||
let h_text = num.' '.h_text
|
||||
endif
|
||||
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
|
||||
|
||||
@@ -1088,7 +1090,7 @@ function! s:process_tag_h(line, 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
|
||||
endif
|
||||
|
||||
@@ -25,6 +25,7 @@ del {text-decoration: line-through; color: #777777;}
|
||||
.justcenter {text-align: center;}
|
||||
.center {margin-left: auto; margin-right: auto;}
|
||||
.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
|
||||
.header a {text-decoration: none; color: inherit;}
|
||||
|
||||
/* classes for items of todo lists */
|
||||
.rejected {
|
||||
|
||||
+209
-76
@@ -13,7 +13,7 @@
|
||||
" 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
|
||||
" 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
|
||||
@@ -28,50 +28,10 @@
|
||||
|
||||
function! s:populate_global_variables()
|
||||
|
||||
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': '',
|
||||
\ }
|
||||
let g:vimwiki_global_vars = {}
|
||||
|
||||
" 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(g:vimwiki_global_vars)
|
||||
if exists('g:vimwiki_'.key)
|
||||
let g:vimwiki_global_vars[key] = g:vimwiki_{key}
|
||||
endif
|
||||
endfor
|
||||
call s:read_global_settings_from_user()
|
||||
call s:normalize_global_settings()
|
||||
|
||||
" 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
|
||||
" buffer (and not on a link) to create a link
|
||||
" basically, it's Ascii alphanumeric characters plus #|./@-_~ plus all
|
||||
" non-Ascii characters
|
||||
let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]\+'
|
||||
" 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
|
||||
@@ -179,31 +139,131 @@ function! s:populate_global_variables()
|
||||
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': 0,
|
||||
\ 'auto_export': 0,
|
||||
\ 'auto_tags': 0,
|
||||
\ 'auto_toc': 0,
|
||||
\ 'automatic_nested_syntaxes': 1,
|
||||
\ 'css_name': 'style.css',
|
||||
\ 'custom_wiki2html': '',
|
||||
\ 'custom_wiki2html_args': '',
|
||||
\ 'diary_header': 'Diary',
|
||||
\ 'diary_index': 'diary',
|
||||
\ 'diary_rel_path': 'diary/',
|
||||
\ 'diary_sort': 'desc',
|
||||
\ 'ext': '.wiki',
|
||||
\ 'index': 'index',
|
||||
\ 'list_margin': -1,
|
||||
\ 'maxhi': 0,
|
||||
\ 'nested_syntaxes': {},
|
||||
\ 'path': $HOME . '/vimwiki/',
|
||||
\ 'path_html': '',
|
||||
\ 'syntax': 'default',
|
||||
\ 'template_default': 'default',
|
||||
\ 'template_ext': '.tpl',
|
||||
\ 'template_path': $HOME . '/vimwiki/templates/',
|
||||
\ '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 = []
|
||||
@@ -211,9 +271,10 @@ function! s:populate_wikilocal_options()
|
||||
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]
|
||||
let default_wiki_settings[key] = default_values[key].default
|
||||
endif
|
||||
endfor
|
||||
|
||||
@@ -223,11 +284,10 @@ function! s:populate_wikilocal_options()
|
||||
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]
|
||||
elseif exists('g:vimwiki_'.key)
|
||||
let new_wiki_settings[key] = g:vimwiki_{key}
|
||||
else
|
||||
let new_wiki_settings[key] = default_values[key]
|
||||
let new_wiki_settings[key] = default_wiki_settings[key]
|
||||
endif
|
||||
endfor
|
||||
|
||||
@@ -247,11 +307,79 @@ function! s:populate_wikilocal_options()
|
||||
let temporary_wiki_settings.is_temporary_wiki = 1
|
||||
call add(g:vimwiki_wikilocal_vars, temporary_wiki_settings)
|
||||
|
||||
call s:validate_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: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
|
||||
let wiki_settings['path'] = s:normalize_path(wiki_settings['path'])
|
||||
|
||||
@@ -270,6 +398,11 @@ function! s:validate_settings()
|
||||
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
|
||||
|
||||
@@ -706,7 +839,7 @@ function! vimwiki#vars#add_temporary_wiki(settings)
|
||||
let new_temp_wiki_settings[key] = value
|
||||
endfor
|
||||
call insert(g:vimwiki_wikilocal_vars, new_temp_wiki_settings, -1)
|
||||
call s:validate_settings()
|
||||
call s:normalize_wikilocal_settings()
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
+33
-10
@@ -707,7 +707,7 @@ Vimwiki file.
|
||||
*:VimwikiGoto*
|
||||
Goto link provided by an argument. For example: >
|
||||
:VimwikiGoto HelloWorld
|
||||
< opens opens/creates HelloWorld wiki page.
|
||||
< opens/creates HelloWorld wiki page.
|
||||
|
||||
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
|
||||
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|.
|
||||
|
||||
@@ -2280,8 +2280,8 @@ local mappings |vimwiki_glstar|, |vimwiki_gl#| |vimwiki_gl-|, |vimwiki_gl-|,
|
||||
|vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI| and
|
||||
|vimwiki_i_<C-L>_<C-M>|.
|
||||
|
||||
Note: if you use MediaWiki syntax, you probably would like to set this option
|
||||
to 0, because every indented line is considered verbatim text.
|
||||
Note: if you use Markdown or MediaWiki syntax, you probably would like to set
|
||||
this option to 0, because every indented line is considered verbatim text.
|
||||
|
||||
|
||||
*vimwiki-option-auto_tags*
|
||||
@@ -2321,7 +2321,7 @@ Global options are configured using the following pattern: >
|
||||
Highlight headers with =Reddish=, ==Greenish==, ===Blueish=== colors.
|
||||
|
||||
Value Description~
|
||||
1 Use VimwikiHeader1-VimwikiHeader6 group colors to highlight
|
||||
1 Use VimwikiHeader1 - VimwikiHeader6 group colors to highlight
|
||||
different header levels.
|
||||
0 Use |hl-Title| color for headers.
|
||||
Default: 0
|
||||
@@ -2338,11 +2338,13 @@ Highlight checked list items with a special color:
|
||||
|
||||
Value Description~
|
||||
0 Don't highlight anything.
|
||||
1 Highlight checked [X] list item with |group-name| "Comment".
|
||||
2 Highlight checked [X] list item and all its child items.
|
||||
1 Highlight only the first line of a checked [X] list item.
|
||||
2 Highlight a complete checked list item and all its child items.
|
||||
|
||||
Default: 0
|
||||
|
||||
The |group-name| "Comment" is used for highlighting.
|
||||
|
||||
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
|
||||
indenting. Also, indented headers can be highlighted erroneously.
|
||||
@@ -2957,7 +2959,7 @@ Contributors and their Github usernames in roughly chronological order:
|
||||
- Daniel Trnka (@trnila)
|
||||
- Yuchen Pei (@ycpei)
|
||||
- @maqiv
|
||||
- @dpc
|
||||
- Dawid Ciężarkiewicz (@dpc)
|
||||
- Drew Hays (@Dru89)
|
||||
- Daniel Etrata (@danetrata)
|
||||
- Keith Haber (@kjhaber)
|
||||
@@ -2971,6 +2973,21 @@ Contributors and their Github usernames in roughly chronological order:
|
||||
- Zhuang Ma (@mzlogin)
|
||||
- Huy Le (@huynle)
|
||||
- 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)
|
||||
|
||||
|
||||
==============================================================================
|
||||
@@ -2983,7 +3000,7 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
||||
https://github.com/vimwiki-backup/vimwiki/issues.
|
||||
|
||||
|
||||
2.4 (not yet released)~
|
||||
2.4 (2019-03-24)~
|
||||
|
||||
New:~
|
||||
* Add the option |g:vimwiki_text_ignore_newline|.
|
||||
@@ -3003,6 +3020,8 @@ New:~
|
||||
* Add the %date placeholder, see |vimwiki-date|.
|
||||
* Add the option |vimwiki-option-custom_wiki2html_args|.
|
||||
* 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:~
|
||||
* Remove the undocumented and buggy command :VimwikiReadLocalOptions
|
||||
@@ -3027,6 +3046,10 @@ Fixed:~
|
||||
* Opening the diary and wikis from the menu works correctly now.
|
||||
* Issue #497: Make |:VimwikiMakeDiaryNote| work outside a wiki buffer.
|
||||
* 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.
|
||||
|
||||
|
||||
@@ -3249,7 +3272,7 @@ http://code.google.com/p/vimwiki/issues/list
|
||||
* Issue 210: HTML: para enclose header.
|
||||
* Issue 214: External links containing Chinese characters get trimmed.
|
||||
* 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|
|
||||
|
||||
|
||||
|
||||
+26
-2
@@ -9,6 +9,11 @@ if exists("g:loaded_vimwiki") || &cp
|
||||
endif
|
||||
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
|
||||
set cpo&vim
|
||||
@@ -31,7 +36,7 @@ function! s:setup_buffer_leave()
|
||||
|
||||
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'
|
||||
endif
|
||||
endfunction
|
||||
@@ -147,7 +152,7 @@ function! s:set_global_options()
|
||||
let s:vimwiki_autowriteall_saved = &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'
|
||||
endif
|
||||
endfunction
|
||||
@@ -188,6 +193,23 @@ function! s:set_windowlocal_options()
|
||||
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
|
||||
@@ -281,6 +303,8 @@ command! -count=1 VimwikiMakeTomorrowDiaryNote
|
||||
command! VimwikiDiaryGenerateLinks
|
||||
\ call vimwiki#diary#generate_diary_section()
|
||||
|
||||
command! VimwikiShowVersion call s:get_version()
|
||||
|
||||
|
||||
|
||||
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
|
||||
|
||||
Reference in New Issue
Block a user