I broke up with neovim....vim is my best friend now

This commit is contained in:
LinlyBoi
2023-04-30 08:14:07 +03:00
parent 0d185449c5
commit 4a4a6b1e81
5245 changed files with 468325 additions and 25 deletions

View File

@@ -0,0 +1,68 @@
# Contributing to VimWiki
# Filing a bug
Before filing a bug or starting to write a patch, check the latest development
version from https://github.com/vimwiki/vimwiki/tree/dev to see if your problem
is already fixed.
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/
# Git branching model
As of v2022.12.02, VimWiki has adopted a rolling release model, along with
[calendar versioning][calver]. A release should be
[prepared][#preparing-a-release] for every change or set of changes which merge
to `dev`.
[calver]: https://calver.org/
There are two permanent branches:
1. `dev`: This is the default branch, and where changes are released. Tasks
which are done in one or only a few commits go here directly. Always
keep this branch in a working state. If the task you work on requires
multiple commits, make sure intermediate commits don't make VimWiki
unusable.
2. `master`: This is a legacy branch, retained to avoid breaking existing
checkouts of the plugin. It should be kept in sync with `dev`.
Large changes which require multiple commits may be authored in feature
branches, and merged into `dev` when the work is done.
# Creating a pull request
If you want to provide a pull request on GitHub, start from the `dev` branch,
not from the `master` branch.
Version bureaucracy:
1. Pick a new version number according to the current date:
`YYYY.MM.DD` (if releasing a second version for the
current date, append a `_MICRO` version such as `_1`, `_2`, etc.
- Examples: `2022.12.22`, `2022.12.22_1`
2. Update the version number at the top of `plugin/vimwiki.vim`
3. Update the `!_TAG_PROGRAM_VERSION` expected in `test/tag.vader`
(this is a bit silly, will have to figure out how to get rid of it)
Update `doc/vimwiki.txt` with the following information:
1. Update the changelog to include, at the top of it, information on the new
feature the PR introduces or the bug it is fixing as well as the PR number
and related issue number if possible.
2. Add a help section to describe any new features or options.
3. If you are a first time contributor add your name to the list of
contributors.
# Preparing a release
This section is primarily for maintainers.
1. Set a tag with the version number in Git: `git tag -a v2022.12.02 -m 'Release v2022.12.02'`
2. `git push --tags`
3. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag,
convert the changelog from the doc to Markdown and post it there. Make
plans to build an automatic converter and immediately forget this plan.
4. If necessary, update `README.md` and the home page.
5. For major changes: Tell the world.
[semver]: https://semver.org/

View File

@@ -0,0 +1,25 @@
FROM testbed/vim:latest
# Add packages
RUN apk --no-cache add bash
RUN apk --no-cache add git
RUN apk --no-cache add python3
RUN apk --no-cache add py3-pip
# Get vint for linting
RUN pip3 install vim-vint
# Get vader for unit tests
RUN git clone -n https://github.com/junegunn/vader.vim /vader
WORKDIR /vader
RUN git checkout de8a976f1eae2c2b680604205c3e8b5c8882493c
# Build vim and neovim versions we want to test
# TODO add nvim tag
WORKDIR /
RUN install_vim -tag v7.3.429 -name vim_7.3.429 -build \
-tag v7.4.1099 -name vim_7.4.1099 -build \
-tag v7.4.1546 -name vim_7.4.1546 -build \
-tag v8.0.0027 -name vim_8.0.0027 -build \
-tag v8.1.0519 -name vim_8.1.0519 -build \
-tag neovim:v0.3.8 -name nvim_0.3.8 -build \

View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2008-2010 Maxim Kim
2013-2017 Daniel Schemala
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,161 @@
VimWiki —— Vim 个人 Wiki 插件
==============================================================================
[English](README.md)
![screenshot1](doc/screenshot_1.png)
![screenshot2](doc/screenshot_2.png) *
介绍
------------------------------------------------------------------------------
Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法高亮的文本文件。
通过 Vimwiki你可以:
* 组织笔记和想法
* 管理待办事项
* 编写文档
* 坚持写日记
* 将这一切导出成 HTML 网页
马上开始!按下 `<Leader>ww`(通常是 `\ww`)进入作为目录页的 wiki 文件,这个文件默认存放在 `~/vimwiki/index.wiki`
在该文件中输入以下示例:
= 我的个人知识库 =
* 任务列表 -- _昨天_ 就该完成的事!!!
* Gutenberg 计划 -- 好书给我力量。
* 草稿 -- 临时记录一些东西。
把光标移到 `任务` 二字上,按 Enter回车创建链接。按下后`任务`二字会变成 `[[任务]]` —— 这是一个 Vimwiki 链接。再次按 Enter 即可进入这个链接(打开新的 wiki 文件)。编辑这个新文件,保存,然后按 Backspace退格就能回到目录页。
如果 Vimwiki 链接长度不止一个单词(指的是英文单词),只需在 Visual 模式选择这段文本后按 Enter 即可。用上面的 `Gutenberg 计划` 试试吧。最终结果是这样:
= 我的个人知识库 =
* [[任务列表]] -- _昨天_ 就该完成的事!!!
* [[Gutenberg 计划]] -- 好书给我力量。
* 草稿 -- 临时记录一些东西。
基本标记
------------------------------------------------------------------------------
= 一级标题 =
== 二级标题 ==
=== 三级标题 ===
*bold* -- 粗体文本
_italic_ -- 斜体文本
(应用于句中的汉字文本时,必须在标记前后加空格,例如:一段 *中文* 文本)
[[wiki link]] -- wiki 链接
[[wiki link|description]] -- 带有描述文本的 wiki 链接
列表:
* bullet list item 1无编号列表
- bullet list item 2
- bullet list item 3
* bullet list item 4
* bullet list item 5
* bullet list item 6
* bullet list item 7
- bullet list item 8
- bullet list item 9
1. numbered list item 1有编号列表
2. numbered list item 2
a) numbered list item 3
b) numbered list item 4
更多格式说明,请阅 `:h vimwiki-syntax`
键位绑定
------------------------------------------------------------------------------
normal 模式:
* `<Leader>ww` -- 打开默认的 wiki 目录文件
* `<Leader>wt` -- 在新标签Tab中打开 wiki 目录文件
* `<Leader>ws` -- 在多个 wiki 中选择并打开该 wiki 的目录文件
* `<Leader>wd` -- 删除当前 wiki 文件
* `<Leader>wr` -- 重命名当前 wiki 文件
* `<Enter>` -- 创建或打开 wiki 链接
* `<Shift-Enter>` -- 先上下分屏再打开 wiki 链接(若非链接则先创建)
* `<Ctrl-Enter>` -- 先左右分屏再打开 wiki 链接(若非链接则先创建)
* `<Backspace>` -- 返回之前浏览的 wiki 文件
* `<Tab>` -- 跳到本文件中下一个 wiki 链接
* `<Shift-Tab>` -- 跳到本文件中上一个 wiki 链接
更多快捷键说明,请阅 `:h vimwiki-mappings`
命令
------------------------------------------------------------------------------
* `:Vimwiki2HTML` -- 将当前 wiki 文件转换成 HTML 网页
* `:VimwikiAll2HTML` -- 把所有 wiki 文件转换成 HTML 网页
* `:help vimwiki-commands` -- 显示全部命令
安装
==============================================================================
准备工作
------------------------------------------------------------------------------
确保在 `vimrc` 中加入了以下设置:
set nocompatible
filetype plugin on
syntax on
没有这些设置Vimwiki 将无法正常工作。
通过 [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) 安装Vim 7.4.1528 后)
------------------------------------------------------------------------------
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
通过 [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) 安装
------------------------------------------------------------------------------
cd ~/.vim
mkdir bundle
cd bundle
git clone https://github.com/vimwiki/vimwiki.git
通过 [Vim-Plug](https://github.com/junegunn/vim-plug) 安装
------------------------------------------------------------------------------
`vimrc` 中加入以下插件设置:
Plug 'vimwiki/vimwiki'
然后运行 `:PlugInstall`
通过 [Vundle](https://github.com/VundleVim/Vundle.vim) 安装
------------------------------------------------------------------------------
`vimrc` 中加入 `Plugin 'vimwiki/vimwiki'`,然后执行:
vim +PluginInstall +qall
或者下载 [zip 压缩包](https://github.com/vimwiki/vimwiki/archive/master.zip)然后解压到 `~/.vim/bundle/` 目录下。
安装后,启动 Vim 并执行 `:Helptags` 以及 `:help vimwiki`,检查安装是否成功。
获取帮助
==============================================================================
遇到问题?在 Freenode 的 IRC 频道 `#vimwiki`[网页聊天](https://webchat.freenode.net/?channels=#vimwiki))提问,或者发送问题到[邮件列表](https://groups.google.com/forum/#!forum/vimwiki)上吧。
----
\* 前面截图中用的是 [solarized 配色方案](https://github.com/altercation/vim-colors-solarized)以及 [lightline](https://github.com/itchyny/lightline.vim) 插件。

View File

@@ -0,0 +1,294 @@
![VimWiki: A Personal Wiki For Vim](doc/splash.png)
[中文](README-cn.md)
- [Intro](#introduction)
- [Screenshots](#screenshots)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [VIM Packages](#installation-using-vim-packages-since-vim-741528)
- [Pathogen](#installation-using-pathogen)
- [Vim-Plug](#installation-using-vim-plug)
- [Vundle](#installation-using-vundle)
- [Basic Markup](#basic-markup)
- [Lists](#lists)
- [Key Bindings](#key-bindings)
- [Commands](#commands)
- [Changing Wiki Syntax](#changing-wiki-syntax)
- [Getting Help](#getting-help)
- [Helping VimWiki](#helping-vimwiki)
- [Wiki](https://github.com/vimwiki/vimwiki/wiki)
- [License](#license)
----
## Introduction
VimWiki is a personal wiki for Vim -- a number of linked text files that have
their own syntax highlighting. See the [VimWiki Wiki](https://vimwiki.github.io/vimwikiwiki/)
for an example website built with VimWiki!
For the latest features and fixes checkout the [dev branch](https://github.com/vimwiki/vimwiki/tree/dev).
If you are interested in contributing see [this section](#helping-vimwiki).
With VimWiki, you can:
- Organize notes and ideas
- Manage to-do lists
- Write documentation
- Maintain a diary
- Export everything to HTML
To do a quick start, press `<Leader>ww` (default is `\ww`) to go to your index
wiki file. By default, it is located in `~/vimwiki/index.wiki`. See `:h vimwiki_list`
for registering a different path/wiki.
Feed it with the following example:
```text
= My knowledge base =
* Tasks -- things to be done _yesterday_!!!
* Project Gutenberg -- good books are power.
* Scratchpad -- various temporary stuff.
```
Place your cursor on `Tasks` and press Enter to create a link. Once pressed,
`Tasks` will become `[[Tasks]]` -- a VimWiki link. Press Enter again to
open it. Edit the file, save it, and then press Backspace to jump back to your
index.
A VimWiki link can be constructed from more than one word. Just visually
select the words to be linked and press Enter. Try it, with `Project Gutenberg`.
The result should look something like:
```text
= My knowledge base =
* [[Tasks]] -- things to be done _yesterday_!!!
* [[Project Gutenberg]] -- good books are power.
* Scratchpad -- various temporary stuff.
```
## Screenshots
![Lists View](doc/lists.png)
![Entries View](doc/entries.png)
![Todos View](doc/todos.png)
![Wiki View](doc/wiki.png)
## Installation
VimWiki has been tested on **Vim >= 7.3**. It will likely work on older
versions but will not be officially supported.
### Prerequisites
Make sure you have these settings in your vimrc file:
```vim
set nocompatible
filetype plugin on
syntax on
```
Without them, VimWiki will not work properly.
#### Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
```sh
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
# to generate documentation i.e. ':h vimwiki'
vim -c 'helptags ~/.vim/pack/plugins/start/vimwiki/doc' -c quit
```
Notes:
- See `:h helptags` for issues with installing the documentation.
- For general information on vim packages see `:h packages`.
#### Installation using [Pathogen](https://github.com/tpope/vim-pathogen)
```sh
cd ~/.vim
mkdir bundle
cd bundle
git clone https://github.com/vimwiki/vimwiki.git
```
#### Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
Add the following to the plugin-configuration in your vimrc:
```vim
Plug 'vimwiki/vimwiki'
```
Then run `:PlugInstall`.
#### Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run:
```sh
vim +PluginInstall +qall
```
#### Manual Install
Download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip)
and extract it in `~/.vim/bundle/`
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was
installed.
## Basic Markup
```text
= Header1 =
== Header2 ==
=== Header3 ===
*bold* -- bold text
_italic_ -- italic text
[[wiki link]] -- wiki link
[[wiki link|description]] -- wiki link with description
```
### Lists
```text
* bullet list item 1
- bullet list item 2
- bullet list item 3
* bullet list item 4
* bullet list item 5
* bullet list item 6
* bullet list item 7
- bullet list item 8
- bullet list item 9
1. numbered list item 1
2. numbered list item 2
a) numbered list item 3
b) numbered list item 4
```
For other syntax elements, see `:h vimwiki-syntax`
## Key bindings
### Normal mode
**Note:** your terminal may prevent capturing some of the default bindings
listed below. See `:h vimwiki-local-mappings` for suggestions for alternative
bindings if you encounter a problem.
#### Basic key bindings
- `<Leader>ww` -- Open default wiki index file.
- `<Leader>wt` -- Open default wiki index file in a new tab.
- `<Leader>ws` -- Select and open wiki index file.
- `<Leader>wd` -- Delete wiki file you are in.
- `<Leader>wr` -- Rename wiki file you are in.
- `<Enter>` -- Follow/Create wiki link.
- `<Shift-Enter>` -- Split and follow/create wiki link.
- `<Ctrl-Enter>` -- Vertical split and follow/create wiki link.
- `<Backspace>` -- Go back to parent(previous) wiki link.
- `<Tab>` -- Find next wiki link.
- `<Shift-Tab>` -- Find previous wiki link.
#### Advanced key bindings
Refer to the complete documentation at `:h vimwiki-mappings` to see many
more bindings.
## 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).
**NOTE:** Only the default syntax ships with a built-in HTML converter. For
Markdown or MediaWiki see `:h vimwiki-option-custom_wiki2html`. Some examples
and 3rd party tools are available [here](https://vimwiki.github.io/vimwikiwiki/Related%20Tools.html#Related%20Tools-External%20Tools).
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
following option in your `.vimrc`:
```vim
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
```
This option will treat all markdown files in your system as part of vimwiki (check `set filetype?`). Add
```vim
let g:vimwiki_global_ext = 0
```
to your `.vimrc` to restrict Vimwiki's operation to only those paths listed in `g:vimwiki_list`.
Other markdown files wouldn't be treated as wiki pages.
See [g:vimwiki_global_ext](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L2631).
## Getting help
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
method for raising bug reports or feature requests.
Additional resources:
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on irc.libera.chat
- [Connect via webchat](https://web.libera.chat/?channels=#vimwiki)
- Connect via Matrix/Element: [#vimwiki:libera.chat](https://matrix.to/#/#vimwiki:libera.chat)
- 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.
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md) and [design_notes.md](doc/design_notes.md)
----
## License
MIT License
Copyright (c) 2008-2010 Maxim Kim
2013-2017 Daniel Schemala
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<link rel="Stylesheet" type="text/css" href="%root_path%%css%">
<link rel="alternate" type="application/rss+xml" title="RSS" href="%root_path%%rss%">
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
%content%
</body>
</html>

View File

@@ -0,0 +1,535 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Handle diary notes
" Home: https://github.com/vimwiki/vimwiki/
" Clause: load only once
if exists('g:loaded_vimwiki_diary_auto') || &compatible
finish
endif
let g:loaded_vimwiki_diary_auto = 1
function! s:prefix_zero(num) abort
" Add zero prefix to a number
if a:num < 10
return '0'.a:num
endif
return a:num
endfunction
function! s:diary_path(...) abort
" Return: diary directory path <String>
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
return vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)
endfunction
function! s:diary_index(...) abort
" Return: diary index file path <String>
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).
\ vimwiki#vars#get_wikilocal('ext', idx)
endfunction
function! vimwiki#diary#diary_date_link(...) abort
" Return: <String> date
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
if wiki_nr < 0 " this happens when called outside a wiki buffer
let wiki_nr = 0
endif
if wiki_nr >= vimwiki#vars#number_of_wikis()
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!')
return
endif
if a:0
let l:timestamp = a:1
else
let l:timestamp = localtime()
endif
let l:delta_periods = 0
if a:0 > 1
let l:delta_periods = a:2
endif
let l:day_s = 60*60*24
let l:weekday_number = {
\ 'monday': 1, 'tuesday': 2,
\ 'wednesday': 3, 'thursday': 4,
\ 'friday': 5, 'saturday': 6,
\ 'sunday': 0}
let l:frequency = vimwiki#vars#get_wikilocal('diary_frequency', wiki_nr)
if l:frequency ==? 'weekly'
let l:start_week_day = vimwiki#vars#get_wikilocal('diary_start_week_day', wiki_nr)
let l:weekday_num = str2nr(strftime('%w', l:timestamp))
let l:days_to_end_of_week = (7-l:weekday_number[l:start_week_day]+weekday_num) % 7
let l:computed_timestamp = l:timestamp
\ + 7*l:day_s*l:delta_periods
\ - l:day_s*l:days_to_end_of_week
elseif l:frequency ==? 'monthly'
let l:day_of_month = str2nr(strftime('%d', l:timestamp))
let l:beginning_of_month = l:timestamp - (l:day_of_month - 1)*l:day_s
let l:middle_of_month = l:beginning_of_month + 15*l:day_s
let l:middle_of_computed_month = l:middle_of_month + float2nr(30.5*l:day_s*l:delta_periods)
let l:day_of_computed_month = str2nr(strftime('%d', l:middle_of_computed_month)) - 1
let l:computed_timestamp = l:middle_of_computed_month - l:day_of_computed_month*l:day_s
elseif l:frequency ==? 'yearly'
let l:day_of_year = str2nr(strftime('%j', l:timestamp))
let l:beginning_of_year = l:timestamp - (l:day_of_year - 1)*l:day_s
let l:middle_of_year = l:beginning_of_year + float2nr(365.25/2*l:day_s)
let l:middle_of_computed_year = l:middle_of_year + float2nr(365.25*l:day_s*l:delta_periods)
let l:day_of_computed_year = str2nr(strftime('%j', l:middle_of_computed_year)) - 1
let l:computed_timestamp = l:middle_of_computed_year - l:day_of_computed_year*l:day_s
else "daily
let l:computed_timestamp = localtime() + l:delta_periods*l:day_s
endif
return strftime('%Y-%m-%d', l:computed_timestamp)
endfunction
function! s:get_position_links(link) abort
" Return: <int:index, list:links>
let idx = -1
let links = []
if a:link =~# '^\d\{4}-\d\d-\d\d'
let links = map(vimwiki#diary#get_diary_files(), 'fnamemodify(v:val, ":t:r")')
" include 'today' into links
if index(links, vimwiki#diary#diary_date_link()) == -1
call add(links, vimwiki#diary#diary_date_link())
endif
call sort(links)
let idx = index(links, a:link)
endif
return [idx, links]
endfunction
function! s:get_month_name(month) abort
" Convert month: number -> name
return vimwiki#vars#get_global('diary_months')[str2nr(a:month)]
endfunction
function! s:get_first_header(fl) abort
" Get the first header in the file within the first s:vimwiki_max_scan_for_caption lines.
let header_rx = vimwiki#vars#get_syntaxlocal('rxHeader')
for line in readfile(a:fl, '', g:vimwiki_max_scan_for_caption)
if line =~# header_rx
return vimwiki#u#trim(matchstr(line, header_rx))
endif
endfor
return ''
endfunction
function! s:get_all_headers(fl, maxlevel) abort
" Get a list of all headers in a file up to a given level.
" Return: list whose elements are pairs [level, title]
let headers_rx = {}
for i in range(1, a:maxlevel)
let headers_rx[i] = vimwiki#vars#get_syntaxlocal('rxH'.i.'_Text')
endfor
let headers = []
for line in readfile(a:fl, '')
for [i, header_rx] in items(headers_rx)
if line =~# header_rx
call add(headers, [i, vimwiki#u#trim(matchstr(line, header_rx))])
break
endif
endfor
endfor
return headers
endfunction
function! s:count_headers_level_less_equal(headers, maxlevel) abort
" Count headers with level <= maxlevel in a list of [level, title] pairs.
let l:count = 0
for [header_level, _] in a:headers
if header_level <= a:maxlevel
let l:count += 1
endif
endfor
return l:count
endfunction
function! s:get_min_header_level(headers) abort
" Get the minimum level of any header in a list of [level, title] pairs.
if len(a:headers) == 0
return 0
endif
let minlevel = a:headers[0][0]
for [level, _] in a:headers
let minlevel = min([minlevel, level])
endfor
return minlevel
endfunction
function! s:read_captions(files) abort
" Read all cpation in 1. <List>files
" Return: <Dic>: key -> caption
let result = {}
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level')
for fl in a:files
" Remove paths and extensions
let fl_captions = {}
" Default; no captions from the file.
let fl_captions['top'] = ''
let fl_captions['rest'] = []
if caption_level >= 0 && filereadable(fl)
if caption_level == 0
" Take first header of any level as the top caption.
let fl_captions['top'] = s:get_first_header(fl)
else
let headers = s:get_all_headers(fl, caption_level)
if len(headers) > 0
" If first header is the only one at its level or less, then make it the top caption.
let [first_level, first_header] = headers[0]
if s:count_headers_level_less_equal(headers, first_level) == 1
let fl_captions['top'] = first_header
call remove(headers, 0)
endif
let min_header_level = s:get_min_header_level(headers)
for [level, header] in headers
call add(fl_captions['rest'], [level - min_header_level, header])
endfor
endif
endif
endif
let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
let result[fl_key] = fl_captions
endfor
return result
endfunction
function! vimwiki#diary#get_diary_files() abort
" Return: <list> diary file names
let rx = '^\d\{4}-\d\d-\d\d'
let s_files = glob(vimwiki#vars#get_wikilocal('path').
\ vimwiki#vars#get_wikilocal('diary_rel_path').'*'.vimwiki#vars#get_wikilocal('ext'))
let files = split(s_files, '\n')
call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
" remove backup files (.wiki~)
call filter(files, 'v:val !~# ''.*\~$''')
return files
endfunction
function! s:group_links(links) abort
" Return: <dic> nested -> links
let result = {}
let p_year = 0
let p_month = 0
for fl in sort(keys(a:links))
let year = strpart(fl, 0, 4)
let month = strpart(fl, 5, 2)
if p_year != year
let result[year] = {}
let p_month = 0
endif
if p_month != month
let result[year][month] = {}
endif
let result[year][month][fl] = a:links[fl]
let p_year = year
let p_month = month
endfor
return result
endfunction
function! s:sort(lst) abort
" Sort list
if vimwiki#vars#get_wikilocal('diary_sort') ==? 'desc'
return reverse(sort(a:lst))
else
return sort(a:lst)
endif
endfunction
function! vimwiki#diary#diary_sort(lst) abort
return s:sort(a:lst)
endfunction
function! vimwiki#diary#make_note(wnum, ...) abort
" Create note
" The given wiki number a:wnum is 1 for the first wiki, 2 for the second and so on. This is in
" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki
" is used.
if a:wnum == 0
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
if wiki_nr < 0 " this happens when e.g. VimwikiMakeDiaryNote was called outside a wiki buffer
let wiki_nr = 0
endif
else
let wiki_nr = a:wnum - 1
endif
if wiki_nr >= vimwiki#vars#number_of_wikis()
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!')
return
endif
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
let cmd = 'edit'
if a:0
if a:1 == 1
let cmd = 'tabedit'
elseif a:1 == 2
let cmd = 'split'
elseif a:1 == 3
let cmd = 'vsplit'
elseif a:1 == 4
let cmd = 'tab drop'
elseif a:1 == 5
let cmd = 'drop'
if exists(':drop')
let cmd = 'drop'
endif
endif
endif
if a:0>1
let link = 'diary:'.a:2
else
let link = 'diary:'.vimwiki#diary#diary_date_link()
endif
call vimwiki#base#open_link(cmd, link, s:diary_index(wiki_nr))
endfunction
function! vimwiki#diary#goto_diary_index(wnum) abort
" Jump to diary index of 1. <Int> wikinumber
" if wnum = 0 the current wiki is used
if a:wnum == 0
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
if idx < 0 " not in a wiki
let idx = 0
endif
else
let idx = a:wnum - 1 " convert to 0 based counting
endif
if a:wnum > vimwiki#vars#number_of_wikis()
call vimwiki#u#error('Wiki '.a:wnum.' is not registered in g:vimwiki_list!')
return
endif
call vimwiki#base#edit_file('e', s:diary_index(idx), '')
if vimwiki#vars#get_wikilocal('auto_diary_index')
call vimwiki#diary#generate_diary_section()
write! " save changes
endif
endfunction
function! vimwiki#diary#goto_next_day() abort
" Jump to next day
let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r'))
if idx == (len(links) - 1)
return
endif
if idx != -1 && idx < len(links) - 1
let link = 'diary:'.links[idx+1]
else
" goto today
let link = 'diary:'.vimwiki#diary#diary_date_link()
endif
if len(link)
call vimwiki#base#open_link(':e ', link)
endif
endfunction
function! vimwiki#diary#goto_prev_day() abort
" Jump to previous day
let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r'))
if idx == 0
return
endif
if idx > 0
let link = 'diary:'.links[idx-1]
else
" goto today
let link = 'diary:'.vimwiki#diary#diary_date_link()
endif
if len(link)
call vimwiki#base#open_link(':e ', link)
endif
endfunction
function! vimwiki#diary#generate_diary_section() abort
" Create diary index content
let GeneratorDiary = copy(l:)
function! GeneratorDiary.f() abort
let lines = []
let links_with_captions = s:read_captions(vimwiki#diary#get_diary_files())
let g_files = s:group_links(links_with_captions)
let g_keys = s:sort(keys(g_files))
for year in g_keys
if len(lines) > 0
call add(lines, '')
endif
call add(lines, substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', year , ''))
for month in s:sort(keys(g_files[year]))
call add(lines, '')
call add(lines, substitute(vimwiki#vars#get_syntaxlocal('rxH3_Template'),
\ '__Header__', s:get_month_name(month), ''))
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
call add(lines, '')
endfor
endif
for [fl, captions] in s:sort(items(g_files[year][month]))
let topcap = captions['top']
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
if empty(topcap) " When using markdown syntax, we should ensure we always have a link description.
let topcap = fl
endif
endif
if empty(topcap)
let top_link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
else
let top_link_tpl = link_tpl
endif
let bullet = vimwiki#lst#default_symbol().' '
let entry = substitute(top_link_tpl, '__LinkUrl__', fl, '')
let entry = substitute(entry, '__LinkDescription__', topcap, '')
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
let extension = vimwiki#vars#get_wikilocal('ext', wiki_nr)
let entry = substitute(entry, '__FileExtension__', extension, 'g')
" If single H1 then that will be used as the description for the link to the file
" if multple H1 then the filename will be used as the description for the link to the
" file and multiple H1 headers will be indented by shiftwidth
call add(lines, repeat(' ', vimwiki#lst#get_list_margin()).bullet.entry)
let startindent = repeat(' ', vimwiki#lst#get_list_margin())
let indentstring = repeat(' ', vimwiki#u#sw())
for [depth, subcap] in captions['rest']
if empty(subcap)
continue
endif
let entry = substitute(link_tpl, '__LinkUrl__', fl.'#'.subcap, '')
let entry = substitute(entry, '__LinkDescription__', subcap, '')
" if single H1 then depth H2=0, H3=1, H4=2, H5=3, H6=4
" if multiple H1 then depth H1= 0, H2=1, H3=2, H4=3, H5=4, H6=5
" indent subsequent headers levels by shiftwidth
call add(lines, startindent.repeat(indentstring, depth+1).bullet.entry)
endfor
endfor
endfor
endfor
return lines
endfunction
let current_file = vimwiki#path#path_norm(expand('%:p'))
let diary_file = vimwiki#path#path_norm(s:diary_index())
if vimwiki#path#is_equal(current_file, diary_file)
let content_rx = '^\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)\|'.
\ '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(
\ GeneratorDiary,
\ vimwiki#vars#get_wikilocal('diary_header'),
\ content_rx,
\ 1,
\ 1,
\ 1)
else
call vimwiki#u#error('You can generate diary links only in a diary index page!')
endif
endfunction
function! vimwiki#diary#calendar_action(day, month, year, week, dir) abort
" Callback function for Calendar.vim
let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month)
let link = a:year.'-'.month.'-'.day
if winnr('#') == 0
if a:dir ==? 'V'
vsplit
else
split
endif
else
wincmd p
if !&hidden && &modified
new
endif
endif
call vimwiki#diary#make_note(0, 0, link)
endfunction
function! vimwiki#diary#calendar_sign(day, month, year) abort
" Callback function for Calendar.vim
" Clause: no wiki no sign #290
if len(g:vimwiki_list) <= 0
return
endif
let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month)
let sfile = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
\ . a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
return filereadable(expand(sfile))
endfunction
function! vimwiki#diary#diary_file_captions() abort
return s:read_captions(vimwiki#diary#get_diary_files())
endfunction

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
#
# This script converts markdown into html, to be used with vimwiki's
# "customwiki2html" option. Experiment with the two proposed methods by
# commenting / uncommenting the relevant lines below.
#
# NEW! An alternative converter was developed by Jason6Anderson, and can
# be located at https://github.com/vimwiki-backup/vimwiki/issues/384
#
#
# To use this script, you must have the Discount converter installed.
#
# http://www.pell.portland.or.us/~orc/Code/discount/
#
# To verify your installation, check that the commands markdown and mkd2html,
# are on your path.
#
# Also verify that this file is executable.
#
# Then, in your .vimrc file, set:
#
# g:vimwiki_custom_wiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
#
# On your next restart, Vimwiki will run this script instead of using the
# internal wiki2html converter.
#
MKD2HTML=mkd2html
# shellcheck disable=SC2034 # FORCE appears unused
FORCE="$1"
SYNTAX="$2"
EXTENSION="$3"
OUTPUTDIR="$4"
INPUT="$5"
CSSFILE="$6"
[[ "$SYNTAX" == "markdown" ]] || { echo "Error: Unsupported syntax"; exit 2; };
OUTPUT="$OUTPUTDIR/$(basename "$INPUT" ."$EXTENSION").html"
# # Method 1:
# FORCEFLAG=
# (( "$FORCE" == 0 )) || { FORCEFLAG="-f"; };
# MARKDOWN=markdown
#
# # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile]
#
# URLBASE=http://example.com
# $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT
# Method 2:
# mkd2html [-css file] [-header string] [-footer string] [file]
$MKD2HTML -css "$CSSFILE" "$INPUT"
OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html
mv -f "$OUTPUTTMP" "$OUTPUT"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Link functions for markdown syntax
" Home: https://github.com/vimwiki/vimwiki/
function! s:safesubstitute(text, search, replace, mode) abort
" Substitute regexp but do not interpret replace
let escaped = escape(a:replace, '\&')
return substitute(a:text, a:search, escaped, a:mode)
endfunction
function! vimwiki#markdown_base#scan_reflinks() abort
let mkd_refs = {}
" construct list of references using vimgrep
try
" Why noautocmd? Because https://github.com/vimwiki/vimwiki/issues/121
noautocmd execute 'vimgrep #'.vimwiki#vars#get_syntaxlocal('rxMkdRef').'#j %'
catch /^Vim\%((\a\+)\)\=:E480/ " No Match
"Ignore it, and move on to the next file
endtry
for d in getqflist()
let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ')
let descr = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchDescr'))
let url = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchUrl'))
if descr !=? '' && url !=? ''
let mkd_refs[descr] = url
endif
endfor
call vimwiki#vars#set_bufferlocal('markdown_refs', mkd_refs)
return mkd_refs
endfunction
function! vimwiki#markdown_base#open_reflink(link) abort
" try markdown reference links
let link = a:link
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
if has_key(mkd_refs, link)
let url = mkd_refs[link]
call vimwiki#base#system_open_link(url)
return 1
else
return 0
endif
endfunction
function! s:normalize_link_syntax_n() abort
let lnum = line('.')
" try WikiIncl
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl'))
if !empty(lnk)
" NO-OP !!
return
endif
" try WikiLink0: replace with WikiLink1
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'))
if !empty(lnk)
let sub = vimwiki#base#normalize_link_helper(lnk,
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'),
\ vimwiki#vars#get_syntaxlocal('WikiLink1Template2'))
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'), sub)
return
endif
" try WikiLink1: replace with WikiLink0
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'))
if !empty(lnk)
let sub = vimwiki#base#normalize_link_helper(lnk,
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchDescr'),
\ vimwiki#vars#get_global('WikiLinkTemplate2'))
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), sub)
return
endif
" try Weblink
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'))
if !empty(lnk)
let sub = vimwiki#base#normalize_link_helper(lnk,
\ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'),
\ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchDescr'),
\ vimwiki#vars#get_syntaxlocal('Weblink1Template'))
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWeblink'), sub)
return
endif
" try Word (any characters except separators)
" rxWord is less permissive than rxWikiLinkUrl which is used in
" normalize_link_syntax_v
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord'))
if !empty(lnk)
if vimwiki#base#is_diary_file(expand('%:p'))
let sub = vimwiki#base#normalize_link_in_diary(lnk)
else
let sub = vimwiki#base#normalize_link_helper(lnk,
\ vimwiki#vars#get_global('rxWord'), '',
\ vimwiki#vars#get_syntaxlocal('Link1'))
endif
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
return
endif
endfunction
function! vimwiki#markdown_base#normalize_link() abort
" TODO mutualize with base
call s:normalize_link_syntax_n()
endfunction

View File

@@ -0,0 +1,251 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Path manipulation functions
" Home: https://github.com/vimwiki/vimwiki/
function! s:unixify(path) abort
" Unixify Path:
return substitute(a:path, '\', '/', 'g')
endfunction
function! s:windowsify(path) abort
" Windowsify Path:
return substitute(a:path, '/', '\', 'g')
endfunction
" Define: os specific path convertion
if vimwiki#u#is_windows()
function! s:osxify(path) abort
return s:windowsify(a:path)
endfunction
else
function! s:osxify(path) abort
return s:unixify(a:path)
endfunction
endif
function! vimwiki#path#chomp_slash(str) abort
" Remove Delimiter: of last path (slash or backslash)
return substitute(a:str, '[/\\]\+$', '', '')
endfunction
" Define: path-compare function, either case-sensitive or not, depending on OS.
if vimwiki#u#is_windows()
function! vimwiki#path#is_equal(p1, p2) abort
return a:p1 ==? a:p2
endfunction
else
function! vimwiki#path#is_equal(p1, p2) abort
return a:p1 ==# a:p2
endfunction
endif
function! vimwiki#path#normalize(path) abort
" Collapse Sections: like /a/b/../c to /a/c and /a/b/./c to /a/b/c
let path = a:path
while 1
let intermediateResult = substitute(path, '/[^/]\+/\.\.', '', '')
let result = substitute(intermediateResult, '/\./', '/', '')
if result ==# path
break
endif
let path = result
endwhile
return result
endfunction
function! vimwiki#path#path_norm(path) abort
" Normalize Path: \ -> / && /// -> / && resolve(symlinks)
" return if scp
if a:path =~# '^scp:' | return a:path | endif
" convert backslash to slash
let path = substitute(a:path, '\', '/', 'g')
" treat multiple consecutive slashes as one path separator
let path = substitute(path, '/\+', '/', 'g')
" ensure that we are not fooled by a symbolic link
return resolve(path)
endfunction
function! vimwiki#path#is_link_to_dir(link) abort
" Check: if link is to a directory
" It should be ended with \ or /.
return a:link =~# '\m[/\\]$'
endfunction
function! vimwiki#path#abs_path_of_link(link) abort
" Get: absolute path <- path relative to current file
return vimwiki#path#normalize(expand('%:p:h').'/'.a:link)
endfunction
function! vimwiki#path#path_common_pfx(path1, path2) abort
" Returns: longest common path prefix of 2 given paths.
" Ex: '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
let p1 = split(a:path1, '[/\\]', 1)
let p2 = split(a:path2, '[/\\]', 1)
let idx = 0
let minlen = min([len(p1), len(p2)])
while (idx < minlen) && vimwiki#path#is_equal(p1[idx], p2[idx])
let idx = idx + 1
endwhile
if idx == 0
return ''
else
return join(p1[: idx-1], '/')
endif
endfunction
function! vimwiki#path#wikify_path(path) abort
" Convert: path -> full resolved slashed path
let result = resolve(fnamemodify(a:path, ':p'))
if vimwiki#u#is_windows()
let result = substitute(result, '\\', '/', 'g')
endif
let result = vimwiki#path#chomp_slash(result)
return result
endfunction
function! vimwiki#path#current_wiki_file() abort
" Return: Current file path relative
return vimwiki#path#wikify_path(expand('%:p'))
endfunction
function! vimwiki#path#relpath(dir, file) abort
" Return: the relative path from a:dir to a:file
" Check if dir here ('.') -> return file
if empty(a:dir) || a:dir =~# '^\.[/\\]\?$'
return a:file
endif
" Unixify && Expand in
let s_dir = s:unixify(expand(a:dir))
let s_file = s:unixify(expand(a:file))
" Split path
let dir = split(s_dir, '/')
let file = split(s_file, '/')
" Shorten loop till equality
while (len(dir) > 0 && len(file) > 0) && vimwiki#path#is_equal(dir[0], file[0])
call remove(dir, 0)
call remove(file, 0)
endwhile
" Return './' if nothing left
if empty(dir) && empty(file)
return s:osxify('./')
endif
" Build path segment
let segments = []
for segment in dir
let segments += ['..']
endfor
for segment in file
let segments += [segment]
endfor
" Join segments
let result_path = join(segments, '/')
if a:file =~# '\m/$'
let result_path .= '/'
endif
return result_path
endfunction
function! vimwiki#path#mkdir(path, ...) abort
" Mkdir:
" if the optional argument provided and nonzero,
" it will ask before creating a directory
" returns: 1 iff directory exists or successfully created
let path = expand(a:path)
if path =~# '^scp:'
" we can not do much, so let's pretend everything is ok
return 1
endif
if isdirectory(path)
return 1
else
if !exists('*mkdir')
return 0
endif
let path = vimwiki#path#chomp_slash(path)
if vimwiki#u#is_windows() && !empty(vimwiki#vars#get_global('w32_dir_enc'))
let path = iconv(path, &encoding, vimwiki#vars#get_global('w32_dir_enc'))
endif
if a:0 && a:1 && input('Vimwiki: Make new directory: '.path."\n [y]es/[N]o? ") !~? '^y'
return 0
endif
call mkdir(path, 'p')
return 1
endif
endfunction
function! vimwiki#path#is_absolute(path) abort
" Check: if path is absolute
let res=0
" Match 'C:' or '/' or '~'
if vimwiki#u#is_windows()
let res += a:path =~? '\m^\a:'
else
let res += a:path =~# '\m^/\|\~/'
endif
" Do not prepend root_path to scp files
" See: https://vim.fandom.com/wiki/Editing_remote_files_via_scp_in_vim
let res += a:path =~# '\m^scp:'
return res
endfunction
function! s:get_wikifile_link(wikifile) abort
return vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), a:wikifile).
\ fnamemodify(a:wikifile, ':t:r')
endfunction
function! vimwiki#path#PasteLink(wikifile) abort
call append(line('.'), '[[/'.s:get_wikifile_link(a:wikifile).']]')
endfunction
if vimwiki#u#is_windows()
" Combine: a directory and a file into one path, doesn't generate duplicate
" path separator in case the directory is also having an ending / or \. This
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
" valid path.
function! vimwiki#path#join_path(directory, file) abort
let directory = vimwiki#path#chomp_slash(a:directory)
let file = substitute(a:file, '\m^[\\/]\+', '', '')
return directory . '/' . file
endfunction
else
function! vimwiki#path#join_path(directory, file) abort
let directory = substitute(a:directory, '\m/\+$', '', '')
let file = substitute(a:file, '\m^/\+', '', '')
return directory . '/' . file
endfunction
endif

View File

@@ -0,0 +1,187 @@
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;;
margin: 2em 4em 2em 4em;
font-size: 120%;
line-height: 130%;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
line-height:100%;
margin-top: 1.5em;
margin-bottom: 0.5em;
}
h1 {font-size: 2em; color: #000000;}
h2 {font-size: 1.8em; color: #404040;}
h3 {font-size: 1.6em; color: #707070;}
h4 {font-size: 1.4em; color: #909090;}
h5 {font-size: 1.2em; color: #989898;}
h6 {font-size: 1em; color: #9c9c9c;}
p, pre, blockquote, table, ul, ol, dl {
margin-top: 1em;
margin-bottom: 1em;
}
ul ul, ul ol, ol ol, ol ul {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
li { margin: 0.3em auto; }
ul {
margin-left: 2em;
padding-left: 0;
}
dt { font-weight: bold; }
img { border: none; }
pre {
border-left: 5px solid #dcdcdc;
background-color: #f5f5f5;
padding-left: 1em;
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
font-size: 0.8em;
border-radius: 6px;
}
p > a {
color: white;
text-decoration: none;
font-size: 0.7em;
padding: 3px 6px;
border-radius: 3px;
background-color: #1e90ff;
text-transform: uppercase;
font-weight: bold;
}
p > a:hover {
color: #dcdcdc;
background-color: #484848;
}
li > a {
color: #1e90ff;
font-weight: bold;
text-decoration: none;
}
li > a:hover { color: #ff4500; }
blockquote {
color: #686868;
font-size: 0.8em;
line-height: 120%;
padding: 0.8em;
border-left: 5px solid #dcdcdc;
}
th, td {
border: 1px solid #ccc;
padding: 0.3em;
}
th { background-color: #f0f0f0; }
hr {
border: none;
border-top: 1px solid #ccc;
width: 100%;
}
del {
text-decoration: line-through;
color: #777777;
}
.toc li { list-style-type: none; }
.todo {
font-weight: bold;
background-color: #ff4500 ;
color: white;
font-size: 0.8em;
padding: 3px 6px;
border-radius: 3px;
}
.justleft { text-align: left; }
.justright { text-align: right; }
.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 {
/* list-style: none; */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAACXBIWXMAAADFAAAAxQEdzbqoAAAAB3RJTUUH4QgEFhAtuWgv9wAAAPZQTFRFmpqam5iYnJaWnJeXnpSUn5OTopCQpoqKpouLp4iIqIiIrYCAt3V1vW1tv2xsmZmZmpeXnpKS/x4e/x8f/yAg/yIi/yQk/yUl/yYm/ygo/ykp/yws/zAw/zIy/zMz/zQ0/zU1/zY2/zw8/0BA/0ZG/0pK/1FR/1JS/1NT/1RU/1VV/1ZW/1dX/1pa/15e/19f/2Zm/2lp/21t/25u/3R0/3p6/4CA/4GB/4SE/4iI/46O/4+P/52d/6am/6ur/66u/7Oz/7S0/7e3/87O/9fX/9zc/93d/+Dg/+vr/+3t/+/v//Dw//Ly//X1//f3//n5//z8////gzaKowAAAA90Uk5T/Pz8/Pz8/Pz8/Pz8/f39ppQKWQAAAAFiS0dEEnu8bAAAAACuSURBVAhbPY9ZF4FQFEZPSKbIMmWep4gMGTKLkIv6/3/GPbfF97b3w17rA0kQOPgvAeHW6uJ6+5h7HqLdwowgOzejXRXBdx6UdSru216xuOMBHHNU0clTzeSUA6EhF8V8kqroluMiU6HKcuf4phGPr1o2q9kYZWwNq1qfRRmTaXpqsyjj17KkWCxKBUBgXWueHIyiAIg18gsse4KHkLF5IKIY10WQgv7fOy4ST34BRiopZ8WLNrgAAAAASUVORK5CYII=);
background-repeat: no-repeat;
background-position: 0 .2em;
padding-left: 1.5em;
}
.done0 {
/* list-style: none; */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
background-repeat: no-repeat;
background-position: 0 .2em;
padding-left: 1.5em;
}
.done1 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
background-repeat: no-repeat;
background-position: 0 .15em;
padding-left: 1.5em;
}
.done2 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
background-repeat: no-repeat;
background-position: 0 .15em;
padding-left: 1.5em;
}
.done3 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
background-repeat: no-repeat;
background-position: 0 .15em;
padding-left: 1.5em;
}
.done4 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
background-repeat: no-repeat;
background-position: 0 .15em;
padding-left: 1.5em;
}
code {
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
padding: 0px 3px;
display: inline-block;
color: #52595d;
border: 1px solid #ccc;
background-color: #f9f9f9;
}

View File

@@ -0,0 +1,450 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Tag manipulation functions
" Home: https://github.com/vimwiki/vimwiki/
"
" Tags metadata in-memory format:
" metadata := { 'pagename': [entries, ...] }
" entry := { 'tagname':..., 'lineno':..., 'link':... }
" Tags metadata in-file format:
"
" Is based on CTags format (see |tags-file-format|) and
" https://ctags.sourceforge.net/FORMAT
"
" {tagaddress} is set to lineno. We'll let vim search by exact line number; we
" can afford that, we assume metadata file is always updated before use.
"
" Pagename and link are not saved in standard ctags fields, so we'll add
" an optional field, "vimwiki:". In this field, we encode tab-separated values
" of missing parameters -- "pagename" and "link".
let s:TAGS_METADATA_FILE_NAME = '.vimwiki_tags'
function! vimwiki#tags#update_tags(full_rebuild, all_files) abort
" Update tags metadata.
" Param: a:full_rebuild == 1: re-scan entire wiki
" Param: a:full_rebuild == 0: only re-scan current page
" a:all_files == '': only if the file is newer than .tags
let all_files = a:all_files !=? ''
if !a:full_rebuild
" Updating for one page (current)
let page_name = vimwiki#vars#get_bufferlocal('subdir') . expand('%:t:r')
" Collect tags in current file
let tags = s:scan_tags(getline(1, '$'), page_name)
" Load metadata file
let metadata = s:load_tags_metadata()
" Drop old tags
let metadata = s:remove_page_from_tags(metadata, page_name)
" Merge in the new ones
let metadata = s:merge_tags(metadata, page_name, tags)
" Save
call s:write_tags_metadata(metadata)
else " full rebuild
let files = vimwiki#base#find_files(vimwiki#vars#get_bufferlocal('wiki_nr'), 0)
let wiki_base_dir = vimwiki#vars#get_wikilocal('path')
let tags_file_last_modification = getftime(vimwiki#tags#metadata_file_path())
let metadata = s:load_tags_metadata()
for file in files
if all_files || getftime(file) >= tags_file_last_modification
let subdir = vimwiki#base#subdir(wiki_base_dir, file)
let page_name = subdir . fnamemodify(file, ':t:r')
let tags = s:scan_tags(readfile(file), page_name)
let metadata = s:remove_page_from_tags(metadata, page_name)
let metadata = s:merge_tags(metadata, page_name, tags)
endif
endfor
call s:write_tags_metadata(metadata)
endif
endfunction
function! s:safesubstitute(text, search, replace, mode) abort
" Substitute regexp but do not interpret replace
" TODO mutualize with same function in base
let escaped = escape(a:replace, '\&')
return substitute(a:text, a:search, escaped, a:mode)
endfunction
function! s:scan_tags(lines, page_name) abort
" Scan the list of text lines (argument) and produces tags metadata as a list of tag entries.
" Code wireframe to scan for headers -- borrowed from
" vimwiki#base#get_anchors(), with minor modifications.
let entries = []
" Get syntax wide regex
let rxheader = vimwiki#vars#get_syntaxlocal('header_search')
let tag_search_rx = vimwiki#vars#get_syntaxlocal('tag_search')
let tag_format = vimwiki#vars#get_syntaxlocal('tag_format')
let anchor_level = ['', '', '', '', '', '', '']
let current_complete_anchor = ''
let PROXIMITY_LINES_NR = 2
let header_line_nr = - (2 * PROXIMITY_LINES_NR)
for line_nr in range(1, len(a:lines))
let line = a:lines[line_nr - 1]
" ignore verbatim blocks
if vimwiki#u#is_codeblock(line_nr)
continue
endif
" process headers
let h_match = matchlist(line, rxheader)
if !empty(h_match) " got a header
let header_line_nr = line_nr
let header = vimwiki#base#normalize_anchor(h_match[2])
let current_header_description = vimwiki#u#trim(h_match[2])
let level = len(h_match[1])
let anchor_level[level-1] = header
for l in range(level, 6)
let anchor_level[l] = ''
endfor
if level == 1
let current_complete_anchor = header
else
let current_complete_anchor = ''
for l in range(level-1)
if anchor_level[l] !=? ''
let current_complete_anchor .= anchor_level[l].'#'
endif
endfor
let current_complete_anchor .= header
endif
continue " tags are not allowed in headers
endif
" Scan line for tags. There can be many of them.
let str = line
while 1
" Get all matches
let tag_groups = []
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
if tag_groups == []
break
endif
let tagend = matchend(str, tag_search_rx)
let str = str[(tagend):]
for tag_group in tag_groups
for tag in split(tag_group, tag_format.sep)
" Create metadata entry
let entry = {}
let entry.tagname = tag
let entry.lineno = line_nr
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
" Tag appeared at the top of the file
let entry.link = a:page_name
let entry.description = entry.link
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
" Tag appeared right below a header
let entry.link = a:page_name . '#' . current_complete_anchor
let entry.description = current_header_description
else
" Tag stands on its own
let entry.link = a:page_name . '#' . tag
let entry.description = entry.link
endif
call add(entries, entry)
endfor
endfor
endwhile
endfor " loop over lines
return entries
endfunction
function! vimwiki#tags#metadata_file_path() abort
" Return: tags metadata file path
return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'),
\ s:TAGS_METADATA_FILE_NAME), ':p')
endfunction
function! s:load_tags_metadata() abort
" Load tags metadata from file, returns a dictionary
let metadata_path = vimwiki#tags#metadata_file_path()
if !filereadable(metadata_path)
return {}
endif
let metadata = {}
for line in readfile(metadata_path)
if line =~# '^!_TAG_.*$'
continue
endif
let parts = matchlist(line, '^\(.\{-}\);"\(.*\)$')
if parts[0] ==? '' || parts[1] ==? '' || parts[2] ==? ''
throw 'VimwikiTags1: Metadata file corrupted'
endif
let std_fields = split(parts[1], '\t')
if len(std_fields) != 3
throw 'VimwikiTags2: Metadata file corrupted'
endif
let vw_part = parts[2]
if vw_part[0] !=? "\t"
throw 'VimwikiTags3: Metadata file corrupted'
endif
let vw_fields = split(vw_part[1:], "\t")
if len(vw_fields) != 1 || vw_fields[0] !~# '^vimwiki:'
throw 'VimwikiTags4: Metadata file corrupted'
endif
let vw_data = substitute(vw_fields[0], '^vimwiki:', '', '')
let vw_data = substitute(vw_data, '\\n', "\n", 'g')
let vw_data = substitute(vw_data, '\\r', "\r", 'g')
let vw_data = substitute(vw_data, '\\t', "\t", 'g')
let vw_data = substitute(vw_data, '\\\\', "\\", 'g')
let vw_fields = split(vw_data, "\t")
if len(vw_fields) != 3
throw 'VimwikiTags5: Metadata file corrupted'
endif
let pagename = vw_fields[0]
let entry = {}
let entry.tagname = std_fields[0]
let entry.lineno = std_fields[2]
let entry.link = vw_fields[1]
let entry.description = vw_fields[2]
if has_key(metadata, pagename)
call add(metadata[pagename], entry)
else
let metadata[pagename] = [entry]
endif
endfor
return metadata
endfunction
function! s:remove_page_from_tags(metadata, page_name) abort
" Remove all entries for given page from metadata in-place. Returns updated
" metadata (just in case).
if has_key(a:metadata, a:page_name)
call remove(a:metadata, a:page_name)
return a:metadata
else
return a:metadata
endif
endfunction
function! s:merge_tags(metadata, pagename, file_metadata) abort
" Merge metadata of one file into a:metadata
let metadata = a:metadata
let metadata[a:pagename] = a:file_metadata
return metadata
endfunction
function! s:tags_entry_cmp(i1, i2) abort
" Compare two actual lines from tags file. Return value is in strcmp style.
" See help on sort() -- that's what this function is going to be used for.
" See also s:write_tags_metadata below -- that's where we compose these tags
" file lines.
"
" This function is needed for tags sorting, since plain sort() compares line
" numbers as strings, not integers, and so, for example, tag at line 14
" preceeds the same tag on the same page at line 9. (Because string "14" is
" alphabetically 'less than' string "9".)
let items = []
for orig_item in [a:i1, a:i2]
let fields = split(orig_item, "\t")
let item = {}
let item.text = fields[0]."\t".fields[1]
let item.lineno = 0 + matchstr(fields[2], '\m\d\+')
call add(items, item)
endfor
if items[0].text ># items[1].text
return 1
elseif items[0].text <# items[1].text
return -1
elseif items[0].lineno > items[1].lineno
return 1
elseif items[0].lineno < items[1].lineno
return -1
else
return 0
endif
endfunction
function! s:write_tags_metadata(metadata) abort
" Save metadata object into a file. Throws exceptions in case of problems.
let metadata_path = vimwiki#tags#metadata_file_path()
let tags = []
for pagename in keys(a:metadata)
for entry in a:metadata[pagename]
let entry_data = pagename . "\t" . entry.link . "\t" . entry.description
let entry_data = substitute(entry_data, "\\", '\\\\', 'g')
let entry_data = substitute(entry_data, "\t", '\\t', 'g')
let entry_data = substitute(entry_data, "\r", '\\r', 'g')
let entry_data = substitute(entry_data, "\n", '\\n', 'g')
call add(tags,
\ entry.tagname . "\t"
\ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t"
\ . entry.lineno
\ . ';"'
\ . "\t" . 'vimwiki:' . entry_data
\)
endfor
endfor
call sort(tags, 's:tags_entry_cmp')
let tag_comments = [
\ "!_TAG_PROGRAM_VERSION\t" . g:vimwiki_version,
\ "!_TAG_PROGRAM_URL\thttps://github.com/vimwiki/vimwiki",
\ "!_TAG_PROGRAM_NAME\tVimwiki Tags",
\ "!_TAG_PROGRAM_AUTHOR\tVimwiki",
\ "!_TAG_OUTPUT_MODE\tvimwiki-tags",
\ "!_TAG_FILE_SORTED\t1",
\ "!_TAG_FILE_FORMAT\t2",
\ ]
for c in tag_comments
call insert(tags, c)
endfor
call writefile(tags, metadata_path)
endfunction
function! vimwiki#tags#get_tags() abort
" Return: list of unique tags found in the .tags file
let metadata = s:load_tags_metadata()
let tags = {}
for entries in values(metadata)
for entry in entries
let tags[entry.tagname] = 1
endfor
endfor
return keys(tags)
endfunction
function! vimwiki#tags#generate_tags(create, ...) abort
" Generate tags in current buffer
" Similar to vimwiki#base#generate_links. In the current buffer, appends
" tags and references to all their instances. If no arguments (tags) are
" specified, outputs all tags.
let header_level = vimwiki#vars#get_global('tags_header_level')
let tags_header_text = vimwiki#vars#get_global('tags_header')
" If tag headers should only be updated, search for already present tag headers
if !a:create
let headers = vimwiki#base#collect_headers()
let specific_tags = []
let inside_tag_headers = 0
for header in headers
" If we ran out of the headers containing the tags, stop
if inside_tag_headers && header[1] <= header_level
break
endif
" All headers in the tag headers section correspond to tag names. Collect all of them in a list.
if inside_tag_headers
call add(specific_tags, header[2])
endif
" If we found the start of the tag headers section, remember that the following headers are now inside of it
if header[1] == header_level && header[2] ==# tags_header_text
let inside_tag_headers = 1
endif
endfor
else
let specific_tags = a:000
endif
" use a dictionary function for closure like capability
" copy all local variables into dict (add a: if arguments are needed)
let GeneratorTags = copy(l:)
function! GeneratorTags.f() abort
let need_all_tags = empty(self.specific_tags)
let metadata = s:load_tags_metadata()
" make a dictionary { tag_name: [tag_links, ...] }
let tags_entries = {}
for entries in values(metadata)
for entry in entries
if has_key(tags_entries, entry.tagname)
call add(tags_entries[entry.tagname], [entry.link, entry.description])
else
let tags_entries[entry.tagname] = [[entry.link, entry.description]]
endif
endfor
unlet entry " needed for older vims with sticky type checking since name is reused
endfor
let lines = []
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
let current_dir = vimwiki#base#current_subdir()
for tagname in sort(keys(tags_entries))
if need_all_tags || index(self.specific_tags, tagname) != -1
if len(lines) > 0
call add(lines, '')
endif
let tag_tpl = printf('rxH%d_Template', self.header_level + 1)
call add(lines, s:safesubstitute(vimwiki#vars#get_syntaxlocal(tag_tpl), '__Header__', tagname, ''))
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
call add(lines, '')
endfor
endif
for [taglink, tagdescription] in sort(tags_entries[tagname])
let taglink = vimwiki#path#relpath(current_dir, taglink)
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink3Template')
let link_infos = vimwiki#base#resolve_link(taglink)
if empty(link_infos.anchor)
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', taglink, '')
let entry = s:safesubstitute(entry, '__LinkDescription__', tagdescription, '')
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
let entry = s:safesubstitute(entry, '__FileExtension__', file_extension , '')
else
let link_caption = split(tagdescription, '#', 0)[-1]
let link_text = split(taglink, '#', 1)[0]
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', link_text, '')
let entry = s:safesubstitute(entry, '__LinkAnchor__', link_infos.anchor, '')
let entry = s:safesubstitute(entry, '__LinkDescription__', link_caption, '')
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
let entry = s:safesubstitute(entry, '__FileExtension__', file_extension , '')
endif
call add(lines, bullet . entry)
else
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
let link_tpl = s:safesubstitute(link_tpl, '__FileExtension__', file_extension , '')
call add(lines, bullet . substitute(link_tpl, '__LinkUrl__', taglink, ''))
endif
endfor
endif
endfor
return lines
endfunction
let tag_match = printf('rxH%d', header_level + 1)
let links_rx = '^\%('.vimwiki#vars#get_syntaxlocal(tag_match).'\)\|'.
\ '\%(^\s*$\)\|^\s*\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(
\ GeneratorTags,
\ tags_header_text,
\ links_rx,
\ line('$')+1,
\ header_level,
\ a:create)
endfunction
function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
" Complete tags
" We can safely ignore args if we use -custom=complete option, Vim engine
" will do the job of filtering.
let taglist = vimwiki#tags#get_tags()
return join(taglist, "\n")
endfunction

View File

@@ -0,0 +1,856 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Tables
" | Easily | manageable | text | tables | ! |
" |--------|------------|-------|--------|---------|
" | Have | fun! | Drink | tea | Period. |
"
" Home: https://github.com/vimwiki/vimwiki/
" Clause: Load only once
if exists('g:loaded_vimwiki_tbl_auto') || &compatible
finish
endif
let g:loaded_vimwiki_tbl_auto = 1
function! s:s_sep() abort
" Return string column separator
return vimwiki#vars#get_syntaxlocal('rxTableSep')
endfunction
function! s:r_sep() abort
" Return regex column separator
" Not prefixed with \
let res = '\(^\|[^\\]\)\@<='
let res .= vimwiki#vars#get_syntaxlocal('rxTableSep')
return res
endfunction
function! s:wide_len(str) abort
" vim73 has new function that gives correct string width.
if exists('*strdisplaywidth')
return strdisplaywidth(a:str)
endif
" get str display width in vim ver < 7.2
if !vimwiki#vars#get_global('CJK_length')
let ret = strlen(substitute(a:str, '.', 'x', 'g'))
else
let savemodified = &modified
let save_cursor = getpos('.')
exe "norm! o\<esc>"
call setline(line('.'), a:str)
let ret = virtcol('$') - 1
d
call setpos('.', save_cursor)
let &modified = savemodified
endif
return ret
endfunction
function! s:cell_splitter() abort
return '\s*'.s:r_sep().'\s*'
endfunction
function! s:sep_splitter() abort
return '-'.s:r_sep().'-'
endfunction
function! s:is_table(line) abort
" Check if param:line is in a table
return s:is_separator(a:line) ||
\ (a:line !~# s:r_sep().s:r_sep() && a:line =~# '^\s*'.s:r_sep().'.\+'.s:r_sep().'\s*$')
endfunction
function! s:is_separator(line) abort
" Check if param:line is a separator (ex: | --- | --- |)
return a:line =~# '^\s*'.s:r_sep().'\(:\=--\+:\='.s:r_sep().'\)\+\s*$'
endfunction
function! s:is_separator_tail(line) abort
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:r_sep().'-\+\)\+'.s:r_sep().'\s*$'
endfunction
function! s:is_last_column(lnum, cnum) abort
let line = strpart(getline(a:lnum), a:cnum - 1)
return line =~# s:r_sep().'\s*$' && line !~# s:r_sep().'.*'.s:r_sep().'\s*$'
endfunction
function! s:is_first_column(lnum, cnum) abort
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
return line =~# '^\s*$' ||
\ (line =~# '^\s*'.s:r_sep() && line !~# '^\s*'.s:r_sep().'.*'.s:r_sep())
endfunction
function! s:count_separators_up(lnum) abort
let lnum = a:lnum - 1
while lnum > 1
if !s:is_separator(getline(lnum))
break
endif
let lnum -= 1
endwhile
return (a:lnum-lnum)
endfunction
function! s:count_separators_down(lnum) abort
let lnum = a:lnum + 1
while lnum < line('$')
if !s:is_separator(getline(lnum))
break
endif
let lnum += 1
endwhile
return (lnum-a:lnum)
endfunction
function! s:create_empty_row(cols) abort
" Create an empty row of a:cols columns
let row = s:s_sep()
let cell = ' '.s:s_sep()
for c in range(a:cols)
let row .= cell
endfor
return row
endfunction
function! s:create_row_sep(cols) abort
" Create an empty separator row of a:cols columns
let row = s:s_sep()
let cell = '---'.s:s_sep()
for c in range(a:cols)
let row .= cell
endfor
return row
endfunction
function! vimwiki#tbl#get_cells(line, ...) abort
let result = []
let state = 'NONE'
let cell_start = 0
let quote_start = 0
let len = strlen(a:line) - 1
" 'Simple' FSM
while state !=# 'CELL'
if quote_start != 0 && state !=# 'CELL'
let state = 'CELL'
endif
for idx in range(quote_start, len)
" The only way I know Vim can do Unicode...
let ch = a:line[idx]
if state ==# 'NONE'
if ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
let cell_start = idx + 1
let state = 'CELL'
endif
elseif state ==# 'CELL'
if ch ==# '[' || ch ==# '{'
let state = 'BEFORE_QUOTE_START'
let quote_start = idx
elseif ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
let cell = strpart(a:line, cell_start, idx - cell_start)
if a:0 && a:1
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
else
let cell = vimwiki#u#trim(cell)
endif
call add(result, cell)
let cell_start = idx + 1
endif
elseif state ==# 'BEFORE_QUOTE_START'
if ch ==# '[' || ch ==# '{'
let state = 'QUOTE'
let quote_start = idx
else
let state = 'CELL'
endif
elseif state ==# 'QUOTE'
if ch ==# ']' || ch ==# '}'
let state = 'BEFORE_QUOTE_END'
endif
elseif state ==# 'BEFORE_QUOTE_END'
if ch ==# ']' || ch ==# '}'
let state = 'CELL'
endif
endif
endfor
if state ==# 'NONE'
break
endif
endwhile
return result
endfunction
function! s:col_count(lnum) abort
return len(vimwiki#tbl#get_cells(getline(a:lnum)))
endfunction
function! s:get_indent(lnum, depth) abort
if !s:is_table(getline(a:lnum))
return
endif
let indent = 0
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if !s:is_table(line)
let indent = indent(lnum+1)
break
endif
let lnum -= 1
if a:depth > 0 && lnum < a:lnum - a:depth
break
endif
endwhile
return indent
endfunction
function! s:get_rows(lnum, ...) abort
let rows = []
if !s:is_table(getline(a:lnum))
return rows
endif
let lnum = a:lnum - 1
let depth = a:0 > 0 ? a:1 : 0
let ldepth = 0
while lnum >= 1 && (depth == 0 || ldepth < depth)
let line = getline(lnum)
if s:is_table(line)
call insert(rows, [lnum, line])
else
break
endif
let lnum -= 1
let ldepth += 1
endwhile
let lnum = a:lnum
while lnum <= line('$')
let line = getline(lnum)
if s:is_table(line)
call add(rows, [lnum, line])
else
break
endif
if depth > 0
break
endif
let lnum += 1
endwhile
return rows
endfunction
function! s:get_cell_aligns(lnum, ...) abort
let aligns = {}
let depth = a:0 > 0 ? a:1 : 0
for [lnum, row] in s:get_rows(a:lnum, depth)
if s:is_separator(row)
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
let cell = cells[idx]
if cell =~# '^--\+:'
let aligns[idx] = 'right'
elseif cell =~# '^:--\+:'
let aligns[idx] = 'center'
else
let aligns[idx] = 'left'
endif
endfor
else
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
if !has_key(aligns, idx)
let aligns[idx] = 'left'
endif
endfor
endif
endfor
return aligns
endfunction
function! s:get_cell_aligns_fast(rows) abort
let aligns = {}
let clen = 0
for [lnum, row] in a:rows
if s:is_separator(row)
return s:get_cell_aligns(lnum, 1)
endif
let cells = vimwiki#tbl#get_cells(row, 1)
let clen = len(cells)
for idx in range(clen)
let cell = cells[idx]
if !has_key(aligns, idx)
let cs = matchlist(cell, '^\(\s*\)[^[:space:]].\{-}\(\s*\)$')
if !empty(cs)
let lstart = len(cs[1])
let lend = len(cs[2])
if lstart > 0 && lend > 0
let aligns[idx] = 'center'
elseif lend > 0
let aligns[idx] = 'left'
elseif lstart > 0
let aligns[idx] = 'right'
endif
endif
endif
endfor
endfor
for idx in range(clen)
if !has_key(aligns, idx)
return {}
endif
endfor
return aligns
endfunction
function! s:get_cell_max_lens(lnum, ...) abort
let max_lens = {}
let rows = a:0 > 2 ? a:3 : s:get_rows(a:lnum)
for [lnum, row] in rows
if s:is_separator(row)
continue
endif
let cells = a:0 > 1 ? a:1[lnum - a:2] : vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
let value = cells[idx]
if has_key(max_lens, idx)
let max_lens[idx] = max([s:wide_len(value), max_lens[idx]])
else
let max_lens[idx] = s:wide_len(value)
endif
endfor
endfor
return max_lens
endfunction
function! s:get_aligned_rows(lnum, col1, col2, depth) abort
let rows = []
let aligns = {}
let startlnum = 0
let cells = []
let max_lens = {}
let check_all = 1
if a:depth > 0
let rows = s:get_rows(a:lnum, a:depth)
let startlnum = len(rows) > 0 ? rows[0][0] : 0
let lrows = len(rows)
if lrows == a:depth + 1
let line = rows[-1][1]
if !s:is_separator(line)
let lcells = vimwiki#tbl#get_cells(line)
let lclen = len(lcells)
let lmax_lens = repeat([0], lclen)
let laligns = repeat(['left'], lclen)
let rows[-1][1] = s:fmt_row(lcells, lmax_lens, laligns, 0, 0)
endif
let i = 1
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, i != lrows - 1))
let i += 1
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
" user option not to expand last call
if vimwiki#vars#get_global('table_reduce_last_col')
let last_index = keys(max_lens)[-1]
let max_lens[last_index] = 1
endif
let fst_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows[0:0])
let check_all = max_lens != fst_lens
let aligns = s:get_cell_aligns_fast(rows[0:-2])
let rows[-1][1] = line
endif
endif
if check_all
" all the table must be re-formatted
let rows = s:get_rows(a:lnum)
let startlnum = len(rows) > 0 ? rows[0][0] : 0
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row))
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
" user option not to expand last call
if vimwiki#vars#get_global('table_reduce_last_col')
let last_index = keys(max_lens)[-1]
let max_lens[last_index] = 1
endif
endif
if empty(aligns)
let aligns = s:get_cell_aligns(a:lnum)
endif
let result = []
for [lnum, row] in rows
if s:is_separator(row)
let new_row = s:fmt_sep(max_lens, aligns, a:col1, a:col2)
else
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, aligns, a:col1, a:col2)
endif
call add(result, [lnum, new_row])
endfor
return result
endfunction
function! s:cur_column() abort
" Number of the current column. Starts from 0.
let line = getline('.')
if !s:is_table(line)
return -1
endif
" TODO: do we need conditional: if s:is_separator(line)
let curs_pos = col('.')
let mpos = match(line, s:r_sep(), 0)
let col = -1
while mpos < curs_pos && mpos != -1
let mpos = match(line, s:r_sep(), mpos+1)
if mpos != -1
let col += 1
endif
endwhile
return col
endfunction
function! s:fmt_cell(cell, max_len, align) abort
let cell = ' '.a:cell.' '
let diff = a:max_len - s:wide_len(a:cell)
if diff == 0 && empty(a:cell)
let diff = 1
endif
if a:align ==# 'left'
let cell .= repeat(' ', diff)
elseif a:align ==# 'right'
let cell = repeat(' ',diff).cell
else
let cell = repeat(' ',diff/2).cell.repeat(' ',diff-diff/2)
endif
return cell
endfunction
function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort
let new_line = s:s_sep()
for idx in range(len(a:cells))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let value = a:cells[idx]
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:s_sep()
endfor
let idx = len(a:cells)
while idx < len(a:max_lens)
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:s_sep()
let idx += 1
endwhile
return new_line
endfunction
function! s:fmt_cell_sep(max_len, align) abort
let cell = ''
if a:max_len == 0
let cell .= '-'
else
let cell .= repeat('-', a:max_len)
endif
if a:align ==# 'right'
return cell.'-:'
elseif a:align ==# 'left'
return cell.'--'
else
return ':'.cell.':'
endif
endfunction
function! s:fmt_sep(max_lens, aligns, col1, col2) abort
let new_line = s:s_sep()
for idx in range(len(a:max_lens))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:s_sep()
endfor
return new_line
endfunction
function! s:kbd_create_new_row(cols, goto_first) abort
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'), 2)\<CR>"
let cmd .= "\<ESC>0"
if a:goto_first
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'c', line('.'))\<CR>"
else
let cmd .= (col('.')-1).'l'
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
endif
let cmd .= 'a'
return cmd
endfunction
function! s:kbd_goto_next_row() abort
let cmd = "\<ESC>j"
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a'
return cmd
endfunction
function! s:kbd_goto_prev_row() abort
let cmd = "\<ESC>k"
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a'
return cmd
endfunction
function! vimwiki#tbl#goto_next_col() abort
" Used in s:kbd_goto_next_col
let curcol = virtcol('.')
let lnum = line('.')
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = len(rows) > 0 ? rows[0][0] : 0
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, 1))
endfor
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
for cell_len in values(max_lens)
if newcol >= curcol-1
break
endif
let newcol += cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
endfor
let newcol += 2 " +2 == 1 separator + 1 space |<space
call vimwiki#u#cursor(lnum, newcol)
endfunction
function! s:kbd_goto_next_col(jumpdown) abort
let cmd = "\<ESC>"
if a:jumpdown
let seps = s:count_separators_down(line('.'))
let cmd .= seps.'j0'
endif
let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a"
return cmd
endfunction
function! vimwiki#tbl#goto_prev_col() abort
" Used in s:kbd_goto_prev_col
let curcol = virtcol('.')
let lnum = line('.')
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = len(rows) > 0 ? rows[0][0] : 0
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, 1))
endfor
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
let prev_cell_len = 0
for cell_len in values(max_lens)
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
if newcol + delta > curcol-1
let newcol -= (prev_cell_len + 3) " +3 == 2 spaces + 1 separator |<space>...<space>
break
elseif newcol + delta == curcol-1
break
endif
let prev_cell_len = cell_len
let newcol += delta
endfor
let newcol += 2 " +2 == 1 separator + 1 space |<space
call vimwiki#u#cursor(lnum, newcol)
endfunction
function! s:kbd_goto_prev_col(jumpup) abort
let cmd = "\<ESC>"
if a:jumpup
let seps = s:count_separators_up(line('.'))
let cmd .= seps.'k'
let cmd .= '$'
endif
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
" let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'b', line('.'))\<CR>"
" let cmd .= "a"
return cmd
endfunction
function! vimwiki#tbl#kbd_cr() abort
let lnum = line('.')
if !s:is_table(getline(lnum))
return ''
endif
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
return s:kbd_create_new_row(cols, 0)
else
return s:kbd_goto_next_row()
endif
endfunction
function! vimwiki#tbl#kbd_tab() abort
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<Tab>"
endif
let last = s:is_last_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum))
"vimwiki#u#debug("DEBUG kbd_tab> last=".last.", is_sep=".is_sep)
if (is_sep || last) && !s:is_table(getline(lnum+1))
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
return s:kbd_create_new_row(cols, 1)
endif
return s:kbd_goto_next_col(is_sep || last)
endfunction
function! vimwiki#tbl#kbd_shift_tab() abort
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<S-Tab>"
endif
let first = s:is_first_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum))
"vimwiki#u#debug("kbd_tab> ".first)
if (is_sep || first) && !s:is_table(getline(lnum-1))
return ''
endif
return s:kbd_goto_prev_col(is_sep || first)
endfunction
function! vimwiki#tbl#format(lnum, ...) abort
" Clause in
if !vimwiki#u#ft_is_vw()
return
endif
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
" Backup textwidth
let textwidth = &textwidth
let depth = a:0 == 1 ? a:1 : 0
if a:0 == 2
let col1 = a:1
let col2 = a:2
else
let col1 = 0
let col2 = 0
endif
let indent = s:get_indent(a:lnum, depth)
if &expandtab
let indentstring = repeat(' ', indent)
else
execute "let indentstring = repeat('\<TAB>', indent / &tabstop) . repeat(' ', indent % &tabstop)"
endif
" getting N = depth last rows is enough for having been formatted tables
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2, depth)
let row = indentstring.row
if getline(lnum) != row
call setline(lnum, row)
endif
endfor
" Restore user textwidth
let &textwidth = textwidth
endfunction
function! vimwiki#tbl#create(...) abort
if a:0 > 1
let cols = a:1
let rows = a:2
elseif a:0 == 1
let cols = a:1
let rows = 2
elseif a:0 == 0
let cols = 5
let rows = 2
endif
if cols < 1
let cols = 5
endif
if rows < 1
let rows = 2
endif
let lines = []
let row = s:create_empty_row(cols)
call add(lines, row)
if rows > 1
call add(lines, s:create_row_sep(cols))
endif
for r in range(rows - 1)
call add(lines, row)
endfor
call append(line('.'), lines)
endfunction
function! vimwiki#tbl#align_or_cmd(cmd, ...) abort
if s:is_table(getline('.'))
call call('vimwiki#tbl#format', [line('.')] + a:000)
else
exe 'normal! '.a:cmd
endif
endfunction
function! vimwiki#tbl#move_column_left() abort
" TODO: move_column_left and move_column_right are good candidates to be refactored.
" Clause in
let line = getline('.')
if !s:is_table(line)
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col <= 0
return
endif
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
call cursor(line('.'), 1)
let sep = '\('.s:r_sep().'\).\zs'
let mpos = -1
let col = -1
while col < cur_col-1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
else
break
endif
endwhile
endfunction
function! vimwiki#tbl#move_column_right() abort
" Clause in
let line = getline('.')
if !s:is_table(line)
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col >= s:col_count(line('.'))-1
return
endif
" Format table && Put cursor on first col
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
call cursor(line('.'), 1)
" Change add one to all col
let sep = '\('.s:r_sep().'\).\zs'
let mpos = -1
let col = -1
while col < cur_col+1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
else
break
endif
endwhile
endfunction
function! vimwiki#tbl#get_rows(lnum) abort
return s:get_rows(a:lnum)
endfunction
function! vimwiki#tbl#is_table(line) abort
return s:is_table(a:line)
endfunction
function! vimwiki#tbl#is_separator(line) abort
return s:is_separator(a:line)
endfunction
function! vimwiki#tbl#cell_splitter() abort
return s:cell_splitter()
endfunction
function! vimwiki#tbl#sep_splitter() abort
return s:sep_splitter()
endfunction

View File

@@ -0,0 +1,446 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Utility functions
" Home: https://github.com/vimwiki/vimwiki/
function! vimwiki#u#echo(msg, ...) abort
" Echo: msg
" :param: (1) <string> highlighting group
" :param: (2) <string> echo suffix (ex: 'n', 'm')
" :param: (3) <string> message prefix, default Vimwiki
let hl_group = a:0 > 0 ? a:1 : ''
let echo_suffix = a:0 > 1 ? a:2 : ''
let msg_prefix = a:0 > 2 ? a:3 : 'Vimwiki: '
" Start highlighting
if hl_group !=# ''
exe 'echohl ' . hl_group
endif
" Escape
let msg = substitute(a:msg, "'", "''", 'g')
" Print
exe 'echo'.echo_suffix . " '" . msg_prefix . msg . "'"
" Stop highlighting
if hl_group !=# ''
echohl None
endif
endfunction
function! vimwiki#u#debug(msg) abort
" Debug: msg
" let b:vimwiki_debug to trigger
if !exists('b:vimwiki_debug') || b:vimwiki_debug == 0
return
endif
echomsg 'DEBUG: ' . a:msg
endfunction
function! vimwiki#u#warn(msg) abort
" Warn: msg
call vimwiki#u#echo('Warning: ' . a:msg, 'WarningMsg', '')
endfunction
function! vimwiki#u#error(msg) abort
" Error: msg
call vimwiki#u#echo('Error: ' . a:msg, 'Error', 'msg')
endfunction
function! vimwiki#u#deprecate(old, new) abort
" Warn: deprecated feature: old -> new
call vimwiki#u#warn('Deprecated: ' . a:old . ' is deprecated and '
\ . 'will be removed in future versions. Use ' . a:new . ' instead.')
endfunction
function! vimwiki#u#get_selection(...) abort
" Get visual selection text content, optionaly replace its content
" :param: Text to replace selection
" Copyed from DarkWiiPlayer at stackoverflow
" https://stackoverflow.com/a/47051271/2544873
" Get selection extremity position,
" Discriminate selection mode
if mode() ==? 'v'
let [line_start, column_start] = getpos('v')[1:2]
let [line_end, column_end] = getpos('.')[1:2]
else
let [line_start, column_start] = getpos("'<")[1:2]
let [line_end, column_end] = getpos("'>")[1:2]
end
" Guard
if (line2byte(line_start)+column_start) > (line2byte(line_end)+column_end)
let [line_start, column_start, line_end, column_end] =
\ [line_end, column_end, line_start, column_start]
end
let lines = getline(line_start, line_end)
if len(lines) == 0
return ''
endif
" If want to modify selection
if a:0 > 0
" Grab new content
let line_link = a:1
" Grab the content of line around the link: pre and post
let start_link = max([column_start - 2, 0])
let line_pre = ''
if start_link > 0
let line_pre .= lines[0][ : start_link]
endif
let line_post = lines[0][column_end - (&selection ==# 'inclusive' ? 0 : 1) : ]
" Set the only single selected line
call setline(line_start, line_pre . line_link . line_post)
endif
" Get selection extremity position, take into account selection option
let lines[-1] = lines[-1][: column_end - (&selection ==# 'inclusive' ? 1 : 2)]
let lines[0] = lines[0][column_start - 1:]
return join(lines, "\n")
endfunction
function! vimwiki#u#count_exe(cmd) abort
" Execute: string v:count times
" Called: prefixable mapping
for i in range( max([1, v:count]) )
exe a:cmd
endfor
endfunction
function! vimwiki#u#sort_len(list) abort
function! s:len_compare(s1, s2) abort
let i1 = len(a:s1)
let i2 = len(a:s2)
return i1 == i2 ? 0 : i1 > i2 ? 1 : -1
endfunction
return sort(a:list, 's:len_compare')
endfunction
function! vimwiki#u#trim(string, ...) abort
" Trim spaces: leading and trailing
" :param: string in
" :param: (1) <string> optional list of character to trim
let chars = ''
if a:0 > 0
let chars = a:1
endif
let res = substitute(a:string, '^[[:space:]'.chars.']\+', '', '')
let res = substitute(res, '[[:space:]'.chars.']\+$', '', '')
return res
endfunction
function! vimwiki#u#cursor(lnum, cnum) abort
" Builtin cursor doesn't work right with unicode characters.
exe a:lnum
exe 'normal! 0'.a:cnum.'|'
endfunction
function! vimwiki#u#os_name() abort
" Returns: OS name, human readable
if vimwiki#u#is_windows()
return 'Windows'
elseif vimwiki#u#is_macos()
return 'Mac'
else
return 'Linux'
endif
endfunction
function! vimwiki#u#is_windows() abort
" Check if OS is windows
return has('win32') || has('win64') || has('win95') || has('win16')
endfunction
function! vimwiki#u#is_macos() abort
" Check if OS is mac
if has('mac') || has('macunix') || has('gui_mac')
return 1
endif
" that still doesn't mean we are not on Mac OS
let os = substitute(system('uname'), '\n', '', '')
return os ==? 'Darwin' || os ==? 'Mac'
endfunction
function! vimwiki#u#count_first_sym(line) abort
let first_sym = matchstr(a:line, '\S')
return len(matchstr(a:line, first_sym.'\+'))
endfunction
function! vimwiki#u#escape(string) abort
" Escape string for literal magic regex match
return escape(a:string, '~.*[]\^$')
endfunction
function! vimwiki#u#reload_regexes() abort
" Load concrete Wiki syntax: sets regexes and templates for headers and links
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
endfunction
function! vimwiki#u#reload_regexes_custom() abort
" Load syntax-specific functionality
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
endfunction
function! vimwiki#u#sw() abort
" Backward compatible version of the built-in function shiftwidth()
if exists('*shiftwidth')
return shiftwidth()
else
return &shiftwidth
endif
endfunc
function! vimwiki#u#map_key(mode, key, plug, ...) abort
" a:mode single character indicating the mode as defined by :h maparg
" a:key the key sequence to map
" a:plug the plug command the key sequence should be mapped to
" a:1 optional argument with the following functionality:
" if a:1==1 then the hasmapto(<Plug>) check is skipped.
" this can be used to map different keys to the same <Plug> definition
" if a:1==2 then the mapping is not <buffer> specific i.e. it is global
if a:0 && a:1 == 2
" global mappings
if !hasmapto(a:plug, a:mode) && maparg(a:key, a:mode) ==# ''
exe a:mode . 'map ' . a:key . ' ' . a:plug
endif
elseif a:0 && a:1 == 1
" vimwiki buffer mappings, repeat mapping to the same <Plug> definition
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
else
" vimwiki buffer mappings
if !hasmapto(a:plug, a:mode)
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
endif
endif
endfunction
function! vimwiki#u#is_codeblock(lnum) abort
" Returns: 1 if line is a code block or math block
"
" The last two conditions are needed for this to correctly
" detect nested syntaxes within code blocks
let syn_g = synIDattr(synID(a:lnum,1,1),'name')
if syn_g =~# 'Vimwiki\(Pre.*\|IndentedCodeBlock\|Math.*\)'
\ || (syn_g !~# 'Vimwiki.*' && syn_g !=? '')
return 1
else
return 0
endif
endfunction
function! vimwiki#u#ft_set() abort
" Sets the filetype to vimwiki
" If g:vimwiki_filetypes variable is set
" the filetype will be vimwiki.<ft1>.<ft2> etc.
let ftypelist = vimwiki#vars#get_global('filetypes')
let ftype = 'vimwiki'
for ftypeadd in ftypelist
let ftype = ftype . '.' . ftypeadd
endfor
let &filetype = ftype
endfunction
function! vimwiki#u#ft_is_vw() abort
" Returns: 1 if filetype is vimwiki, 0 else
" If multiple fileytpes are in use 1 is returned only if the
" first ft is vimwiki which should always be the case unless
" the user manually changes it to something else
" Clause: is filetype defined
if &filetype ==# '' | return 0 | endif
if split(&filetype, '\.')[0] ==? 'vimwiki'
return 1
else
return 0
endif
endfunction
function! vimwiki#u#get_syntax_dic(...) abort
" Helper: Getter
" :param: syntax <string> to retrive, default to current
let syntax = a:0 ? a:1 : vimwiki#vars#get_wikilocal('syntax')
return g:vimwiki_syntaxlocal_vars[syntax]
endfunction
function! vimwiki#u#get_punctuation_regex() abort
" Helper: to mutualize
" Called: normalize and unnormalize anchor
" From: https://gist.github.com/asabaylus/3071099#gistcomment-2563127
" Faster
" Unused now
if v:version <= 703
" Retrocompatibility: Get invalid range for vim 7.03
return '[^0-9a-zA-Z_ \-]'
else
return '[^0-9a-zA-Z\u4e00-\u9fff_ \-]'
endif
endfunction
function! vimwiki#u#get_punctuation_string() abort
" Faster
" See: https://github.github.com/gfm/#ascii-punctuation-character
return '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
endfunction
function! vimwiki#u#hi_expand_regex(lst) abort
" Helper: Expand regex from reduced typeface delimiters
" :param: list<list,delimiters>> with reduced regex
" Return: list with extended regex delimiters (not inside a word)
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
" See: https://github.github.com/gfm/#left-flanking-delimiter-run
let res = []
let p = vimwiki#u#get_punctuation_string()
for delimiters in a:lst
let r_prefix = '\(^\|[[:space:]]\@<=\)'
" Regex Start: not preceded by backslash, not ended by space
let r_start = r_prefix . delimiters[0] . '\S\@='
" Regex End: not preceded by backslash or space, ended by punctuation or space
let r_prefix = '\(^\|[^[:space:]\\]\@<=\)'
let r_end = r_prefix . delimiters[1] . '\%(\_[[:space:]' . p . ']\)\@='
call add(res, [r_start, r_end])
endfor
return res
endfunction
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
" Helper: Create highlight region between two tags
" :param: tag <string> example '<b>'
" :param: syntax_group <string> example: VimwikiBold
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
" :param: (1) <boolean> is contained
" :param: (2) <string> more param ex:oneline
" Discriminate parameters
let opt_is_contained = a:0 > 0 && a:1 > 0 ? 'contained ' : ''
let opt_more = a:0 > 1 ? ' ' . a:2 : ''
let opt_contains = ''
if a:contains !=# ''
let opt_contains = 'contains=' . a:contains . ' '
endif
" Craft command
let cmd = 'syn region ' . a:syntax_group . ' matchgroup=VimwikiDelimiter ' .
\ opt_is_contained .
\ 'skip="\\' . a:tag_pre . '" ' .
\ 'start="' . a:tag_pre . '" ' .
\ 'end="' . a:tag_post . '" ' .
\ 'keepend ' .
\ opt_contains .
\ b:vimwiki_syntax_concealends .
\ opt_more
exe cmd
endfunction
function! vimwiki#u#hi_typeface(dic) abort
" Highight typeface: see $VIMRUNTIME/syntax/html.vim
" -- Basically allow nesting with multiple definition contained
" :param: dic <dic:list:list> must contain: bold, italic and underline, even if underline is often void,
" -- see here for underline not defined: https://stackoverflow.com/questions/3003476
" Italic must go before, otherwise single * takes precedence over ** and ** is considered as
" -- a void italic.
" Note:
" The last syntax defined take precedence so that user can change at runtime (:h :syn-define)
" Some cases are contained by default:
" -- ex: VimwikiCodeBoldUnderline is not defined in colorschemes -> VimwikiCode
" -- see: #709 asking for concealing quotes in bold, so it must be higlighted differently
" -- -- for the user to understand what is concealed around
" VimwikiCheckBoxDone and VimwikiDelText are as their are even when nested in bold or italic
" -- This is because it would add a lot of code (as n**2) at startup and is not often used
" -- Here n=3 (bold, italic, underline)
" Bold > Italic > Underline
let nested = vimwiki#u#get_syntax_dic().nested
" Italic
for i in a:dic['italic']
" -- Italic 1
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiItalic ', nested .',VimwikiItalicBold,VimwikiItalicUnderline')
" -- Bold 2
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline', 1)
" -- Bold 3
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiBoldUnderlineItalic', nested, 2)
" -- Underline 2
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiUnderlineItalic', nested . ',VimwikiUnderlineItalicBold', 1)
" -- Underline 3
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiUnderlineBoldItalic', nested, 2)
endfor
" Bold
for b in a:dic['bold']
" -- Bold 1
call vimwiki#u#hi_tag(b[0],b[1], 'VimwikiBold', nested . ',VimwikiBoldUnderline,VimwikiBoldItalic')
" -- Italic 2
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiItalicBold', nested . ',VimwikiItalicBoldUnderline', 1)
" -- Italic 3
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiItalicUnderlineBold', nested, 2)
" -- Underline 2
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineBold', nested . ',VimwikiUnderlineBoldItalic', 1)
" -- Underline 3
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2)
endfor
" Bold Italic
if has_key(a:dic, 'bold_italic')
for bi in a:dic['bold_italic']
call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline')
endfor
endif
" Underline
for u in a:dic['underline']
" -- Underline 1
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiUnderline', nested . ',VimwikiUnderlineBold,VimwikiUnderlineItalic')
" -- Italic 2
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiItalicUnderline', nested . ',VimwikiItalicUnderlineBold', 1)
" -- Italic 3
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiBoldItalicUnderline', nested, 2)
" -- Underline 2
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiBoldUnderline', nested . ',VimwikiBoldUnderlineItalic', 1)
" -- Underline 3
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiItalicBoldUnderline', nested, 2)
endfor
" Strikethrough
" Note: VimwikiBoldDelText Not Implemented (see above)
for u in a:dic['del']
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiDelText', nested)
endfor
"" Code do not contain anything but can be contained very nested
for u in a:dic['code']
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiCode', '')
endfor
" Superscript
for u in a:dic['sup']
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiSuperScript', nested, 0, 'oneline')
endfor
" Subscript
for u in a:dic['sub']
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiSubScript', nested, 0, 'oneline')
endfor
" Prevent var_with_underscore to trigger italic text
" -- See $VIMRUNTIME/syntax/markdown.vim
syn match VimwikiError "\w\@<=[_*]\w\@="
endfunction

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,254 @@
# Design Notes
This file is meant to document design decisions and algorithms inside Vimwiki
which are too large for code comments, and not necessarily interesting to
users. Please create a new section to document each behavior.
## Formatting tables
In Vimwiki, formatting tables occurs dynamically, when navigating between cells
and adding new rows in a table in the Insert mode, or statically, when pressing
`gqq` or `gqw` (which are mappings for commands `VimwikiTableAlignQ` and
`VimwikiTableAlignW` respectively) in the Normal mode. It also triggers when
leaving Insert mode, provided variable `g:vimwiki_table_auto_fmt` is set. In
this section, the original and the newer optimized algorithms of table
formatting will be described and compared.
### The older table formatting algorithm and why this is not optimal
Let's consider a simple example. Open a new file, say _tmp.wiki_, and create a
new table with command `VimwikiTable`. This should create a blank table.
```
| | | | | |
|---|---|---|---|---|
| | | | | |
```
Let's put the cursor in the first header column of the table, enter the Insert
mode and type a name, say _Col1_. Then press _Tab_: the cursor will move to the
second column of the header and the table will get aligned (in the context of
the table formatting story, words _aligned_ and _formatted_ are considered as
synonyms). Now the table looks as in the following snippet.
```
| Col1 | | | | |
|------|---|---|---|---|
| | | | | |
```
Then, when moving cursor to the first data row (i.e. to the third line of the
table below the separator line) and typing anything here and there while
navigating using _Tab_ or _Enter_ (pressing this creates a new row below the
current row), the table shall keep formatting. Below is a result of such a
random edit.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| | | | | New data |
```
The lowest row gets aligned when leaving the Insert mode. Let's copy _Data1_
(using `viwy` or another keystroke) and paste it (using `p`) in the second data
row of the first column. Now the table looks mis-aligned (as we did not enter
the Insert mode).
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
```
This is not a big problem though, because we can put the cursor at _any_ place
in the table and press `gqq`: the table will get aligned.
```
| Col1 | | | | |
|-------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
```
Now let's make real problems! Move the cursor to the lowest row and copy it
with `yy`. Then 500-fold paste it with `500p`. Now the table very long. Move
the cursor to the lowest row (by pressing `G`), enter the Insert mode, and try
a new random editing session by typing anything in cells with _Tab_ and _Enter_
navigation interleaves. The editing got painfully slow, did not?
The reason of the slowing down is the older table formatting algorithm. Every
time _Tab_ or _Enter_ get pressed down, all rows in the table get visited to
calculate a new alignment. Moreover, by design it may happen even more than
once per one press!
```vim
function! s:kbd_create_new_row(cols, goto_first)
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
let cmd .= "\<ESC>0"
if a:goto_first
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
else
let cmd .= (col('.')-1)."l"
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
endif
let cmd .= "a"
return cmd
endfunction
```
Function `s:kbd_create_new_row()` is called when _Tab_ or _Enter_ get pressed.
Formatting of the whole table happens in function `vimwiki#tbl#format()`. But
remember that leaving the Insert mode triggers re-formatting of a table when
variable `g:vimwiki_table_auto_fmt` is set. This means that formatting of the
whole table is called on all those multiple interleaves between the Insert and
the Normal mode in `s:kbd_create_new_row` (notice `\<ESC>`, `o`, etc.).
### The newer table formatting algorithm
The newer algorithm was introduced to struggle against performance issues when
formatting large tables.
Let's take the table from the previous example in an intermediate state.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
```
Then move the cursor to the first data row, copy it with `yy`, go down to the
mis-aligned line, and press `5p`. Now we have a slightly bigger mis-aligned
table.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
```
Go down to the lowest, the 7th, data row and press `gq1`. Nothing happened.
Let's go to the second or the third data row and press `gq1` once again. Now
the table gets aligned. Let's undo formatting with `u`, go to the fourth row,
and press `gq1`. Now the table should look like in the following snippet.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
```
What a peculiar command! Does using it make any sense? Not much, honestly.
Except it shows how the newer optimized table formatting algorithm works in the
Insert mode.
Indeed, the newer table formatting algorithm introduces a _viewport_ on a table.
Now, when pressing _Tab_ or _Enter_ in the Insert mode, only a small part of
rows are checked for possible formatting: two rows above the current line and
the current line itself (the latter gets preliminary shrunk with function
`s:fmt_row()`). If all three lines in the viewport are of the same length, then
nothing happens (case 1 in the example). If the second or the shrunk current
line is longer then the topmost line in the viewport, then the algorithm falls
back to the older formatting algorithm and the whole table gets aligned
(case 2). If the topmost line in the viewport is longer than the second
and the shrunk current line, then the two lowest lines get aligned according to
the topmost line (case 3).
Performance of the newer formatting algorithm should not depend on the height
of the table. The newer algorithm should also be consistent with respect to
user editing experience. Indeed, as soon as a table should normally be edited
row by row from the top to the bottom, dynamic formatting should be both fast
(watching only three rows in a table, re-formatting only when the shrunk
current row gets longer than any of the two rows above) and eager (a table
should look formatted on every press on _Tab_ and _Enter_). However, the newer
algorithm differs from the older algorithm when starting editing a mis-aligned
table in an area where mis-aligned rows do not get into the viewport: in this
case the newer algorithm will format the table partly (in the rows of the
viewport) until one of the being edited cells grows in length to a value big
enough to trigger the older algorithm and the whole table gets aligned. When
partial formatting is not desirable, the whole table can be formatted by
pressing `gqq` in the Normal mode.
## Scoped Variable
Vimwiki's variables have a scope. They can be:
1. Global [ex: `global_ext`]
2. Wikilocal (1, 2, 3 ...) [ex: `path`]
3. Syntaxlocal (default, markdown, media) [ex: `bullet_types`]
4. Bufferlocal [ex: `b:vimwiki_wiki_nr`]
They all can be configured, changed by user
As a comparison, Vim's variables also have a scope (`:h variable-scope`) and
can also be configured by users.
While features kept stacking, it became more and more difficult to maintain the
coherence and configurability between these variables: a type of markers, say
`bullet_types`, can affect folding, highlighting, keystrokes mapping, indentation.
All of those aspects often requires internal variables that should be calculated
only once's when user is changing the variable and affect only the scope in which
they are defined: a `markdown` syntax configuration should affect all `markdown`
wikis but not `default` ones. So it was decided (#894) to keep a 3 global
dictionaries to hold internal variables (there is only one bufferlocal variable
so a dictionary was clearly overkill) and 3 other dictionaries for user
configuration. The internal dictionaries get updated at startup (`:h extend`)
with the user content but do not modify it. They can also be updated later with
`VimwikiVar` function.
Here, `key` is the variable name, `2` the wiki number and `markdown` the syntax
```vim
" External -> Internal
g:vimwiki_{key} -> g:vimwiki_global_vars[key]
g:vimwiki_syntax_list['markdown'][key]
-> g:vimwiki_syntaxlocal_vars['markdown'][key]
g:vimwiki_list[2][key] -> g:vimwiki_wikilocal_vars[2][key]
```
All are defined in `vars.vim` and in case of a conflict while executing it, the
innermost scope if privileged (as usual for variable scoping conflicts). The
reasons for such a complex system is:
1. The diversity of variables and developers
2. The nature of new (2020) issues asking for some deep customisation (ex: of
the link format) or high functionality (ex: on demand wiki creation and
configuration)
3. Historical excuses that Vimwiki was not designed to be highly configurable at
beginning and many temporary internal variables where created to "fix some
holes"
## Syntax and Highlight
* [Vimwiki syntax specification](./specification.wiki)
* [Syntax region](../syntax/vimwiki.vim)
* [Nesting manager]( ../autoload/vimwiki/u.vim): vimwiki#u#hi_typeface(dic)
TODO currently the typeface delimiters are customized that way:
```vim
" Typeface: -> u.vim
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
call vimwiki#u#hi_typeface(s:typeface_dic)
```
<!-- vim: set tw=80: -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

View File

@@ -0,0 +1,10 @@
<svg width="200" height="43" viewBox="0 0 372 80" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M45.592 20.804C48.4347 22.4987 49.856 24.3027 49.856 26.216C49.856 27.3093 49.3093 28.8127 48.216 30.726L31.242 59.836C30.6953 60.7653 29.8207 61.6127 28.618 62.378C27.4153 63.0887 26.2127 63.444 25.01 63.444C23.862 63.444 22.7413 63.1707 21.648 62.624C20.6093 62.0227 19.8713 61.4213 19.434 60.82L18.696 59.918L1.64 30.726C0.546667 28.922 0 27.446 0 26.298C0 24.33 1.42133 22.4987 4.264 20.804C6.34133 19.6013 7.98133 19 9.184 19C10.3867 19 11.316 19.3827 11.972 20.148C12.6827 20.8587 13.4207 21.952 14.186 23.428L24.928 44.092L35.67 23.428C36.2713 22.3893 36.7087 21.6513 36.982 21.214C37.31 20.722 37.802 20.2573 38.458 19.82C39.114 19.328 39.9887 19.082 41.082 19.082C42.1753 19.082 43.6787 19.656 45.592 20.804Z" fill="#000"/>
<path d="M54.341 27.036C54.341 25.7787 54.3683 24.8493 54.423 24.248C54.5323 23.592 54.7783 22.854 55.161 22.034C55.9263 20.6127 58.0583 19.902 61.557 19.902C64.181 19.902 66.0397 20.3667 67.133 21.296C68.0623 22.0613 68.5544 23.2367 68.609 24.822C68.6637 25.3687 68.691 26.1613 68.691 27.2V55.9C68.691 57.1573 68.6363 58.114 68.527 58.77C68.4724 59.3713 68.2263 60.082 67.789 60.902C67.0784 62.3233 64.9737 63.034 61.475 63.034C58.031 63.034 55.9263 62.296 55.161 60.82C54.7783 60 54.5323 59.2893 54.423 58.688C54.3683 58.0867 54.341 57.13 54.341 55.818V27.036Z" fill="#000"/>
<path d="M89.3454 25.56C91.9147 21.6787 95.0034 19.738 98.6114 19.738C104.187 19.738 108.342 22.116 111.075 26.872C111.677 26.052 112.387 25.2047 113.207 24.33C114.082 23.4007 115.449 22.4167 117.307 21.378C119.166 20.2847 121.079 19.738 123.047 19.738C127.421 19.738 131.083 21.4327 134.035 24.822C136.987 28.1567 138.463 33.7053 138.463 41.468V55.818C138.463 57.0753 138.409 58.032 138.299 58.688C138.245 59.2893 137.999 60 137.561 60.82C136.851 62.296 134.746 63.034 131.247 63.034C127.803 63.034 125.699 62.2687 124.933 60.738C124.551 59.918 124.305 59.2073 124.195 58.606C124.141 57.95 124.113 56.9933 124.113 55.736V41.386C124.113 36.63 122.419 34.252 119.029 34.252C117.116 34.252 115.804 34.8807 115.093 36.138C114.437 37.3953 114.109 39.172 114.109 41.468V55.818C114.109 57.13 114.055 58.0867 113.945 58.688C113.891 59.2893 113.645 60 113.207 60.82C112.442 62.296 110.31 63.034 106.811 63.034C103.367 63.034 101.263 62.2687 100.497 60.738C100.115 59.918 99.8687 59.2073 99.7594 58.606C99.7047 57.95 99.6774 56.9933 99.6774 55.736V41.386C99.6774 36.63 97.9827 34.252 94.5934 34.252C91.3134 34.252 89.6734 36.63 89.6734 41.386V55.9C89.6734 57.1573 89.6187 58.114 89.5094 58.77C89.4547 59.3713 89.2087 60.082 88.7714 60.902C87.9514 62.3233 85.8194 63.034 82.3754 63.034C78.9314 63.034 76.8267 62.296 76.0614 60.82C75.6787 60 75.4327 59.2893 75.3234 58.688C75.2687 58.0867 75.2414 57.13 75.2414 55.818V26.954C75.2414 25.6967 75.2687 24.7673 75.3234 24.166C75.4327 23.51 75.7061 22.7993 76.1434 22.034C76.9634 20.558 78.9041 19.82 81.9654 19.82C85.0267 19.82 87.0221 20.312 87.9514 21.296C88.8807 22.28 89.3454 23.7013 89.3454 25.56Z" fill="#000"/>
<path d="M219.3 71.3359C216.999 70.2839 215.158 68.7386 213.777 66.7002C212.462 64.6618 211.147 62.3932 209.832 59.8945C209.634 59.5 209.437 59.1055 209.24 58.7109C209.042 58.3164 208.845 57.9548 208.648 57.626L207.267 55.0615L206.478 53.4834L205.294 54.5684L203.519 56.1465L202.533 57.1328C200.823 58.7109 199.081 60.2891 197.305 61.8672C195.596 63.3796 193.754 64.7604 191.782 66.0098C189.875 67.1934 187.836 68.1797 185.667 68.9688C183.562 69.6921 181.261 70.0866 178.762 70.1523L176.592 69.0674C175.343 68.4098 174.291 67.818 173.436 67.292C172.581 66.7659 171.595 65.944 170.477 64.8262C170.148 64.2344 169.852 63.6755 169.589 63.1494C169.392 62.6234 169.162 62.0973 168.899 61.5713C168.176 60.2562 167.584 59.0726 167.124 58.0205C166.663 56.9684 166.203 55.7848 165.743 54.4697C165.94 53.5492 166.236 52.0039 166.63 49.834C167.025 47.5983 167.485 45.1654 168.011 42.5352C168.603 39.9049 169.195 37.2747 169.787 34.6445C170.444 31.9486 171.102 29.6143 171.759 27.6416C172.351 25.932 173.009 24.1237 173.732 22.2168C174.521 20.3099 175.343 18.5674 176.198 16.9893C177.118 15.3454 178.105 13.9645 179.157 12.8467C180.209 11.6631 181.327 10.9727 182.51 10.7754C182.839 11.2357 183.201 11.5645 183.595 11.7617C183.99 11.959 184.351 12.1234 184.68 12.2549C185.601 13.57 186.488 14.6878 187.343 15.6084C188.264 16.529 189.316 17.4495 190.5 18.3701C190.171 20.014 189.678 21.8551 189.02 23.8936C188.428 25.8662 187.771 27.8717 187.047 29.9102C186.39 31.8828 185.732 33.8226 185.075 35.7295C184.417 37.6364 183.891 39.2803 183.497 40.6611C183.102 41.779 182.773 43.0283 182.51 44.4092C181.918 46.8421 181.36 50.1628 180.833 54.3711C181.623 54.1738 182.477 53.7464 183.398 53.0889C184.319 52.4313 185.206 51.7409 186.061 51.0176C187.047 50.2285 188.034 49.3408 189.02 48.3545C190.269 47.1051 191.321 45.9544 192.176 44.9023C193.031 43.8503 193.82 42.7653 194.543 41.6475C195.333 40.5296 196.122 39.3132 196.911 37.998C197.7 36.6172 198.653 35.0062 199.771 33.165C200.757 31.5869 201.777 29.9102 202.829 28.1348C203.946 26.2936 205.031 24.5511 206.083 22.9072C207.201 21.1976 208.286 19.6523 209.338 18.2715C210.39 16.8906 211.344 15.8057 212.199 15.0166C212.725 15.6742 213.382 16.2988 214.171 16.8906C215.026 17.4824 215.914 17.9427 216.834 18.2715C217.229 18.8633 217.591 19.4222 217.919 19.9482C218.314 20.4085 218.676 20.8359 219.004 21.2305C219.399 21.8223 219.761 22.3812 220.089 22.9072C220.484 23.4333 220.846 23.9593 221.174 24.4854C221.109 24.9456 221.01 25.5374 220.878 26.2607C220.747 26.984 220.583 27.7731 220.385 28.6279C220.254 29.4827 220.089 30.3704 219.892 31.291C219.695 32.1458 219.498 32.9678 219.3 33.7568C218.774 36.2555 218.38 38.1296 218.117 39.3789C217.854 40.6283 217.656 41.6146 217.525 42.3379C217.459 43.0612 217.393 43.6859 217.328 44.2119C217.328 44.6722 217.328 45.3298 217.328 46.1846C217.262 46.8421 217.295 47.4997 217.426 48.1572C217.492 48.749 217.624 49.3737 217.821 50.0312C218.018 50.6888 218.281 51.2806 218.61 51.8066L222.555 48.749C223.673 47.8942 224.725 46.7435 225.711 45.2969C226.764 43.7845 227.75 42.0749 228.67 40.168C229.657 38.1953 230.61 36.0583 231.531 33.7568C232.451 31.4554 233.372 29.1211 234.292 26.7539C235.673 23.2689 237.054 19.8825 238.435 16.5947C239.882 13.307 241.263 10.7754 242.578 9C244.024 9.92057 245.274 10.874 246.326 11.8604C247.444 12.7809 248.397 13.8001 249.186 14.918C249.975 16.0358 250.6 17.318 251.06 18.7646C251.586 20.2113 251.948 21.9209 252.145 23.8936C250.961 26.195 249.811 28.5622 248.693 30.9951C247.641 33.4281 246.622 35.861 245.635 38.2939C244.32 41.4502 242.939 44.6064 241.493 47.7627C240.112 50.9189 238.567 53.9437 236.857 56.8369C235.147 59.6644 233.24 62.2946 231.136 64.7275C229.032 67.0947 226.599 69.1003 223.837 70.7441C223.114 70.5469 222.489 70.4482 221.963 70.4482C220.911 70.4482 220.024 70.7441 219.3 71.3359Z" fill="#bbb"/>
<path d="M268.025 63.1494C268.354 65.1221 268.222 66.6673 267.63 67.7852C267.104 68.903 266.315 69.7249 265.263 70.251C264.277 70.8428 263.126 71.1716 261.811 71.2373C260.496 71.3031 259.247 71.2373 258.063 71.04C257.405 70.1195 256.814 68.9688 256.288 67.5879C255.762 66.207 255.268 64.7933 254.808 63.3467C254.348 61.8343 253.92 60.3548 253.526 58.9082C253.197 57.4616 252.901 56.1794 252.638 55.0615C252.967 54.2725 253.164 53.3848 253.23 52.3984C253.361 51.3464 253.427 50.2943 253.427 49.2422C253.493 48.1901 253.526 47.138 253.526 46.0859C253.592 44.9681 253.69 43.916 253.822 42.9297C254.282 40.168 254.94 37.5378 255.794 35.0391C256.715 32.5404 257.438 29.943 257.964 27.2471C258.096 26.6553 258.03 26.0964 257.767 25.5703C257.57 25.0443 257.537 24.5511 257.668 24.0908C257.734 23.8278 257.931 23.6634 258.26 23.5977C258.589 23.4661 258.786 23.236 258.852 22.9072C259.049 22.1839 259.082 21.5921 258.951 21.1318C258.885 20.6715 259.016 20.1126 259.345 19.4551C259.674 18.929 260.069 18.1729 260.529 17.1865C261.055 16.1344 261.252 15.0495 261.121 13.9316C261.712 13.5371 262.271 13.0768 262.797 12.5508C263.323 12.0247 263.849 11.5645 264.375 11.1699C264.967 10.7096 265.592 10.3151 266.25 9.98633C266.973 9.65755 267.828 9.49316 268.814 9.49316C269.34 10.1507 269.669 10.874 269.8 11.6631C269.998 12.4521 270.162 13.2412 270.293 14.0303C270.491 14.8193 270.754 15.5755 271.083 16.2988C271.411 16.9564 271.97 17.4824 272.759 17.877C272.759 18.403 272.759 19.0605 272.759 19.8496C272.759 20.6387 272.792 21.4277 272.858 22.2168C272.924 22.9401 273.055 23.6305 273.252 24.2881C273.515 24.8799 273.91 25.2744 274.436 25.4717C273.252 28.6279 272.135 31.7513 271.083 34.8418C270.096 37.9323 269.274 41.0557 268.617 44.2119C267.959 47.3024 267.532 50.4258 267.334 53.582C267.203 56.7383 267.433 59.9274 268.025 63.1494Z" fill="#bbb"/>
<path d="M338.942 66.5029C335.786 66.6344 332.991 66.5687 330.558 66.3057C328.191 66.0426 325.857 65.418 323.555 64.4316C323.424 64.3659 323.292 64.2015 323.161 63.9385C323.029 63.6755 322.898 63.4782 322.766 63.3467C322.372 63.1494 321.878 63.0837 321.287 63.1494C320.761 63.1494 320.3 63.0837 319.906 62.9521C319.38 62.6891 318.558 62.196 317.44 61.4727C316.322 60.6836 315.303 59.9603 314.382 59.3027C313.199 58.3822 312.081 57.4616 311.029 56.541C309.977 55.6204 309.056 54.6341 308.267 53.582C308.07 53.319 307.807 53.1875 307.478 53.1875C307.149 53.1217 306.853 53.0231 306.59 52.8916C304.683 54.0752 303.072 55.5547 301.757 57.3301C300.442 59.1055 299.193 60.9137 298.009 62.7549C296.826 64.596 295.576 66.3385 294.261 67.9824C292.946 69.6263 291.269 70.8757 289.231 71.7305C288.639 71.7305 288.113 71.6318 287.653 71.4346C287.193 71.2373 286.765 70.9743 286.371 70.6455C285.976 70.3825 285.582 70.1195 285.187 69.8564C284.792 69.5934 284.365 69.3962 283.905 69.2646C283.905 68.4756 283.74 67.7523 283.412 67.0947C283.149 66.4372 282.853 65.8125 282.524 65.2207C282.261 64.6289 282.064 64.07 281.932 63.5439C281.801 62.9521 281.932 62.3932 282.327 61.8672C281.932 61.4727 281.34 61.0452 280.551 60.585C280.946 60.1904 281.11 59.8288 281.044 59.5C281.044 59.1712 280.979 58.8424 280.847 58.5137C280.716 58.1849 280.584 57.8232 280.453 57.4287C280.387 57.0342 280.486 56.6396 280.749 56.2451C281.077 56.2451 281.472 56.1794 281.932 56.0479C281.538 55.5218 281.34 55.2259 281.34 55.1602C281.406 55.0286 281.34 54.8643 281.143 54.667C281.012 54.2725 281.077 54.0423 281.34 53.9766C281.603 53.8451 281.866 53.7135 282.129 53.582C282.392 50.36 282.951 47.3682 283.806 44.6064C284.661 41.8447 285.614 39.1816 286.667 36.6172C287.719 34.0527 288.738 31.4554 289.724 28.8252C290.776 26.195 291.631 23.3675 292.289 20.3428C293.012 19.6195 293.571 18.7646 293.965 17.7783C294.426 16.792 294.886 15.8057 295.346 14.8193C295.872 13.833 296.431 12.8796 297.023 11.959C297.68 10.9727 298.568 10.1836 299.686 9.5918C300.607 9.65755 301.429 9.92057 302.152 10.3809C302.875 10.7754 303.763 10.9398 304.815 10.874C305.012 11.2028 305.177 11.5316 305.308 11.8604C305.505 12.1891 305.736 12.5179 305.999 12.8467L307.478 12.5508C308.201 13.1426 308.826 13.8988 309.352 14.8193C309.944 15.6742 310.338 16.5947 310.536 17.5811C310.733 18.5674 310.7 19.5208 310.437 20.4414C310.174 21.2962 309.549 21.9867 308.563 22.5127C308.629 22.8415 308.629 23.1045 308.563 23.3018C308.563 23.4333 308.53 23.5648 308.464 23.6963C308.399 23.8278 308.366 23.9593 308.366 24.0908C308.366 24.2223 308.464 24.4196 308.662 24.6826C307.347 25.6689 306.36 27.0498 305.703 28.8252C305.045 30.6006 304.683 32.1787 304.618 33.5596C305.407 32.7705 306.262 32.0143 307.182 31.291C308.168 30.502 309.155 29.7458 310.141 29.0225C311.193 28.2992 312.18 27.6087 313.1 26.9512C314.086 26.2936 314.974 25.6361 315.763 24.9785C317.933 23.0059 320.004 21.4277 321.977 20.2441C324.015 18.9948 326.153 17.6139 328.388 16.1016C328.914 15.9701 329.309 15.9701 329.572 16.1016C329.901 16.1673 330.229 16.266 330.558 16.3975C330.558 16.0029 330.427 15.7728 330.164 15.707C329.966 15.6413 329.901 15.3783 329.966 14.918C330.953 14.6549 331.807 14.359 332.531 14.0303C333.254 13.6357 334.043 13.2741 334.898 12.9453C335.49 13.5371 336.049 14.1618 336.575 14.8193C337.101 15.4111 337.824 15.7728 338.745 15.9043C339.073 16.6276 339.468 17.1865 339.928 17.5811C340.389 17.9098 340.849 18.2386 341.309 18.5674C341.769 18.8962 342.164 19.2907 342.493 19.751C342.887 20.2113 343.117 20.9346 343.183 21.9209C342.92 22.3812 342.624 22.8743 342.295 23.4004C342.032 23.9264 341.769 24.5511 341.506 25.2744C340.191 26.458 338.843 27.5101 337.462 28.4307C336.147 29.3512 334.799 30.2389 333.418 31.0938C332.038 31.9486 330.624 32.8034 329.177 33.6582C327.731 34.513 326.251 35.5322 324.739 36.7158C324.41 37.1761 323.983 37.6035 323.457 37.998C322.996 38.3268 322.503 38.6885 321.977 39.083C321.451 39.4118 320.958 39.7734 320.498 40.168C320.037 40.5625 319.676 41.0228 319.413 41.5488C319.215 41.6146 319.018 41.6475 318.821 41.6475C318.624 41.6475 318.426 41.6803 318.229 41.7461C318.032 42.2064 317.703 42.568 317.243 42.8311C316.848 43.0941 316.585 43.4557 316.454 43.916C317.44 46.0202 318.722 47.6312 320.3 48.749C321.878 49.8669 323.654 50.6888 325.626 51.2148C327.599 51.6751 329.736 51.9382 332.038 52.0039C334.339 52.0039 336.739 52.0039 339.238 52.0039C339.501 51.9382 339.599 51.8066 339.534 51.6094C339.534 51.3464 339.698 51.2477 340.027 51.3135C341.605 51.8395 342.821 52.5957 343.676 53.582C344.531 54.5026 345.55 55.4232 346.734 56.3438C346.602 58.8424 345.846 60.9137 344.465 62.5576C343.084 64.2015 341.243 65.5166 338.942 66.5029Z" fill="#bbb"/>
<path d="M365.573 63.1494C365.902 65.1221 365.77 66.6673 365.178 67.7852C364.652 68.903 363.863 69.7249 362.811 70.251C361.825 70.8428 360.674 71.1716 359.359 71.2373C358.044 71.3031 356.794 71.2373 355.611 71.04C354.953 70.1195 354.361 68.9688 353.835 67.5879C353.309 66.207 352.816 64.7933 352.356 63.3467C351.896 61.8343 351.468 60.3548 351.074 58.9082C350.745 57.4616 350.449 56.1794 350.186 55.0615C350.515 54.2725 350.712 53.3848 350.778 52.3984C350.909 51.3464 350.975 50.2943 350.975 49.2422C351.041 48.1901 351.074 47.138 351.074 46.0859C351.139 44.9681 351.238 43.916 351.37 42.9297C351.83 40.168 352.487 37.5378 353.342 35.0391C354.263 32.5404 354.986 29.943 355.512 27.2471C355.644 26.6553 355.578 26.0964 355.315 25.5703C355.118 25.0443 355.085 24.5511 355.216 24.0908C355.282 23.8278 355.479 23.6634 355.808 23.5977C356.137 23.4661 356.334 23.236 356.4 22.9072C356.597 22.1839 356.63 21.5921 356.499 21.1318C356.433 20.6715 356.564 20.1126 356.893 19.4551C357.222 18.929 357.616 18.1729 358.077 17.1865C358.603 16.1344 358.8 15.0495 358.668 13.9316C359.26 13.5371 359.819 13.0768 360.345 12.5508C360.871 12.0247 361.397 11.5645 361.923 11.1699C362.515 10.7096 363.14 10.3151 363.797 9.98633C364.521 9.65755 365.375 9.49316 366.362 9.49316C366.888 10.1507 367.217 10.874 367.348 11.6631C367.545 12.4521 367.71 13.2412 367.841 14.0303C368.039 14.8193 368.302 15.5755 368.63 16.2988C368.959 16.9564 369.518 17.4824 370.307 17.877C370.307 18.403 370.307 19.0605 370.307 19.8496C370.307 20.6387 370.34 21.4277 370.406 22.2168C370.472 22.9401 370.603 23.6305 370.8 24.2881C371.063 24.8799 371.458 25.2744 371.984 25.4717C370.8 28.6279 369.682 31.7513 368.63 34.8418C367.644 37.9323 366.822 41.0557 366.165 44.2119C365.507 47.3024 365.08 50.4258 364.882 53.582C364.751 56.7383 364.981 59.9274 365.573 63.1494Z" fill="#bbb"/>
<rect x="144.77" width="15" height="80" rx="4" fill="#00FFA3"/>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,898 @@
= Specification =
The following is a draft specification for the *vimwiki* markup language. It is
provided as a guideline for consistent parsing and rendering of vimwiki
content.
Similar to the approach taken with [[https://www.commonmark.org/|commonmark]],
this document attempts to specify *vimwiki* syntax unambiguously. It contains
examples of the language and describes the specifics of the language in a way
that tooling can more easily define parsers and generators.
== Version ==
Current: *0.1.0*
This specification is versioned in order to provide a stable point of reference
for external tools. [[https://semver.org/|Semantic versioning]] is used to keep
track of the current state of the specification. *MAJOR.MINOR.PATCH* is the
format.
While the specification remains with a zero major version, the contents of this
specification can change without any requirement to maintain compatibility.
Once a non-zero major version is released, new vimwiki language elements may
only be added in minor releases and any breaking change must be reflected by a
major release. Tweaks in language that do not add, alter, or remove elements of
vimwiki (such as typos, clarifications, etc) may be made with patch releases.
The specification will continue to remain in a development mode (zero major
mode) until the language has become relatively stable.
== Language ==
The following will describe the individual elements of the vimwiki language.
It will cover each element's purpose and a clear description of the syntax.
For details on parsing prescedence, see the [[#Specification#Parser Details|companion section]].
=== Primitives ===
In order to define the vimwiki language, we first need to present several
definitions for primitive building blocks used to shape up higher-level
elements. Relevant definitions are borrowed from
[[https://spec.commonmark.org/0.29/#characters-and-lines|commonmark characters and lines]].
A *character* in vimwiki is a valid UTF-8 code point. For the purposes of
this document, we further restrict a character to not include any
[[https://en.wikipedia.org/wiki/Control_character|control character]] as those will be referenced separately.
An *alphanumeric character* is a [[#character|character]] that can only be in
the range of a-z, A-Z, or 0-9 where these represent alphabet characters
(abcdef...z) of lower and upper case as well as digits (0, 1, 2, ..., 9).
A *line* is a sequence of zero or more [[#Specification#Language#Primitives#character|characters]] other than a
newline (`U+000A` aka `\n`) or carriage return (`U+000D` aka `\r`), followed by
a [[#Specification#Language#Primitives#line ending|line ending]] or by the end of a file.
A *line ending* is a newline (`U+000A` aka `\n`), a carriage return (`U+000D`
aka `\r`) not followed by a newline, or a carriage return and a following
newline (`\r\n`).
A line with no [[#character|characters]], or a line containing only spaces (`U+0020`) or tabs
(`U+0009`), is called a *blank line*.
A *whitespace character* is a space (`U+0020`) or tab (`U+0009`).
*All characters until end of line* is any sequence of [[#character|characters]]
leading up to but not including a [[#line ending|line ending]].
A *user-defined content* is an arbitrary series of [[#character|characters]] or a function
that yields those characters. Its purpose is to enable users of vimwiki to
interject their own configuration into aspects of the vimwiki language.
*User-definable* represents any language definition that can be altered to
instead be represented by one or more [[#user-defined content|user-defined content]].
=== Block Elements ===
The vimwiki language has a variety of syntax that represent elements within
a page. In this section, we discuss block-level elements, which are vimwiki
syntax that are standalone and can comprise one or more entire lines within
a file.
==== Blockquote ====
A blockquote has two different forms available: indented text or text prefixed
with a right angle bracket or chevron `>`. Its purpose is to convey an extended
quotation.
*Form 1*:
{{{vimwiki
This is a blockquote
that exists on more than one line
}}}
*Form 2*:
{{{vimwiki
> This is a blockquote
> that exists on more than one line
}}}
===== Syntax =====
*Form 1*:
A blockquote is made of *one* or more [[#indented blockquote line|indented blockquote lines]]
An *indented blockquote line* is made of the following:
1. Four or more [[#whitespace character|whitespace characters]]
2. All [[#character|characters]] up until a [[#line ending|line ending]]
3. A [[#line ending|line ending]] or end of input
*Form 2*:
A blockquote is made of *one* or more [[#chevron blockquote line|chevron blockquote lines]], which may be
separated by zero or more [[#blank line|blank lines]]
A *chevron blockquote line* is made of the following:
1. Starts at the beginning of a line
2. A prefix right angle bracket or chevron (`U+003E` aka `>`)
3. A [[#whitespace character|whitespace character]] such as ' ' or '\t'
4. All characters up until a [[#line ending|line ending]]
5. A [[#line ending|line ending]] or end of input
*Extra Notes*: Each line of a blockquote, minus the indentation or chevron, is
trimmed to remove all leading and trailing [[#whitespace character|whitespace characters]].
==== Definition List ====
A definition list is composed of a series of terms and associated definitions.
It mirrors the functionality available in an [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl|HTML Description List]].
{{{vimwiki
Term 1:: Some definition
Term 2:: First def
:: Second def with [[link]]
Term3::
:: Some *bold* definition
}}}
===== Syntax =====
A *definition list* is composed of one or more [[#term and definitions|term and definitions]]
A *term and definitions* is composed of one [[#term line|term line]] and
zero or more [[#definition line|definition lines]]
A *term line* is represented by the following:
1. Starts at the beginning of a line
2. One or more [[#inline elements|inline elements]] (except [[#tags|tags]]) before the sequence `::`
3. The sequence `::`
4. An optional one or more [[#inline elements|inline elements]] before [[#line ending|line ending]]
to be the first definition
5. A [[#line ending|line ending]] or end of input
A *definition line* is represented by the following:
1. Starts at the beginning of a line
2. The sequence `::`
3. One or more [[#inline elements|inline elements]] before [[#line ending|line ending]]
4. A [[#line ending|line ending]] or end of input
*Extra Notes*: Each term and definition is trimmed to remove all leading and
trailing [[#whitespace character|whitespace characters]].
==== Divider ====
A divider is composed of a sequence of dashes (`U+002D`). It mirrors the
functionality of the [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr|HTML Horizontal Rule]].
{{{vimwiki
----
}}}
===== Syntax =====
A *divider* is represented by the following:
1. Starts at the beginning of a line
2. Four or more dashes (`U+002D`)
3. A [[#line ending|line ending]] or end of input
==== Header ====
A header is composed of some content surrounded by equals sign (`U+003D` aka
`=`) of equal length. It mirrors the functionality of the [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements|HTML Heading]].
{{{vimwiki
= Some Header =
== Some Sub Header ==
= *Bold* Header with [[link]] =
}}}
===== Syntax =====
A *header* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]] (implying
whether or not a header is centered)
3. One or more equal sign (`U+003D`) characters
4. One or more [[#inline elements|inline elements]]
5. An equivalent number of equal sign characters as in step #3
6. A [[#line ending|line ending]] or end of input
*Extra Notes*: Each header's content, minus the equals signs, is trimmed to
remove all leading and trailing [[#whitespace character|whitespace characters]].
For example, `= header =` is equal to `=header=`.
==== List ====
A list is composed of a series list items, each being comprised
of [[#inline elements|inline elements]] and [[#list|sub lists]]. It mirrors the
functionality available in an [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul|HTML Unordered List]]
and [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol|HTML Ordered List]].
{{{vimwiki
- List item 1 has *bold* and [[links]]
- List item 2 has content
1. Ordered sublist
2. within list item 2
}}}
===== Syntax =====
A *list* is composed of one or more [[#list item|list items]].
A *list item* is composed of a [[#starting list item line|starting list item line]]
and zero or more [[#companion list item line|companion list item lines]].
A *starting list item line* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]] that signify
the level of indentation to use when understanding if later content is
still associated with this list item, if a new list item is the beginning
of a sublist, if a new list item is a sibling, or if a new list item
is the sibling of a parent
3. One of the following default prefixes (this is also [[#user-definable|user definable]])
that determines the type of list item:
* Hyphen (`U+002D` aka `-`) is for an unordered list
* Asterisk (`U+002A` aka `*`) is for an unordered list
* Pound (`U+0023` aka `#`) is for an ordered list
* One or more digits followed by a period (`U+002E` aka `.`) or
a right parenthesis (`U+0029` aka `)`) is for an ordered list
* One or more lowercase alphabetic (`a-z`) followed by a period
(`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is for an
ordered list
* One or more uppercase alphabetic (`A-Z`) followed by a period
(`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is for an
ordered list
* One or more lowercase Roman numerals (any of `ivxlcdm`) followed by a
period (`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is
for an ordered list
* One or more uppercase Roman numerals (any of `IVXLCDM`) followed by a
period (`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is
for an ordered list
4. A [[#whitespace character|whitespace character]]
5. An optional [[#todo attribute|todo attribute]] and additional [[#whitespace character|whitespace character]]
6. Zero or more [[#inline elements|inline elements]]
7. A [[#line ending|line ending]] or end of input
A *companion list item line* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]] that total
as many or more as the [[#starting list item line|starting list item line]] indentation
3. One of the following:
* The start of a new [[#list|list]] (to be treated as a sublist of the
current list item)
* A series of one or more [[#inline elements|inline elements]]
(to be added to the content of the current list item) followed by
a [[#line ending|line ending]] or end of input
* A [[#blank line|blank line]] if there is guaranteed to still be some
list item content in later lines
A *todo attribute* is composed of surrounding square brackets in the form
of a left square bracket (`U+005B` aka `[`) and right square bracket
(`U+005D` aka `]`). Inbetween the square brackets is a single character to
denote the todo status and is by default one of the following or [[#user-definable|user-definable]]:
* A space (`U+0020` aka ' ') meaning 0% or incomplete
* A period (`U+002E` aka `.`) meaning 1-33% progress
* A lowercase o (`U+006F` aka `o`) meaning 34-66% progress
* An uppercase O (`U+004F` aka `O`) meaning 67-99% progress
* An uppercase X (`U+0058` aka `X`) meaning 100% or completed
* A hyphen (`U+002D` aka `-`) meaning rejected
*Extra Notes*: Because of the ambiguity of alphabetic list items and Roman
numerals, which are composed of specific alphabetic characters in various
arrangements, a list needs to be evaluated across all of its items to determine
if a list item's type is Roman or alphabetic. If all list items begin with
valid Roman numerals, then the types are Roman numerals. If any list item is
not a valid Roman numeral, then all list item type's for those prefixes are
considered to be alphabetic.
==== Math Block ====
A math block is composed of a series of lines representing a mathematical
formula. It is rendered in HTML using the [[https://www.mathjax.org/|MathJax engine]].
{{{vimwiki
{{$%align%
\sum_i a_i^2 &= 1 + 1 \\
&= 2.
}}$
}}}
===== Syntax =====
A *math block* is composed of a [[#beginning math block line|beginning math block line]],
one or more [[#math block line|math block lines]], and an [[#ending math block line|ending math block line]].
A *beginning math block line* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]]
3. The sequence `{{$`
4. An optional [[#math environment|math environment]]
5. Zero or more [[#whitespace character|whitespace characters]]
6. A [[#line ending|line ending]]
A *math environment* is represented by the following:
1. The percent sign (`U+0025` aka `%`)
2. One or more [[#character|characters]] that are not the percent sign or [[#line ending|line ending]]
3. The percent sign (`U+0025` aka `%`)
A *math block line* is a line found after a [[#beginning math block line|beginning math block line]]
and before an [[#ending math block line|ending math block line]] and is
comprised of zero or more [[#character|characters]] representing [[https://en.wikipedia.org/wiki/TeX|TeX syntax]]
followed by a [[#line ending|line ending]].
An *ending math block line* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]]
3. The sequence `}}$`
4. Zero or more [[#whitespace character|whitespace characters]]
5. A [[#line ending|line ending]] or end of input
==== Paragraph ====
A paragraph is composed of a series of lines representing some content. It
mirrors [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p|HTML Paragraph]].
{{{vimwiki
Some paragraph containing
multiple lines including
*bold* and [[links]].
}}}
===== Syntax =====
A *paragraph* is composed of one or more [[#paragraph line|paragraph lines]].
A *paragraph line* is represented by the following:
1. Starts at the beginning of a line
2. Has zero to three [[#whitespace character|whitespace]] characters for indentation
3. Is not any of the following:
* [[#header|header]]
* [[#definition list|definition list]]
* [[#list|list]]
* [[#table|table]]
* [[#preformatted text|preformatted text]]
* [[#math block|math block]]
* [[#blank link|blank line]]
* [[#blockquote|blockquote]]
* [[#divider|divider]]
* [[#placeholder|placeholder]]
4. One or more [[#inline elements|inline elements]]
5. A [[#line ending|line ending]] or end of input
==== Placeholder ====
A placeholder is composed of an identifier and some information. Its purpose
is to provide metadata for use in rendering vimwiki to HTML and populating
portions of the HTML template used with a vimwiki page.
{{{vimwiki
%title Some title
%nohtml
%template my_template
%date 2020-12-23
}}}
===== Syntax =====
A *placeholder* is represented by one of the following:
* A [[#title placeholder|title placeholder]]
* A [[#nohtml placeholder|nohtml placeholder]]
* A [[#template placeholder|template placeholder]]
* A [[#date placeholder|date placeholder]]
A *title placeholder* is represented by the following:
1. Starts at the beginning of a line
2. A percent sign (`U+0025` aka `%`)
3. The sequence `title`
4. One or more [[#whitespace character|whitespace characters]]
5. [[#all characters until end of line|all characters until end of line]]
6. A [[#line ending|line ending]] or end of input
A *nohtml placeholder* is represented by the following:
1. Starts at the beginning of a line
2. A percent sign (`U+0025` aka `%`)
3. The sequence `nohtml`
4. A [[#line ending|line ending]] or end of input
A *template placeholder* is represented by the following:
1. Starts at the beginning of a line
2. A percent sign (`U+0025` aka `%`)
3. The sequence `template`
4. One or more [[#whitespace character|whitespace characters]]
5. [[#all characters until end of line|all characters until end of line]]
6. A [[#line ending|line ending]] or end of input
A *date placeholder* is represented by the following:
1. Starts at the beginning of a line
2. A percent sign (`U+0025` aka `%`)
3. The sequence `date`
4. One or more [[#whitespace character|whitespace characters]]
5. A date string in the format of [[https://en.wikipedia.org/wiki/ISO_8601|ISO 8601]] such as
`YYYY-MM-DD` where `YYYY` symbolizes a four-digit year (e.g. `1990`),
`MM` symbolizes a two-digit month (e.g. `04`),
and `DD` symbolizes a two-digit day (e.g. `23`)
6. A [[#line ending|line ending]] or end of input
==== Preformatted Text ====
A preformatted text block is composed of a series of lines representing some
content, usually related to a programming language. It mirrors
[[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre|HTML Preformatted Text]].
{{{vimwiki
{{{rust
fn my_func() -> u32 {
1 + 2
}
\}}}
}}}
===== Syntax =====
A *preformatted text* is composed of a [[#beginning preformatted text line|beginning preformatted text line]],
one or more [[#preformatted text line|preformatted text lines]], and an [[#ending preformatted text line|ending preformatted text line]].
A *beginning preformatted text line* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]]
3. The sequence `{{{`
4. An optional [[#preformatted language identifier|preformatted language identifier]]
5. An optional [[#preformatted metadata list|preformatted metadata list]]
6. Zero or more [[#whitespace character|whitespace characters]]
7. A [[#line ending|line ending]] or end of input
A *preformatted language identifier* is represented by the following:
1. One or more [[#character|characters]] leading up to a [[#whitespace character|whitespace characters]]
2. Is comprised of a series of any character except equals sign (`U+003D` aka `=`)
A *preformatted metadata list* is composed of one or more
[[#preformatted metadata list items|preformatted metadata list items]] separated by [[#whitespace character|whitespace characters]].
A *preformatted metadata list item* is represented by the following:
1. One or more [[#character|characters]] leading up to an equals sign (`U+003D` aka `=`),
not including a [[#line ending|line ending]]
2. An equals sign (`U+003D` aka `=`)
3. A quotation mark (`U+0022` aka `"`)
4. One or more [[#character|characters]] leading up to a quotation mark (`U+0022` aka `"`)
5. A quotation mark (`U+0022` aka `"`)
A *preformatted text line* is a line found after a [[#beginning preformatted text line|beginning preformatted text line]]
and before an [[#ending preformatted text line|ending preformatted text line]] and is
comprised of zero or more [[#character|characters]] followed by a [[#line ending|line ending]].
An *ending preformatted text line* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]]
3. The sequence `}}}`
4. Zero or more [[#whitespace character|whitespace characters]]
5. A [[#line ending|line ending]] or end of input
==== Table ====
A table is composed of a series of rows containing various other elements. It
mirrors [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table|HTML Table]].
{{{vimwiki
| Year | Temperature (low) | Temperature (high) | Temperature (avg) |
|------|-------------------|:------------------------:|------------------:|
| 1990 | *50* degrees | 90 according to [[link]] | 72 |
| \/ | 45 degrees | > | 80 |
| \/ | \/ | > | 60 |
| 2000 | > | > | > |
}}}
===== Syntax =====
A *table* is composed of one or more [[#row|rows]] with the indentation of
the first row indicating whether the table is centered (is indented) or not.
A *row* is represented by one of the following:
* A [[#divider row|divider row]]
* A [[#content row|content row]]
A *divider row* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]]
3. A sequence of pairs comprised of a [[#cell boundary|cell boundary]] and [[#divider column|divider column]]
4. A final [[#cell boundary|cell boundary]]
5. A [[#line ending|line ending]] or end of input
A *divider column* is represented by the following:
1. An optional colon (`U+003A` aka `:`)
2. One or more hyphens (`U+002D` aka `-`)
3. An optional colon (`U+003A` aka `:`)
A *content row* is represented by the following:
1. Starts at the beginning of a line
2. Zero or more [[#whitespace character|whitespace characters]]
3. A sequence of pairs comprised of a [[#cell boundary|cell boundary]] and a [[#cell|cell]]
4. A final [[#cell boundary|cell boundary]]
5. A [[#line ending|line ending]] or end of input
A *cell* is represented by one of the following:
* A [[#span above cell|span above cell]]
* A [[#span left cell|span left cell]]
* A [[#content cell|content cell]]
A *span above cell* is represented by the following:
1. Zero or more [[#whitespace character|whitespace characters]]
2. Sequence `\/`
3. Zero or more [[#whitespace character|whitespace characters]]
A *span left cell* is represented by the following:
1. Zero or more [[#whitespace character|whitespace characters]]
2. Sequence `>`
3. Zero or more [[#whitespace character|whitespace characters]]
A *content cell* is represented by the following:
1. Zero or more [[#whitespace character|whitespace characters]]
2. One or more [[#inline elements|inline elements]] not comprised of `|`
3. Zero or more [[#whitespace character|whitespace characters]]
A *cell boundary* is represented by the pipe character (`U+007C` aka `|`).
=== Inline Elements ===
The vimwiki language also has a variety of syntax that can be used within a
line on a page. These are referred to as *inline elements* and can be found
within a variety of [[#block elements|block elements]] as well as nested
within other inline elements.
==== Math Inline ====
A math inline element is composed of a single-line formula.
Like its big brother, the [[#math block|math block]], it is rendered in HTML
using the [[https://www.mathjax.org/|MathJax engine]].
{{{vimwiki
$ \sum_i a_i^2 = 1 $
}}}
===== Syntax =====
An *inline math* element is represented by the following:
1. A dollar sign (`U+0024` aka `$`)
2. One or more [[#character|characters]] representing [[https://en.wikipedia.org/wiki/TeX|TeX syntax]]
that are not a dollar sign or [[#line ending|line ending]]
3. A dollar sign (`U+0024` aka `$`)
*Extra Notes*: The formula within the inline element is trimmed to remove all
leading and trailing [[#whitespace character|whitespace characters]].
==== Tags ====
A tags element is composed of a series of individual tag elements. It is used
both to mark various places within a page as well as act as an [[#anchor|anchor]].
{{{vimwiki
:tag-1:tag-2:
}}}
===== Syntax =====
A *tags* element is represented by the following:
1. A [[#tag separator|tag separator]]
2. A sequence of [[#tag|tag]] separated by [[#tag separator|tag separator]]
3. A [[#tag separator|tag separator]]
A *tag* is represented by one or more [[#character|characters]] that are not a colon,
[[#whitespace character|whitespace]], or [[#line ending|line ending]]
A *tag separator* is represented by a colon (`U+003A` aka `:`).
==== Link ====
A link is a crucial inline element of vimwiki and is able to connect pages
with each other as well as external wikis and resources.
{{{vimwiki
[[other page|link to another page]]
[[wiki1:page|link to page in another wiki]]
[[#some#anchor|link to another location in same page]]
[[diary:2020-12-23|link to diary entry]]
{{https://example.com/img.jpg|Transclusion to pull in image}}
[[https://example.com|{{https://example.com/img.jpg}}]]
}}}
===== Syntax =====
A *link* is represented by one of the following:
* A [[#wiki link|wiki link]]
* An [[#interwiki link|interwiki link]]
* A [[#diary link|diary link]]
* An [[#external file link|external file link]]
* A [[#raw link|raw link]]
* A [[#transclusion link|transclusion link]]
A *wiki link* is represented by the following:
1. A [[#link start seq|link start seq]]
2. At least one of the following (in order):
1. An optional [[#link path|link path]]
2. An optional [[#link anchor|link anchor]]
3. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
4. A [[#link end seq|link end seq]]
An *interwiki link* is represented by one of the following:
* An [[#indexed interwiki link|indexed interwiki link]]
* An [[#named interwiki link|named interwiki link]]
An *indexed interwiki link* is represented by the following:
1. A [[#link start seq|link start seq]]
2. The sequence `wiki`
3. One or more digits (`0-9`)
4. A colon (`U+003A` aka `:`)
5. A [[#link path|link path]]
6. An optional [[#link anchor|link anchor]]
7. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
8. A [[#link end seq|link end seq]]
A *named interwiki link* is represented by the following:
1. A [[#link start seq|link start seq]]
2. The sequence `wn.`
3. One or more [[#alphanumeric character|alphanumeric characters]]
4. A colon (`U+003A` aka `:`)
5. A [[#link path|link path]]
6. An optional [[#link anchor|link anchor]]
7. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
8. A [[#link end seq|link end seq]]
An *external file link* is represented by the following:
1. A [[#link start seq|link start seq]]
2. A [[#link uri|link uri]] whose schema is `local` or `file` or has no schema
and starts with `//` for an absolute file path
3. A [[#link path|link path]]
4. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
5. A [[#link end seq|link end seq]]
A *raw link* is represented by a [[#link uri|link uri]] not found within
another link type.
A *transclusion link* is represented by the following:
1. The sequence `{{`
2. A [[#link uri|link uri]]
3. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
4. An optional sequence of [[#link key value pair|link key value pairs]],
each separated by [[#link inner separator|link inner separator]]
4. The sequence `}}`
A *link key value pair* is represented by the following:
1. One or more [[#character|characters]] that are not a pipe symbol (`U+007C`
aka `|`), equals sign (`U+003D` aka `=`), `}}`, or [[#line ending|line ending]]
2. An equals sign (`U+003D` aka `=`)
3. A quotation mark (`U+0022` aka `"`)
4. One or more [[#character|characters]] that are not a pipe symbol (`U+007C`
aka `|`), quotation mark (`U+0022` aka `"`), `}}`, or [[#line ending|line ending]]
5. A quotation mark (`U+0022` aka `"`)
A *link path* is represented by the following:
1. Does not start with a [[#link anchor prefix|link anchor prefix]]
2. One or more [[#character|characters]] that are not a [[#link anchor prefix|link anchor prefix]],
[[#link inner separator|link inner separator]], [[#link end seq|link end seq]], or [[#line ending|line ending]]
A *link description* is represented by one of the following:
* A [[#link uri|link uri]]
* One or more [[#character|characters]] that are not a [[#link end seq|link end seq]] or [[#line ending|line ending]]
A *link anchor* is represented by a series of pairs, each comprised of
a [[#link anchor prefix|link anchor prefix]] and a [[#link anchor element|link anchor element]]
A *link anchor element* is represented by one or more [[#character|characters]] that are
not a [[#link anchor prefix|link anchor prefix]], [[#link inner separator|link inner separator]],
[[#link end seq|link end seq]], or [[#line ending|line ending]]
A *link anchor prefix* is represented by a pound symbol (`U+0023` aka `#`).
A *link inner separator* is represented by a pipe symbol (`U+007C` aka `|`).
A *link start seq* is represented by `[[`.
A *link end seq* is represented by `]]`.
A *link uri* is represented by the following:
1. Starts with `www.`, `//`, or a [[#link uri scheme|link uri scheme]]
a. If starting with `www.`, we add a virtual prefix of `https://` going forward
b. If starting with `//`, we add a virtual prefix of `file:/` going forward
2. One or more [[#character|characters]] that are not [[#whitespace character|whitespace characters]]
or [[#line ending|line ending]]
A *link uri scheme* is represented by a series of alphanumeric [[#character|characters]]
(`a-z`, `A-Z`, `0-9`) as well as plus (`U+002B` aka `+`), period (`U+002E`
aka `.`), and hyphen (`U+002D` aka `-`). The scheme is terminated by a
colon (`U+003A` aka `:`).
*Extra Notes*: Additional validation should be done to ensure that a
[[#line uri|link uri]] properly adheres to [[https://tools.ietf.org/html/rfc3986|RFC3986]].
==== Decorated Text ====
Decorated text supports a variety of markups across [[#link|links]],
[[#keyword|keywords]], non-repeating [[#decorated text|decorated text]], and [[#text|text]].
It mirrors these different HTML elements:
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong|strong]]
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em|em]]
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s|s]]
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code|code]]
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup|sup]]
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub|sub]]
{{{vimwiki
*bold*
_italic_
~~strikeout~~
`code`
^superscript^
,,superscript,,
}}}
===== Syntax =====
*Decorated text* is represented by one of the following:
* [[#bold text|Bold text]]
* [[#italic text|Italic text]]
* [[#strikeout text|Strikeout text]]
* [[#code text|Code text]]
* [[#superscript text|Superscript text]]
* [[#subscript text|Subscript text]]
*Bold text* is represented by the following:
1. An asterisk (`U+002A` aka `*`)
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
an asterisk (`U+002A` aka `*`) is encountered
3. An asterisk (`U+002A` aka `*`)
*Italic text* is represented by the following:
1. An underscore (`U+005F` aka `_`)
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
an underscore (`U+005F` aka `_`) is encountered
3. An underscore (`U+005F` aka `_`)
*Strikeout text* is represented by the following:
1. Two tilde (`U+007E` aka `~`)
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
two tilde (`U+007E` aka `~`) are encountered
3. Two tilde (`U+007E` aka `~`)
*Code text* is represented by the following:
1. A backtick (`U+0060`)
2. Any character other than a backtick or [[#line ending|line ending]]
3. A backtick (`U+0060`)
*Superscript text* is represented by the following:
1. A carrot or circumflex accent (`U+005E` aka `^`)
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
a carrot or circumflex accent (`U+005E` aka `^`) is encountered
3. A carrot or circumflex accent (`U+005E` aka `^`)
*Superscript text* is represented by the following:
1. Two commas (`U+002C` aka `,`)
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
two commas (`U+002C` aka `,`) are encountered
3. Two commas (`U+002C` aka `,`)
*Non-repeated decorated text* is represented as [[#decorated text|decorated text]]
where no previous styling is seen again until that styling is closed. For
example, if [[#bold text|bold text]] is first seen, there will not be another
case of bold text until after the current one has ended
(`*bold *inner bold* text*` is not allowed).
==== Keyword ====
Keywords are specific, case-sensitive words that have an alternative
highlighting within vim as well as provide highlighting in generated HTML
via classes.
===== Syntax =====
A *keyword* is represented as one of the following:
* `DONE`
* `FIXED`
* `FIXME`
* `STARTED`
* `TODO`
* `XXX`
==== Text ====
Text is a plain series of [[#character|characters]] that have no special stylings applied
directly, but can be included in other [[#inline elements|inline elements]].
===== Syntax =====
A *text* is represented as one or more [[#character|characters]] until any of the following
is encountered:
* [[#inline math|inline math]]
* [[#tags|tags]]
* [[#link|link]]
* [[#decorated text|decorated text]]
* [[#keyword|keyword]]
* [[#line ending|line ending]]
==== Comments ====
A special type of inline element is the comment. Compared to all other inline
elements, comments are unique in that they do not render into any other
format (HTML, PDF, etc) and - in the case of multi-line comments - can span
across more than one line.
There are two types of comments:
1. Line comment in the form of `%%CONTENT`
2. Multi-line comment in the form of `%%+CONTENT++%`
===== Line Comment Syntax =====
1. A *line comment* is represented by the following:
1. The sequence `%%`
2. Any character until [[#line ending|line ending]]
*Extra Notes*: A line comment does not consume a [[#line ending|line ending]],
only the [[#character|characters]] leading up to one. If a line comment is at the beginning of
a line, it will leave a blank line in its place.
===== Multi-line Comment Syntax =====
1. A *multi-line comment* is represented by the following:
1. The sequence `%%+`
2. Any character until the sequence `+%%`
3. The sequence `+%%`
*Extra Notes*: A multi-line comment consumes all [[#character|characters]] - including
[[#line ending|line ending]] - between the surrounding character sequences. It
can be used to join content in separate lines together. See example below.
{{{vimwiki
first line%%+
+%%second line
would become
first linesecond line
}}}
== Parser Details ==
When building a parser for the vimwiki language, certain elements may overlap
in the text that they can match. This means that the order in which elements
are evaluated can affect how a page is perceived.
Additionally, the inclusion of [[#comments|comments]] further complicates the
process of parsing a file. Comments can be placed alongside inline elements,
which enables them to be in most locations within vimwiki. Compared to any
other element, comments yield empty text when rendered. This can result in
shortening of lines and even removal of [[#line ending|line ending]] characters.
Below is a breakdown of element categorization:
{{{
Comment =
Page = (Block Element)+
Block Element =
| Header
| Definition List
| List
| Table
| Math Block
| Blockquote
| Divider
| Placeholder
| Paragraph
Inline Block Element =
| List Item
| Term
| Definition
Inline Element =
| Multi Line Comment
| Line Comment
| Math Inline
| Tags
| Link
| Decorated Text
| Keyword
| Text
}}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,295 @@
:VWB vimwiki.txt /*:VWB*
:VWS vimwiki.txt /*:VWS*
:Vimwiki2HTML vimwiki.txt /*:Vimwiki2HTML*
:Vimwiki2HTMLBrowse vimwiki.txt /*:Vimwiki2HTMLBrowse*
:VimwikiAll2HTML[!] vimwiki.txt /*:VimwikiAll2HTML[!]*
:VimwikiBacklinks vimwiki.txt /*:VimwikiBacklinks*
:VimwikiBaddLink vimwiki.txt /*:VimwikiBaddLink*
:VimwikiCheckLinks vimwiki.txt /*:VimwikiCheckLinks*
:VimwikiColorize vimwiki.txt /*:VimwikiColorize*
:VimwikiDeleteFile vimwiki.txt /*:VimwikiDeleteFile*
:VimwikiDiaryGenerateLinks vimwiki.txt /*:VimwikiDiaryGenerateLinks*
:VimwikiDiaryIndex vimwiki.txt /*:VimwikiDiaryIndex*
:VimwikiDiaryNextDay vimwiki.txt /*:VimwikiDiaryNextDay*
:VimwikiDiaryPrevDay vimwiki.txt /*:VimwikiDiaryPrevDay*
:VimwikiFollowLink vimwiki.txt /*:VimwikiFollowLink*
:VimwikiGenerateLinks vimwiki.txt /*:VimwikiGenerateLinks*
:VimwikiGenerateTagLinks vimwiki.txt /*:VimwikiGenerateTagLinks*
:VimwikiGoBackLink vimwiki.txt /*:VimwikiGoBackLink*
:VimwikiGoto vimwiki.txt /*:VimwikiGoto*
:VimwikiIndex vimwiki.txt /*:VimwikiIndex*
:VimwikiListChangeLvl vimwiki.txt /*:VimwikiListChangeLvl*
:VimwikiMakeDiaryNote vimwiki.txt /*:VimwikiMakeDiaryNote*
:VimwikiMakeTomorrowDiaryNote vimwiki.txt /*:VimwikiMakeTomorrowDiaryNote*
:VimwikiMakeYesterdayDiaryNote vimwiki.txt /*:VimwikiMakeYesterdayDiaryNote*
:VimwikiNextLink vimwiki.txt /*:VimwikiNextLink*
:VimwikiNextTask vimwiki.txt /*:VimwikiNextTask*
:VimwikiPasteLink vimwiki.txt /*:VimwikiPasteLink*
:VimwikiPasteUrl vimwiki.txt /*:VimwikiPasteUrl*
:VimwikiPrevLink vimwiki.txt /*:VimwikiPrevLink*
:VimwikiRebuildTags vimwiki.txt /*:VimwikiRebuildTags*
:VimwikiRemoveDone vimwiki.txt /*:VimwikiRemoveDone*
:VimwikiRenameFile vimwiki.txt /*:VimwikiRenameFile*
:VimwikiRss vimwiki.txt /*:VimwikiRss*
:VimwikiSearch vimwiki.txt /*:VimwikiSearch*
:VimwikiSearchTags vimwiki.txt /*:VimwikiSearchTags*
:VimwikiSplitLink vimwiki.txt /*:VimwikiSplitLink*
:VimwikiTOC vimwiki.txt /*:VimwikiTOC*
:VimwikiTabDropLink vimwiki.txt /*:VimwikiTabDropLink*
:VimwikiTabIndex vimwiki.txt /*:VimwikiTabIndex*
:VimwikiTabMakeDiaryNote vimwiki.txt /*:VimwikiTabMakeDiaryNote*
:VimwikiTable vimwiki.txt /*:VimwikiTable*
:VimwikiTableMoveColumnLeft vimwiki.txt /*:VimwikiTableMoveColumnLeft*
:VimwikiTableMoveColumnRight vimwiki.txt /*:VimwikiTableMoveColumnRight*
:VimwikiTabnewLink vimwiki.txt /*:VimwikiTabnewLink*
:VimwikiToggleListItem vimwiki.txt /*:VimwikiToggleListItem*
:VimwikiToggleRejectedListItem vimwiki.txt /*:VimwikiToggleRejectedListItem*
:VimwikiUISelect vimwiki.txt /*:VimwikiUISelect*
:VimwikiVSplitLink vimwiki.txt /*:VimwikiVSplitLink*
:VimwikiVar vimwiki.txt /*:VimwikiVar*
VimwikiLinkConverter vimwiki.txt /*VimwikiLinkConverter*
VimwikiLinkHandler vimwiki.txt /*VimwikiLinkHandler*
VimwikiWikiIncludeHandler vimwiki.txt /*VimwikiWikiIncludeHandler*
g:vimwiki-option-rx_todo vimwiki.txt /*g:vimwiki-option-rx_todo*
g:vimwiki_CJK_length vimwiki.txt /*g:vimwiki_CJK_length*
g:vimwiki_auto_chdir vimwiki.txt /*g:vimwiki_auto_chdir*
g:vimwiki_auto_header vimwiki.txt /*g:vimwiki_auto_header*
g:vimwiki_autowriteall vimwiki.txt /*g:vimwiki_autowriteall*
g:vimwiki_commentstring vimwiki.txt /*g:vimwiki_commentstring*
g:vimwiki_conceal_onechar_markers vimwiki.txt /*g:vimwiki_conceal_onechar_markers*
g:vimwiki_conceal_pre vimwiki.txt /*g:vimwiki_conceal_pre*
g:vimwiki_conceallevel vimwiki.txt /*g:vimwiki_conceallevel*
g:vimwiki_create_link vimwiki.txt /*g:vimwiki_create_link*
g:vimwiki_diary_months vimwiki.txt /*g:vimwiki_diary_months*
g:vimwiki_dir_link vimwiki.txt /*g:vimwiki_dir_link*
g:vimwiki_emoji_enable vimwiki.txt /*g:vimwiki_emoji_enable*
g:vimwiki_ext2syntax vimwiki.txt /*g:vimwiki_ext2syntax*
g:vimwiki_filetypes vimwiki.txt /*g:vimwiki_filetypes*
g:vimwiki_folding vimwiki.txt /*g:vimwiki_folding*
g:vimwiki_global_ext vimwiki.txt /*g:vimwiki_global_ext*
g:vimwiki_hl_cb_checked vimwiki.txt /*g:vimwiki_hl_cb_checked*
g:vimwiki_hl_headers vimwiki.txt /*g:vimwiki_hl_headers*
g:vimwiki_html_header_numbering vimwiki.txt /*g:vimwiki_html_header_numbering*
g:vimwiki_html_header_numbering_sym vimwiki.txt /*g:vimwiki_html_header_numbering_sym*
g:vimwiki_key_mappings vimwiki.txt /*g:vimwiki_key_mappings*
g:vimwiki_links_header vimwiki.txt /*g:vimwiki_links_header*
g:vimwiki_links_header_level vimwiki.txt /*g:vimwiki_links_header_level*
g:vimwiki_list vimwiki.txt /*g:vimwiki_list*
g:vimwiki_list_ignore_newline vimwiki.txt /*g:vimwiki_list_ignore_newline*
g:vimwiki_listing_hl vimwiki.txt /*g:vimwiki_listing_hl*
g:vimwiki_listing_hl_command vimwiki.txt /*g:vimwiki_listing_hl_command*
g:vimwiki_listsym_rejected vimwiki.txt /*g:vimwiki_listsym_rejected*
g:vimwiki_listsyms vimwiki.txt /*g:vimwiki_listsyms*
g:vimwiki_map_prefix vimwiki.txt /*g:vimwiki_map_prefix*
g:vimwiki_markdown_header_style vimwiki.txt /*g:vimwiki_markdown_header_style*
g:vimwiki_markdown_link_ext vimwiki.txt /*g:vimwiki_markdown_link_ext*
g:vimwiki_menu vimwiki.txt /*g:vimwiki_menu*
g:vimwiki_schemes_any vimwiki.txt /*g:vimwiki_schemes_any*
g:vimwiki_schemes_web vimwiki.txt /*g:vimwiki_schemes_web*
g:vimwiki_table_auto_fmt vimwiki.txt /*g:vimwiki_table_auto_fmt*
g:vimwiki_table_reduce_last_col vimwiki.txt /*g:vimwiki_table_reduce_last_col*
g:vimwiki_tag_format vimwiki.txt /*g:vimwiki_tag_format*
g:vimwiki_tags_header vimwiki.txt /*g:vimwiki_tags_header*
g:vimwiki_tags_header_level vimwiki.txt /*g:vimwiki_tags_header_level*
g:vimwiki_text_ignore_newline vimwiki.txt /*g:vimwiki_text_ignore_newline*
g:vimwiki_toc_header vimwiki.txt /*g:vimwiki_toc_header*
g:vimwiki_toc_header_level vimwiki.txt /*g:vimwiki_toc_header_level*
g:vimwiki_toc_link_format vimwiki.txt /*g:vimwiki_toc_link_format*
g:vimwiki_url_maxsave vimwiki.txt /*g:vimwiki_url_maxsave*
g:vimwiki_use_calendar vimwiki.txt /*g:vimwiki_use_calendar*
g:vimwiki_user_htmls vimwiki.txt /*g:vimwiki_user_htmls*
g:vimwiki_valid_html_tags vimwiki.txt /*g:vimwiki_valid_html_tags*
g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc*
vimwiki vimwiki.txt /*vimwiki*
vimwiki-anchors vimwiki.txt /*vimwiki-anchors*
vimwiki-build-tags vimwiki.txt /*vimwiki-build-tags*
vimwiki-calendar vimwiki.txt /*vimwiki-calendar*
vimwiki-changelog vimwiki.txt /*vimwiki-changelog*
vimwiki-commands vimwiki.txt /*vimwiki-commands*
vimwiki-contributing vimwiki.txt /*vimwiki-contributing*
vimwiki-date vimwiki.txt /*vimwiki-date*
vimwiki-development vimwiki.txt /*vimwiki-development*
vimwiki-diary vimwiki.txt /*vimwiki-diary*
vimwiki-emoji vimwiki-emoji.txt /*vimwiki-emoji*
vimwiki-emoji-activity vimwiki-emoji.txt /*vimwiki-emoji-activity*
vimwiki-emoji-face vimwiki-emoji.txt /*vimwiki-emoji-face*
vimwiki-emoji-familly vimwiki-emoji.txt /*vimwiki-emoji-familly*
vimwiki-emoji-flags vimwiki-emoji.txt /*vimwiki-emoji-flags*
vimwiki-emoji-foods vimwiki-emoji.txt /*vimwiki-emoji-foods*
vimwiki-emoji-job vimwiki-emoji.txt /*vimwiki-emoji-job*
vimwiki-emoji-nature vimwiki-emoji.txt /*vimwiki-emoji-nature*
vimwiki-emoji-objects vimwiki-emoji.txt /*vimwiki-emoji-objects*
vimwiki-emoji-people vimwiki-emoji.txt /*vimwiki-emoji-people*
vimwiki-emoji-places vimwiki-emoji.txt /*vimwiki-emoji-places*
vimwiki-emoji-symbols vimwiki-emoji.txt /*vimwiki-emoji-symbols*
vimwiki-emoji.txt vimwiki-emoji.txt /*vimwiki-emoji.txt*
vimwiki-folding vimwiki.txt /*vimwiki-folding*
vimwiki-global-commands vimwiki.txt /*vimwiki-global-commands*
vimwiki-global-mappings vimwiki.txt /*vimwiki-global-mappings*
vimwiki-global-options vimwiki.txt /*vimwiki-global-options*
vimwiki-help vimwiki.txt /*vimwiki-help*
vimwiki-intro vimwiki.txt /*vimwiki-intro*
vimwiki-license vimwiki.txt /*vimwiki-license*
vimwiki-list-manipulation vimwiki.txt /*vimwiki-list-manipulation*
vimwiki-list-mappings vimwiki.txt /*vimwiki-list-mappings*
vimwiki-lists vimwiki.txt /*vimwiki-lists*
vimwiki-local-commands vimwiki.txt /*vimwiki-local-commands*
vimwiki-local-mappings vimwiki.txt /*vimwiki-local-mappings*
vimwiki-local-options vimwiki.txt /*vimwiki-local-options*
vimwiki-mappings vimwiki.txt /*vimwiki-mappings*
vimwiki-nohtml vimwiki.txt /*vimwiki-nohtml*
vimwiki-option-auto_diary_index vimwiki.txt /*vimwiki-option-auto_diary_index*
vimwiki-option-auto_export vimwiki.txt /*vimwiki-option-auto_export*
vimwiki-option-auto_generate_links vimwiki.txt /*vimwiki-option-auto_generate_links*
vimwiki-option-auto_generate_tags vimwiki.txt /*vimwiki-option-auto_generate_tags*
vimwiki-option-auto_tags vimwiki.txt /*vimwiki-option-auto_tags*
vimwiki-option-auto_toc vimwiki.txt /*vimwiki-option-auto_toc*
vimwiki-option-automatic_nested_syntaxes vimwiki.txt /*vimwiki-option-automatic_nested_syntaxes*
vimwiki-option-base_url vimwiki.txt /*vimwiki-option-base_url*
vimwiki-option-bullet_types vimwiki.txt /*vimwiki-option-bullet_types*
vimwiki-option-color_dic vimwiki.txt /*vimwiki-option-color_dic*
vimwiki-option-color_tag_template vimwiki.txt /*vimwiki-option-color_tag_template*
vimwiki-option-css_name vimwiki.txt /*vimwiki-option-css_name*
vimwiki-option-custom_wiki2html vimwiki.txt /*vimwiki-option-custom_wiki2html*
vimwiki-option-custom_wiki2html_args vimwiki.txt /*vimwiki-option-custom_wiki2html_args*
vimwiki-option-cycle_bullets vimwiki.txt /*vimwiki-option-cycle_bullets*
vimwiki-option-diary_caption_level vimwiki.txt /*vimwiki-option-diary_caption_level*
vimwiki-option-diary_frequency vimwiki.txt /*vimwiki-option-diary_frequency*
vimwiki-option-diary_header vimwiki.txt /*vimwiki-option-diary_header*
vimwiki-option-diary_index vimwiki.txt /*vimwiki-option-diary_index*
vimwiki-option-diary_rel_path vimwiki.txt /*vimwiki-option-diary_rel_path*
vimwiki-option-diary_sort vimwiki.txt /*vimwiki-option-diary_sort*
vimwiki-option-diary_start_week_day vimwiki.txt /*vimwiki-option-diary_start_week_day*
vimwiki-option-exclude_files vimwiki.txt /*vimwiki-option-exclude_files*
vimwiki-option-ext vimwiki.txt /*vimwiki-option-ext*
vimwiki-option-generated_links_caption vimwiki.txt /*vimwiki-option-generated_links_caption*
vimwiki-option-html_filename_parameterization vimwiki.txt /*vimwiki-option-html_filename_parameterization*
vimwiki-option-index vimwiki.txt /*vimwiki-option-index*
vimwiki-option-links_space_char vimwiki.txt /*vimwiki-option-links_space_char*
vimwiki-option-list_margin vimwiki.txt /*vimwiki-option-list_margin*
vimwiki-option-listsym_rejected vimwiki.txt /*vimwiki-option-listsym_rejected*
vimwiki-option-listsyms vimwiki.txt /*vimwiki-option-listsyms*
vimwiki-option-listsyms_propagate vimwiki.txt /*vimwiki-option-listsyms_propagate*
vimwiki-option-maxhi vimwiki.txt /*vimwiki-option-maxhi*
vimwiki-option-name vimwiki.txt /*vimwiki-option-name*
vimwiki-option-nested_syntaxes vimwiki.txt /*vimwiki-option-nested_syntaxes*
vimwiki-option-path vimwiki.txt /*vimwiki-option-path*
vimwiki-option-path_html vimwiki.txt /*vimwiki-option-path_html*
vimwiki-option-rss_max_items vimwiki.txt /*vimwiki-option-rss_max_items*
vimwiki-option-rss_name vimwiki.txt /*vimwiki-option-rss_name*
vimwiki-option-syntax vimwiki.txt /*vimwiki-option-syntax*
vimwiki-option-template_date_format vimwiki.txt /*vimwiki-option-template_date_format*
vimwiki-option-template_default vimwiki.txt /*vimwiki-option-template_default*
vimwiki-option-template_ext vimwiki.txt /*vimwiki-option-template_ext*
vimwiki-option-template_path vimwiki.txt /*vimwiki-option-template_path*
vimwiki-options vimwiki.txt /*vimwiki-options*
vimwiki-placeholders vimwiki.txt /*vimwiki-placeholders*
vimwiki-prerequisites vimwiki.txt /*vimwiki-prerequisites*
vimwiki-register-extension vimwiki.txt /*vimwiki-register-extension*
vimwiki-register-wiki vimwiki.txt /*vimwiki-register-wiki*
vimwiki-syntax vimwiki.txt /*vimwiki-syntax*
vimwiki-syntax-blockquotes vimwiki.txt /*vimwiki-syntax-blockquotes*
vimwiki-syntax-comments vimwiki.txt /*vimwiki-syntax-comments*
vimwiki-syntax-headers vimwiki.txt /*vimwiki-syntax-headers*
vimwiki-syntax-hr vimwiki.txt /*vimwiki-syntax-hr*
vimwiki-syntax-links vimwiki.txt /*vimwiki-syntax-links*
vimwiki-syntax-lists vimwiki.txt /*vimwiki-syntax-lists*
vimwiki-syntax-math vimwiki.txt /*vimwiki-syntax-math*
vimwiki-syntax-options vimwiki.txt /*vimwiki-syntax-options*
vimwiki-syntax-paragraphs vimwiki.txt /*vimwiki-syntax-paragraphs*
vimwiki-syntax-preformatted vimwiki.txt /*vimwiki-syntax-preformatted*
vimwiki-syntax-tables vimwiki.txt /*vimwiki-syntax-tables*
vimwiki-syntax-tags vimwiki.txt /*vimwiki-syntax-tags*
vimwiki-syntax-typefaces vimwiki.txt /*vimwiki-syntax-typefaces*
vimwiki-table-mappings vimwiki.txt /*vimwiki-table-mappings*
vimwiki-table-of-contents vimwiki.txt /*vimwiki-table-of-contents*
vimwiki-tables vimwiki.txt /*vimwiki-tables*
vimwiki-tagbar vimwiki.txt /*vimwiki-tagbar*
vimwiki-template vimwiki.txt /*vimwiki-template*
vimwiki-temporary-wiki vimwiki.txt /*vimwiki-temporary-wiki*
vimwiki-text-objects vimwiki.txt /*vimwiki-text-objects*
vimwiki-title vimwiki.txt /*vimwiki-title*
vimwiki-toc vimwiki.txt /*vimwiki-toc*
vimwiki-todo-lists vimwiki.txt /*vimwiki-todo-lists*
vimwiki.txt vimwiki.txt /*vimwiki.txt*
vimwiki_+ vimwiki.txt /*vimwiki_+*
vimwiki_- vimwiki.txt /*vimwiki_-*
vimwiki_<A-Left> vimwiki.txt /*vimwiki_<A-Left>*
vimwiki_<A-Right> vimwiki.txt /*vimwiki_<A-Right>*
vimwiki_<Backspace> vimwiki.txt /*vimwiki_<Backspace>*
vimwiki_<C-CR> vimwiki.txt /*vimwiki_<C-CR>*
vimwiki_<C-Down> vimwiki.txt /*vimwiki_<C-Down>*
vimwiki_<C-S-CR> vimwiki.txt /*vimwiki_<C-S-CR>*
vimwiki_<C-Space> vimwiki.txt /*vimwiki_<C-Space>*
vimwiki_<C-Up> vimwiki.txt /*vimwiki_<C-Up>*
vimwiki_<CR> vimwiki.txt /*vimwiki_<CR>*
vimwiki_<D-CR> vimwiki.txt /*vimwiki_<D-CR>*
vimwiki_<Leader>w<Leader>i vimwiki.txt /*vimwiki_<Leader>w<Leader>i*
vimwiki_<Leader>w<Leader>m vimwiki.txt /*vimwiki_<Leader>w<Leader>m*
vimwiki_<Leader>w<Leader>t vimwiki.txt /*vimwiki_<Leader>w<Leader>t*
vimwiki_<Leader>w<Leader>w vimwiki.txt /*vimwiki_<Leader>w<Leader>w*
vimwiki_<Leader>w<Leader>y vimwiki.txt /*vimwiki_<Leader>w<Leader>y*
vimwiki_<Leader>wc vimwiki.txt /*vimwiki_<Leader>wc*
vimwiki_<Leader>wd vimwiki.txt /*vimwiki_<Leader>wd*
vimwiki_<Leader>wh vimwiki.txt /*vimwiki_<Leader>wh*
vimwiki_<Leader>whh vimwiki.txt /*vimwiki_<Leader>whh*
vimwiki_<Leader>wi vimwiki.txt /*vimwiki_<Leader>wi*
vimwiki_<Leader>wn vimwiki.txt /*vimwiki_<Leader>wn*
vimwiki_<Leader>wr vimwiki.txt /*vimwiki_<Leader>wr*
vimwiki_<Leader>ws vimwiki.txt /*vimwiki_<Leader>ws*
vimwiki_<Leader>wt vimwiki.txt /*vimwiki_<Leader>wt*
vimwiki_<Leader>ww vimwiki.txt /*vimwiki_<Leader>ww*
vimwiki_<M-CR> vimwiki.txt /*vimwiki_<M-CR>*
vimwiki_<S-CR> vimwiki.txt /*vimwiki_<S-CR>*
vimwiki_<S-Tab> vimwiki.txt /*vimwiki_<S-Tab>*
vimwiki_<Tab> vimwiki.txt /*vimwiki_<Tab>*
vimwiki_= vimwiki.txt /*vimwiki_=*
vimwiki_[= vimwiki.txt /*vimwiki_[=*
vimwiki_[[ vimwiki.txt /*vimwiki_[[*
vimwiki_[u vimwiki.txt /*vimwiki_[u*
vimwiki_]= vimwiki.txt /*vimwiki_]=*
vimwiki_]] vimwiki.txt /*vimwiki_]]*
vimwiki_]u vimwiki.txt /*vimwiki_]u*
vimwiki_gL# vimwiki.txt /*vimwiki_gL#*
vimwiki_gL- vimwiki.txt /*vimwiki_gL-*
vimwiki_gL1 vimwiki.txt /*vimwiki_gL1*
vimwiki_gL<Space> vimwiki.txt /*vimwiki_gL<Space>*
vimwiki_gLA vimwiki.txt /*vimwiki_gLA*
vimwiki_gLI vimwiki.txt /*vimwiki_gLI*
vimwiki_gLa vimwiki.txt /*vimwiki_gLa*
vimwiki_gLh vimwiki.txt /*vimwiki_gLh*
vimwiki_gLi vimwiki.txt /*vimwiki_gLi*
vimwiki_gLl vimwiki.txt /*vimwiki_gLl*
vimwiki_gLr vimwiki.txt /*vimwiki_gLr*
vimwiki_gLstar vimwiki.txt /*vimwiki_gLstar*
vimwiki_gl# vimwiki.txt /*vimwiki_gl#*
vimwiki_gl- vimwiki.txt /*vimwiki_gl-*
vimwiki_gl1 vimwiki.txt /*vimwiki_gl1*
vimwiki_gl<Space> vimwiki.txt /*vimwiki_gl<Space>*
vimwiki_glA vimwiki.txt /*vimwiki_glA*
vimwiki_glI vimwiki.txt /*vimwiki_glI*
vimwiki_gla vimwiki.txt /*vimwiki_gla*
vimwiki_glh vimwiki.txt /*vimwiki_glh*
vimwiki_gli vimwiki.txt /*vimwiki_gli*
vimwiki_gll vimwiki.txt /*vimwiki_gll*
vimwiki_gln vimwiki.txt /*vimwiki_gln*
vimwiki_glp vimwiki.txt /*vimwiki_glp*
vimwiki_glr vimwiki.txt /*vimwiki_glr*
vimwiki_glstar vimwiki.txt /*vimwiki_glstar*
vimwiki_glx vimwiki.txt /*vimwiki_glx*
vimwiki_gnt vimwiki.txt /*vimwiki_gnt*
vimwiki_gq1 vimwiki.txt /*vimwiki_gq1*
vimwiki_gqq vimwiki.txt /*vimwiki_gqq*
vimwiki_gw1 vimwiki.txt /*vimwiki_gw1*
vimwiki_gww vimwiki.txt /*vimwiki_gww*
vimwiki_i_<C-D> vimwiki.txt /*vimwiki_i_<C-D>*
vimwiki_i_<C-L>_<C-J> vimwiki.txt /*vimwiki_i_<C-L>_<C-J>*
vimwiki_i_<C-L>_<C-K> vimwiki.txt /*vimwiki_i_<C-L>_<C-K>*
vimwiki_i_<C-L>_<C-M> vimwiki.txt /*vimwiki_i_<C-L>_<C-M>*
vimwiki_i_<C-T> vimwiki.txt /*vimwiki_i_<C-T>*
vimwiki_i_<CR> vimwiki.txt /*vimwiki_i_<CR>*
vimwiki_i_<CR>_table vimwiki.txt /*vimwiki_i_<CR>_table*
vimwiki_i_<S-CR> vimwiki.txt /*vimwiki_i_<S-CR>*
vimwiki_i_<S-Tab>_table vimwiki.txt /*vimwiki_i_<S-Tab>_table*
vimwiki_i_<Tab>_table vimwiki.txt /*vimwiki_i_<Tab>_table*
vimwiki_mouse vimwiki.txt /*vimwiki_mouse*

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100"
height="100"
viewBox="0 0 186 186.0465"
fill="none"
version="1.1"
id="svg86"
sodipodi:docname="vertical-logo.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata92">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs90" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1256"
inkscape:window-height="1000"
id="namedview88"
showgrid="false"
inkscape:zoom="6.33"
inkscape:cx="48.744425"
inkscape:cy="52.804906"
inkscape:window-x="1616"
inkscape:window-y="64"
inkscape:window-maximized="0"
inkscape:current-layer="svg86"
units="px" />
<path
d="m 57.306337,151.56994 c -1.657094,-0.76144 -2.982911,-1.87997 -3.977454,-3.35539 -0.947014,-1.47545 -1.894026,-3.1175 -2.841039,-4.9261 -0.142593,-0.28556 -0.284465,-0.57111 -0.426336,-0.85672 -0.142592,-0.28555 -0.284465,-0.54728 -0.426335,-0.78527 l -0.994544,-1.85624 -0.568208,-1.14226 -0.852672,0.78534 -1.278288,1.14225 -0.710079,0.71391 c -1.231478,1.14226 -2.486,2.28461 -3.765006,3.42686 -1.230758,1.0947 -2.557296,2.09415 -3.977457,2.99848 -1.373348,0.85672 -2.841757,1.57062 -4.403789,2.14179 -1.515941,0.52354 -3.173033,0.80909 -4.97272,0.85665 l -1.562749,-0.78527 c -0.899483,-0.47599 -1.657093,-0.90434 -2.272833,-1.28507 -0.615736,-0.3808 -1.325816,-0.97571 -2.130958,-1.7848 -0.236933,-0.42835 -0.450102,-0.83288 -0.639503,-1.21369 -0.141872,-0.38073 -0.307511,-0.76153 -0.496912,-1.14227 -0.520678,-0.95188 -0.947013,-1.8086 -1.278287,-2.57013 -0.331995,-0.76154 -0.663269,-1.61825 -0.994543,-2.57015 0.141873,-0.66627 0.35504,-1.78479 0.638784,-3.35542 0.284464,-1.61823 0.615738,-3.37922 0.994543,-5.28301 0.426335,-1.90386 0.852669,-3.80765 1.279006,-5.71144 0.473146,-1.95134 0.947014,-3.64095 1.420159,-5.06883 0.426337,-1.23744 0.900204,-2.54633 1.42088,-3.92658 0.568207,-1.38026 1.160181,-2.64151 1.775918,-3.78376 0.66255,-1.18989 1.37335,-2.18942 2.13096,-2.9985 0.757611,-0.85671 1.562753,-1.35644 2.414704,-1.49924 0.236932,0.33317 0.497632,0.57116 0.781375,0.71391 0.284464,0.1428 0.544442,0.2618 0.781376,0.35697 0.663268,0.95191 1.302053,1.76099 1.917791,2.42733 0.66327,0.66635 1.42088,1.33263 2.273552,1.99898 -0.236934,1.18989 -0.591973,2.52251 -1.065841,3.99801 -0.426336,1.42781 -0.899482,2.87943 -1.42088,4.35493 -0.473145,1.4278 -0.947012,2.83188 -1.420158,4.21213 -0.473867,1.38024 -0.852671,2.57013 -1.136416,3.56959 -0.284464,0.80914 -0.521397,1.71342 -0.710799,2.71293 -0.426335,1.76099 -0.828187,4.16457 -1.207712,7.21063 0.568927,-0.14281 1.183945,-0.45217 1.847215,-0.92808 0.663269,-0.47599 1.302054,-0.97571 1.917791,-1.49925 0.710079,-0.57117 1.42088,-1.2137 2.130959,-1.9276 0.899483,-0.90434 1.657094,-1.73725 2.272831,-2.49879 0.615739,-0.76143 1.183947,-1.54679 1.704625,-2.35588 0.568926,-0.80915 1.137135,-1.68961 1.705343,-2.64157 0.568207,-0.99946 1.254521,-2.16553 2.059663,-3.49823 0.71008,-1.14225 1.444645,-2.35589 2.202256,-3.64096 0.80442,-1.33269 1.585796,-2.59394 2.343406,-3.78383 0.805141,-1.23744 1.586517,-2.35596 2.344128,-3.35541 0.75761,-0.99953 1.444645,-1.7848 2.060383,-2.35596 0.378806,0.47598 0.851952,0.92808 1.420159,1.35643 0.615739,0.42836 1.255241,0.76154 1.917791,0.99953 0.284464,0.42835 0.545162,0.8329 0.781377,1.21362 0.284463,0.33318 0.545161,0.64253 0.781375,0.92816 0.284464,0.42835 0.545163,0.8329 0.781375,1.21363 0.284465,0.3808 0.545164,0.76153 0.781376,1.14233 -0.04681,0.3331 -0.118106,0.76145 -0.213168,1.285 -0.09435,0.52353 -0.212448,1.0947 -0.35504,1.71342 -0.09435,0.61872 -0.213168,1.26126 -0.355039,1.9276 -0.141872,0.61872 -0.283743,1.21371 -0.426336,1.7848 -0.378805,1.8086 -0.662548,3.16512 -0.851951,4.06939 -0.189404,0.90433 -0.331995,1.61824 -0.426337,2.14177 -0.04753,0.52354 -0.09507,0.97572 -0.141871,1.35644 0,0.33317 0,0.80917 0,1.42789 -0.04753,0.47591 -0.02377,0.95189 0.07058,1.4278 0.04753,0.42835 0.142593,0.88052 0.284464,1.35643 0.141873,0.47599 0.331275,0.90434 0.568207,1.28507 l 2.841039,-2.21315 c 0.805143,-0.61871 1.562754,-1.45162 2.272834,-2.4987 0.758329,-1.0947 1.46841,-2.33214 2.130959,-3.71239 0.7108,-1.42787 1.397113,-2.97468 2.060384,-4.64055 0.662548,-1.6658 1.325816,-3.35541 1.988367,-5.06884 0.994543,-2.52251 1.989087,-4.97366 2.98363,-7.35342 1.042075,-2.3797 2.036618,-4.21212 2.983631,-5.4972 1.041355,0.66633 1.941557,1.35644 2.699168,2.07043 0.80514,0.66627 1.491454,1.40398 2.059663,2.21313 0.568207,0.80909 1.018308,1.73717 1.349582,2.78425 0.378807,1.04716 0.639505,2.28459 0.781376,3.71247 -0.852672,1.66581 -1.680857,3.37923 -2.485999,5.1402 -0.75761,1.76106 -1.491454,3.52204 -2.202255,5.28302 -0.947012,2.28459 -1.941557,4.56912 -2.982911,6.8537 -0.994543,2.28452 -2.107193,4.47393 -3.33867,6.56808 -1.231477,2.04661 -2.604827,3.95041 -4.120047,5.71138 -1.515221,1.71343 -3.267375,3.16511 -5.256465,4.35493 -0.520676,-0.14272 -0.970777,-0.21417 -1.349583,-0.21417 -0.75761,0 -1.396394,0.21417 -1.917791,0.64252 z"
fill="#e5e5e5"
id="path76"
style="stroke-width:0.721988" />
<path
d="m 92.396232,145.6444 c 0.236928,1.42788 0.141863,2.54633 -0.284466,3.35548 -0.378802,0.80908 -0.947017,1.40399 -1.704611,1.78479 -0.710087,0.42835 -1.538988,0.66635 -2.486004,0.71391 -0.947016,0.0477 -1.846494,0 -2.699175,-0.14281 -0.473857,-0.66628 -0.899478,-1.49919 -1.278291,-2.4987 -0.378791,-0.99953 -0.734555,-2.02279 -1.065829,-3.06986 -0.331275,-1.0947 -0.6395,-2.1656 -0.923258,-3.21269 -0.236934,-1.04707 -0.450096,-1.97515 -0.6395,-2.78431 0.236936,-0.5711 0.378811,-1.21363 0.426332,-1.92761 0.09436,-0.76145 0.141875,-1.52298 0.141875,-2.28452 0.04755,-0.76153 0.07133,-1.52306 0.07133,-2.28458 0.04756,-0.80909 0.118115,-1.57063 0.213181,-2.28453 0.331274,-1.99897 0.805132,-3.90276 1.420154,-5.71137 0.663269,-1.8086 1.183945,-3.68865 1.562747,-5.63999 0.09512,-0.42837 0.04756,-0.8329 -0.141864,-1.2137 -0.141873,-0.38074 -0.165642,-0.73772 -0.07129,-1.0709 0.04755,-0.19037 0.189401,-0.30936 0.426341,-0.35691 0.236917,-0.0953 0.378791,-0.26181 0.426329,-0.49979 0.141874,-0.52354 0.165643,-0.9519 0.07129,-1.28508 -0.04755,-0.33316 0.04681,-0.73771 0.283747,-1.21363 0.236929,-0.3808 0.521395,-0.92808 0.852669,-1.64205 0.378803,-0.76153 0.520677,-1.54681 0.426331,-2.35595 0.42561,-0.28556 0.828191,-0.61873 1.206994,-0.99945 0.378802,-0.3808 0.757615,-0.71391 1.136417,-0.99953 0.42633,-0.33317 0.876429,-0.61872 1.350296,-0.85668 0.520677,-0.23799 1.136418,-0.35698 1.846505,-0.35698 0.378802,0.47595 0.61572,0.99948 0.710066,1.57065 0.142594,0.5711 0.260709,1.14226 0.355044,1.71343 0.142593,0.57108 0.331995,1.11844 0.568934,1.64198 0.236209,0.47598 0.638769,0.85671 1.206983,1.14233 0,0.38073 0,0.85665 0,1.42781 0,0.57116 0.02373,1.14225 0.07129,1.71342 0.04755,0.52354 0.141874,1.02327 0.283748,1.49926 0.1894,0.42835 0.473867,0.71389 0.852673,0.8567 -0.852673,2.28452 -1.657097,4.54531 -2.414702,6.78226 -0.710807,2.23697 -1.302779,4.49774 -1.775926,6.78226 -0.473858,2.23697 -0.781375,4.49774 -0.923968,6.78227 -0.09437,2.28459 0.07129,4.59293 0.497637,6.92508 z"
fill="#e5e5e5"
id="path78"
style="stroke-width:0.721988" />
<path
d="m 143.46797,148.07174 c -2.27282,0.0952 -4.28569,0.0477 -6.03785,-0.14276 -1.70461,-0.19042 -3.38546,-0.64252 -5.04328,-1.3565 -0.0944,-0.0477 -0.1894,-0.16655 -0.28375,-0.35691 -0.0951,-0.19036 -0.1894,-0.33318 -0.28446,-0.42836 -0.28374,-0.14281 -0.63949,-0.19038 -1.06513,-0.14281 -0.37881,0 -0.7108,-0.0477 -0.99453,-0.14281 -0.37881,-0.19037 -0.97078,-0.54728 -1.77593,-1.07082 -0.80513,-0.57116 -1.53898,-1.0947 -2.20226,-1.57069 -0.85193,-0.66628 -1.65709,-1.33263 -2.41469,-1.99897 -0.75761,-0.66636 -1.42089,-1.38026 -1.9891,-2.14179 -0.14186,-0.19036 -0.33127,-0.28556 -0.5682,-0.28556 -0.23693,-0.0477 -0.45011,-0.11898 -0.63949,-0.21416 -1.37336,0.8567 -2.53354,1.9276 -3.48055,3.21268 -0.94701,1.28506 -1.8465,2.59388 -2.69917,3.92656 -0.85195,1.33262 -1.75215,2.59389 -2.69916,3.78377 -0.94703,1.18989 -2.15474,2.09425 -3.62243,2.71295 -0.42633,0 -0.80513,-0.0715 -1.13642,-0.21418 -0.33127,-0.14279 -0.6395,-0.33316 -0.92323,-0.57116 -0.28448,-0.19036 -0.56822,-0.38072 -0.85268,-0.57116 -0.28446,-0.19036 -0.59198,-0.33311 -0.92326,-0.42835 0,-0.5711 -0.11882,-1.09464 -0.35503,-1.57062 -0.18941,-0.47591 -0.40258,-0.92808 -0.63951,-1.35644 -0.18939,-0.42835 -0.33127,-0.8329 -0.42632,-1.2137 -0.0944,-0.42835 0,-0.83289 0.28445,-1.21362 -0.28445,-0.28555 -0.7108,-0.59499 -1.27901,-0.92808 0.28446,-0.28562 0.40258,-0.54736 0.35505,-0.78536 0,-0.238 -0.0468,-0.47599 -0.14187,-0.7139 -0.0944,-0.23798 -0.18941,-0.49979 -0.28376,-0.78534 -0.0476,-0.28556 0.0239,-0.57116 0.21317,-0.85672 0.23622,0 0.52068,-0.0476 0.85197,-0.14273 -0.28375,-0.3808 -0.42635,-0.59498 -0.42635,-0.64255 0.0476,-0.0953 0,-0.21417 -0.14186,-0.35698 -0.0944,-0.28555 -0.0476,-0.45218 0.14186,-0.49972 0.18941,-0.0952 0.37881,-0.19044 0.56821,-0.28562 0.18941,-2.33215 0.59197,-4.49767 1.20772,-6.49671 0.61573,-1.99898 1.30205,-3.92659 2.06037,-5.78275 0.75763,-1.85623 1.49146,-3.73621 2.20153,-5.64 0.75761,-1.90378 1.37336,-3.95039 1.84722,-6.13972 0.52069,-0.52355 0.92326,-1.14234 1.207,-1.85624 0.33199,-0.7139 0.66327,-1.42781 0.99455,-2.14179 0.3788,-0.71389 0.78137,-1.40398 1.20771,-2.07033 0.47314,-0.71391 1.11265,-1.28507 1.91778,-1.71343 0.66327,0.0476 1.25525,0.23797 1.77593,0.57117 0.52068,0.28555 1.16017,0.40454 1.91778,0.35691 0.14188,0.23799 0.2607,0.47599 0.35504,0.71399 0.14188,0.23792 0.30824,0.4759 0.49765,0.71389 l 1.06511,-0.21417 c 0.52068,0.42836 0.9708,0.9757 1.34959,1.64197 0.42633,0.6188 0.71007,1.28508 0.85267,1.99905 0.14186,0.7139 0.11811,1.40399 -0.0713,2.07034 -0.1894,0.61873 -0.6395,1.11852 -1.34959,1.49925 0.0476,0.23799 0.0476,0.42835 0,0.57116 0,0.0952 -0.0238,0.19037 -0.0713,0.28555 -0.0468,0.0952 -0.0705,0.19037 -0.0705,0.28555 0,0.0952 0.0705,0.23799 0.21316,0.42836 -0.94699,0.71391 -1.6578,1.71343 -2.13094,2.99849 -0.47387,1.28507 -0.73458,2.42733 -0.78139,3.42685 0.5682,-0.57116 1.18395,-1.11851 1.8465,-1.64206 0.71009,-0.57109 1.42088,-1.11844 2.13096,-1.64198 0.75761,-0.52354 1.46842,-1.02334 2.13096,-1.49924 0.71008,-0.47599 1.34959,-0.9519 1.91779,-1.42788 1.56274,-1.42781 3.05421,-2.57015 4.47509,-3.42685 1.46769,-0.90428 3.00739,-1.9038 4.61694,-2.99843 0.37882,-0.0952 0.66328,-0.0952 0.85268,0 0.23693,0.0476 0.47316,0.119 0.71009,0.21418 0,-0.28562 -0.0944,-0.45217 -0.28375,-0.4998 -0.1426,-0.0476 -0.18941,-0.23791 -0.1426,-0.5711 0.71082,-0.19043 1.32583,-0.4046 1.84722,-0.64252 0.52068,-0.28562 1.08889,-0.54736 1.70463,-0.78535 0.42633,0.42835 0.8289,0.88053 1.20772,1.35643 0.37879,0.42837 0.89947,0.69017 1.56274,0.78535 0.23621,0.52354 0.52068,0.92808 0.85195,1.2137 0.33201,0.23792 0.66327,0.47591 0.99454,0.7139 0.33128,0.238 0.61574,0.52354 0.85267,0.85672 0.28375,0.33318 0.44939,0.85671 0.49692,1.57061 -0.18941,0.33318 -0.40257,0.69009 -0.63951,1.07089 -0.18939,0.38074 -0.37881,0.83291 -0.56821,1.35644 -0.947,0.85672 -1.91778,1.61825 -2.91231,2.2846 -0.94704,0.66627 -1.91781,1.3088 -2.91235,1.9276 -0.99382,0.61872 -2.01214,1.23744 -3.05421,1.85616 -1.04136,0.61872 -2.10718,1.35644 -3.19608,2.21316 -0.23694,0.33316 -0.54444,0.64252 -0.92324,0.92808 -0.332,0.23798 -0.68703,0.49978 -1.06584,0.78533 -0.3788,0.238 -0.73384,0.49973 -1.06513,0.78535 -0.33199,0.28554 -0.59196,0.61872 -0.78139,0.99945 -0.14258,0.0477 -0.28446,0.0714 -0.42633,0.0714 -0.14187,0 -0.28446,0.0238 -0.42632,0.0714 -0.14188,0.33317 -0.37881,0.59492 -0.71008,0.78535 -0.28446,0.19037 -0.47387,0.4521 -0.5682,0.78526 0.71006,1.52307 1.63331,2.68915 2.76973,3.49824 1.13642,0.80915 2.41543,1.40405 3.83558,1.78477 1.42087,0.33318 2.95986,0.52362 4.61768,0.57118 1.6571,0 3.38547,0 5.18517,0 0.1894,-0.0477 0.25998,-0.14281 0.21317,-0.28555 0,-0.19036 0.1181,-0.2618 0.35503,-0.21418 1.13641,0.38073 2.01214,0.92808 2.62786,1.64199 0.61575,0.66635 1.34959,1.3327 2.20227,1.99904 -0.095,1.80854 -0.63951,3.30779 -1.63406,4.49769 -0.99453,1.18988 -2.32035,2.14177 -3.97745,2.85568 z"
fill="#e5e5e5"
id="path80"
style="stroke-width:0.721988" />
<path
d="m 162.64661,145.6444 c 0.23693,1.42788 0.14187,2.54633 -0.28446,3.35548 -0.37882,0.80908 -0.94703,1.40399 -1.70463,1.78479 -0.7101,0.42835 -1.539,0.66635 -2.486,0.71391 -0.94702,0.0477 -1.84721,0 -2.69917,-0.14281 -0.47387,-0.66628 -0.9002,-1.49919 -1.279,-2.4987 -0.37881,-0.99953 -0.73384,-2.02279 -1.06514,-3.06986 -0.33127,-1.0947 -0.63948,-2.1656 -0.92323,-3.21269 -0.23696,-1.04707 -0.45011,-1.97515 -0.63951,-2.78431 0.23694,-0.5711 0.3788,-1.21363 0.42633,-1.92761 0.0944,-0.76145 0.14187,-1.52298 0.14187,-2.28452 0.0476,-0.76153 0.0712,-1.52306 0.0712,-2.28458 0.0468,-0.80909 0.11812,-1.57063 0.21317,-2.28453 0.33126,-1.99897 0.80441,-3.90276 1.42017,-5.71137 0.66327,-1.8086 1.18395,-3.68865 1.56275,-5.63999 0.0951,-0.42837 0.0476,-0.8329 -0.14188,-1.2137 -0.14187,-0.38074 -0.16565,-0.73772 -0.0713,-1.0709 0.0476,-0.19037 0.18939,-0.30936 0.42634,-0.35691 0.23693,-0.0953 0.3788,-0.26181 0.42633,-0.49979 0.14188,-0.52354 0.16563,-0.9519 0.0712,-1.28508 -0.0476,-0.33316 0.0468,-0.73771 0.28375,-1.21363 0.23695,-0.3808 0.52066,-0.92808 0.85266,-1.64205 0.37881,-0.76153 0.52068,-1.54681 0.42562,-2.35595 0.42635,-0.28556 0.82891,-0.61873 1.20772,-0.99945 0.3788,-0.3808 0.75759,-0.71391 1.13641,-0.99953 0.42634,-0.33317 0.87644,-0.61872 1.34959,-0.85668 0.52139,-0.23799 1.13641,-0.35698 1.8472,-0.35698 0.37881,0.47595 0.61575,0.99948 0.7101,1.57065 0.14187,0.5711 0.26068,1.14226 0.35503,1.71343 0.14259,0.57108 0.332,1.11844 0.56821,1.64198 0.23694,0.47598 0.63949,0.85671 1.2077,1.14233 0,0.38073 0,0.85665 0,1.42781 0,0.57116 0.0238,1.14225 0.0713,1.71342 0.0476,0.52354 0.14186,1.02327 0.28374,1.49926 0.18941,0.42835 0.47386,0.71389 0.85266,0.8567 -0.85266,2.28452 -1.6578,4.54531 -2.41542,6.78226 -0.71008,2.23697 -1.30205,4.49774 -1.77521,6.78226 -0.47386,2.23697 -0.78137,4.49774 -0.92395,6.78227 -0.0944,2.28459 0.0712,4.59293 0.49763,6.92508 z"
fill="#e5e5e5"
id="path82"
style="stroke-width:0.721988" />
<rect
x="84.206207"
width="14.097202"
height="167.75996"
rx="1.5241456"
fill="#00ffa3"
id="rect84"
y="-176.87997"
style="stroke-width:1.0187"
transform="rotate(90)" />
<path
d="m 70.621435,35.89871 c 2.69107,1.604304 4.036557,3.312078 4.036557,5.123322 0,1.034983 -0.517539,2.458192 -1.552521,4.269435 L 57.036869,72.848731 c -0.517538,0.879731 -1.345487,1.68193 -2.484035,2.406408 -1.138548,0.672791 -2.277,1.00914 -3.415548,1.00914 -1.086765,0 -2.147687,-0.258722 -3.18267,-0.776261 -0.983295,-0.569227 -1.68193,-1.138548 -2.095904,-1.707775 L 45.160077,72.926356 29.01385,45.291467 c -1.035015,-1.707774 -1.552523,-3.105044 -1.552523,-4.191809 0,-1.863026 1.345517,-3.596644 4.036557,-5.200948 1.966524,-1.138547 3.519047,-1.707774 4.657566,-1.707774 1.138548,0 2.018278,0.362286 2.639287,1.086765 0.672791,0.672791 1.371426,1.707774 2.095904,3.105044 L 51.05966,57.944521 61.228678,38.382745 c 0.569227,-0.983296 0.983296,-1.68193 1.242018,-2.095904 0.310504,-0.465757 0.77626,-0.90567 1.39727,-1.319644 0.621008,-0.465756 1.449051,-0.698635 2.484034,-0.698635 1.034984,0 2.458191,0.543382 4.269435,1.630148 z"
fill="#000000"
id="path230"
style="stroke-width:0.946656" />
<path
d="m 78.903761,41.798293 c 0,-1.190235 0.02584,-2.070061 0.07763,-2.639287 0.10347,-0.621009 0.336348,-1.319644 0.698635,-2.095904 0.724478,-1.345488 2.742756,-2.018279 6.054835,-2.018279 2.484035,0 4.243591,0.439913 5.278574,1.319644 0.879731,0.724479 1.345583,1.837182 1.39727,3.337922 0.05179,0.517539 0.07763,1.267861 0.07763,2.251156 v 27.169133 c 0,1.190236 -0.05178,2.095905 -0.155252,2.716913 -0.05169,0.569227 -0.284661,1.242018 -0.698635,2.018279 -0.672696,1.345487 -2.665132,2.018278 -5.977209,2.018278 -3.260296,0 -5.252731,-0.698635 -5.977209,-2.095905 -0.362287,-0.77626 -0.595165,-1.449051 -0.698635,-2.018278 -0.05179,-0.569226 -0.07763,-1.474895 -0.07763,-2.716913 z"
fill="#000000"
id="path232"
style="stroke-width:0.946656" />
<path
d="m 112.04102,40.401023 c 2.43225,-3.67427 5.3562,-5.511452 8.77175,-5.511452 5.27819,0 9.21156,2.251156 11.79878,6.75347 0.56989,-0.776261 1.24201,-1.578366 2.01828,-2.406409 0.82832,-0.879731 2.12241,-1.811244 3.8813,-2.79454 1.75984,-1.034982 3.5708,-1.552521 5.43383,-1.552521 4.14069,0 7.60736,1.604304 10.40189,4.812818 2.79454,3.156825 4.19182,8.409462 4.19182,15.758097 v 13.584566 c 0,1.190235 -0.0512,2.095905 -0.15526,2.716913 -0.0512,0.569227 -0.28399,1.242018 -0.69864,2.018278 -0.67212,1.39727 -2.66483,2.095905 -5.9772,2.095905 -3.2603,0 -5.25207,-0.724479 -5.97721,-2.17353 -0.36162,-0.776262 -0.5945,-1.449053 -0.69864,-2.018278 -0.0511,-0.62101 -0.0776,-1.526679 -0.0776,-2.716914 V 55.382859 c 0,-4.502313 -1.60365,-6.75347 -4.81283,-6.75347 -1.81095,0 -3.05297,0.595166 -3.72605,1.785401 -0.62101,1.190235 -0.93151,2.872165 -0.93151,5.045696 v 13.584566 c 0,1.242018 -0.0511,2.147687 -0.15526,2.716913 -0.0511,0.569227 -0.28399,1.242018 -0.69863,2.018278 -0.72419,1.39727 -2.74247,2.095905 -6.05483,2.095905 -3.2603,0 -5.25207,-0.724479 -5.97721,-2.17353 -0.36162,-0.776262 -0.59479,-1.449053 -0.69826,-2.018278 -0.0518,-0.62101 -0.0776,-1.526679 -0.0776,-2.716914 V 55.382859 c 0,-4.502313 -1.6043,-6.75347 -4.81282,-6.75347 -3.10505,0 -4.65756,2.251157 -4.65756,6.75347 v 13.739819 c 0,1.190236 -0.0518,2.095905 -0.15526,2.716913 -0.0518,0.569227 -0.28466,1.242018 -0.69864,2.018279 -0.77625,1.345487 -2.79453,2.018278 -6.05484,2.018278 -3.26028,0 -5.25272,-0.698635 -5.977196,-2.095905 -0.362286,-0.77626 -0.595164,-1.449051 -0.698635,-2.018278 -0.05178,-0.569226 -0.07763,-1.474895 -0.07763,-2.716913 V 41.720667 c 0,-1.190236 0.02584,-2.070061 0.07763,-2.639287 0.103471,-0.621009 0.362288,-1.293799 0.776262,-2.018278 0.776259,-1.39727 2.613439,-2.095905 5.511449,-2.095905 2.89801,0 4.78698,0.465757 5.66671,1.39727 0.87972,0.931513 1.31964,2.277 1.31964,4.036556 z"
fill="#000000"
id="path234"
style="stroke-width:0.946656" />
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,598 @@
*vimwiki-emoji.txt* A Reference table of markdown emoji
==============================================================================
CONTENTS *vimwiki-emoji*
1. People |vimwiki-emoji-people|
1.1. Face |vimwiki-emoji-face|
1.2. Job |vimwiki-emoji-job|
1.3. Familly |vimwiki-emoji-familly|
2. Activity |vimwiki-emoji-activity|
3. Places |vimwiki-emoji-places|
4. Nature |vimwiki-emoji-nature|
5. Objects |vimwiki-emoji-objects|
6. Foods |vimwiki-emoji-foods|
7. Symbols |vimwiki-emoji-symbols|
8. Flags |vimwiki-emoji-flags|
==============================================================================
1. People *vimwiki-emoji-people*
------------------------------------------------------------------------------
1.1 Face *vimwiki-emoji-face*
| 😀 | grinning | 😃 | smiley | 😄 | smile
| 😁 | grin | 😆 | laughing | 😅 | sweat_smile
| 😂 | joy | 🤣 | rofl | ☺️ | relaxed
| 😊 | blush | 😇 | innocent | 🙂 | slightly_smiling_face
| 🙃 | upside_down_face | 😉 | wink | 😌 | relieved
| 😍 | heart_eyes | 😘 | kissing_heart | 😗 | kissing
| 😙 | kissing_smiling_eyes | 😚 | kissing_closed_eyes | 😋 | yum
| 😜 | stuck_out_tongue_winking_eye | 😝 | stuck_out_tongue_closed_eyes| 😛 | stuck_out_tongue
| 🤑 | money_mouth_face | 🤗 | hugs | 🤓 | nerd_face
| 😎 | sunglasses | 🤡 | clown_face | 🤠 | cowboy_hat_face
| 😏 | smirk | 😒 | unamused | 😞 | disappointed
| 😔 | pensive | 😟 | worried | 😕 | confused
| 🙁 | slightly_frowning_face | ☹️ | frowning_face | 😣 | persevere
| 😖 | confounded | 😫 | tired_face | 😩 | weary
| 😤 | triumph | 😠 | angry | 😡 | rage
| 😶 | no_mouth | 😐 | neutral_face | 😑 | expressionless
| 😯 | hushed | 😦 | frowning | 😧 | anguished
| 😮 | open_mouth | 😲 | astonished | 😵 | dizzy_face
| 😳 | flushed | 😱 | scream | 😨 | fearful
| 😰 | cold_sweat | 😢 | cry | 😥 | disappointed_relieved
| 🤤 | drooling_face | 😭 | sob | 😓 | sweat
| 😪 | sleepy | 😴 | sleeping | 🙄 | roll_eyes
| 🤔 | thinking | 🤥 | lying_face | 😬 | grimacing
| 🤐 | zipper_mouth_face | 🤢 | nauseated_face | 🤧 | sneezing_face
| 😷 | mask | 🤒 | face_with_thermometer | 🤕 | face_with_head_bandage
| 😈 | smiling_imp | 👿 | imp | 👹 | japanese_ogre
| 👺 | japanese_goblin | 💩 | hankey | 👻 | ghost
| 💀 | skull | ☠️ | skull_and_crossbones| 👽 | alien
| 👾 | space_invader | 🤖 | robot | 🎃 | jack_o_lantern
| 😺 | smiley_cat | 😸 | smile_cat | 😹 | joy_cat
| 😻 | heart_eyes_cat | 😼 | smirk_cat | 😽 | kissing_cat
| 🙀 | scream_cat | 😿 | crying_cat_face | 😾 | pouting_cat
| 👐 | open_hands | 🙌 | raised_hands | 👏 | clap
| 🙏 | pray | 🤝 | handshake | 👍 | +1
| 👎 | -1 | 👊 | fist_oncoming | ✊ | fist_raised
| 🤛 | fist_left | 🤜 | fist_right | 🤞 | crossed_fingers
| ✌️ | v | 🤘 | metal | 👌 | ok_hand
| 👈 | point_left | 👉 | point_right | 👆 | point_up_2
| 👇 | point_down | ☝️ | point_up | ✋ | hand
| 🤚 | raised_back_of_hand | 🖐 | raised_hand_with_fingers_splayed | 🖖 | vulcan_salute
| 👋 | wave | 🤙 | call_me_hand | 💪 | muscle
| 🖕 | middle_finger | ✍️ | writing_hand | 🤳 | selfie
| 💅 | nail_care | 💍 | ring | 💄 | lipstick
| 💋 | kiss | 👄 | lips | 👅 | tongue
| 👂 | ear | 👃 | nose | 👣 | footprints
| 👁 | eye | 👀 | eyes | 🗣 | speaking_head
------------------------------------------------------------------------------
1.2 Job *vimwiki-emoji-job*
| 👤 | bust_in_silhouette | 👥 | busts_in_silhouette | 👶 | baby
| 👦 | boy | 👧 | girl | 👨 | man
| 👩 | woman | 👱‍♀️ | blonde_woman| 👱 | blonde_man
| 👴 | older_man | 👵 | older_woman | 👲 | man_with_gua_pi_mao
| 👳‍♀️ | woman_with_turban | 👳 | man_with_turban
| 👮‍♀️ | policewoman | 👮 | policeman
| 👷‍♀️ | construction_worker_woman| 👷 | construction_worker_man
| 💂‍♀️ | guardswoman | 💂 | guardsman
| 🕵️‍♀️ | female_detective | 🕵️ | male_detective
| 👩‍⚕️ | woman_health_worker | 👨‍⚕️ | man_health_worker
| 👩‍🌾 | woman_farmer | 👨‍🌾 | man_farmer
| 👩‍🍳 | woman_cook | 👨‍🍳 | man_cook
| 👩‍🎓 | woman_student | 👨‍🎓 | man_student
| 👩‍🎤 | woman_singer | 👨‍🎤 | man_singer
| 👩‍🏫 | woman_teacher | 👨‍🏫 | man_teacher
| 👩‍🏭 | woman_factory_worker | 👨‍🏭 | man_factory_worker
| 👩‍💻 | woman_technologist | 👨‍💻 | man_technologist
| 👩‍💼 | woman_office_worker | 👨‍💼 | man_office_worker
| 👩‍🔧 | woman_mechanic | 👨‍🔧 | man_mechanic
| 👩‍🔬 | woman_scientist | 👨‍🔬 | man_scientist
| 👩‍🎨 | woman_artist | 👨‍🎨 | man_artist
| 👩‍🚒 | woman_firefighter | 👨‍🚒 | man_firefighter
| 👩‍✈️ | woman_pilot | 👨‍✈️ | man_pilot
| 👩‍🚀 | woman_astronaut | 👨‍🚀 | man_astronaut
| 👩‍⚖️ | woman_judge | 👨‍⚖️ | man_judge
| 🤶 | mrs_claus | 🎅 | santa
| 👸 | princess | 🤴 | prince
| 👰 | bride_with_veil | 🤵 | man_in_tuxedo
| 👼 | angel | 🤰 | pregnant_woman
| 🙇‍♀️ | bowing_woman | 🙇 | bowing_man
| 💁 | tipping_hand_woman | 💁‍♂️ | tipping_hand_man
| 🙅 | no_good_woman | 🙅‍♂️ | no_good_man
| 🙆 | ok_woman | 🙆‍♂️ | ok_man
| 🙋 | raising_hand_woman | 🙋‍♂️ | raising_hand_man
| 🤦‍♀️ | woman_facepalming | 🤦‍♂️ | man_facepalming
| 🤷‍♀️ | woman_shrugging | 🤷‍♂️ | man_shrugging
| 🙎 | pouting_woman | 🙎‍♂️ | pouting_man
| 🙍 | frowning_woman | 🙍‍♂️ | frowning_man
| 💇 | haircut_woman | 💇‍♂️ | haircut_man
| 💆 | massage_woman | 💆‍♂️ | massage_man
| 🕴 | business_suit_levitating | 💃 | dancer
| 🕺 | man_dancing | 👯 | dancing_women
| 👯‍♂️ | dancing_men | 🚶‍♀️ | walking_woman
| 🚶 | walking_man | 🏃‍♀️ | running_woman
| 🏃 | running_man | 👚 | womans_clothes
| 👕 | shirt | 👖 | jeans
| 👔 | necktie | 👗 | dress | 👙 | bikini
| 👘 | kimono | 👠 | high_heel | 👡 | sandal
| 👢 | boot | 👞 | mans_shoe | 👟 | athletic_shoe
| 👒 | womans_hat | 🎩 | tophat | 🎓 | mortar_board
| 👑 | crown | ⛑ | rescue_worker_helmet| 🎒 | school_satchel
| 👝 | pouch | 👛 | purse | 👜 | handbag
| 💼 | briefcase | 👓 | eyeglasses | 🕶 | dark_sunglasses
| 🌂 | closed_umbrella | ☂️ | open_umbrella
------------------------------------------------------------------------------
1.3 Familly *vimwiki-emoji-familly*
| 👫 | couple
| 👭 | two_women_holding_hands
| 👬 | two_men_holding_hands
| 💑 | couple_with_heart_woman_man
| 👩‍❤️‍👩 | couple_with_heart_woman_woman
| 👨‍❤️‍👨 | couple_with_heart_man_man
| 💏 | couplekiss_man_woman
| 👩‍❤️‍💋‍👩 | couplekiss_woman_woman
| 👨‍❤️‍💋‍👨 | couplekiss_man_man
| 👪 | family_man_woman_boy
| 👨‍👩‍👧 | family_man_woman_girl
| 👨‍👩‍👧‍👦 | family_man_woman_girl_boy
| 👨‍👩‍👦‍👦 | family_man_woman_boy_boy
| 👨‍👩‍👧‍👧 | family_man_woman_girl_girl
| 👩‍👩‍👦 | family_woman_woman_boy
| 👩‍👩‍👧 | family_woman_woman_girl
| 👩‍👩‍👧‍👦 | family_woman_woman_girl_boy
| 👩‍👩‍👦‍👦 | family_woman_woman_boy_boy
| 👩‍👩‍👧‍👧 | family_woman_woman_girl_girl
| 👨‍👨‍👦 | family_man_man_boy
| 👨‍👨‍👧 | family_man_man_girl
| 👨‍👨‍👧‍👦 | family_man_man_girl_boy
| 👨‍👨‍👦‍👦 | family_man_man_boy_boy
| 👨‍👨‍👧‍👧 | family_man_man_girl_girl
| 👩‍👦 | family_woman_boy
| 👩‍👧 | family_woman_girl
| 👩‍👧‍👦 | family_woman_girl_boy
| 👩‍👦‍👦 | family_woman_boy_boy
| 👩‍👧‍👧 | family_woman_girl_girl
| 👨‍👦 | family_man_boy
| 👨‍👧 | family_man_girl
| 👨‍👧‍👦 | family_man_girl_boy
| 👨‍👦‍👦 | family_man_boy_boy
| 👨‍👧‍👧 | family_man_girl_girl
==============================================================================
2. Activity *vimwiki-emoji-activity*
| 👴 | older_man | 👵 | older_woman | 👲 | man_with_gua_pi_mao
| ⚽️ | soccer | 🏀 | basketball | 🏈 | football
| ⚾️ | baseball | 🎾 | tennis | 🏐 | volleyball
| 🏉 | rugby_football | 🎱 | 8ball | 🏓 | ping_pong
| 🏸 | badminton | 🥅 | goal_net | 🏒 | ice_hockey
| 🏑 | field_hockey | 🏏 | cricket | ⛳️ | golf
| 🏹 | bow_and_arrow | 🎣 | fishing_pole_and_fish | 🥊 | boxing_glove
| 🥋 | martial_arts_uniform | ⛸ | ice_skate | 🎿 | ski
| ⛷ | skier | 🏂 | snowboarder
| 🏋️‍♀️ | weight_lifting_woman | 🏋️ | weight_lifting_man
| 🤺 | person_fencing | 🤼‍♀️ | women_wrestling
| 🤼‍♂️ | men_wrestling | 🤸‍♀️ | woman_cartwheeling
| 🤸‍♂️ | man_cartwheeling | ⛹️‍♀️ | basketball_woman
| ⛹️ | basketball_man | 🤾‍♀️ | woman_playing_handball
| 🤾‍♂️ | man_playing_handball | 🏌️‍♀️ | golfing_woman
| 🏌️ | golfing_man | 🏄‍♀️ | surfing_woman
| 🏄 | surfing_man | 🏊‍♀️ | swimming_woman
| 🏊 | swimming_man | 🤽‍♀️ | woman_playing_water_polo
| 🤽‍♂️ | man_playing_water_polo | 🚣‍♀️ | rowing_woman
| 🚣 | rowing_man | 🏇 | horse_racing
| 🚴‍♀️ | biking_woman | 🚴 | biking_man
| 🚵‍♀️ | mountain_biking_woman | 🚵 | mountain_biking_man
| 🎽 | running_shirt_with_sash | 🏅 | medal_sports
| 🎖 | medal_military | 🥇 | 1st_place_medal | 🥈 | 2nd_place_medal
| 🥉 | 3rd_place_medal | 🏆 | trophy | 🏵 | rosette
| 🎗 | reminder_ribbon | 🎫 | ticket | 🎟 | tickets
| 🎪 | circus_tent | 🤹‍♀️ | woman_juggling | 🤹‍♂️ | man_juggling
| 🎭 | performing_arts | 🎨 | art | 🎬 | clapper
| 🎤 | microphone | 🎧 | headphones | 🎼 | musical_score
| 🎹 | musical_keyboard | 🥁 | drum | 🎷 | saxophone
| 🎺 | trumpet | 🎸 | guitar | 🎻 | violin
| 🎲 | game_die | 🎯 | dart | 🎳 | bowling
| 🎮 | video_game | 🎰 | slot_machine
==============================================================================
3. Places *vimwiki-emoji-places*
| 🚗 | car | 🚕 | taxi | 🚙 | blue_car
| 🚌 | bus | 🚎 | trolleybus | 🏎 | racing_car
| 🚓 | police_car | 🚑 | ambulance | 🚒 | fire_engine
| 🚐 | minibus | 🚚 | truck | 🚛 | articulated_lorry
| 🚜 | tractor | 🛴 | kick_scooter | 🚲 | bike
| 🛵 | motor_scooter | 🏍 | motorcycle | 🚨 | rotating_light
| 🚔 | oncoming_police_car | 🚍 | oncoming_bus | 🚘 | oncoming_automobile
| 🚖 | oncoming_taxi | 🚡 | aerial_tramway | 🚠 | mountain_cableway
| 🚟 | suspension_railway | 🚃 | railway_car | 🚋 | train
| 🚞 | mountain_railway | 🚝 | monorail | 🚄 | bullettrain_side
| 🚅 | bullettrain_front | 🚈 | light_rail | 🚂 | steam_locomotive
| 🚆 | train2 | 🚇 | metro | 🚊 | tram
| 🚉 | station | 🚁 | helicopter | 🛩 | small_airplane
| ✈️ | airplane | 🛫 | flight_departure | 🛬 | flight_arrival
| 🚀 | rocket | 🛰 | artificial_satellite| 💺 | seat
| 🛶 | canoe | ⛵️ | boat | 🛥 | motor_boat
| 🚤 | speedboat | 🛳 | passenger_ship | ⛴ | ferry
| 🚢 | ship | ⚓️ | anchor | 🚧 | construction
| ⛽️ | fuelpump | 🚏 | busstop | 🚦 | vertical_traffic_light
| 🚥 | traffic_light | 🗺 | world_map | 🗿 | moyai
| 🗽 | statue_of_liberty | ⛲️ | fountain | 🗼 | tokyo_tower
| 🏰 | european_castle | 🏯 | japanese_castle | 🏟 | stadium
| 🎡 | ferris_wheel | 🎢 | roller_coaster | 🎠 | carousel_horse
| ⛱ | parasol_on_ground | 🏖 | beach_umbrella | 🏝 | desert_island
| ⛰ | mountain | 🏔 | mountain_snow | 🗻 | mount_fuji
| 🌋 | volcano | 🏜 | desert | 🏕 | camping
| ⛺️ | tent | 🛤 | railway_track | 🛣 | motorway
| 🏗 | building_construction| 🏭 | factory | 🏠 | house
| 🏡 | house_with_garden | 🏘 | houses | 🏚 | derelict_house
| 🏢 | office | 🏬 | department_store | 🏣 | post_office
| 🏤 | european_post_office | 🏥 | hospital | 🏦 | bank
| 🏨 | hotel | 🏪 | convenience_store | 🏫 | school
| 🏩 | love_hotel | 💒 | wedding | 🏛 | classical_building
| ⛪️ | church | 🕌 | mosque | 🕍 | synagogue
| 🕋 | kaaba | ⛩ | shinto_shrine | 🗾 | japan
| 🎑 | rice_scene | 🏞 | national_park | 🌅 | sunrise
| 🌄 | sunrise_over_mountain| 🌠 | stars | 🎇 | sparkler
| 🎆 | fireworks | 🌇 | city_sunrise | 🌆 | city_sunset
| 🏙 | cityscape | 🌃 | night_with_stars | 🌌 | milky_way
| 🌉 | bridge_at_night | 🌁 | foggy
==============================================================================
4. Nature *vimwiki-emoji-nature*
| 🐶 | dog | 🐱 | cat | 🐭 | mouse
| 🐹 | hamster | 🐰 | rabbit | 🦊 | fox_face
| 🐻 | bear | 🐼 | panda_face | 🐨 | koala
| 🐯 | tiger | 🦁 | lion | 🐮 | cow
| 🐷 | pig | 🐽 | pig_nose | 🐸 | frog
| 🐵 | monkey_face | 🙈 | see_no_evil | 🙉 | hear_no_evil
| 🙊 | speak_no_evil | 🐒 | monkey | 🐔 | chicken
| 🐧 | penguin | 🐦 | bird | 🐤 | baby_chick
| 🐣 | hatching_chick | 🐥 | hatched_chick | 🦆 | duck
| 🦅 | eagle | 🦉 | owl | 🦇 | bat
| 🐺 | wolf | 🐗 | boar | 🐴 | horse
| 🦄 | unicorn | 🐝 | bee | 🐛 | bug
| 🦋 | butterfly | 🐌 | snail | 🐚 | shell
| 🐞 | beetle | 🐜 | ant | 🕷 | spider
| 🕸 | spider_web | 🐢 | turtle | 🐍 | snake
| 🦎 | lizard | 🦂 | scorpion | 🦀 | crab
| 🦑 | squid | 🐙 | octopus | 🦐 | shrimp
| 🐠 | tropical_fish | 🐟 | fish | 🐡 | blowfish
| 🐬 | dolphin | 🦈 | shark | 🐳 | whale
| 🐋 | whale2 | 🐊 | crocodile | 🐆 | leopard
| 🐅 | tiger2 | 🐃 | water_buffalo | 🐂 | ox
| 🐄 | cow2 | 🦌 | deer | 🐪 | dromedary_camel
| 🐫 | camel | 🐘 | elephant | 🦏 | rhinoceros
| 🦍 | gorilla | 🐎 | racehorse | 🐖 | pig2
| 🐐 | goat | 🐏 | ram | 🐑 | sheep
| 🐕 | dog2 | 🐩 | poodle | 🐈 | cat2
| 🐓 | rooster | 🦃 | turkey | 🕊 | dove
| 🐇 | rabbit2 | 🐁 | mouse2 | 🐀 | rat
| 🐿 | chipmunk | 🐾 | feet | 🐉 | dragon
| 🐲 | dragon_face | 🌵 | cactus | 🎄 | christmas_tree
| 🌲 | evergreen_tree | 🌳 | deciduous_tree | 🌴 | palm_tree
| 🌱 | seedling | 🌿 | herb | ☘️ | shamrock
| 🍀 | four_leaf_clover | 🎍 | bamboo | 🎋 | tanabata_tree
| 🍃 | leaves | 🍂 | fallen_leaf | 🍁 | maple_leaf
| 🍄 | mushroom | 🌾 | ear_of_rice | 💐 | bouquet
| 🌷 | tulip | 🌹 | rose | 🥀 | wilted_flower
| 🌻 | sunflower | 🌼 | blossom | 🌸 | cherry_blossom
| 🌺 | hibiscus | 🌎 | earth_americas | 🌍 | earth_africa
| 🌏 | earth_asia | 🌕 | full_moon | 🌖 | waning_gibbous_moon
| 🌗 | last_quarter_moon | 🌘 | waning_crescent_moon| 🌑 | new_moon
| 🌒 | waxing_crescent_moon | 🌓 | first_quarter_moon | 🌔 | moon
| 🌚 | new_moon_with_face | 🌝 | full_moon_with_face | 🌞 | sun_with_face
| 🌛 | first_quarter_moon_with_face | 🌜 | last_quarter_moon_with_face
| 🌙 | crescent_moon | 💫 | dizzy | ⭐️ | star
| 🌟 | star2 | ✨ | sparkles | ⚡️ | zap
| 🔥 | fire | 💥 | boom | ☄️ | comet
| ☀️ | sunny | 🌤 | sun_behind_small_cloud
| ⛅️ | partly_sunny | 🌥 | sun_behind_large_cloud
| 🌦 | sun_behind_rain_cloud | 🌈 | rainbow
| ☁️ | cloud | 🌧 | cloud_with_rain
| ⛈ | cloud_with_lightning_and_rain | 🌩 | cloud_with_lightning
| 🌨 | cloud_with_snow | ☃️ | snowman_with_snow | ⛄️ | snowman
| ❄️ | snowflake | 🌬 | wind_face | 💨 | dash
| 🌪 | tornado | 🌫 | fog | 🌊 | ocean
| 💧 | droplet | 💦 | sweat_drops | ☔️ | umbrella
==============================================================================
5. Objects *vimwiki-emoji-objects*
| ⌚️ | watch | 📱 | iphone | 📲 | calling
| 💻 | computer | ⌨️ | keyboard | 🖥 | desktop_computer
| 🖨 | printer | 🖱 | computer_mouse | 🖲 | trackball
| 🕹 | joystick | 🗜 | clamp | 💽 | minidisc
| 💾 | floppy_disk | 💿 | cd | 📀 | dvd
| 📼 | vhs | 📷 | camera | 📸 | camera_flash
| 📹 | video_camera | 🎥 | movie_camera | 📽 | film_projector
| 🎞 | film_strip | 📞 | telephone_receiver | ☎️ | phone
| 📟 | pager | 📠 | fax | 📺 | tv
| 📻 | radio | 🎙 | studio_microphone | 🎚 | level_slider
| 🎛 | control_knobs | ⏱ | stopwatch | ⏲ | timer_clock
| ⏰ | alarm_clock | 🕰 | mantelpiece_clock | ⌛️ | hourglass
| ⏳ | hourglass_flowing_sand | 📡 | satellite
| 🔋 | battery | 🔌 | electric_plug | 💡 | bulb
| 🔦 | flashlight | 🕯 | candle | 🗑 | wastebasket
| 🛢 | oil_drum | 💸 | money_with_wings | 💵 | dollar
| 💴 | yen | 💶 | euro | 💷 | pound
| 💰 | moneybag | 💳 | credit_card | 💎 | gem
| ⚖️ | balance_scale | 🔧 | wrench | 🔨 | hammer
| ⚒ | hammer_and_pick | 🛠 | hammer_and_wrench | ⛏ | pick
| 🔩 | nut_and_bolt | ⚙️ | gear | ⛓ | chains
| 🔫 | gun | 💣 | bomb | 🔪 | hocho
| 🗡 | dagger | ⚔️ | crossed_swords | 🛡 | shield
| 🚬 | smoking | ⚰️ | coffin | ⚱️ | funeral_urn
| 🏺 | amphora | 🔮 | crystal_ball | 📿 | prayer_beads
| 💈 | barber | ⚗️ | alembic | 🔭 | telescope
| 🔬 | microscope | 🕳 | hole | 💊 | pill
| 💉 | syringe | 🌡 | thermometer | 🚽 | toilet
| 🚰 | potable_water | 🚿 | shower | 🛁 | bathtub
| 🛀 | bath | 🛎 | bellhop_bell | 🔑 | key
| 🗝 | old_key | 🚪 | door | 🛋 | couch_and_lamp
| 🛏 | bed | 🛌 | sleeping_bed | 🖼 | framed_picture
| 🛍 | shopping | 🛒 | shopping_cart | 🎁 | gift
| 🎈 | balloon | 🎏 | flags | 🎀 | ribbon
| 🎊 | confetti_ball | 🎉 | tada | 🎎 | dolls
| 🏮 | izakaya_lantern | 🎐 | wind_chime | ✉️ | email
| 📩 | envelope_with_arrow | 📨 | incoming_envelope | 📧 | e-mail
| 💌 | love_letter | 📥 | inbox_tray | 📤 | outbox_tray
| 📦 | package | 🏷 | label | 📪 | mailbox_closed
| 📫 | mailbox | 📬 | mailbox_with_mail | 📭 | mailbox_with_no_mail
| 📮 | postbox | 📯 | postal_horn | 📜 | scroll
| 📃 | page_with_curl | 📄 | page_facing_up | 📑 | bookmark_tabs
| 📊 | bar_chart | 📈 | chart_with_upwards_trend
| 📉 | chart_with_downwards_trend | 🗒 | spiral_notepad
| 🗓 | spiral_calendar | 📆 | calendar | 📅 | date
| 📇 | card_index | 🗃 | card_file_box | 🗳 | ballot_box
| 🗄 | file_cabinet | 📋 | clipboard | 📁 | file_folder
| 📂 | open_file_folder | 🗂 | card_index_dividers | 🗞 | newspaper_roll
| 📰 | newspaper | 📓 | notebook | 📔 | notebook_with_decorative_cover
| 📒 | ledger | 📕 | closed_book | 📗 | green_book
| 📘 | blue_book | 📙 | orange_book | 📚 | books
| 📖 | book | 🔖 | bookmark | 🔗 | link
| 📎 | paperclip | 🖇 | paperclips | 📐 | triangular_ruler
| 📏 | straight_ruler | 📌 | pushpin | 📍 | round_pushpin
| ✂️ | scissors | 🖊 | pen | 🖋 | fountain_pen
| ✒️ | black_nib | 🖌 | paintbrush | 🖍 | crayon
| 📝 | memo | ✏️ | pencil2 | 🔍 | mag
| 🔎 | mag_right | 🔏 | lock_with_ink_pen | 🔐 | closed_lock_with_key
| 🔒 | lock | 🔓 | unlock
==============================================================================
6. Foods *vimwiki-emoji-foods*
| 🍏 | green_apple | 🍎 | apple | 🍐 | pear
| 🍊 | tangerine | 🍋 | lemon | 🍌 | banana
| 🍉 | watermelon | 🍇 | grapes | 🍓 | strawberry
| 🍈 | melon | 🍒 | cherries | 🍑 | peach
| 🍍 | pineapple | 🥝 | kiwi_fruit | 🥑 | avocado
| 🍅 | tomato | 🍆 | eggplant | 🥒 | cucumber
| 🥕 | carrot | 🌽 | corn | 🌶 | hot_pepper
| 🥔 | potato | 🍠 | sweet_potato | 🌰 | chestnut
| 🥜 | peanuts | 🍯 | honey_pot | 🥐 | croissant
| 🍞 | bread | 🥖 | baguette_bread | 🧀 | cheese
| 🥚 | egg | 🍳 | fried_egg | 🥓 | bacon
| 🥞 | pancakes | 🍤 | fried_shrimp | 🍗 | poultry_leg
| 🍖 | meat_on_bone | 🍕 | pizza | 🌭 | hotdog
| 🍔 | hamburger | 🍟 | fries | 🥙 | stuffed_flatbread
| 🌮 | taco | 🌯 | burrito | 🥗 | green_salad
| 🥘 | shallow_pan_of_food | 🍝 | spaghetti | 🍜 | ramen
| 🍲 | stew | 🍥 | fish_cake | 🍣 | sushi
| 🍱 | bento | 🍛 | curry | 🍚 | rice
| 🍙 | rice_ball | 🍘 | rice_cracker | 🍢 | oden
| 🍡 | dango | 🍧 | shaved_ice | 🍨 | ice_cream
| 🍦 | icecream | 🍰 | cake | 🎂 | birthday
| 🍮 | custard | 🍭 | lollipop | 🍬 | candy
| 🍫 | chocolate_bar | 🍿 | popcorn | 🍩 | doughnut
| 🍪 | cookie | 🥛 | milk_glass | 🍼 | baby_bottle
| ☕️ | coffee | 🍵 | tea | 🍶 | sake
| 🍺 | beer | 🍻 | beers | 🥂 | clinking_glasses
| 🍷 | wine_glass | 🥃 | tumbler_glass | 🍸 | cocktail
| 🍹 | tropical_drink | 🍾 | champagne | 🥄 | spoon
| 🍴 | fork_and_knife | 🍽 | plate_with_cutlery
==============================================================================
7. Symbols *vimwiki-emoji-symbols*
| ❤️ | heart | 💛 | yellow_heart | 💚 | green_heart
| 💙 | blue_heart | 💜 | purple_heart | 🖤 | black_heart
| 💔 | broken_heart | ❣️ | heavy_heart_exclamation
| 💕 | two_hearts | 💞 | revolving_hearts | 💓 | heartbeat
| 💗 | heartpulse | 💖 | sparkling_heart | 💘 | cupid
| 💝 | gift_heart | 💟 | heart_decoration | ☮️ | peace_symbol
| ✝️ | latin_cross | ☪️ | star_and_crescent | 🕉 | om
| ☸️ | wheel_of_dharma | ✡️ | star_of_david | 🔯 | six_pointed_star
| 🕎 | menorah | ☯️ | yin_yang | ☦️ | orthodox_cross
| 🛐 | place_of_worship | ⛎ | ophiuchus | ♈️ | aries
| ♉️ | taurus | ♊️ | gemini | ♋️ | cancer
| ♌️ | leo | ♍️ | virgo | ♎️ | libra
| ♏️ | scorpius | ♐️ | sagittarius | ♑️ | capricorn
| ♒️ | aquarius | ♓️ | pisces | 🆔 | id
| ⚛️ | atom_symbol | 🉑 | accept | ☢️ | radioactive
| ☣️ | biohazard | 📴 | mobile_phone_off | 📳 | vibration_mode
| 🈶 | u6709 | 🈚️ | u7121 | 🈸 | u7533
| 🈺 | u55b6 | 🈷️ | u6708 | ✴️ | eight_pointed_black_star
| 🆚 | vs | 💮 | white_flower | 🉐 | ideograph_advantage
| ㊙️ | secret | ㊗️ | congratulations | 🈴 | u5408
| 🈵 | u6e80 | 🈹 | u5272 | 🈲 | u7981
| 🅰️ | a | 🅱️ | b | 🆎 | ab
| 🆑 | cl | 🅾️ | o2 | 🆘 | sos
| ❌ | x | ⭕️ | o | 🛑 | stop_sign
| ⛔️ | no_entry | 📛 | name_badge | 🚫 | no_entry_sign
| 💯 | 100 | 💢 | anger | ♨️ | hotsprings
| 🚷 | no_pedestrians | 🚯 | do_not_litter | 🚳 | no_bicycles
| 🚱 | non-potable_water | 🔞 | underage | 📵 | no_mobile_phones
| 🚭 | no_smoking | ❗️ | exclamation | ❕ | grey_exclamation
| ❓ | question | ❔ | grey_question | ‼️ | bangbang
| ⁉️ | interrobang | 🔅 | low_brightness | 🔆 | high_brightness
| 〽️ | part_alternation_mark | ⚠️ | warning
| 🚸 | children_crossing | 🔱 | trident | ⚜️ | fleur_de_lis
| 🔰 | beginner | ♻️ | recycle | ✅ | white_check_mark
| 🈯️ | u6307 | 💹 | chart | ❇️ | sparkle
| ✳️ | eight_spoked_asterisk | ❎ | negative_squared_cross_mark
| 🌐 | globe_with_meridians | 💠 | diamond_shape_with_a_dot_inside
| Ⓜ️ | m | 🌀 | cyclone | 💤 | zzz
| 🏧 | atm | 🚾 | wc | ♿️ | wheelchair
| 🅿️ | parking | 🈳 | u7a7a | 🈂️ | sa
| 🛂 | passport_control | 🛃 | customs | 🛄 | baggage_claim
| 🛅 | left_luggage | 🚹 | mens | 🚺 | womens
| 🚼 | baby_symbol | 🚻 | restroom | 🚮 | put_litter_in_its_place
| 🎦 | cinema | 📶 | signal_strength | 🈁 | koko
| 🔣 | symbols | | information_source | 🔤 | abc
| 🔡 | abcd | 🔠 | capital_abcd | 🆖 | ng
| 🆗 | ok | 🆙 | up | 🆒 | cool
| 🆕 | new | 🆓 | free |0⃣ | zero
| 1⃣ | one | 2⃣ | two |3⃣ | three
| 4⃣ | four |5⃣ | five |6⃣ | six
| 7⃣ | seven |8⃣ | eight |9⃣ | nine
| 🔟 | keycap_ten | 🔢 | 1234 |#️⃣ | hash
| *️⃣ | asterisk | ▶️ | arrow_forward | ⏸ | pause_button
| ⏯ | play_or_pause_button | ⏹ | stop_button
| ⏺ | record_button | ⏭ | next_track_button | ⏮ | previous_track_button
| ⏩ | fast_forward | ⏪ | rewind | ⏫ | arrow_double_up
| ⏬ | arrow_double_down | ◀️ | arrow_backward | 🔼 | arrow_up_small
| 🔽 | arrow_down_small | ➡️ | arrow_right | ⬅️ | arrow_left
| ⬆️ | arrow_up | ⬇️ | arrow_down | ↗️ | arrow_upper_right
| ↘️ | arrow_lower_right | ↙️ | arrow_lower_left | ↖️ | arrow_upper_left
| ↕️ | arrow_up_down | ↔️ | left_right_arrow | ↪️ | arrow_right_hook
| ↩️ | leftwards_arrow_with_hook | ⤴️ | arrow_heading_up
| ⤵️ | arrow_heading_down | 🔀 | twisted_rightwards_arrows
| 🔁 | repeat | 🔂 | repeat_one
| 🔄 | arrows_counterclockwise | 🔃 | arrows_clockwise
| 🎵 | musical_note | 🎶 | notes | | heavy_plus_sign
| | heavy_minus_sign | ➗ | heavy_division_sign | ✖️ | heavy_multiplication_x
| 💲 | heavy_dollar_sign | 💱 | currency_exchange | ™️ | tm
| ©️ | copyright | ®️ | registered | 〰️ | wavy_dash
| ➰ | curly_loop | ➿ | loop | 🔚 | end
| 🔙 | back | 🔛 | on | 🔝 | top
| 🔜 | soon | ✔️ | heavy_check_mark | ☑️ | ballot_box_with_check
| 🔘 | radio_button | ⚪️ | white_circle | ⚫️ | black_circle
| 🔴 | red_circle | 🔵 | large_blue_circle | 🔺 | small_red_triangle
| 🔻 | small_red_triangle_down | 🔸 | small_orange_diamond
| 🔹 | small_blue_diamond | 🔶 | large_orange_diamond| 🔷 | large_blue_diamond
| 🔳 | white_square_button | 🔲 | black_square_button | ▪️ | black_small_square
| ▫️ | white_small_square | ◾️ | black_medium_small_square
| ◽️ | white_medium_small_square | ◼️ | black_medium_square
| ◻️ | white_medium_square | ⬛️ | black_large_square | ⬜️ | white_large_square
| 🔈 | speaker | 🔇 | mute | 🔉 | sound
| 🔊 | loud_sound | 🔔 | bell | 🔕 | no_bell
| 📣 | mega | 📢 | loudspeaker | 👁‍🗨 | eye_speech_bubble
| 💬 | speech_balloon | 💭 | thought_balloon | 🗯 | right_anger_bubble
| ♠️ | spades | ♣️ | clubs | ♥️ | hearts
| ♦️ | diamonds | 🃏 | black_joker | 🎴 | flower_playing_cards
| 🀄️ | mahjong | 🕐 | clock1 | 🕑 | clock2
| 🕒 | clock3 | 🕓 | clock4 | 🕔 | clock5
| 🕕 | clock6 | 🕖 | clock7 | 🕗 | clock8
| 🕘 | clock9 | 🕙 | clock10 | 🕚 | clock11
| 🕛 | clock12 | 🕜 | clock130 | 🕝 | clock230
| 🕞 | clock330 | 🕟 | clock430 | 🕠 | clock530
| 🕡 | clock630 | 🕢 | clock730 | 🕣 | clock830
| 🕤 | clock930 | 🕥 | clock1030 | 🕦 | clock1130
| 🕧 | clock1230
8. Flags *vimwiki-emoji-flags*
==============================================================================
| 🏳️ | white_flag | 🏴 | black_flag | 🏁 | checkered_flag
| 🚩 | triangular_flag_on_post | 🏳️‍🌈 | rainbow_flag
| 🇦🇫 | afghanistan | 🇦🇽 | aland_islands | 🇦🇱 | albania
| 🇩🇿 | algeria | 🇦🇸 | american_samoa | 🇦🇩 | andorra
| 🇦🇴 | angola | 🇦🇮 | anguilla | 🇦🇶 | antarctica
| 🇦🇬 | antigua_barbuda | 🇦🇷 | argentina | 🇦🇲 | armenia
| 🇦🇼 | aruba | 🇦🇺 | australia | 🇦🇹 | austria
| 🇦🇿 | azerbaijan | 🇧🇸 | bahamas | 🇧🇭 | bahrain
| 🇧🇩 | bangladesh | 🇧🇧 | barbados | 🇧🇾 | belarus
| 🇧🇪 | belgium | 🇧🇿 | belize | 🇧🇯 | benin
| 🇧🇲 | bermuda | 🇧🇹 | bhutan | 🇧🇴 | bolivia
| 🇧🇶 | caribbean_netherlands | 🇧🇦 | bosnia_herzegovina
| 🇧🇼 | botswana | 🇧🇷 | brazil | 🇮🇴 | british_indian_ocean_territory
| 🇻🇬 | british_virgin_islands | 🇧🇳 | brunei
| 🇧🇬 | bulgaria | 🇧🇫 | burkina_faso | 🇧🇮 | burundi
| 🇨🇻 | cape_verde | 🇰🇭 | cambodia | 🇨🇲 | cameroon
| 🇨🇦 | canada | 🇮🇨 | canary_islands | 🇰🇾 | cayman_islands
| 🇨🇫 | central_african_republic | 🇹🇩 | chad
| 🇨🇱 | chile | 🇨🇳 | cn | 🇨🇽 | christmas_island
| 🇨🇨 | cocos_islands | 🇨🇴 | colombia | 🇰🇲 | comoros
| 🇨🇬 | congo_brazzaville | 🇨🇩 | congo_kinshasa | 🇨🇰 | cook_islands
| 🇨🇷 | costa_rica | 🇨🇮 | cote_divoire | 🇭🇷 | croatia
| 🇨🇺 | cuba | 🇨🇼 | curacao | 🇨🇾 | cyprus
| 🇨🇿 | czech_republic | 🇩🇰 | denmark | 🇩🇯 | djibouti
| 🇩🇲 | dominica | 🇩🇴 | dominican_republic| 🇪🇨 | ecuador
| 🇪🇬 | egypt | 🇸🇻 | el_salvador | 🇬🇶 | equatorial_guinea
| 🇪🇷 | eritrea | 🇪🇪 | estonia | 🇪🇹 | ethiopia
| 🇪🇺 | eu | 🇫🇰 | falkland_islands | 🇫🇴 | faroe_islands
| 🇫🇯 | fiji | 🇫🇮 | finland | 🇫🇷 | fr
| 🇬🇫 | french_guiana | 🇵🇫 | french_polynesia | 🇹🇫 | french_southern_territories
| 🇬🇦 | gabon | 🇬🇲 | gambia | 🇬🇪 | georgia
| 🇩🇪 | de | 🇬🇭 | ghana | 🇬🇮 | gibraltar
| 🇬🇷 | greece | 🇬🇱 | greenland | 🇬🇩 | grenada
| 🇬🇵 | guadeloupe | 🇬🇺 | guam | 🇬🇹 | guatemala
| 🇬🇬 | guernsey | 🇬🇳 | guinea | 🇬🇼 | guinea_bissau
| 🇬🇾 | guyana | 🇭🇹 | haiti | 🇭🇳 | honduras
| 🇭🇰 | hong_kong | 🇭🇺 | hungary | 🇮🇸 | iceland
| 🇮🇳 | india | 🇮🇩 | indonesia | 🇮🇷 | iran
| 🇮🇶 | iraq | 🇮🇪 | ireland | 🇮🇲 | isle_of_man
| 🇮🇱 | israel | 🇮🇹 | it | 🇯🇲 | jamaica
| 🇯🇵 | jp | 🎌 | crossed_flags | 🇯🇪 | jersey
| 🇯🇴 | jordan | 🇰🇿 | kazakhstan | 🇰🇪 | kenya
| 🇰🇮 | kiribati | 🇽🇰 | kosovo | 🇰🇼 | kuwait
| 🇰🇬 | kyrgyzstan | 🇱🇦 | laos | 🇱🇻 | latvia
| 🇱🇧 | lebanon | 🇱🇸 | lesotho | 🇱🇷 | liberia
| 🇱🇾 | libya | 🇱🇮 | liechtenstein | 🇱🇹 | lithuania
| 🇱🇺 | luxembourg | 🇲🇴 | macau | 🇲🇰 | macedonia
| 🇲🇬 | madagascar | 🇲🇼 | malawi | 🇲🇾 | malaysia
| 🇲🇻 | maldives | 🇲🇱 | mali | 🇲🇹 | malta
| 🇲🇭 | marshall_islands | 🇲🇶 | martinique | 🇲🇷 | mauritania
| 🇲🇺 | mauritius | 🇾🇹 | mayotte | 🇲🇽 | mexico
| 🇫🇲 | micronesia | 🇲🇩 | moldova | 🇲🇨 | monaco
| 🇲🇳 | mongolia | 🇲🇪 | montenegro | 🇲🇸 | montserrat
| 🇲🇦 | morocco | 🇲🇿 | mozambique | 🇲🇲 | myanmar
| 🇳🇦 | namibia | 🇳🇷 | nauru | 🇳🇵 | nepal
| 🇳🇱 | netherlands | 🇳🇨 | new_caledonia | 🇳🇿 | new_zealand
| 🇳🇮 | nicaragua | 🇳🇪 | niger | 🇳🇬 | nigeria
| 🇳🇺 | niue | 🇳🇫 | norfolk_island | 🇲🇵 | northern_mariana_islands
| 🇰🇵 | north_korea | 🇳🇴 | norway | 🇴🇲 | oman
| 🇵🇰 | pakistan | 🇵🇼 | palau | 🇵🇸 | palestinian_territories
| 🇵🇦 | panama | 🇵🇬 | papua_new_guinea | 🇵🇾 | paraguay
| 🇵🇪 | peru | 🇵🇭 | philippines | 🇵🇳 | pitcairn_islands
| 🇵🇱 | poland | 🇵🇹 | portugal | 🇵🇷 | puerto_rico
| 🇶🇦 | qatar | 🇷🇪 | reunion | 🇷🇴 | romania
| 🇷🇺 | ru | 🇷🇼 | rwanda | 🇧🇱 | st_barthelemy
| 🇸🇭 | st_helena | 🇰🇳 | st_kitts_nevis | 🇱🇨 | st_lucia
| 🇵🇲 | st_pierre_miquelon | 🇻🇨 | st_vincent_grenadines
| 🇼🇸 | samoa | 🇸🇲 | san_marino | 🇸🇹 | sao_tome_principe
| 🇸🇦 | saudi_arabia | 🇸🇳 | senegal | 🇷🇸 | serbia
| 🇸🇨 | seychelles | 🇸🇱 | sierra_leone | 🇸🇬 | singapore
| 🇸🇽 | sint_maarten | 🇸🇰 | slovakia | 🇸🇮 | slovenia
| 🇸🇧 | solomon_islands | 🇸🇴 | somalia | 🇿🇦 | south_africa
| 🇬🇸 | south_georgia_south_sandwich_islands| 🇰🇷 | kr
| 🇸🇸 | south_sudan | 🇪🇸 | es | 🇱🇰 | sri_lanka
| 🇸🇩 | sudan | 🇸🇷 | suriname | 🇸🇿 | swaziland
| 🇸🇪 | sweden | 🇨🇭 | switzerland | 🇸🇾 | syria
| 🇹🇼 | taiwan | 🇹🇯 | tajikistan | 🇹🇿 | tanzania
| 🇹🇭 | thailand | 🇹🇱 | timor_leste | 🇹🇬 | togo
| 🇹🇰 | tokelau | 🇹🇴 | tonga | 🇹🇹 | trinidad_tobago
| 🇹🇳 | tunisia | 🇹🇷 | tr | 🇹🇲 | turkmenistan
| 🇹🇨 | turks_caicos_islands| 🇹🇻 | tuvalu | 🇺🇬 | uganda
| 🇺🇦 | ukraine | 🇦🇪 | united_arab_emirate| 🇬🇧 | gb
| 🇺🇸 | us | 🇻🇮 | us_virgin_islands | 🇺🇾 | uruguay
| 🇺🇿 | uzbekistan | 🇻🇺 | vanuatu | 🇻🇦 | vatican_city
| 🇻🇪 | venezuela | 🇻🇳 | vietnam | 🇼🇫 | wallis_futuna
| 🇪🇭 | western_sahara | 🇾🇪 | yemen | 🇿🇲 | zambia
| 🇿🇼 | zimbabwe

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

View File

@@ -0,0 +1 @@
ref: refs/heads/dev

View File

@@ -0,0 +1,11 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/vimwiki/vimwiki.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "dev"]
remote = origin
merge = refs/heads/dev

View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:

View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View File

@@ -0,0 +1,174 @@
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}

View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info

View File

@@ -0,0 +1,14 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:

View File

@@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View File

@@ -0,0 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:

View File

@@ -0,0 +1,53 @@
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0

View File

@@ -0,0 +1,169 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END

View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi

View File

@@ -0,0 +1,42 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi

View File

@@ -0,0 +1,78 @@
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi

View File

@@ -0,0 +1,128 @@
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

Binary file not shown.

View File

@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 fea8bee382b2051b0137fd2cacf0862823ee69b3 LinlyBoi <libkyy@e.email> 1673460163 +0200 clone: from https://github.com/vimwiki/vimwiki.git
fea8bee382b2051b0137fd2cacf0862823ee69b3 fea8bee382b2051b0137fd2cacf0862823ee69b3 LinlyBoi <libkyy@e.email> 1673460166 +0200 checkout: moving from dev to dev

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 fea8bee382b2051b0137fd2cacf0862823ee69b3 LinlyBoi <libkyy@e.email> 1673460163 +0200 clone: from https://github.com/vimwiki/vimwiki.git

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 fea8bee382b2051b0137fd2cacf0862823ee69b3 LinlyBoi <libkyy@e.email> 1673460163 +0200 clone: from https://github.com/vimwiki/vimwiki.git

View File

@@ -0,0 +1,16 @@
# pack-refs with: peeled fully-peeled sorted
bfc3aa06fd4efedf4956589004cd325c4ed6f65f refs/remotes/origin/configurable_list_syms
99dc186df0ac6a22e79ac2813e7dfe65b8ccd86d refs/remotes/origin/custom_html_win
fea8bee382b2051b0137fd2cacf0862823ee69b3 refs/remotes/origin/dev
fea8bee382b2051b0137fd2cacf0862823ee69b3 refs/remotes/origin/master
86289a84930268c642add8ab10831124465fc8a3 refs/remotes/origin/path-handling
5faf884dc60c3ebd27734fe5f649acfb92025af8 refs/tags/v2.1
2f95a6a651bcc388af466e7377ae3ded3cfcc035 refs/tags/v2.2
3bd3d9b86036b21aecd69f0a1e572643d626c280 refs/tags/v2.2.1
129c2818106bdb9230bbd99ee8eb81fa47c7a414 refs/tags/v2.3
6766c37ce09a623b3de7ddb86ca30278eea37a82 refs/tags/v2.4
5553cef2496668aeddc6a93918595afa3aa79c7c refs/tags/v2.4-rc1
79d6a1a4e2f620214f246e9ae0fdf4e129b91bea refs/tags/v2.4.1
619f04f89861c58e5a6415a4f83847752928252d refs/tags/v2.5
8fad9778e727282e3e5ba94d6c96c3730fb546fc refs/tags/v2022.12.02
^0629b39815c97f1e4ee31e26faa6891b0e13d2d5

View File

@@ -0,0 +1 @@
fea8bee382b2051b0137fd2cacf0862823ee69b3

View File

@@ -0,0 +1 @@
ref: refs/remotes/origin/dev

View File

@@ -0,0 +1,13 @@
0629b39815c97f1e4ee31e26faa6891b0e13d2d5
129c2818106bdb9230bbd99ee8eb81fa47c7a414
2f95a6a651bcc388af466e7377ae3ded3cfcc035
3bd3d9b86036b21aecd69f0a1e572643d626c280
5553cef2496668aeddc6a93918595afa3aa79c7c
5faf884dc60c3ebd27734fe5f649acfb92025af8
619f04f89861c58e5a6415a4f83847752928252d
6766c37ce09a623b3de7ddb86ca30278eea37a82
79d6a1a4e2f620214f246e9ae0fdf4e129b91bea
86289a84930268c642add8ab10831124465fc8a3
99dc186df0ac6a22e79ac2813e7dfe65b8ccd86d
bfc3aa06fd4efedf4956589004cd325c4ed6f65f
fea8bee382b2051b0137fd2cacf0862823ee69b3

View File

@@ -0,0 +1,6 @@
Prior to submitting a new issue make sure to complete these steps:
- [ ] Include the VimWiki settings from your `.vimrc`
- [ ] Include the syntax you are using (default / Markdown / MediaWiki)
- [ ] Provide a detailed description of the problem including **steps to reproduce the issue**.
- [ ] Include the output of `:VimwikiShowVersion`.

View File

@@ -0,0 +1,9 @@
Steps for submitting a pull request:
- [ ] **ALL** pull requests should be made against the `dev` branch!
- [ ] Take a look at [CONTRIBUTING.MD](https://github.com/vimwiki/vimwiki/blob/dev/CONTRIBUTING.md)
- [ ] Reference any related issues.
- [ ] Provide a description of the proposed changes.
- [ ] PRs must pass Vint tests and add new Vader tests as applicable.
- [ ] Make sure to update the documentation in `doc/vimwiki.txt` if applicable,
including the Changelog and Contributors sections.

View File

@@ -0,0 +1,24 @@
# Local stuff
# This section is devoted to this project
##############################
doc/tags
.tags
# Vim stuff
##############################
*.s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
# OS generated files
##############################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
vimtest

View File

@@ -0,0 +1,45 @@
# No language: we download vim and compile it oursselves
language: generic
cache:
# Enable cache folder
bundler: true
directories:
- $HOME/docker_images
before_cache:
# Save tagged docker images. Info at https://github.com/travis-ci/travis-ci/issues/5358#issuecomment-248915326
- >
mkdir -p $HOME/docker_images && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
| xargs -n 2 -t sh -c 'test -e $HOME/docker_images/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker_images/$1.tar.gz'
before_install:
# Install docker
- n_image=$(ls -1 $HOME/docker_images/*.tar.gz | wc -l)
- if (( $n_image )); then ls $HOME/docker_images/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load";
else docker build --tag vimwiki .;
fi
env:
# Define jobs <- vim version <- hard copied from Dockerfile
# First to be launched
- VIM_VERSION=vint
- VIM_VERSION=vim_7.3.429
- VIM_VERSION=nvim_0.3.8
- VIM_VERSION=vim_8.1.0519
# More
- VIM_VERSION=vim_7.4.1099 PATTERN='[a-k]*.vader'
- VIM_VERSION=vim_7.4.1546 PATTERN='l*.vader'
- VIM_VERSION=vim_8.0.0027 PATTERN='[m-z]*.vader'
script:
# Run All tests
- pushd test
- if [[ "$VIM_VERSION" == 'vint' ]]; then bash run_tests.sh -v -t vint;
elif [[ ! -z "$PATTERN" ]]; then bash run_tests.sh -v -t vader -n "$VIM_VERSION" -f "$PATTERN";
else bash run_tests.sh -v -t vader -n "$VIM_VERSION";
fi
- popd
# vim:sw=2:

View File

@@ -0,0 +1,780 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki filetype plugin file
" Home: https://github.com/vimwiki/vimwiki/
" Clause: load only onces per buffer
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
if vimwiki#vars#get_global('conceallevel') && exists('+conceallevel')
let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
endif
" This is for GOTO FILE: gf
execute 'setlocal suffixesadd='.vimwiki#vars#get_wikilocal('ext')
setlocal isfname-=[,]
exe 'setlocal tags+=' . escape(vimwiki#tags#metadata_file_path(), ' \|"')
" Helper: for omnicompletion
function! Complete_wikifiles(findstart, base) abort
" s:line_context = link | tag | ''
if a:findstart == 1
" Find line context
" Called: first time
let column = col('.')-2
let line = getline('.')[:column]
" Check Link:
" -- WikiLink
let startoflink = match(line, '\[\[\zs[^\\[\]]*$')
if startoflink != -1
let s:line_context = 'link'
return startoflink
endif
" -- WebLink
if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
let startofinlinelink = match(line, '\[.*\](\zs[^)]*$')
if startofinlinelink != -1
let s:line_context = 'link'
return startofinlinelink
endif
endif
" Check Tag:
let tf = vimwiki#vars#get_syntaxlocal('tag_format')
let startoftag = match(line, tf.pre_mark . '\zs' . tf.in . '*$')
if startoftag != -1
let s:line_context = 'tag'
return startoftag
endif
" Nothing can do ...
let s:line_context = ''
return -1
else
" Completion works for wikilinks/anchors, and for tags. s:line_content
" tells us which string came before a:base. There seems to be no easier
" solution, because calling col('.') here returns garbage.
if s:line_context ==? ''
return []
elseif s:line_context ==# 'tag'
" Look Tags: completion
let tags = vimwiki#tags#get_tags()
if a:base !=? ''
call filter(tags,
\ 'v:val[:' . (len(a:base)-1) . "] == '" . substitute(a:base, "'", "''", '') . "'" )
endif
return tags
elseif a:base !~# '#'
" Look Wiki: files
if a:base =~# '\m^wiki\d\+:'
let wikinumber = eval(matchstr(a:base, '\m^wiki\zs\d\+'))
if wikinumber >= vimwiki#vars#number_of_wikis()
return []
endif
let prefix = matchstr(a:base, '\m^wiki\d\+:\zs.*')
let scheme = matchstr(a:base, '\m^wiki\d\+:\ze')
elseif a:base =~# '^diary:'
let wikinumber = -1
let prefix = matchstr(a:base, '^diary:\zs.*')
let scheme = matchstr(a:base, '^diary:\ze')
else " current wiki
let wikinumber = vimwiki#vars#get_bufferlocal('wiki_nr')
let prefix = a:base
let scheme = ''
endif
let links = vimwiki#base#get_wikilinks(wikinumber, 1, '')
let result = []
for wikifile in links
if wikifile =~ '^'.vimwiki#u#escape(prefix)
call add(result, scheme . wikifile)
endif
endfor
return result
else
" Look Anchor: in the given wikifile
let segments = split(a:base, '#', 1)
let given_wikifile = segments[0] ==? '' ? expand('%:t:r') : segments[0]
let link_infos = vimwiki#base#resolve_link(given_wikifile.'#')
let wikifile = link_infos.filename
let syntax = vimwiki#vars#get_wikilocal('syntax', link_infos.index)
let anchors = vimwiki#base#get_anchors(wikifile, syntax)
let filtered_anchors = []
let given_anchor = join(segments[1:], '#')
for anchor in anchors
if anchor =~# '^'.vimwiki#u#escape(given_anchor)
call add(filtered_anchors, segments[0].'#'.anchor)
endif
endfor
return filtered_anchors
endif
endif
endfunction
" Set Completion:
setlocal omnifunc=Complete_wikifiles
if and(vimwiki#vars#get_global('emoji_enable'), 2) != 0
\ && &completefunc ==# ''
set completefunc=vimwiki#emoji#complete
endif
" Declare Settings: necessary for the automatic formatting of lists
" ------------------------------------------------
setlocal autoindent
setlocal nosmartindent
setlocal nocindent
" Set Comments: to insert and format 'comments' or cheat
" Used to break blockquote prepending one on each new line (see: #915)
" B like blank character follow
" blockquotes
let comments = 'b:>'
for bullet in vimwiki#vars#get_syntaxlocal('bullet_types')
" task list
for point in vimwiki#vars#get_wikilocal('listsyms_list')
\ + [vimwiki#vars#get_wikilocal('listsym_rejected')]
let comments .= ',fb:' . bullet . ' [' . point . ']'
endfor
" list
let comments .= ',fb:' . bullet
endfor
let &l:comments = comments
" Set Format Options: (:h fo-table)
" Disable autocomment because, vimwiki does it better
setlocal formatoptions-=r
setlocal formatoptions-=o
setlocal formatoptions-=2
" Autowrap with leading comment
setlocal formatoptions+=c
" Do not wrap if line was already long
setlocal formatoptions+=l
" AutoWrap inteligent with lists
setlocal formatoptions+=n
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')
" Used to join 'commented' lines (blockquote, list) (see: #915)
if v:version > 703
setlocal formatoptions+=j
endif
" Set commentstring %%%s
let &l:commentstring = vimwiki#vars#get_wikilocal('commentstring')
" ------------------------------------------------
" Folding stuff
" ------------------------------------------------
" Get fold level for a list
function! VimwikiFoldListLevel(lnum) abort
return vimwiki#lst#fold_level(a:lnum)
endfunction
" Get fold level for 1. line number
function! VimwikiFoldLevel(lnum) abort
let line = getline(a:lnum)
" Header/section folding...
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader') && !vimwiki#u#is_codeblock(a:lnum)
return '>'.vimwiki#u#count_first_sym(line)
" Code block folding...
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
return 'a1'
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
return 's1'
else
return '='
endif
endfunction
" Declare Constants: used by VimwikiFoldText
" use \u2026 and \u21b2 (or \u2424) if enc=utf-8 to save screen space
let s:ellipsis = (&encoding ==? 'utf-8') ? "\u2026" : '...'
let s:ell_len = strlen(s:ellipsis)
let s:newline = (&encoding ==? 'utf-8') ? "\u21b2 " : ' '
let s:tolerance = 5
" unused: too naive
function! s:shorten_text_simple(text, len) abort
let spare_len = a:len - len(a:text)
return (spare_len>=0) ? [a:text,spare_len] : [a:text[0:a:len].s:ellipsis, -1]
endfunction
" Shorten Text:
" Called: by VimwikiFoldText
" s:shorten_text(text, len) = [string, spare] with "spare" = len-strlen(string)
" for long enough "text", the string's length is within s:tolerance of "len"
" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
" Return: [string, spare]
function! s:shorten_text(text, len) abort
" strlen() returns lenght in bytes, not in characters, so we'll have to do a
" trick here -- replace all non-spaces with dot, calculate lengths and
" indexes on it, then use original string to break at selected index.
let text_pattern = substitute(a:text, '\m\S', '.', 'g')
let spare_len = a:len - strlen(text_pattern)
if (spare_len + s:tolerance >= 0)
return [a:text, spare_len]
endif
" try to break on a space; assumes a:len-s:ell_len >= s:tolerance
let newlen = a:len - s:ell_len
let idx = strridx(text_pattern, ' ', newlen + s:tolerance)
let break_idx = (idx + s:tolerance >= newlen) ? idx : newlen
return [matchstr(a:text, '\m^.\{'.break_idx.'\}').s:ellipsis, newlen - break_idx]
endfunction
" Fold: text chapter
function! VimwikiFoldText() abort
let line = getline(v:foldstart)
let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
let fold_len = v:foldend - v:foldstart + 1
let len_text = ' ['.fold_len.'] '
if line !~# vimwiki#vars#get_syntaxlocal('rxPreStart')
let [main_text, spare_len] = s:shorten_text(main_text, 50)
return main_text.len_text
else
" fold-text for code blocks: use one or two of the starting lines
let [main_text, spare_len] = s:shorten_text(main_text, 24)
let line1 = substitute(getline(v:foldstart+1), '^\s*', ' ', '')
let [content_text, spare_len] = s:shorten_text(line1, spare_len+20)
if spare_len > s:tolerance && fold_len > 3
let line2 = substitute(getline(v:foldstart+2), '^\s*', s:newline, '')
let [more_text, spare_len] = s:shorten_text(line2, spare_len+12)
let content_text .= more_text
endif
return main_text.len_text.content_text
endif
endfunction
" ------------------------------------------------
" Commands
" ------------------------------------------------
command! -buffer Vimwiki2HTML
\ if filewritable(expand('%')) | silent noautocmd w | endif
\ <bar>
\ let res = vimwiki#html#Wiki2HTML(
\ expand(vimwiki#vars#get_wikilocal('path_html')), expand('%'))
\ <bar>
\ if res != '' | call vimwiki#u#echo('HTML conversion is done, output: '
\ . expand(vimwiki#vars#get_wikilocal('path_html'))) | endif
command! -buffer Vimwiki2HTMLBrowse
\ if filewritable(expand('%')) | silent noautocmd w | endif
\ <bar>
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
\ expand(vimwiki#vars#get_wikilocal('path_html')),
\ expand('%')))
command! -buffer -bang VimwikiAll2HTML
\ call vimwiki#html#WikiAll2HTML(expand(vimwiki#vars#get_wikilocal('path_html')), <bang>0)
command! -buffer VimwikiRss call vimwiki#html#diary_rss()
command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1)
command! -buffer VimwikiNextTask call vimwiki#base#find_next_task()
command! -buffer VimwikiNextLink call vimwiki#base#find_next_link()
command! -buffer VimwikiPrevLink call vimwiki#base#find_prev_link()
command! -buffer VimwikiDeleteFile call vimwiki#base#delete_link()
command! -buffer VimwikiDeleteLink
\ call vimwiki#u#deprecate("VimwikiDeleteLink", "VimwikiDeleteFile") |
\ call vimwiki#base#delete_link()
command! -buffer -nargs=? -complete=customlist,vimwiki#base#complete_file
\ VimwikiRenameFile call vimwiki#base#rename_file(<f-args>)
command! -buffer VimwikiRenameLink
\ call vimwiki#u#deprecate("VimwikiRenameLink", "VimwikiRenameFile") |
\ call vimwiki#base#rename_file()
command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit', 0, 1)
command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
command! -buffer -nargs=* VimwikiSplitLink call vimwiki#base#follow_link('hsplit', <f-args>)
command! -buffer -nargs=* VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', <f-args>)
command! -buffer VimwikiBaddLink call vimwiki#base#follow_link('badd', 0, 1)
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tab', 0, 1)
command! -buffer VimwikiTabDropLink call vimwiki#base#follow_link('tabdrop', 0, 1)
command! -buffer -nargs=? VimwikiGenerateLinks call vimwiki#base#generate_links(1, <f-args>)
command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
command! -buffer -nargs=* VimwikiSearch call vimwiki#base#search(<q-args>)
command! -buffer -nargs=* VWS call vimwiki#base#search(<q-args>)
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_escaped
\ VimwikiGoto call vimwiki#base#goto(<q-args>)
command! -buffer -range VimwikiCheckLinks call vimwiki#base#check_links(<range>, <line1>, <line2>)
" list commands
command! -buffer -nargs=+ VimwikiReturn call <SID>CR(<f-args>)
command! -buffer -range -nargs=1 VimwikiChangeSymbolTo
\ call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'n')
command! -buffer -range -nargs=1 VimwikiListChangeSymbolI
\ call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>, 'i')
command! -buffer -nargs=1 VimwikiChangeSymbolInListTo
\ call vimwiki#lst#change_marker_in_list(<f-args>)
command! -buffer -range VimwikiToggleListItem call vimwiki#lst#toggle_cb(<line1>, <line2>)
command! -buffer -range VimwikiToggleRejectedListItem
\ call vimwiki#lst#toggle_rejected_cb(<line1>, <line2>)
command! -buffer -range VimwikiIncrementListItem call vimwiki#lst#increment_cb(<line1>, <line2>)
command! -buffer -range VimwikiDecrementListItem call vimwiki#lst#decrement_cb(<line1>, <line2>)
command! -buffer -range -nargs=+ VimwikiListChangeLvl
\ call vimwiki#lst#change_level(<line1>, <line2>, <f-args>)
command! -buffer -range VimwikiRemoveSingleCB call vimwiki#lst#remove_cb(<line1>, <line2>)
command! -buffer VimwikiRemoveCBInList call vimwiki#lst#remove_cb_in_list()
command! -buffer VimwikiRenumberList call vimwiki#lst#adjust_numbered_list()
command! -buffer VimwikiRenumberAllLists call vimwiki#lst#adjust_whole_buffer()
command! -buffer VimwikiListToggle call vimwiki#lst#toggle_list_item()
command! -buffer -range VimwikiRemoveDone call vimwiki#lst#remove_done(1, "<range>", <line1>, <line2>)
" table commands
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
command! -buffer -nargs=? VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq', <f-args>)
command! -buffer -nargs=? VimwikiTableAlignW call vimwiki#tbl#align_or_cmd('gww', <f-args>)
command! -buffer VimwikiTableMoveColumnLeft call vimwiki#tbl#move_column_left()
command! -buffer VimwikiTableMoveColumnRight call vimwiki#tbl#move_column_right()
" diary commands
command! -buffer VimwikiDiaryNextDay call vimwiki#diary#goto_next_day()
command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
" tags commands
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
\ VimwikiSearchTags VimwikiSearch /:<args>:/
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
\ VimwikiGenerateTagLinks call vimwiki#tags#generate_tags(1, <f-args>)
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
\ VimwikiGenerateTags
\ call vimwiki#u#deprecate("VimwikiGenerateTags", "VimwikiGenerateTagLinks") |
\ call vimwiki#tags#generate_tags(1, <f-args>)
command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
command! -buffer VimwikiPasteLink call vimwiki#path#PasteLink(expand('%:p'))
command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
command! -buffer -nargs=* -range -complete=custom,vimwiki#base#complete_colorize
\ VimwikiColorize <line1>,<line2>call vimwiki#base#colorize(<f-args>)
" ------------------------------------------------
" Keybindings
" ------------------------------------------------
" mouse mappings
if str2nr(vimwiki#vars#get_global('key_mappings').mouse)
nmap <buffer> <S-LeftMouse> <NOP>
nmap <buffer> <C-LeftMouse> <NOP>
nnoremap <silent><buffer> <2-LeftMouse>
\ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<lt>2-LeftMouse>")<CR>
nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
nnoremap <silent><buffer> <MiddleMouse> <LeftMouse>:VimwikiBaddLink<CR>
nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
endif
" <Plug> HTML definitions
nnoremap <script><buffer> <Plug>Vimwiki2HTML :Vimwiki2HTML<CR>
nnoremap <script><buffer> <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR>
" default HTML key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').html)
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'h', '<Plug>Vimwiki2HTML')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'hh', '<Plug>Vimwiki2HTMLBrowse')
endif
" <Plug> links definitions
nnoremap <silent><script><buffer> <Plug>VimwikiFollowLink
\ :VimwikiFollowLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiSplitLink
\ :VimwikiSplitLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiVSplitLink
\ :VimwikiVSplitLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiBaddLink
\ :VimwikiBaddLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLink
\ :VimwikiNormalizeLink 0<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual
\ :<C-U>VimwikiNormalizeLink 1<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisualCR
\ :<C-U>VimwikiNormalizeLink 1<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiTabnewLink
\ :VimwikiTabnewLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiTabDropLink
\ :VimwikiTabDropLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiGoBackLink
\ :VimwikiGoBackLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiNextLink
\ :VimwikiNextLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiPrevLink
\ :VimwikiPrevLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiGoto
\ :VimwikiGoto<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiDeleteFile
\ :VimwikiDeleteFile<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiRenameFile
\ :VimwikiRenameFile<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryNextDay
\ :VimwikiDiaryNextDay<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryPrevDay
\ :VimwikiDiaryPrevDay<CR>
noremap <script><buffer> <Plug>VimwikiColorizeNormal
\ :call vimwiki#base#colorize(vimwiki#base#get_user_color(), '')<CR>
vnoremap <script><buffer> <Plug>VimwikiColorize
\ :call vimwiki#base#colorize(vimwiki#base#get_user_color(), visualmode())<CR>
" Declare Map: default links key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').links)
call vimwiki#u#map_key('n', '<CR>', '<Plug>VimwikiFollowLink')
call vimwiki#u#map_key('n', '<S-CR>', '<Plug>VimwikiSplitLink')
call vimwiki#u#map_key('n', '<C-CR>', '<Plug>VimwikiVSplitLink')
call vimwiki#u#map_key('n', '<M-CR>', '<Plug>VimwikiBaddLink')
call vimwiki#u#map_key('n', '+', '<Plug>VimwikiNormalizeLink')
call vimwiki#u#map_key('v', '+', '<Plug>VimwikiNormalizeLinkVisual')
call vimwiki#u#map_key('v', '<CR>', '<Plug>VimwikiNormalizeLinkVisualCR')
call vimwiki#u#map_key('n', '<D-CR>', '<Plug>VimwikiTabDropLink')
call vimwiki#u#map_key('n', '<C-S-CR>', '<Plug>VimwikiTabDropLink', 1)
call vimwiki#u#map_key('n', '<BS>', '<Plug>VimwikiGoBackLink')
call vimwiki#u#map_key('n', '<TAB>', '<Plug>VimwikiNextLink')
call vimwiki#u#map_key('n', '<S-TAB>', '<Plug>VimwikiPrevLink')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'n', '<Plug>VimwikiGoto')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'d', '<Plug>VimwikiDeleteFile')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'r', '<Plug>VimwikiRenameFile')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'c', '<Plug>VimwikiColorizeNormal')
call vimwiki#u#map_key('v', vimwiki#vars#get_global('map_prefix').'c', '<Plug>VimwikiColorize')
call vimwiki#u#map_key('n', '<C-Down>', '<Plug>VimwikiDiaryNextDay')
call vimwiki#u#map_key('n', '<C-Up>', '<Plug>VimwikiDiaryPrevDay')
endif
" Map: <Plug> lists definitions
nnoremap <silent><script><buffer> <Plug>VimwikiNextTask
\ :VimwikiNextTask<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem
\ :VimwikiToggleListItem<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem
\ :VimwikiToggleListItem<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiToggleRejectedListItem
\ :VimwikiToggleRejectedListItem<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiToggleRejectedListItem
\ :VimwikiToggleRejectedListItem<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiIncrementListItem
\ :VimwikiIncrementListItem<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiIncrementListItem
\ :VimwikiIncrementListItem<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiDecrementListItem
\ :VimwikiDecrementListItem<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiDecrementListItem
\ :VimwikiDecrementListItem<CR>
inoremap <silent><script><buffer> <Plug>VimwikiDecreaseLvlSingleItem
\ <C-O>:VimwikiListChangeLvl decrease 0<CR>
inoremap <silent><script><buffer> <Plug>VimwikiIncreaseLvlSingleItem
\ <C-O>:VimwikiListChangeLvl increase 0<CR>
inoremap <silent><script><buffer> <Plug>VimwikiListNextSymbol
\ <C-O>:VimwikiListChangeSymbolI next<CR>
inoremap <silent><script><buffer> <Plug>VimwikiListPrevSymbol
\ <C-O>:VimwikiListChangeSymbolI prev<CR>
inoremap <silent><script><buffer> <Plug>VimwikiListToggle
\ <Esc>:VimwikiListToggle<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiRenumberList
\ :VimwikiRenumberList<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiRenumberAllLists
\ :VimwikiRenumberAllLists<CR>
noremap <silent><script><buffer> <Plug>VimwikiDecreaseLvlSingleItem
\ :VimwikiListChangeLvl decrease 0<CR>
noremap <silent><script><buffer> <Plug>VimwikiIncreaseLvlSingleItem
\ :VimwikiListChangeLvl increase 0<CR>
noremap <silent><script><buffer> <Plug>VimwikiDecreaseLvlWholeItem
\ :VimwikiListChangeLvl decrease 1<CR>
noremap <silent><script><buffer> <Plug>VimwikiIncreaseLvlWholeItem
\ :VimwikiListChangeLvl increase 1<CR>
noremap <silent><script><buffer> <Plug>VimwikiRemoveSingleCB
\ :VimwikiRemoveSingleCB<CR>
noremap <silent><script><buffer> <Plug>VimwikiRemoveCBInList
\ :VimwikiRemoveCBInList<CR>
nnoremap <silent><buffer> <Plug>VimwikiListo
\ :<C-U>call vimwiki#u#count_exe('call vimwiki#lst#kbd_o()')<CR>
nnoremap <silent><buffer> <Plug>VimwikiListO
\ :<C-U>call vimwiki#u#count_exe('call vimwiki#lst#kbd_O()')<CR>
" Declare Map: default lists key mappings (again)
if str2nr(vimwiki#vars#get_global('key_mappings').lists)
call vimwiki#u#map_key('n', 'gnt', '<Plug>VimwikiNextTask')
if !hasmapto('<Plug>VimwikiToggleListItem')
call vimwiki#u#map_key('n', '<C-Space>', '<Plug>VimwikiToggleListItem')
call vimwiki#u#map_key('v', '<C-Space>', '<Plug>VimwikiToggleListItem', 1)
if has('unix')
call vimwiki#u#map_key('n', '<C-@>', '<Plug>VimwikiToggleListItem', 1)
call vimwiki#u#map_key('v', '<C-@>', '<Plug>VimwikiToggleListItem', 1)
endif
endif
call vimwiki#u#map_key('n', 'glx', '<Plug>VimwikiToggleRejectedListItem')
call vimwiki#u#map_key('v', 'glx', '<Plug>VimwikiToggleRejectedListItem', 1)
call vimwiki#u#map_key('n', 'gln', '<Plug>VimwikiIncrementListItem')
call vimwiki#u#map_key('v', 'gln', '<Plug>VimwikiIncrementListItem', 1)
call vimwiki#u#map_key('n', 'glp', '<Plug>VimwikiDecrementListItem')
call vimwiki#u#map_key('v', 'glp', '<Plug>VimwikiDecrementListItem', 1)
call vimwiki#u#map_key('i', '<C-D>', '<Plug>VimwikiDecreaseLvlSingleItem')
call vimwiki#u#map_key('i', '<C-T>', '<Plug>VimwikiIncreaseLvlSingleItem')
call vimwiki#u#map_key('n', 'glh', '<Plug>VimwikiDecreaseLvlSingleItem', 1)
call vimwiki#u#map_key('n', 'gll', '<Plug>VimwikiIncreaseLvlSingleItem', 1)
call vimwiki#u#map_key('n', 'gLh', '<Plug>VimwikiDecreaseLvlWholeItem')
call vimwiki#u#map_key('n', 'gLH', '<Plug>VimwikiDecreaseLvlWholeItem', 1)
call vimwiki#u#map_key('n', 'gLl', '<Plug>VimwikiIncreaseLvlWholeItem')
call vimwiki#u#map_key('n', 'gLL', '<Plug>VimwikiIncreaseLvlWholeItem', 1)
call vimwiki#u#map_key('i', '<C-L><C-J>', '<Plug>VimwikiListNextSymbol')
call vimwiki#u#map_key('i', '<C-L><C-K>', '<Plug>VimwikiListPrevSymbol')
call vimwiki#u#map_key('i', '<C-L><C-M>', '<Plug>VimwikiListToggle')
call vimwiki#u#map_key('n', 'glr', '<Plug>VimwikiRenumberList')
call vimwiki#u#map_key('n', 'gLr', '<Plug>VimwikiRenumberAllLists')
call vimwiki#u#map_key('n', 'gLR', '<Plug>VimwikiRenumberAllLists', 1)
call vimwiki#u#map_key('n', 'gl', '<Plug>VimwikiRemoveSingleCB')
call vimwiki#u#map_key('n', 'gL', '<Plug>VimwikiRemoveCBInList')
call vimwiki#u#map_key('n', 'o', '<Plug>VimwikiListo')
call vimwiki#u#map_key('n', 'O', '<Plug>VimwikiListO')
" Set lists_return to 0, if you don't want <CR> mapped to VimwikiReturn
if str2nr(vimwiki#vars#get_global('key_mappings').lists_return)
" Handle case of existing VimwikiReturn mappings outside the <Plug> definition
" Note: Avoid interfering with popup/completion menu if it's active (#813)
if maparg('<CR>', 'i') !~# '.*VimwikiReturn*.'
if has('patch-7.3.489')
" expand iabbrev on enter
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<C-]><Esc>:VimwikiReturn 1 5<CR>'
else
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 1 5<CR>'
endif
endif
if maparg('<S-CR>', 'i') !~# '.*VimwikiReturn*.'
inoremap <expr><silent><buffer> <S-CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 2 2<CR>'
endif
endif
" change symbol for bulleted lists
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')
exe 'noremap <silent><buffer> gl'.s:char.' :VimwikiChangeSymbolTo '.s:char.'<CR>'
endif
if !hasmapto(':VimwikiChangeSymbolInListTo '.s:char.'<CR>')
exe 'noremap <silent><buffer> gL'.s:char.' :VimwikiChangeSymbolInListTo '.s:char.'<CR>'
endif
endfor
" change symbol for numbered lists
for s:typ in vimwiki#vars#get_syntaxlocal('number_types')
if !hasmapto(':VimwikiChangeSymbolTo '.s:typ.'<CR>')
exe 'noremap <silent><buffer> gl'.s:typ[0].' :VimwikiChangeSymbolTo '.s:typ.'<CR>'
endif
if !hasmapto(':VimwikiChangeSymbolInListTo '.s:typ.'<CR>')
exe 'noremap <silent><buffer> gL'.s:typ[0].' :VimwikiChangeSymbolInListTo '.s:typ.'<CR>'
endif
endfor
" insert items in a list using langmap characters (see :h langmap)
if !empty(&langmap)
" Valid only if langmap is a comma separated pairs of chars
let s:l_o = matchstr(&langmap, '\C,\zs.\zeo,')
if s:l_o
exe 'nnoremap <silent><buffer> '.s:l_o.' :call vimwiki#lst#kbd_o()<CR>a'
endif
let s:l_O = matchstr(&langmap, '\C,\zs.\zeO,')
if s:l_O
exe 'nnoremap <silent><buffer> '.s:l_O.' :call vimwiki#lst#kbd_O()<CR>a'
endif
endif
endif
function! s:CR(normal, just_mrkr) abort
let res = vimwiki#tbl#kbd_cr()
if res !=? ''
exe 'normal! ' . res . "\<Right>"
startinsert
return
endif
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
endfunction
" insert mode table mappings
inoremap <silent><buffer><expr> <Plug>VimwikiTableNextCell
\ vimwiki#tbl#kbd_tab()
inoremap <silent><buffer><expr> <Plug>VimwikiTablePrevCell
\ vimwiki#tbl#kbd_shift_tab()
if str2nr(vimwiki#vars#get_global('key_mappings').table_mappings)
call vimwiki#u#map_key('i', '<Tab>', '<Plug>VimwikiTableNextCell')
call vimwiki#u#map_key('i', '<S-Tab>', '<Plug>VimwikiTablePrevCell')
endif
" <Plug> table formatting definitions
nnoremap <silent><buffer> <Plug>VimwikiTableAlignQ
\ :VimwikiTableAlignQ<CR>
nnoremap <silent><buffer> <Plug>VimwikiTableAlignQ1
\ :VimwikiTableAlignQ 2<CR>
nnoremap <silent><buffer> <Plug>VimwikiTableAlignW
\ :VimwikiTableAlignW<CR>
nnoremap <silent><buffer> <Plug>VimwikiTableAlignW1
\ :VimwikiTableAlignW 2<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiTableMoveColumnLeft
\ :VimwikiTableMoveColumnLeft<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiTableMoveColumnRight
\ :VimwikiTableMoveColumnRight<CR>
" default table formatting key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').table_format)
call vimwiki#u#map_key('n', 'gqq', '<Plug>VimwikiTableAlignQ')
call vimwiki#u#map_key('n', 'gq1', '<Plug>VimwikiTableAlignQ1')
call vimwiki#u#map_key('n', 'gww', '<Plug>VimwikiTableAlignW')
call vimwiki#u#map_key('n', 'gw1', '<Plug>VimwikiTableAlignW1')
call vimwiki#u#map_key('n', '<A-Left>', '<Plug>VimwikiTableMoveColumnLeft')
call vimwiki#u#map_key('n', '<A-Right>', '<Plug>VimwikiTableMoveColumnRight')
endif
" <Plug> text object definitions
onoremap <silent><buffer> <Plug>VimwikiTextObjHeader
\ :<C-U>call vimwiki#base#TO_header(0, 0, v:count1)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjHeaderV
\ :<C-U>call vimwiki#base#TO_header(0, 0, v:count1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjHeaderContent
\ :<C-U>call vimwiki#base#TO_header(1, 0, v:count1)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjHeaderContentV
\ :<C-U>call vimwiki#base#TO_header(1, 0, v:count1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjHeaderSub
\ :<C-U>call vimwiki#base#TO_header(0, 1, v:count1)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjHeaderSubV
\ :<C-U>call vimwiki#base#TO_header(0, 1, v:count1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjHeaderSubContent
\ :<C-U>call vimwiki#base#TO_header(1, 1, v:count1)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjHeaderSubContentV
\ :<C-U>call vimwiki#base#TO_header(1, 1, v:count1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjTableCell
\ :<C-U>call vimwiki#base#TO_table_cell(0, 0)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjTableCellV
\ :<C-U>call vimwiki#base#TO_table_cell(0, 1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjTableCellInner
\ :<C-U>call vimwiki#base#TO_table_cell(1, 0)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjTableCellInnerV
\ :<C-U>call vimwiki#base#TO_table_cell(1, 1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjColumn
\ :<C-U>call vimwiki#base#TO_table_col(0, 0)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjColumnV
\ :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjColumnInner
\ :<C-U>call vimwiki#base#TO_table_col(1, 0)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjColumnInnerV
\ :<C-U>call vimwiki#base#TO_table_col(1, 1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjListChildren
\ :<C-U>call vimwiki#lst#TO_list_item(0, 0)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjListChildrenV
\ :<C-U>call vimwiki#lst#TO_list_item(0, 1)<CR>
onoremap <silent><buffer> <Plug>VimwikiTextObjListSingle
\ :<C-U>call vimwiki#lst#TO_list_item(1, 0)<CR>
vnoremap <silent><buffer> <Plug>VimwikiTextObjListSingleV
\ :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
" Declare Map: default text object key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').text_objs)
call vimwiki#u#map_key('o', 'ah', '<Plug>VimwikiTextObjHeader')
call vimwiki#u#map_key('v', 'ah', '<Plug>VimwikiTextObjHeaderV')
call vimwiki#u#map_key('o', 'ih', '<Plug>VimwikiTextObjHeaderContent')
call vimwiki#u#map_key('v', 'ih', '<Plug>VimwikiTextObjHeaderContentV')
call vimwiki#u#map_key('o', 'aH', '<Plug>VimwikiTextObjHeaderSub')
call vimwiki#u#map_key('v', 'aH', '<Plug>VimwikiTextObjHeaderSubV')
call vimwiki#u#map_key('o', 'iH', '<Plug>VimwikiTextObjHeaderSubContent')
call vimwiki#u#map_key('v', 'iH', '<Plug>VimwikiTextObjHeaderSubContentV')
call vimwiki#u#map_key('o', 'a\', '<Plug>VimwikiTextObjTableCell')
call vimwiki#u#map_key('v', 'a\', '<Plug>VimwikiTextObjTableCellV')
call vimwiki#u#map_key('o', 'i\', '<Plug>VimwikiTextObjTableCellInner')
call vimwiki#u#map_key('v', 'i\', '<Plug>VimwikiTextObjTableCellInnerV')
call vimwiki#u#map_key('o', 'ac', '<Plug>VimwikiTextObjColumn')
call vimwiki#u#map_key('v', 'ac', '<Plug>VimwikiTextObjColumnV')
call vimwiki#u#map_key('o', 'ic', '<Plug>VimwikiTextObjColumnInner')
call vimwiki#u#map_key('v', 'ic', '<Plug>VimwikiTextObjColumnInnerV')
call vimwiki#u#map_key('o', 'al', '<Plug>VimwikiTextObjListChildren')
call vimwiki#u#map_key('v', 'al', '<Plug>VimwikiTextObjListChildrenV')
call vimwiki#u#map_key('o', 'il', '<Plug>VimwikiTextObjListSingle')
call vimwiki#u#map_key('v', 'il', '<Plug>VimwikiTextObjListSingleV')
endif
" Map: <Plug> header definitions
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel
\ :<C-U>call vimwiki#base#AddHeaderLevel(v:count)<CR>
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel
\ :<C-U>call vimwiki#base#RemoveHeaderLevel(v:count)<CR>
nnoremap <silent><buffer> <Plug>VimwikiGoToParentHeader
\ :<C-u>call vimwiki#base#goto_parent_header()<CR>
nnoremap <silent><buffer> <Plug>VimwikiGoToNextHeader
\ :<C-u>call vimwiki#base#goto_next_header()<CR>
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevHeader
\ :<C-u>call vimwiki#base#goto_prev_header()<CR>
nnoremap <silent><buffer> <Plug>VimwikiGoToNextSiblingHeader
\ :<C-u>call vimwiki#base#goto_sibling(+1)<CR>
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevSiblingHeader
\ :<C-u>call vimwiki#base#goto_sibling(-1)<CR>
" Declare Map Header: default header key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').headers)
call vimwiki#u#map_key('n', '=', '<Plug>VimwikiAddHeaderLevel')
call vimwiki#u#map_key('n', '-', '<Plug>VimwikiRemoveHeaderLevel')
call vimwiki#u#map_key('n', ']u', '<Plug>VimwikiGoToParentHeader')
call vimwiki#u#map_key('n', '[u', '<Plug>VimwikiGoToParentHeader', 1)
call vimwiki#u#map_key('n', ']]', '<Plug>VimwikiGoToNextHeader')
call vimwiki#u#map_key('n', '[[', '<Plug>VimwikiGoToPrevHeader')
call vimwiki#u#map_key('n', ']=', '<Plug>VimwikiGoToNextSiblingHeader')
call vimwiki#u#map_key('n', '[=', '<Plug>VimwikiGoToPrevSiblingHeader')
endif
if vimwiki#vars#get_wikilocal('auto_export')
" Automatically generate HTML on page write.
augroup vimwiki
au BufWritePost <buffer>
\ call vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')),
\ expand('%'))
augroup END
endif
if vimwiki#vars#get_wikilocal('auto_toc')
" Automatically update the TOC *before* the file is written
augroup vimwiki
au BufWritePre <buffer> call vimwiki#base#table_of_contents(0)
augroup END
endif
if vimwiki#vars#get_wikilocal('auto_tags')
" Automatically update tags metadata on page write.
augroup vimwiki
au BufWritePre <buffer> call vimwiki#tags#update_tags(0, '')
augroup END
endif
if vimwiki#vars#get_wikilocal('auto_generate_links')
" Automatically generate links *before* the file is written
augroup vimwiki
au BufWritePre <buffer> call vimwiki#base#generate_links(0)
augroup END
endif
if vimwiki#vars#get_wikilocal('auto_generate_tags')
" Automatically generate tags *before* the file is written
augroup vimwiki
au BufWritePre <buffer> call vimwiki#tags#generate_tags(0)
augroup END
endif

View File

@@ -0,0 +1,482 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki plugin file
" Home: https://github.com/vimwiki/vimwiki/
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
" Clause: load only onces
if exists('g:loaded_vimwiki') || &compatible
finish
endif
let g:loaded_vimwiki = 1
" Set to version number for release:
let g:vimwiki_version = '2022.12.02'
" Get the directory the script is installed in
let s:plugin_dir = expand('<sfile>:p:h:h')
" Save peace in the galaxy
let s:old_cpo = &cpoptions
set cpoptions&vim
" Save autowriteall varaible state
if exists('g:vimwiki_autowriteall')
let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
else
let s:vimwiki_autowriteall_saved = 1
endif
" Autocommand called when the cursor leaves the buffer
function! s:setup_buffer_leave() abort
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
" a registered wiki and not a temporary wiki)
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
return
endif
let &autowriteall = s:vimwiki_autowriteall_saved
if !empty(vimwiki#vars#get_global('menu'))
exe 'nmenu disable '.vimwiki#vars#get_global('menu').'.Table'
endif
endfunction
" Create a new temporary wiki for the current buffer
function! s:create_temporary_wiki() abort
let path = expand('%:p:h')
let ext = '.'.expand('%:e')
let syntax_mapping = vimwiki#vars#get_global('ext2syntax')
if has_key(syntax_mapping, ext)
let syntax = syntax_mapping[ext]
else
let syntax = vimwiki#vars#get_wikilocal_default('syntax')
endif
let new_temp_wiki_settings = {'path': path,
\ 'ext': ext,
\ 'syntax': syntax,
\ }
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
" Update the wiki number of the current buffer, because it may have changed when adding this
" temporary wiki.
call vimwiki#vars#set_bufferlocal('wiki_nr', vimwiki#base#find_wiki(expand('%:p')))
endfunction
" Autocommand called when Vim opens a new buffer with a known wiki
" extension. Both when the buffer has never been opened in this session and
" when it has.
function! s:setup_new_wiki_buffer() abort
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
if wiki_nr == -1 " it's not in a known wiki directory
if vimwiki#vars#get_global('global_ext')
call s:create_temporary_wiki()
else
" the user does not want a temporary wiki, so do nothing
return
endif
endif
if vimwiki#vars#get_wikilocal('maxhi')
call vimwiki#vars#set_bufferlocal('existing_wikifiles', vimwiki#base#get_wikilinks(wiki_nr, 1, ''))
call vimwiki#vars#set_bufferlocal('existing_wikidirs',
\ vimwiki#base#get_wiki_directories(wiki_nr))
endif
" this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are
" sourced
call vimwiki#u#ft_set()
endfunction
" Autocommand called when the cursor enters the buffer
function! s:setup_buffer_enter() abort
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
" a registered wiki and not a temporary wiki)
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
return
endif
call s:set_global_options()
endfunction
" Autocommand called when the buffer enters a window or when running a diff
function! s:setup_buffer_win_enter() abort
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
" a registered wiki and not a temporary wiki)
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
return
endif
if !vimwiki#u#ft_is_vw()
call vimwiki#u#ft_set()
endif
call s:set_windowlocal_options()
endfunction
" Help syntax reloading
function! s:setup_cleared_syntax() abort
" highlight groups that get cleared
" on colorscheme change because they are not linked to Vim-predefined groups
hi def VimwikiBold term=bold cterm=bold gui=bold
hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def VimwikiUnderline term=underline cterm=underline gui=underline
if vimwiki#vars#get_global('hl_headers') == 1
for i in range(1,6)
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
\ . vimwiki#vars#get_global('hcolor_guifg_'.&background)[i-1]
\ .' gui=bold ctermfg='.vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[i-1]
\ .' term=bold cterm=bold'
endfor
endif
endfunction
" Return: list of extension known vy vimwiki
function! s:vimwiki_get_known_extensions() abort
" Getting all extensions that different wikis could have
let extensions = {}
for idx in range(vimwiki#vars#number_of_wikis())
let ext = vimwiki#vars#get_wikilocal('ext', idx)
let extensions[ext] = 1
endfor
" append extensions from g:vimwiki_ext2syntax
for ext in keys(vimwiki#vars#get_global('ext2syntax'))
let extensions[ext] = 1
endfor
return keys(extensions)
endfunction
" Set settings which are global for Vim, but should only be executed for
" Vimwiki buffers. So they must be set when the cursor enters a Vimwiki buffer
" and reset when the cursor leaves the buffer.
function! s:set_global_options() abort
let s:vimwiki_autowriteall_saved = &autowriteall
let &autowriteall = vimwiki#vars#get_global('autowriteall')
if !empty(vimwiki#vars#get_global('menu'))
exe 'nmenu enable '.vimwiki#vars#get_global('menu').'.Table'
endif
endfunction
" Set settings which are local to a window. In a new tab they would be reset to
" Vim defaults. So we enforce our settings here when the cursor enters a
" Vimwiki buffer.
function! s:set_windowlocal_options() abort
if !&diff " if Vim is currently in diff mode, don't interfere with its folding
let foldmethod = vimwiki#vars#get_global('folding')
if foldmethod =~? '^expr.*'
setlocal foldmethod=expr
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
setlocal foldtext=VimwikiFoldText()
elseif foldmethod =~? '^list.*' || foldmethod =~? '^lists.*'
setlocal foldmethod=expr
setlocal foldexpr=VimwikiFoldListLevel(v:lnum)
setlocal foldtext=VimwikiFoldText()
elseif foldmethod =~? '^syntax.*'
setlocal foldmethod=syntax
setlocal foldtext=VimwikiFoldText()
elseif foldmethod =~? '^custom.*'
" do nothing
else
setlocal foldmethod=manual
normal! zE
endif
endif
if exists('+conceallevel')
let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
endif
if vimwiki#vars#get_global('auto_chdir')
exe 'lcd' vimwiki#vars#get_wikilocal('path')
endif
endfunction
" Echo vimwiki version
" Called by :VimwikiShowVersion
function! s:get_version() abort
echo 'Version: ' . g:vimwiki_version
let l:plugin_rev = system('git --git-dir ' . s:plugin_dir . '/.git rev-parse --short HEAD')
let l:plugin_branch = system('git --git-dir ' . s:plugin_dir . '/.git rev-parse --abbrev-ref HEAD')
let l:plugin_date = system('git --git-dir ' . s:plugin_dir . '/.git show -s --format=%ci')
if v:shell_error == 0
echo 'Os: ' . vimwiki#u#os_name()
echo 'Vim: ' . v:version
echo 'Branch: ' . l:plugin_branch
echo 'Revision: ' . l:plugin_rev
echo 'Date: ' . l:plugin_date
else
echo 'Unable to retrieve repository info'
endif
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Initialization of Vimwiki starts here.
" Make sure everything below does not cause autoload/vimwiki/base.vim
" to be loaded
call vimwiki#vars#init()
" Define callback functions which the user can redefine
if !exists('*VimwikiLinkHandler')
function VimwikiLinkHandler(url)
return 0
endfunction
endif
if !exists('*VimwikiLinkConverter')
function VimwikiLinkConverter(url, source, target)
" Return the empty string when unable to process link
return ''
endfunction
endif
if !exists('*VimwikiWikiIncludeHandler')
function! VimwikiWikiIncludeHandler(value)
return ''
endfunction
endif
" Write a level 1 header to new wiki files
" a:fname should be an absolute filepath
function! s:create_h1(fname) abort
" Clause: Don't do anything for unregistered wikis
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
if idx == -1
return
endif
" Clause: no auto_header
if !vimwiki#vars#get_global('auto_header')
return
endif
" Clause: don't create header for the diary index page
if vimwiki#path#is_equal(a:fname,
\ vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx).
\ vimwiki#vars#get_wikilocal('diary_index', idx).vimwiki#vars#get_wikilocal('ext', idx))
return
endif
" Get tail of filename without extension
let title = expand('%:t:r')
" Clause: don't insert header for index page
if title ==# vimwiki#vars#get_wikilocal('index', idx)
return
endif
" Don't substitute space char for diary pages
if title !~# '^\d\{4}-\d\d-\d\d'
" NOTE: it is possible this could remove desired characters if the 'links_space_char'
" character matches characters that are intentionally used in the title.
let title = substitute(title, vimwiki#vars#get_wikilocal('links_space_char'), ' ', 'g')
endif
" Insert the header
if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
keepjumps call append(0, '# ' . title)
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
keepjumps call append(1, '')
endfor
else
keepjumps call append(0, '= ' . title . ' =')
endif
endfunction
" Define autocommands for all known wiki extensions
let s:known_extensions = s:vimwiki_get_known_extensions()
if index(s:known_extensions, '.wiki') > -1
augroup filetypedetect
" Clear FlexWiki's stuff
au! * *.wiki
augroup end
endif
augroup vimwiki
autocmd!
autocmd ColorScheme * call s:setup_cleared_syntax()
" ['.md', '.mdown'] => *.md,*.mdown
let pat = join(map(s:known_extensions, '"*" . v:val'), ',')
exe 'autocmd BufNewFile,BufRead '.pat.' call s:setup_new_wiki_buffer()'
exe 'autocmd BufEnter '.pat.' call s:setup_buffer_enter()'
exe 'autocmd BufLeave '.pat.' call s:setup_buffer_leave()'
exe 'autocmd BufWinEnter '.pat.' call s:setup_buffer_win_enter()'
if exists('##DiffUpdated')
exe 'autocmd DiffUpdated '.pat.' call s:setup_buffer_win_enter()'
endif
" automatically generate a level 1 header for new files
exe 'autocmd BufNewFile '.pat.' call s:create_h1(expand("%:p"))'
" Format tables when exit from insert mode. Do not use textwidth to
" autowrap tables.
if vimwiki#vars#get_global('table_auto_fmt')
exe 'autocmd InsertLeave '.pat.' call vimwiki#tbl#format(line("."), 2)'
endif
if vimwiki#vars#get_global('folding') =~? ':quick$'
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
exe 'autocmd InsertEnter '.pat.' if !exists("w:last_fdm") | let w:last_fdm=&foldmethod'.
\ ' | setlocal foldmethod=manual | endif'
exe 'autocmd InsertLeave,WinLeave '.pat.' if exists("w:last_fdm") |'.
\ 'let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif'
endif
augroup END
" Declare global commands
command! VimwikiUISelect call vimwiki#base#ui_select()
" these commands take a count e.g. :VimwikiIndex 2
" the default behavior is to open the index, diary etc.
" for the CURRENT wiki if no count is given
command! -count=0 VimwikiIndex
\ call vimwiki#base#goto_index(<count>)
command! -count=0 VimwikiTabIndex
\ call vimwiki#base#goto_index(<count>, 1)
command! -count=0 VimwikiDiaryIndex
\ call vimwiki#diary#goto_diary_index(<count>)
command! -count=0 VimwikiMakeDiaryNote
\ call vimwiki#diary#make_note(<count>, 5)
command! -count=0 VimwikiTabMakeDiaryNote
\ call vimwiki#diary#make_note(<count>, 1)
command! -count=0 VimwikiMakeYesterdayDiaryNote
\ call vimwiki#diary#make_note(<count>, 0,
\ vimwiki#diary#diary_date_link(localtime(), -1))
command! -count=0 VimwikiMakeTomorrowDiaryNote
\ call vimwiki#diary#make_note(<count>, 0,
\ vimwiki#diary#diary_date_link(localtime(), 1))
command! VimwikiDiaryGenerateLinks
\ call vimwiki#diary#generate_diary_section()
command! VimwikiShowVersion call s:get_version()
command! -nargs=* -complete=customlist,vimwiki#vars#complete
\ VimwikiVar call vimwiki#vars#cmd(<q-args>)
" Declare global maps
" <Plug> global definitions
nnoremap <silent><script> <Plug>VimwikiIndex
\ :<C-U>call vimwiki#base#goto_index(v:count)<CR>
nnoremap <silent><script> <Plug>VimwikiTabIndex
\ :<C-U>call vimwiki#base#goto_index(v:count, 1)<CR>
nnoremap <silent><script> <Plug>VimwikiUISelect
\ :VimwikiUISelect<CR>
nnoremap <silent><script> <Plug>VimwikiDiaryIndex
\ :<C-U>call vimwiki#diary#goto_diary_index(v:count)<CR>
nnoremap <silent><script> <Plug>VimwikiDiaryGenerateLinks
\ :VimwikiDiaryGenerateLinks<CR>
nnoremap <silent><script> <Plug>VimwikiMakeDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 5)<CR>
nnoremap <silent><script> <Plug>VimwikiTabMakeDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 1)<CR>
nnoremap <silent><script> <Plug>VimwikiMakeYesterdayDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime(), -1))<CR>
nnoremap <silent><script> <Plug>VimwikiMakeTomorrowDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime(), 1))<CR>
" Set default global key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').global)
" Get the user defined prefix (default <leader>w)
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
call vimwiki#u#map_key('n', s:map_prefix . 'w', '<Plug>VimwikiIndex', 2)
call vimwiki#u#map_key('n', s:map_prefix . 't', '<Plug>VimwikiTabIndex', 2)
call vimwiki#u#map_key('n', s:map_prefix . 's', '<Plug>VimwikiUISelect', 2)
call vimwiki#u#map_key('n', s:map_prefix . 'i', '<Plug>VimwikiDiaryIndex', 2)
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>i', '<Plug>VimwikiDiaryGenerateLinks', 2)
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>w', '<Plug>VimwikiMakeDiaryNote', 2)
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>t', '<Plug>VimwikiTabMakeDiaryNote', 2)
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>y', '<Plug>VimwikiMakeYesterdayDiaryNote', 2)
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>m', '<Plug>VimwikiMakeTomorrowDiaryNote', 2)
endif
" Build global wiki menu (GUI)
function! s:build_menu(topmenu) abort
let wnamelist = []
for idx in range(vimwiki#vars#number_of_wikis())
let wname = vimwiki#vars#get_wikilocal('name', idx)
if wname ==? ''
" fall back to the path if wiki isn't named
let wname = fnamemodify(vimwiki#vars#get_wikilocal('path', idx), ':h:t')
endif
if index(wnamelist, wname) != -1
" append wiki index number to duplicate entries
let wname = wname . ' ' . string(idx + 1)
endif
" add entry to the list of names for duplicate checks
call add(wnamelist, wname)
" escape spaces and periods
let wname = escape(wname, '\ \.')
" build the menu
execute 'menu '.a:topmenu.'.Open\ index.'.wname.
\ ' :call vimwiki#base#goto_index('.(idx+1).')<CR>'
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.wname.
\ ' :call vimwiki#diary#make_note('.(idx+1).')<CR>'
endfor
endfunction
" Build global table menu (GUI)
function! s:build_table_menu(topmenu) abort
exe 'menu '.a:topmenu.'.-Sep- :'
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq'
exe 'nmenu '.a:topmenu.'.Table.Move\ column\ left<tab><A-Left> :VimwikiTableMoveColumnLeft<CR>'
exe 'nmenu '.a:topmenu.
\ '.Table.Move\ column\ right<tab><A-Right> :VimwikiTableMoveColumnRight<CR>'
exe 'nmenu disable '.a:topmenu.'.Table'
endfunction
" Build Menus now
if !empty(vimwiki#vars#get_global('menu'))
call s:build_menu(vimwiki#vars#get_global('menu'))
call s:build_table_menu(vimwiki#vars#get_global('menu'))
endif
" Hook for calendar.vim
if vimwiki#vars#get_global('use_calendar')
let g:calendar_action = 'vimwiki#diary#calendar_action'
let g:calendar_sign = 'vimwiki#diary#calendar_sign'
endif
" Restore peace in the galaxy
let &cpoptions = s:old_cpo

View File

@@ -0,0 +1,540 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki syntax file
" Home: https://github.com/vimwiki/vimwiki/
" Quit if syntax file is already loaded
if v:version < 600
syntax clear
elseif exists('b:current_syntax')
finish
endif
let s:current_syntax = vimwiki#vars#get_wikilocal('syntax')
" Get config: possibly concealed chars
let b:vimwiki_syntax_conceal = exists('+conceallevel') ? ' conceal' : ''
let b:vimwiki_syntax_concealends = has('conceal') ? ' concealends' : ''
" Populate all syntax vars
" Include syntax/vimwiki_markdown.vim as "side effect"
call vimwiki#vars#populate_syntax_vars(s:current_syntax)
let syntax_dic = g:vimwiki_syntaxlocal_vars[s:current_syntax]
" Declare nesting capabilities
" -- to be embeded in standard: bold, italic, underline
" text: `code` or ``code`` only inline
" Note: `\%(^\|[^`]\)\@<=` means after a new line or a non `
" LINKS: highlighting is complicated due to "nonexistent" links feature
function! s:add_target_syntax_ON(target, type) abort
let prefix0 = 'syntax match '.a:type.' `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match '.a:type.'T `'
let suffix1 = '` display contained'
execute prefix0. a:target. suffix0
execute prefix1. a:target. suffix1
endfunction
function! s:add_target_syntax_OFF(target) abort
let prefix0 = 'syntax match VimwikiNoExistsLink `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
let suffix1 = '` display contained'
execute prefix0. a:target. suffix0
execute prefix1. a:target. suffix1
endfunction
function! s:highlight_existing_links() abort
" Wikilink
" Conditional highlighting that depends on the existence of a wiki file or
" directory is only available for *schemeless* wiki links
" Links are set up upon BufEnter (see plugin/...)
let safe_links = '\%('.vimwiki#base#file_pattern(
\ vimwiki#vars#get_bufferlocal('existing_wikifiles')) . '\%(#[^|]*\)\?\|#[^|]*\)'
" Wikilink Dirs set up upon BufEnter (see plugin/...)
let safe_dirs = vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikidirs'))
" match [[URL]]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(target, 'VimwikiLink')
" match [[URL|DESCRIPTION]]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(target, 'VimwikiLink')
" match {{URL}}
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
call s:add_target_syntax_ON(target, 'VimwikiLink')
" match {{URL|...}}
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
call s:add_target_syntax_ON(target, 'VimwikiLink')
" match [[DIRURL]]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(target, 'VimwikiLink')
" match [[DIRURL|DESCRIPTION]]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(target, 'VimwikiLink')
endfunction
" use max highlighting - could be quite slow if there are too many wikifiles
if vimwiki#vars#get_wikilocal('maxhi')
" WikiLink
call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink'))
" WikiIncl
call s:add_target_syntax_OFF(vimwiki#vars#get_global('rxWikiIncl'))
" Subsequently, links verified on vimwiki's path are highlighted as existing
call s:highlight_existing_links()
else
" Wikilink
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink'), 'VimwikiLink')
" WikiIncl
call s:add_target_syntax_ON(vimwiki#vars#get_global('rxWikiIncl'), 'VimwikiLink')
endif
" Weblink: [DESCRIPTION](FILE)
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink')
" WikiLink:
" All remaining schemes are highlighted automatically
let s:rxSchemes = '\%('.
\ vimwiki#vars#get_global('schemes_local') . '\|'.
\ vimwiki#vars#get_global('schemes_web').
\ '\):'
" a) match [[nonwiki-scheme-URL]]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" a) match {{nonwiki-scheme-URL}}
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" b) match {{nonwiki-scheme-URL}[{...}]}
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" Header Level: 1..6
for s:i in range(1,6)
" WebLink are for markdown but putting them here avoidcode duplication
" -- and syntax folding Issue #1009
execute 'syntax match VimwikiHeader'.s:i
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax)
\ . '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'
\ . 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,VimwikiList,VimwikiListTodo,@Spell'
execute 'syntax region VimwikiH'.s:i.'Folding start=/'
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax)
\ . '/me=s-1'
\ . ' transparent fold'
endfor
" SetExt Header:
" TODO mutualise SetExt Regexp
let setex_header1_re = '^\s\{0,3}[^>].*\n\s\{0,3}==\+$'
let setex_header2_re = '^\s\{0,3}[^>].*\n\s\{0,3}--\+$'
execute 'syntax match VimwikiHeader1'
\ . ' /'. setex_header1_re . '/ '
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
execute 'syntax match VimwikiHeader2'
\ . ' /'. setex_header2_re . '/ ' .
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
let s:options = ' contained transparent contains=NONE'
if exists('+conceallevel')
let s:options .= b:vimwiki_syntax_conceal
endif
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
" VimwikiLinkRest group is left undefined if link shortening is not desired
if exists('+conceallevel') && vimwiki#vars#get_global('url_maxsave') > 0
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
\.'\%([/#?]\w\|\S\{'.vimwiki#vars#get_global('url_maxsave').'}\)`'.' cchar=~'.s:options
endif
" VimwikiLinkChar is for syntax markers (and also URL when a description
" is present) and may be concealed
" conceal wikilinks
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_prefix').'/'.s:options
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_suffix').'/'.s:options
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_prefix1').'/'.s:options
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_suffix1').'/'.s:options
" conceal wikiincls
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclPrefix').'/'.s:options
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix').'/'.s:options
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclPrefix1').'/'.s:options
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix1').'/'.s:options
" non concealed chars
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.
\ vimwiki#vars#get_syntaxlocal('header_symbol').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('header_symbol').
\ '\+\s*$\)/'
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_wikilocal('rx_todo') .'/'
" Table:
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ transparent contains=VimwikiCellSeparator,
\ VimwikiLinkT,
\ VimwikiNoExistsLinkT,
\ VimwikiTodo,
\ VimwikiBoldT,
\ VimwikiItalicT,
\ VimwikiBoldItalicT,
\ VimwikiItalicBoldT,
\ VimwikiDelTextT,
\ VimwikiSuperScriptT,
\ VimwikiSubScriptT,
\ VimwikiCodeT,
\ VimwikiEqInT,
\ VimwikiEmoji,
\ @Spell
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
" List:
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
" Task List Done:
if vimwiki#vars#get_global('hl_cb_checked') == 1
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
\ . vimwiki#vars#get_global('listsym_rejected')
\ . ']\]\s\(.*\)$/ '
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
execute 'syntax match VimwikiCheckBoxDone /'
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
endif
" Horizontal Rule: <hr>
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
" Preformated Text: `like that`
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@NoSpell'.concealpre
" Equation Text: $like that$
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell'
" Placeholder:
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
syntax match VimwikiPlaceholder
\ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
syntax match VimwikiPlaceholder
\ /^\s*%date\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
syntax match VimwikiPlaceholder
\ /^\s*%template\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
syntax match VimwikiPlaceholderParam /.*/ contained
" Html Tag: <u>
if vimwiki#vars#get_global('valid_html_tags') !=? ''
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
" Html Typeface: <b>bold text</b>
let html_typeface = {
\ 'bold': [['<b>', '</b\_s*>'], ['<strong>', '</strong\_s*>']],
\ 'italic': [['<i>', '</i\_s*>'], ['<em>', '</em\_s*>']],
\ 'underline': [['<u>', '</u\_s*>']],
\ 'code': [['<code>', '</code\_s*>']],
\ 'del': [['<del>', '</del\_s*>']],
\ 'eq': [],
\ 'sup': [['<sup>', '</sup\_s*>']],
\ 'sub': [['<sub>', '</sub\_s*>']],
\ }
" Highlight now
call vimwiki#u#hi_typeface(html_typeface)
endif
" Html Color: <span style="color:#FF0000";>Red paragraph</span>
" -- See: h color_dic
let color_dic = vimwiki#vars#get_wikilocal('color_dic')
let color_tag = vimwiki#vars#get_wikilocal('color_tag_template')
for [color_key, color_value] in items(color_dic)
let [fg, bg] = color_value
let delimiter = color_tag
let delimiter = substitute(delimiter, '__COLORFG__', fg, 'g')
let delimiter = substitute(delimiter, '__COLORBG__', bg, 'g')
" The user input has been already checked
let [pre_region, post_region] = split(delimiter, '__CONTENT__')
let cmd = 'syntax region Vimwiki' . color_key . ' matchgroup=VimwikiDelimiterColor'
\ . ' start=/' . pre_region . '/'
\ . ' end=/' . post_region . '/'
\ . ' ' . b:vimwiki_syntax_concealends
execute cmd
" Build hightlight command
let cmd = 'hi Vimwiki' . color_key
if fg !=# ''
let cmd .= ' guifg=' . fg
endif
if bg !=# ''
let cmd .= ' guibg=' . bg
endif
execute cmd
endfor
" Comment: home made
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex').
\ '/ contains=@Spell,VimwikiTodo'
" Only do syntax highlighting for multiline comments if they exist
let mc_format = vimwiki#vars#get_syntaxlocal('multiline_comment_format')
if !empty(mc_format.pre_mark) && !empty(mc_format.post_mark)
execute 'syntax region VimwikiMultilineComment start=/'.mc_format.pre_mark.
\ '/ end=/'.mc_format.post_mark.'/ contains=@NoSpell,VimwikiTodo'
endif
" Tag:
let tag_cmd = 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
let tf = vimwiki#vars#get_wikilocal('tag_format')
if exists('+conceallevel') && tf.conceal != 0
let tag_cmd .= ' conceal'
if tf.cchar !=# ''
let tag_cmd .= ' cchar=' . tf.cchar
endif
endif
execute tag_cmd
" Header Groups: highlighting
if vimwiki#vars#get_global('hl_headers') == 0
" Strangely in default colorscheme Title group is not set to bold for cterm...
if !exists('g:colors_name')
hi Title cterm=bold
endif
for s:i in range(1,6)
execute 'hi def link VimwikiHeader'.s:i.' Title'
endfor
else
for s:i in range(1,6)
execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg='
\ .vimwiki#vars#get_global('hcolor_guifg_'.&background)[s:i-1].' gui=bold ctermfg='
\ .vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[s:i-1].' term=bold cterm=bold'
endfor
endif
" Typeface: -> u.vim
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
call vimwiki#u#hi_typeface(s:typeface_dic)
" Link highlighting groups
""""""""""""""""""""""""""
hi def link VimwikiMarkers Normal
hi def link VimwikiError Normal
hi def link VimwikiEqIn Number
hi def link VimwikiEqInT VimwikiEqIn
" Typeface 1
hi def VimwikiBold term=bold cterm=bold gui=bold
hi def link VimwikiBoldT VimwikiBold
hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def link VimwikiItalicT VimwikiItalic
hi def VimwikiUnderline term=underline cterm=underline gui=underline
" Typeface 2
" Bold > Italic > Underline
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def link VimwikiItalicBold VimwikiBoldItalic
hi def link VimwikiBoldItalicT VimwikiBoldItalic
hi def link VimwikiItalicBoldT VimwikiBoldItalic
hi def VimwikiBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
hi def link VimwikiUnderlineBold VimwikiBoldUnderline
hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=italic,underline
hi def link VimwikiUnderlineItalic VimwikiItalicUnderline
" Typeface 3
hi def VimwikiBoldItalicUnderline term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
hi def link VimwikiBoldUnderlineItalic VimwikiBoldItalicUnderline
hi def link VimwikiItalicBoldUnderline VimwikiBoldItalicUnderline
hi def link VimwikiItalicUnderlineBold VimwikiBoldItalicUnderline
hi def link VimwikiUnderlineBoldItalic VimwikiBoldItalicUnderline
hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
" Code
hi def link VimwikiCode PreProc
hi def link VimwikiCodeT VimwikiCode
hi def link VimwikiPre PreProc
hi def link VimwikiPreT VimwikiPre
hi def link VimwikiPreDelim VimwikiPre
hi def link VimwikiMath Number
hi def link VimwikiMathT VimwikiMath
hi def link VimwikiNoExistsLink SpellBad
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
hi def link VimwikiLink Underlined
hi def link VimwikiLinkT VimwikiLink
hi def link VimwikiList Identifier
hi def link VimwikiListTodo VimwikiList
hi def link VimwikiCheckBoxDone Comment
hi def link VimwikiHR Identifier
hi def link VimwikiTag Keyword
" Deleted called strikethrough
" See $VIMRUTIME/syntax/html.vim
if v:version > 800 || (v:version == 800 && has('patch1038')) || has('nvim-0.4.3')
hi def VimwikiDelText term=strikethrough cterm=strikethrough gui=strikethrough
else
hi def link VimwikiDelText Constant
endif
hi def link VimwikiDelTextT VimwikiDelText
hi def link VimwikiSuperScript Number
hi def link VimwikiSuperScriptT VimwikiSuperScript
hi def link VimwikiSubScript Number
hi def link VimwikiSubScriptT VimwikiSubScript
hi def link VimwikiTodo Todo
hi def link VimwikiComment Comment
hi def link VimwikiMultilineComment Comment
hi def link VimwikiPlaceholder SpecialKey
hi def link VimwikiPlaceholderParam String
hi def link VimwikiHTMLtag SpecialKey
hi def link VimwikiEqInChar VimwikiMarkers
hi def link VimwikiCellSeparator VimwikiMarkers
hi def link VimwikiBoldChar VimwikiMarkers
hi def link VimwikiItalicChar VimwikiMarkers
hi def link VimwikiBoldItalicChar VimwikiMarkers
hi def link VimwikiItalicBoldChar VimwikiMarkers
hi def link VimwikiDelTextChar VimwikiMarkers
hi def link VimwikiSuperScriptChar VimwikiMarkers
hi def link VimwikiSubScriptChar VimwikiMarkers
hi def link VimwikiCodeChar VimwikiMarkers
hi def link VimwikiHeaderChar VimwikiMarkers
" TODO remove unsued due to region refactoring
hi def link VimwikiEqInCharT VimwikiMarkers
hi def link VimwikiBoldCharT VimwikiMarkers
hi def link VimwikiItalicCharT VimwikiMarkers
hi def link VimwikiBoldItalicCharT VimwikiMarkers
hi def link VimwikiItalicBoldCharT VimwikiMarkers
hi def link VimwikiDelTextCharT VimwikiMarkers
hi def link VimwikiSuperScriptCharT VimwikiMarkers
hi def link VimwikiSubScriptCharT VimwikiMarkers
hi def link VimwikiCodeCharT VimwikiMarkers
hi def link VimwikiHeaderCharT VimwikiMarkers
hi def link VimwikiLinkCharT VimwikiLinkT
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
" Load syntax-specific functionality
call vimwiki#u#reload_regexes_custom()
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
let b:current_syntax='vimwiki'
" Include: Code: EMBEDDED syntax setup -> base.vim
let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), 'keep')
endif
if !empty(s:nested)
for [s:hl_syntax, s:vim_syntax] in items(s:nested)
call vimwiki#base#nested_syntax(s:vim_syntax,
\ vimwiki#vars#get_syntaxlocal('rxPreStart').'\%(.*[[:blank:][:punct:]]\)\?'.
\ s:hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
\ vimwiki#vars#get_syntaxlocal('rxPreEnd'), 'VimwikiPre')
endfor
endif
" LaTex: Load
if !empty(globpath(&runtimepath, 'syntax/tex.vim'))
execute 'syntax include @textGrouptex syntax/tex.vim'
endif
if !empty(globpath(&runtimepath, 'after/syntax/tex.vim'))
execute 'syntax include @textGrouptex after/syntax/tex.vim'
endif
" LaTeX: Block
call vimwiki#base#nested_syntax('tex',
\ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'.
\ '\%([[:blank:][:punct:]].*\)\?',
\ vimwiki#vars#get_syntaxlocal('rxMathEnd'), 'VimwikiMath')
" LaTeX: Inline
for u in syntax_dic.typeface.eq
execute 'syntax region textSniptex matchgroup=texSnip'
\ . ' start="'.u[0].'" end="'.u[1].'"'
\ . ' contains=@texMathZoneGroup'
\ . ' keepend oneline '. b:vimwiki_syntax_concealends
endfor
" Emoji: :dog: (after tags to take precedence, after nested to not be reset)
if and(vimwiki#vars#get_global('emoji_enable'), 1) != 0 && has('conceal')
call vimwiki#emoji#apply_conceal()
exe 'syn iskeyword '.&iskeyword.',-,:'
endif
syntax spell toplevel

View File

@@ -0,0 +1,196 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki syntax file
" Description: Defines markdown custom syntax
" Home: https://github.com/vimwiki/vimwiki/
function! s:add_target_syntax_ON(target, type) abort
let prefix0 = 'syntax match '.a:type.' `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match '.a:type.'T `'
let suffix1 = '` display contained'
execute prefix0. a:target. suffix0
execute prefix1. a:target. suffix1
endfunction
function! s:add_target_syntax_OFF(target, type) abort
let prefix0 = 'syntax match VimwikiNoExistsLink `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
let suffix1 = '` display contained'
execute prefix0. a:target. suffix0
execute prefix1. a:target. suffix1
endfunction
function! s:wrap_wikilink1_rx(target) abort
return vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidPrefix') . a:target.
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidSuffix')
endfunction
function! s:existing_mkd_refs() abort
return keys(vimwiki#markdown_base#scan_reflinks())
endfunction
function! s:highlight_existing_links() abort
" Wikilink1
" Conditional highlighting that depends on the existence of a wiki file or
" directory is only available for *schemeless* wiki links
" Links are set up upon BufEnter (see plugin/...)
let safe_links = '\%('.
\ vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikifiles')) .
\ '\%(#[^|]*\)\?\|#[^|]*\)'
" Wikilink1 Dirs set up upon BufEnter (see plugin/...)
let safe_dirs = vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikidirs'))
" Ref links are cached
let safe_reflinks = vimwiki#base#file_pattern(s:existing_mkd_refs())
" match [URL][]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DESCRIPTION][URL]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DIRURL][]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DESCRIPTION][DIRURL]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [MKDREF][]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DESCRIPTION][MKDREF]
let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
endfunction
" use max highlighting - could be quite slow if there are too many wikifiles
if vimwiki#vars#get_wikilocal('maxhi')
" WikiLink
call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), 'VimwikiWikiLink1')
" Subsequently, links verified on vimwiki's path are highlighted as existing
call s:highlight_existing_links()
else
" Wikilink
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), 'VimwikiWikiLink1')
endif
" Weblink
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink1'), 'VimwikiWeblink1')
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxImage'), 'VimwikiImage')
" WikiLink
" All remaining schemes are highlighted automatically
let s:rxSchemes = '\%('.
\ vimwiki#vars#get_global('schemes_local') . '\|'.
\ vimwiki#vars#get_global('schemes_web').
\ '\):'
" a) match [nonwiki-scheme-URL]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
" b) match [DESCRIPTION][nonwiki-scheme-URL]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
" concealed chars
if exists('+conceallevel')
syntax conceal on
endif
syntax spell toplevel
" VimwikiWikiLink1Char is for syntax markers (and also URL when a description
" is present) and may be concealed
let s:options = ' contained transparent contains=NONE'
" conceal wikilink1
execute 'syn match VimwikiWikiLink1Char /'.
\ vimwiki#vars#get_syntaxlocal('rx_wikilink_md_prefix').'/'.s:options
execute 'syn match VimwikiWikiLink1Char /'.
\ vimwiki#vars#get_syntaxlocal('rx_wikilink_md_suffix').'/'.s:options
execute 'syn match VimwikiWikiLink1Char /'.
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Prefix1').'/'.s:options
execute 'syn match VimwikiWikiLink1Char /'.
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Suffix1').'/'.s:options
" conceal weblink1
execute 'syn match VimwikiWeblink1Char "'.
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
execute 'syn match VimwikiWeblink1Char "'.
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options
"image
execute 'syn match VimwikiImageChar "!"'.s:options
execute 'syn match VimwikiImageChar "'.
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
execute 'syn match VimwikiImageChar "'.
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options
if exists('+conceallevel')
syntax conceal off
endif
" Tables
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ transparent contains=VimwikiCellSeparator,
\ VimwikiLinkT,
\ VimwikiWeblink1T,
\ VimwikiWikiLink1T,
\ VimwikiNoExistsLinkT,
\ VimwikiTodo,
\ VimwikiBoldT,
\ VimwikiItalicT,
\ VimwikiBoldItalicT,
\ VimwikiItalicBoldT,
\ VimwikiDelTextT,
\ VimwikiSuperScriptT,
\ VimwikiSubScriptT,
\ VimwikiCodeT,
\ VimwikiEqInT,
\ @Spell
" TODO fix behavior within lists https://github.github.com/gfm/#list-items
" indented code blocks https://github.github.com/gfm/#indented-code-blocks
" execute 'syntax match VimwikiIndentedCodeBlock /' . vimwiki#vars#get_syntaxlocal('rxIndentedCodeBlock') . '/'
" hi def link VimwikiIndentedCodeBlock VimwikiPre
" syntax group highlighting
hi def link VimwikiImage VimwikiLink
hi def link VimwikiImageT VimwikiLink
hi def link VimwikiWeblink1 VimwikiLink
hi def link VimwikiWeblink1T VimwikiLink
hi def link VimwikiWikiLink1 VimwikiLink
hi def link VimwikiWikiLink1T VimwikiLink

View File

@@ -0,0 +1,85 @@
# Vimwiki Tests
This directory contains a test framework used to automatically test/verify
Vimwiki functionality. It is based on the following tools:
- [vim-testbed GitHub](https://github.com/tweekmonster/vim-testbed) or on [testbed/vim dockerhub](https://hub.docker.com/r/testbed/vim)
- [Vader](https://github.com/junegunn/vader.vim)
- [Vint](https://github.com/Kuniwak/vint)
## Resources
- [Vim patches](http://ftp.vim.org/pub/vim/patches/)
- Example test cases:
- [vim-easy-align](https://github.com/junegunn/vim-easy-align/tree/master/test)
- [vim-plug](https://github.com/junegunn/vim-plug/tree/master/test)
- [ale](https://github.com/w0rp/ale/tree/master/test)
- [Other projects](https://github.com/junegunn/vader.vim/wiki/Projects-using-Vader)
## Building Docker Image
To build the Docker image run `docker build -t vimwiki .` from the Vimwiki
repository root (same location as the Dockerfile).
## Running Tests
### Manual Steps
Starting in the test directory run this command:
```sh
docker run -it --rm -v $PWD/../:/testplugin -v $PWD/../test:/home vimwiki vim_7.4.1099 -u test/vimrc -i NONE
```
This will open a vim instance in the docker container and then all tests
can be run with `:Vader test/*` or individual tests can be run.
**Note:** Substitute `vim_7.4.1099` for any of the vim versions in the Dockerfile.
### Automated Tests
The script in the `test/` directory named `run_test.sh` can be used to
automatically run all tests for all installed vim versions. The vim/nvim
versions are parsed from the Dockerfile. This script will also run `Vint` for all
plugin source files. For more information run `./run_tests.sh -h`.
## Writing Tests
You are advice to write tests at the top of the file where you want to include it because some `Execute` can have some side effect making it hard to debug
### Inside the container
- `$USER` -> `vimtest` : unprivileged => very hard to mess up things
- `$HOME` -> `/home/vimtest` : but it is readonly !
- `$PWD` -> `/testplugin` : mapped to vimwiki plugin root directory
For more information, read the [base docker image](https://github.com/tweekmonster/vim-testbed)
## Known Issues
1. neovim v0.2.x does not work correctly with Vader output from the docker
container. No test results are printed and an error message saying
`Vim: Error reading input, exiting...`
- Probably need to look into this more and determine if the issue is Vader,
Neovim, or Docker.
2. Vader does not play nice with the location list. Tests that use the location
list should be placed in `independent_runs/`.
- [Vader Issue #199](https://github.com/junegunn/vader.vim/issues/199)
## Notable Vim patches
- `v7.3.831` `getbufvar` added a default value
- `v7.4.236` add ability to check patch with has("patch-7.4.123")
- `v7.4.279` added the option to for `globpath()` to return a list
- `v7.4.1546` sticky type checking removed (allow a variables type to change)
- `v7.4.1989` `filter()` accepts a Funcref
- `v7.4.2044` lambda support added - see `:h expr-lambda`
- `v7.4.2120` Added function "closure" argument
- `v7.4.2137` add `funcref()`
- `v8.0` async jobs and timers

View File

@@ -0,0 +1,42 @@
# Test vimwiki#base#resolve_link for various inputs.
Execute (Resolve link for index):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('index')
AssertEqual 'wiki0', link_infos.scheme
AssertEqual $HOME . '/testwiki/index.wiki', link_infos.filename
Execute (Resolve link for /index - absolute path from wiki root):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('/index')
AssertEqual 'wiki0', link_infos.scheme
AssertEqual '', link_infos.anchor
AssertEqual $HOME . '/testwiki/index.wiki', link_infos.filename
Execute (Resolve link for ///tmp/some_page - absolute path to standalone page):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('///tmp/some_page')
AssertEqual '/tmp/some_page.wiki', link_infos.filename
Execute (Resolve link for //~/testwiki/index - page in wiki under homedir):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('//~/testwiki/index')
AssertEqual $HOME . '/testwiki/index.wiki', expand(link_infos.filename)
Execute (Resolve link for diary:2020-01-01 - diary page):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-01-01')
AssertEqual $HOME . '/testwiki/diary/2020-01-01.wiki', link_infos.filename
Execute (Resolve link to link_syntax/nested - page in subdirectory):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('link_syntax/nested')
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', link_infos.filename
Execute (Resolve relative link to ./link_syntax/nested - page in subdirectory):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('link_syntax/nested')
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', link_infos.filename
Execute (Clean):
call ReloadVimwiki()

View File

@@ -0,0 +1,32 @@
# Test comment string PR #946
# TODO try default
# TODO try editing other buffer
#Execute (default commenstring, ft vimwiki):
# AssertEqual &filetype[0], 't'
# AssertEqual '/*%s*/', &commentstring
Given txt (txt):
txt
After (clean up):
if exists('g:vimwiki_commentstring')
unlet g:vimwiki_commentstring
endif
if exists('b:did_ftplugin')
unlet b:did_ftplugin
endif
Execute (default vimwiki commentstring):
call vimwiki#vars#init()
set ft=vimwiki
AssertEqual '%%%s', &commentstring
Execute (html commentstring):
let g:vimwiki_commentstring='<!-- %s -->'
call vimwiki#vars#init()
set ft=vimwiki
AssertEqual '<!-- %s -->', &commentstring
Expect (void):
txt

View File

@@ -0,0 +1,91 @@
# Test variable management (should be small)
# PR #1132 make other test break ...
#Given vimwiki (abc def ghi jkl #1132):
# abc def ghi jkl
#
#Do (vee<CR>):
# :call SetSyntax('markdown')\<CR>
# :call vimwiki#vars#set_wikilocal('links_space_char', '_')\<CR>
# vee\<CR>
# :call vimwiki#vars#set_wikilocal('links_space_char', ' ')\<CR>
#
#Expect (underscores in link url not in description):
# [abc def](abc_def) ghi jkl
#
# Issue #980
#
# brennen commenting these out 2021-03-29 per @tinmarino:
# https://github.com/vimwiki/vimwiki/pull/1108#issuecomment-806775805
# Given txt (txt):
# txt
#
# Execute (VimWei vars #980):
# " Set
# call UnloadVimwiki()
# let wiki = {}
# let wiki.name = 'ChenWei 🦊VimwikiMd @^%@!*#&^'
# let wiki.path = $HOME . '/testmarkdown'
# let wiki.ext = '.md'
# let wiki.syntax = 'markdown'
# let wiki.nested_syntaxes = {'python': 'python'}
#
# " Make other tests crash
# "let wiki.links_space_char = '_'
# "let wiki.list_margin = 0
# "let wiki.auto_toc = 1
# "let wiki.auto_tags = 1
# "let wiki.auto_generate_tags = 1
#
# let g:vimwiki_list = [wiki]
# let g:vimwiki_ext2syntax = {'.md': 'markdown'}
# let g:vimwiki_global_ext = 1
# let g:vimwiki_autowriteall = 1
# let g:vimwiki_auto_chdir = 1
# let g:vimwiki_folding = 'expr'
# call LoadVimwiki()
#
# " Log
# Log 'Path (Current): ' . getcwd()
# Log 'File: (Buffer)' . @%
# Log 'List (Wiki): ' . string(g:vimwiki_list)
# Log ''
# Log 'Local (Vars):'
# Log g:vimwiki_wikilocal_vars
#
# " Work
# edit $HOME/testmarkdown/index.md
#
# " Assert
# AssertEqual '/home/vimtest/testmarkdown_cwd', getcwd() . '_cwd'
# AssertEqual '0_wiki_nr', vimwiki#vars#get_bufferlocal('wiki_nr') . '_wiki_nr'
# AssertEqual 'markdown_syntax', vimwiki#vars#get_wikilocal('syntax') . '_syntax'
# AssertEqual '0_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
# Log 'Path (Current): ' . getcwd()
# Log 'File (Buffer):' . @%
# bprevious
# Log 'Path (Current): ' . getcwd()
# Log 'File (Buffer):' . @%
# bwipeout index.md
#
# " Clean
# Log 'Clean up'
# cd /testplugin
# unlet g:vimwiki_list
# unlet g:vimwiki_ext2syntax
# unlet g:vimwiki_global_ext
# unlet g:vimwiki_autowriteall
# unlet g:vimwiki_auto_chdir
# unlet g:vimwiki_folding
# unlet wiki
# Log 'Path (Current): ' . getcwd()
# Log 'File (Buffer):' . @%
# call ReloadVimwiki()
# Log g:vimwiki_wikilocal_vars
#
# Expect (txt):
# txt
# vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,375 @@
#!/usr/bin/env bash
# credit to https://github.com/w0rp/ale for script ideas and the color vader
# output function.
# Say Hi
echo -en "Starting $(basename "$0") for VimWiki\n"
start_time=$(date +%s)
# For windows: Cmder bash is appending busybox to the path and
# and a smlll vim is included, so that override the windows path vim
if [[ -v OLD_PATH ]]; then
echo "Setting path from OLD_PATH : $OLD_PATH"
export PATH="$OLD_PATH"
fi
printHelp() {
cat << ' EOF' | sed -e 's/^ //'
Usage: bash run_tests.sh [OPTIONS]
Runs Vimwiki Vader tests or Vint in a Docker container
-h (Help) Print help message
-n (versioN) Specify vim/nvim version to run tests for.
Specify "local" to run on your current vim install
for example on Windows.
Multiple versions can be specified by quoting the value and
separating versions with a space. E.g. -n "vim1 vim2".
Default is all available versions.
-f (File) Space separated list of tests to run.
E.g. -o "list_* z_success"
-l (List) list available versions that can be used with the '-n' option
-t (Type) Select test type: 'vader', 'vint', or 'all'
-v (Verbose) Turn on verbose output.
E.g. On Linux
bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader issue_markdown.vader
E.g. On Windows
bash run_tests.sh -v -t vader -n local -f z_success.vader | cat
EOF
exit 0
}
printVersions() {
# Print the names of all vim/nvim versions
getVers
exit 0
}
runVader() {
# Run Vader tests
echo -e "\nStarting Vader tests."
local err=0
# Parse tests files to execute
if [[ -z $file_test ]]; then
res="test/*"
else
read -ra TEST <<< "$file_test"
for i in "${TEST[@]}"; do
if [[ "$i" == *"*"* ]]; then
res="$res test/${i}"
elif [[ -f "$i" ]]; then
res="$res test/${i}"
elif [[ -f "${i}.vader" ]]; then
res="$res test/${i}.vader"
else
printf "WARNING: Test \"%s\" not found.\n", "$i"
fi
done
fi
# Run tests for each specified version
for v in $vers; do
echo -e "\n\nRunning version: $v"
echo -e "============================="
# Set local environment variables
if [[ "$v" == "local" ]]; then
# Save HOME var
home_save="$HOME"
# Create temporary root
mkdir -p "$tmp_dir/vader_wiki"
mkdir -p "$tmp_dir/vader_wiki/home"
mkdir -p "$tmp_dir/vader_wiki/home/test"
mkdir -p "$tmp_dir/vader_wiki/testplugin"
# Set vars
export ROOT="$tmp_dir/vader_wiki/"
export HOME="$tmp_dir/vader_wiki/home"
vim="vim"
vim_opt="-u ~/test/vimrc"
else
# Only set dockerized vars
export ROOT="/" # So no if in vimrc
vim="/vim-build/bin/$v"
vim_opt="-u test/vimrc"
fi
# Too talkative TODO make a verbose level 1..10 an 1 is not taking vim
#if [[ "$verbose" != 0 ]]; then
# vim_opt+=' -V1'
#fi
# IDK why vim with -Es is returning ! and make fail:
# -- tabnext profiling
# -- map.vim
vim_opt+=' -i NONE -Es '
# set -o pipefail
# Copy the resources to temporary directory
if [[ "$v" == "local" ]]; then
# flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
echo -e "\nCopying resources to $ROOT"
# Copy testplugin
cp -rf "$wiki_path/"* "$ROOT/testplugin/"
# Copy home
cp -rf "$script_path/"* "$HOME/test/"
# Copy rtp.vim
cp -rf "$script_path/resources/rtp_local.vim" "$ROOT/rtp.vim"
# Copy vader <- internet
echo 'Cloning Vader (git, do not care the fatal)'
git clone --depth 10 https://github.com/junegunn/vader.vim /tmp/vader_wiki/vader 2>&1
fi
# Run batch of tests
# shellcheck disable=SC2086,SC2206
if [[ "$res" != "" ]]; then
if [[ "$v" == "local" ]]; then
pushd "$tmp_dir/vader_wiki/testplugin" \
|| echo 'Warning pushd testplugin failed'
# Run the tests
fcmd(){
$vim $vim_opt "+Vader! ${res}" 2>&1
return ${PIPESTATUS[1]}
}
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
fcmd; ret=$?
err=$(( err + ret ))
echo -e "\nReturned Batch Vim/Vader -> $ret"
popd \
|| echo 'Warning popd also failed'
else
# In docker
fcmd() {
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
"${flags[@]}" "$v" $vim_opt "+Vader! ${res}" 2>&1 \
| vader_filter | vader_color
return ${PIPESTATUS[1]}
}
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
fcmd; ret=$?
err=$(( err + ret ))
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
fi
fi
#set +o pipefail
# Restore what must (I know it should be refactored in a while)
if [[ "$v" == "local" ]]; then
export HOME=$home_save
fi
done
return $err
}
runVint() {
local err=0
cmd="vint -s . && vint -s test/vimrc"
if echo "$vers" | grep "local" > /dev/null; then
echo -e "\nRunning Vint: $cmd : in $wiki_path"
pushd "$wiki_path" > /dev/null \
|| echo 'Warning pushd wiki_path failed'
$cmd
err=$(( err | $? ))
popd > /dev/null \
|| echo 'Warning popd also failed'
else
echo -e "\nStarting Docker container and running Vint: $cmd"
docker run -a stdout "${flags[@]}" bash -c "$cmd"
err=$(( err | $? ))
fi
return $err
}
getVers() {
# Get all possible version <- Dockerfile
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
}
vader_filter() {
# Filter Vader Stdout
local err=0
# Keep indentation
local IFS=''
while read -r REPLY; do
# Print only possible error cases
if [[ "$REPLY" = *'docker:'* ]] || \
[[ "$REPLY" = *'Starting Vader:'* ]] || \
[[ "$REPLY" = *'Vader error:'* ]] || \
[[ "$REPLY" = *'Vim: Error '* ]]; then
echo "$REPLY"
elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
echo "$REPLY"
err=1
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
if [ "$success" -lt "$total" ]; then
err=1
fi
echo "$REPLY"
elif [[ "$verbose" != 0 ]]; then
# just print everything
echo "$REPLY"
fi
done
if [[ "$err" == 1 ]]; then
echo -e "\033[0;31m"
echo -e "!---------Failed tests detected---------!"
echo -e "Run with the '-v' flag for verbose output"
echo -e "\033[0m"
fi
return $err
}
red='\033[0;31m'
green='\033[0;32m'
nc='\033[0m'
vader_color() {
while read -r; do
if [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
[[ "$REPLY" = *'[ EXPECT] (X)'* ]] || \
[[ "$REPLY" = *'Vim: Error '* ]] || \
[[ "$REPLY" = *'Vader error:'* ]]; then
echo -en "$red"
elif [[ "$REPLY" = *'[EXECUTE]'* ]] || [[ "$REPLY" = *'[ GIVEN]'* ]]; then
echo -en "$nc"
fi
if [[ "$REPLY" = *'Success/Total'* ]]; then
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
if [ "$success" -lt "$total" ]; then
echo -en "$red"
else
echo -en "$green"
fi
echo "$REPLY"
echo -en "$nc"
else
echo "$REPLY"
fi
done
echo -en "$nc"
}
# path of the script, supposing no spaces
script_file="$(dirname "$0")"
script_path="$( realpath "$script_file" )"
wiki_path="$( realpath "$script_path/.." )"
tmp_dir="$(dirname "$(mktemp -u)")"
# list of vim/nvim versions
vers="$(getVers)"
# type of tests to run - vader/vint/all
type="all"
# verbose output flag
verbose=0
# only run these tests
file_test=""
# docker flags
flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
while getopts ":hvn:lt:f:" opt; do
case ${opt} in
h )
printHelp
;;
n )
vers="$OPTARG"
;;
v )
verbose=1
;;
l )
printVersions
;;
t )
type="$OPTARG"
;;
f )
file_test="$OPTARG"
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
exit 1
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
exit 1
;;
esac
done
# shift out processed parameters
shift $((OPTIND -1))
# error handling for non-option arguments
if [[ $# -ne 0 ]]; then
echo "Error: Got $# non-option arguments." 1>&2
exit 1
fi
# stop tests on ctrl-c or ctrl-z
trap exit 1 SIGINT SIGTERM
# Global error return of the script
o_error=0
# Select which tests should run
case $type in
"vader" )
runVader ; err=$?
echo "Main Vader: returned $err"
o_error=$(( err | o_error ))
;;
"vint" )
runVint ; err=$?
echo "Main Vint: returned $err"
o_error=$(( err | o_error ))
;;
"all" )
runVint ; err=$?
echo "Main Vint: returned $err"
o_error=$(( err | o_error ))
runVader ; err=$?
echo "Main Vader: returned $err"
o_error=$(( err | o_error ))
;;
* )
echo "Error: invalid type - '$type'" 1>&2
exit 1
esac
# Calcultate time
end_time=$(date +%s)
sec_time=$((end_time - start_time))
printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
# Exit
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $o_error\n\n"
exit $o_error

View File

@@ -0,0 +1,83 @@
# VimwikiGoto
#
# Note: I dont know why <Tab> is inserting a Tab.
# Well better than to insert a Chair, but it should trigger completion
# So I used C-L
Execute (VimwikiGoto buzz_bozz && Assert):
VimwikiIndex 2
VimwikiGoto buzz_bozz
AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
Execute (VimwikiGoto buzz bozz && Assert):
VimwikiIndex 4
VimwikiGoto buzz bozz
AssertEqual $HOME . '/testwiki space/buzz bozz.wiki', expand('%')
Do (VimwikiGoto <CR> buzz_bozz && Assert):
:VimwikiIndex 2\<CR>
:VimwikiGoto\<CR>
buzz_bozz\<CR>
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
Do (VimwikiGoto + Completion(cmdline) && Assert):
:VimwikiIndex 2\<CR>
:VimwikiGoto buzz_bo\<C-l>\<CR>
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
Do (VimwikiGoto <CR> buzz_bo + Completion(input()) && Assert):
:VimwikiIndex 2\<CR>
:VimwikiGoto\<CR>
buzz_bo\<C-l>\<CR>
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
Do (,wn buzz_bo + Completion(input()) && Assert):
,wn
buzz_bo\<C-l>\<CR>
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
Execute (:VimwikiGoto + Completion (API)):
VimwikiIndex 2
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
let s_complete=string(vimwiki#base#get_globlinks_escaped())
Assert -1 != stridx(s_complete, 'buzz_bozz')
Execute (Create dir1/dir2/test_goto_file.md):
call system("mkdir $HOME/testmarkdown/dir1")
call system("mkdir $HOME/testmarkdown/dir1/dir2")
edit $HOME/testmarkdown/dir1/dir2/test_goto_file.md
call WriteMe()
Execute (:VimwikiGoto + Completion in directory):
" Return to base
VimwikiIndex 2
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
" Complete without argment
let s_complete1=string(vimwiki#base#get_globlinks_escaped())
Assert -1 != stridx(s_complete1, 'test_goto_file')
" Complete with file argument
let s_complete2=string(vimwiki#base#get_globlinks_escaped('test_goto_file'))
Assert -1 != stridx(s_complete2, 'test_goto_file')
" Complete with start of file argument
let s_complete3=string(vimwiki#base#get_globlinks_escaped('test_got'))
Assert -1 != stridx(s_complete3, 'test_goto_file')
" Complete with (nested) dir2 argument
let s_complete4=string(vimwiki#base#get_globlinks_escaped('dir2'))
Assert -1 != stridx(s_complete4, 'test_goto_file')
" Complete with bad argument
let l_complete5=vimwiki#base#get_globlinks_escaped('this_string_is_nowhere')
let s_complete5=string(l_complete5)
Assert -1 == stridx(s_complete5, 'test_goto_file')
AssertEqual 0, len(l_complete5)
Execute (Clean):
call DeleteFile("$HOME/testmarkdown/dir1/dir2/test_goto_file.md")
call system("rm $HOME/testmarkdown/dir1")
# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=

View File

@@ -0,0 +1,27 @@
# Travel thought files
Given (Void for Accessing other files within vimwiki #979 {{{1):
Do (At Index: Create and goto pythonfile):
:VimwikiIndex 2\<Cr>
Opyfile.py\<Esc>\<Cr>\<Cr>
:AssertEqual 'pyfile.py', expand('%:t')\<CR>
:AssertEqual 'python', &ft\<CR>
:Log "Clean pyfile"\<Cr>
dd
:VimwikiIndex 2\<Cr>
:call DeleteFile('pyfile.py')\<Cr>
Do (At Index: Create and goto markdownfile):
:VimwikiIndex 2\<Cr>
Omdfile.md\<Esc>\<Cr>\<Cr>
:AssertEqual 'mdfile.md', expand('%:t')\<CR>
:AssertEqual 'vimwiki', &ft\<CR>
:Log "Clean mdfile"\<Cr>
:VimwikiIndex 2\<Cr>
dd
:call DeleteFile('mdfile.md')\<Cr>
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:

View File

@@ -0,0 +1,59 @@
# Fold
Execute (Save state):
Log 'Previous foldmethod: ' . &foldmethod
let save_foldmethod = &foldmethod
Given vimwiki (Markdown Headers):
Some stuff 1
# Header level 1 2
## Header level 2 3
Content 4
### Header level 3 5
# Header level 1 6
Content 7
## Just to end 8: Vader cannot match end-of-file
Execute (Markdown and Fold Syntax):
call SetSyntax('markdown')
set foldmethod=syntax
Execute (Assert Markdown: Fold Syntax):
Log 'Supposing it starts at foldlevel 0'
AssertEqual 'line 1:0', 'line 1:' . foldlevel(1)
AssertEqual 'line 2:0', 'line 2:' . foldlevel(2)
AssertEqual 'line 3:1', 'line 3:' . foldlevel(3)
AssertEqual 'line 4:2', 'line 4:' . foldlevel(4)
AssertEqual 'line 5:2', 'line 5:' . foldlevel(5)
AssertEqual 'line 6:0', 'line 6:' . foldlevel(6)
AssertEqual 'line 7:0', 'line 7:' . foldlevel(7)
Given vimwiki (Wiki Headers):
Some stuff 1
= Header level 1 2 =
== Header level 2 3 ==
Content 4
=== Header level 3 5 ===
= Header level 1 6 =
Content 7
== Just to end 8 ==
Execute (Markdown and Fold Syntax):
call SetSyntax('default')
set foldmethod=syntax
Execute (Assert Markdown: Fold Syntax):
Log 'Supposing it starts at foldlevel 0'
AssertEqual 'line 1:0', 'line 1:' . foldlevel(1)
AssertEqual 'line 2:0', 'line 2:' . foldlevel(2)
AssertEqual 'line 3:1', 'line 3:' . foldlevel(3)
AssertEqual 'line 4:2', 'line 4:' . foldlevel(4)
AssertEqual 'line 5:2', 'line 5:' . foldlevel(5)
AssertEqual 'line 6:0', 'line 6:' . foldlevel(6)
AssertEqual 'line 7:0', 'line 7:' . foldlevel(7)
Execute (Restore state):
let &foldmethod = save_foldmethod
Log 'Next foldmethod: ' . &foldmethod

View File

@@ -0,0 +1,170 @@
# Blockquotes in html convertion #55
# TODO replace remove newline before end of pre tag: \n</pre></code> -> </pre></code>
Given (Issue 2: BlockQuote restarts list numbering {{{3):
# Item 1
# Item 2
Block Quote Text
# Item 3
Execute (2Html):
call ConvertWiki2Body()
1d | $d | $d
Expect (Tested by hand 2):
<ul>
<li>
Item 1
<li>
Item 2
<pre><code>Block Quote Text
</code></pre>
<li>
Item 3
</ul>
Given vimwiki (Issue 1007: List with hard wraps and a blockquote):
- Item 1
wraps to the second line.
This is a blockquote.
And this is back to the list item
- [ ] Item 2
wraps to the second line.
This is a blockquote.
And this is back to the list item
Execute (2Html):
call ConvertWiki2Body() | 1d | $d | $d
Expect (No blockquote):
<ul>
<li>
Item 1
wraps to the second line.
<pre><code>This is a blockquote.
</code></pre>
</code></pre>
And this is back to the list item
<li class="done0">
Item 2
wraps to the second line.
<pre><code>This is a blockquote.
</code></pre>
And this is back to the list item
</ul>
#Given (Issue 3: BlockQuote at multiple list levels {{{3):
# 1. Outer Item 1
# 1. Inner Item 1
#
# > quote 1
#
# 2. Inner Item 2
# 2. Outer Item 2
#
# > quote 2
#
#Execute (2Html):
# call ConvertWiki2Body()
# 1d | $d | $d
#
#Expect (Got with pandoc):
Given (Issue 5: Newlines in blockquotes are not honored {{{3):
Before
line 1
line 2
After
Execute (2Html):
call ConvertWiki2Body()
1d | $d | $d
Expect (Got with pandoc 5):
<p>
Before
</p>
<pre><code>line 1
line 2
</code></pre>
<p>
After
</p>
Given (Void: Basic test {{{1):
Execute (Edit TestHtml Wiki):
edit $HOME/testwiki/TestHtml.wiki
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Markdown with arrow blockquotes):
:edit $HOME/testwiki/TestHtml.wiki\<CR>
ggdGi first paragraph\<CR>\<CR>
> block\<CR>
> quote\<CR>\<CR>
last paragraph\<CR>\<Esc>
:write\<CR>
Execute (Save and Convert to html):
edit $HOME/testwiki/TestHtml.wiki
Vimwiki2HTML
#Given (Void):
#
#
#Do (Get Html body):
# :read $HOME/html/default/TestHtml.html\<CR>
## Goto body
# gg/<body>\<CR>
## Copy in b
# "bdat
## Delete All
# ggdG
## Paste body
# "bP
## Remove last line
# Gdd
## Save (Not necessary)
# :write
#
#
#
#Expect (Plain Html):
## the whole default html file should be here as a base + the modifications
## from "Given"
# <body>
#
# <p>
# first paragraph
# </p>
#
# <blockquote>
# <p>
# block
# quote
# </p>
# </blockquote>
#
# <p>
# last paragraph
# </p>
#
# </body>
#
## vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,300 @@
# Conversion: Wiki -> Html
#################################################
Given vimwiki (Comments):
This is some text
%% This is a comment
Test%%+INLINE COMMENT+%%1
%%+INLINE COMMENT+%%Test2
Test3%%+INLINE COMMENT+%%
%%+ Multiline
comment
that
is
removed
+%%
Final text
Do (Convert):
:call ConvertWiki2Html()\<Cr>
# Keep only body
ggd/<body>\<Cr>
Expect (Comments Removed):
<body>
<p>
This is some text
Test1
Test2
Test3
</p>
<p>
Final text
</p>
</body>
</html>
#################################################
Given vimwiki (Table no heading {{{1):
| header1 | header2 |
| val1 | val2 |
| val1 | val2 |
| val1 | val2 |
Do (Convert):
:call ConvertWiki2Html()\<Cr>
# Keep only body
ggd/<body>\<Cr>
Expect (Table no heading):
<body>
<table>
<tr>
<td>
header1
</td>
<td>
header2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
</table>
</body>
</html>
Given vimwiki (Table with heading {{{1):
| header1 | header2 | header3 |
|---------|---------|---------|
| val1 | val2 | var3 |
| val4 | val5 | var6 |
Do (Convert):
:call ConvertWiki2Html()\<Cr>
# Keep only body
ggd/<body>\<Cr>
Expect (Table with heading):
<body>
<table>
<thead>
<tr>
<th>
header1
</th>
<th>
header2
</th>
<th>
header3
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
val1
</td>
<td>
val2
</td>
<td>
var3
</td>
</tr>
<tr>
<td>
val4
</td>
<td>
val5
</td>
<td>
var6
</td>
</tr>
</tbody>
</table>
</body>
</html>
#################################################
Execute (Log):
Log '#473: Syntax "local:" doesnt work as expected. #473'
Given vimwiki (Void Md):
Execute (Edit Test473 Wiki):
edit $HOME/testwiki/TestHtml.wiki
Do (Add local link: [[local:$HOME/here|Link]]):
:edit $HOME/testwiki/Test473.wiki\<CR>
i
[[local:
\<C-r>=$HOME\<Cr>
/here|Link]]
\<Esc>
:call WriteMe()\<Cr>
:Vimwiki2HTML\<Cr>
Execute (Save and Convert to html):
edit $HOME/testwiki/Test473.wiki
Vimwiki2HTML
AssertEqual '[[local:'.$HOME.'/here|Link]]', getline(1)
Given (Void Html):
# TODO mutualise
Do (Get Html body):
:read $HOME/html/default/Test473.html\<CR>
# Goto body
gg/<body>\<CR>
# Copy in b
"bdat
# Delete All
ggdG
# Paste body
"bP
# Remove last line
Gdd
# Save (Not necessary)
:write
Expect (Local link):
<body>
<p>
<a href="../../here">Link</a>
</p>
</body>
Execute (Delete):
call DeleteFile(' $HOME/testwiki/Test473.wiki')
#################################################
Given (Void):
Execute (Edit TestHtml Wiki):
edit $HOME/testwiki/TestHtml.wiki
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Markdwon with %plainhtml):
:edit $HOME/testwiki/TestHtml.wiki\<CR>
:normal ggdG\<Cr>
i%plainhtml<div id="test">\<CR>
my paragraph\<CR>
%plainhtml</div>\<CR>\<Esc>
:set bt=\<CR>
:write\<CR>
Execute (Save and Convert to html):
edit $HOME/testwiki/TestHtml.wiki
Vimwiki2HTML
Given (Void):
Do (Get Html body):
:read $HOME/html/default/TestHtml.html\<CR>
# Goto body
gg/<body>\<CR>
# Copy in b
"bdat
# Delete All
ggdG
# Paste body
"bP
# Remove last line
Gdd
# Save (Not necessary)
:write
Expect (Plain Html):
# the whole default html file should be here as a base + the modifications
# from "Given"
<body>
<div id="test">
<p>
my paragraph
</p>
</div>
</body>
Execute (Delete):
call DeleteFile('$HOME/testwiki/TestHtml.wiki')
Given vimwiki (PR: Add option to configure date string format 1073) {{{1):
%template template_1073
content
Do (template_date_format):
# Set conf
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = '%b %d, %Y'\<Cr>
# Convert
:call ConvertWiki2Html()\<Cr>
# Erase oth and date
:%s/[0-9]\+/Z/g\<Cr>
:%s/[A-Z][a-z][a-z]/Z/g\<Cr>
# Restore peace
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = ''\<Cr>
Expect (Date proper format):
<html>
<body>
<div class="content">
<p><small>Zt updated on Z Z, Z</small></p>
</div>
</body>
</html>
# vim: sw=2 foldmethod=marker foldlevel=30

View File

@@ -0,0 +1,10 @@
# Test that %title values carry through when HTML is rendered
Given vimwiki (Title value):
%title this is a title with some quotes in it: ' "
Some content.
Execute(Check for title tag):
call ConvertWiki2Html()
Assert 0 != search('<title>this is a title with some quotes in it: '' "</title>')

View File

@@ -0,0 +1,110 @@
# Feature to generate a diray RSS feed (PR #934)
# TODO bug with 7.3
#Given (Void):
#
#Execute (Generate HTML and RSS feed):
# edit $HOME/testwiki/index.wiki
# Vimwiki2HTML
# VimwikiRss
#
#Given (Void):
#
#Do (Get HTML file):
# :read $HOME/html/default/index.html\<CR>
## Go to line with RSS link
# gg/RSS\<CR>
## Delete everything above
# kdgg
## Delete everything below
# jdG
## Save (Not necessary) => Actually make rest of batch freeze, do you really want
## to quit buffer
## :write
#
#Expect (RSS link in HTML):
# <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
#
#Do (Get RSS feed):
# :read $HOME/html/default/rss.xml\<CR>
## Remove first line
# ggdd
## Replace pubDate with dummy as it's based on file modification time
# :%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
## Save (Not necessary)
## :write
#
#Expect (RSS):
## TODO the next line is deleted with -Es
## <?xml version="1.0" encoding="UTF-8" ?>
# <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
# <channel>
# <title>Diary</title>
# <link>https://example.com/diary/diary.html</link>
# <description>Diary</description>
# <pubDate>...</pubDate>
# <atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
# <item>
# <title>day 4</title>
# <link>https://example.com/diary/2020-07-25.html</link>
# <guid isPermaLink="false">2020-07-25</guid>
# <description><![CDATA[
# <div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
#
# <div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
#
# <p>
# here is some code:
# </p>
#
# <pre>
# #!/bin/sh
# echo "hello world"
# </pre>
#
# <div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
#
# <p>
# an important list:
# </p>
#
# <ul>
# <li>
# point 1
#
# <li>
# point 2
#
# </ul>
# ]]></description>
# <pubDate>...</pubDate>
# </item>
# <item>
# <title>Day 2</title>
# <link>https://example.com/diary/2020-07-23.html</link>
# <guid isPermaLink="false">2020-07-23</guid>
# <description><![CDATA[
# <div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
#
# <p>
# another diary entry
# </p>
# ]]></description>
# <pubDate>...</pubDate>
# </item>
# <item>
# <title>2020-07-22</title>
# <link>https://example.com/diary/2020-07-22.html</link>
# <guid isPermaLink="false">2020-07-22</guid>
# <description><![CDATA[
# <p>
# example diary entry for day 1.
# </p>
# ]]></description>
# <pubDate>...</pubDate>
# </item>
# </channel>
# </rss>
#
#Execute (Clean buffer modification):
# edit! $HOME/testwiki/index.wiki

View File

@@ -0,0 +1,177 @@
# Non regression tests for issues, see changelog
# In reverse chronological order
#
# Thanks to all contributors with issues and pull request on github
#
Given vimwiki (a):
a
Execute (Set filename wiki_test.md):
file wiki_test.md
Expect (a):
a
################################################################################
Execute (Log):
Log '#915 Vimwiki Markdown Blockquote Syntax issue'
call SetSyntax('markdown')
Given vimwiki (One blockquote):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.
Do (gqq):
gqq
Expect (Well formated and cursor on Sed):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
> est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
> vel.
Do (move cursor and gww):
fS
gww
i__HERE__
Expect (Well formated and cursor on Sed):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
> est sed facilisis. __HERE__Sed imperdiet massa tellus, eu fermentum felis fringilla
> vel.
Given vimwiki (Multiple line blockquote):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
> est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
> vel.
Execute (no JJ && Assert for Version > 7.3):
normal JJ
if v:version > 703
AssertEqual getline(1), '> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.'
endif
################################################################################
Execute (Log):
Log '#949 <Enter> create link bug with Chinese characters'
call SetSyntax('markdown')
Given vimwiki (Madarin with vimwiki Yeeepy):
你好
你们好
你们好啊
你们好啊啊
你们好啊aaaaa
aaaaa你们好啊
Do (Enter in all):
\<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j
Expect (all WORDS are links):
[你](你)
[你好](你好)
[你们好](你们好)
[你们好啊](你们好啊)
[你们好啊啊](你们好啊啊)
[你们好啊aaaaa](你们好啊aaaaa)
[aaaaa你们好啊](aaaaa你们好啊)
################################################################################
Execute (Log):
Log '#735 Fix off-by-one error in get_next_line and get_prev_line'
file wiki_test.md
call SetSyntax('markdown')
Given vimwiki (P#735 -> I#407):
1. item1
2. item2
```
echo "hello world"
```
3. item3
Do (o):
o
Expect (Renumber all):
1. item1
2.
3. item2
```
echo "hello world"
```
4. item3
################################################################################
Execute (Log):
Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)'
call SetSyntax('markdown')
Given vimwiki (Void):
Execute (conceal):
set conceallevel=1
let g:vimwiki_global_vars['conceallevel']=2
Log ' ConcealLevel is set to vimwiki for a .md'
call SetSyntax('markdown')
file main.md
edit
AssertEqual &ft, 'vimwiki'
AssertEqual @%, 'main.md'
if exists('+conceallevel')
AssertEqual &conceallevel, 2
endif
Log ' ConcealLevel is set to vim for a no_ext'
edit no_ext
AssertEqual &ft, ''
if exists('+conceallevel')
AssertEqual &conceallevel, 1
endif
Log ' Again ConcealLevel is set to vimwiki for a .md (just for fun)'
let g:vimwiki_global_vars['conceallevel']=0
edit new.md
AssertEqual &ft, 'vimwiki'
AssertEqual @%, 'new.md'
if exists('+conceallevel')
AssertEqual &conceallevel, 0
endif
################################################################################
Execute (Log):
Log 'PR #528: Add option |g:vimwiki_create_link| to prevent link creation'
call SetSyntax('markdown')
Given vimwiki (Link):
Link
Do (Enter):
\<CR>
# TODO should be Link.md, revise the test
Expect (Link):
[Link](Link)
Do (<CR><CR>):
\<CR>\<CR>
:AssertEqual expand('%:t'), 'Link.md'\<CR>
Given vimwiki (Link):
Link
Do (No link: <CR><CR>):
:call vimwiki#vars#set_global('markdown_create_link', 0)
\<CR>\<CR>
:AssertEqual expand('%:t'), 'main.md'\<CR>
Expect (Link):
[Link](Link)
Execute (wipeout):
" This solves many things
file /testplugin/[Vader-workbench]

View File

@@ -0,0 +1,51 @@
# See Issue #580
Given vimwiki (Void):
Tabnext
Execute (Set fold method):
let g:vimwiki_folding = 'expr:quick'
call ReloadVimwiki()
Execute (Expect < 0.5 second delay: Issue #580):
let mode = mode(1)
Log 'Mode : ' .mode
if mode ==# 'ce' || mode ==# 'cv' " -es (silent ex mode)
Log 'Skiped: Tabedit and tabnext are not working weel with -Es'
else
Log 'Prepare: Edit: mode: ' . mode
edit /testplugin/test/resources/delay.wiki
Log 'Prepare: Assert'
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
Log 'Prepare: Goto 50%'
normal! 50%
# "TODO set ft and set wiki syntax or this error (no fold found)
# "normal! zozo
Log 'Run: tabedit'
let start = reltime()
tabedit
let end = str2float(reltimestr(reltime(start)))
Log 'Verify redraw'
Log 'Elapsed time Tabedit = ' . string(end)
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
Log 'Run: redraw'
let start = reltime()
tabprev
redraw
let end = str2float(reltimestr(reltime(start)))
Log 'Verify redraw'
Log 'Elapsed time redraw = ' . string(end)
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
endif
Execute (Reset variables):
call DeleteFile('/testplugin/test/resources/delay.wiki')
let g:vimwiki_folding = ''
call ReloadVimwiki()
Expect vimwiki (Tabnext):
Tabnext

View File

@@ -0,0 +1,394 @@
# Link internal to a file
#
# See: generate_toc.vim
#
# See issue #666 for anchor support (then internal links)
# Preambule set file onces and for all {{{1
# Otherwise the bash script is freezing
### Wiki {{{1
###############
### Markdown {{{1
###############
Given vimwiki (a):
a
Execute (Set filename wiki_test.md):
file wiki_test.md
Expect (a):
a
Given vimwiki (VimwikiTOC with link and number {{{1):
[link1](#i-v-p-741528)
[link2](#i-v-p-741528-2)
# I [V p](h) (7.415.28)
# I [V p](h) 741.528
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Enter link):
gg\<Cr>
A__HERE1__\<Esc>
ggj\<Cr>
A__HERE2__\<Esc>
Expect():
[link1](#i-v-p-741528)
[link2](#i-v-p-741528-2)
# I [V p](h) (7.415.28)__HERE1__
# I [V p](h) 741.528__HERE2__
Given vimwiki (VimwikiTOC is broken against headers with link #182 {{{1):
[A link B](#a-link-b)
[tlink](#tlink)
[7.4.1528](#741528)
[link (333)](#link-333)
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
#### [link]() (333)
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Enter link):
gg\<Cr>
A__HERE1__\<Esc>
ggj\<Cr>
A__HERE2__\<Esc>
ggjj\<Cr>
A__HERE3__\<Esc>
ggjjj\<Cr>
A__HERE4__\<Esc>
:AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')\<Cr>
Expect vimwiki (Good anchor with link navigation):
[A link B](#a-link-b)
[tlink](#tlink)
[7.4.1528](#741528)
[link (333)](#link-333)
# A [link](anything here) B__HERE1__
# t[link](anything here)__HERE2__
## 7.4.1528__HERE3__
#### [link]() (333)__HERE4__
# Link to anchor in SetExt {{{1
# Like that
# -----
# Issue: #209
Given vimwiki (Anchor SetExt):
[jump](#frst-one)
F!rst One
=========
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
Do (Enter link):
\<Cr>
A__HERE__\<Esc>
Expect (Cursor jumped SetExt):
[jump](#frst-one)
F!rst One__HERE__
=========
Given vimwiki (Bad Anchor SetExt):
[jump](#frst-one)
F!rst One
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
Do (Enter link):
\<Cr>
A__HERE__\<Esc>
Expect (Cursor stayed (not jumped) SetExt):
[jump](#frst-one)__HERE__
F!rst One
# Link to anchor with spaces {{{1
# PR #840
# Issues: #831
Given vimwiki (Internal links zith spaces):
[Any ! apparent name @#$](#basic-heading-many-spaces)
One line here
## Basic HeAding Many SpacES
One line here
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
Do (Enter link):
\<Cr>
A__HERE__\<Esc>
Expect (Cursor at heading position):
[Any ! apparent name @#$](#basic-heading-many-spaces)
One line here
## Basic HeAding Many SpacES__HERE__
One line here
Execute (Clear wiki jumps (alias: prev_links)):
call vimwiki#vars#set_bufferlocal('prev_links', [])
# Before {{{1
Given vimwiki (Internal links + one link to filenew):
# Contents
- [Test1](#Test1)
- [Test2](#Test2)
# Test1
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
# Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
Do (Navigate with <Tab>):
A more Contents\<Esc>
\<Tab>
\<Enter>
A more Test1\<Esc>
\<Tab>
\<Tab>
\<Enter>
A more Test2\<Esc>
Expect (Content added to titles):
# Contents more Contents
- [Test1](#Test1)
- [Test2](#Test2)
# Test1 more Test1
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
# Test2 more Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
\<Tab>
\<Enter>
# Cursor at Test1
\<Tab>
\<Tab>
\<Enter>
# Cursor at Test2
\<Tab>
\<Tab>
\<Tab>
# Cursor at Test2/filenew
A not yet\<Esc>
\<Bs>
# Cursor at Test1/test2
A near Test1/test2
\<Esc>
\<Bs>
# Cursor at Contents/test1
A near Contents/test1
\<Esc>
Expect (Vimwiki links):
# Contents
- [Test1](#Test1) near Contents/test1
- [Test2](#Test2)
# Test1
- [Test1](#Test1)
- [Test2](#Test2) near Test1/test2
- [filenew](filenew)
# Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew) not yet
Do (Navigate with <Tab> comeback with <Bs> from filenew):
\<Tab>
A first shot\<Esc>
0\<Tab>
# Cursor at Contents/test1
\<Enter>
\<Tab>
\<Tab>
A first shot\<Esc>
0\<Tab>
# Cursor at Test1/test2
\<Enter>
G
# Cursor at Test2/filenew
A first shot\<Esc>
0\<Tab>
# Cursor at Test2/filenew
\<Enter>
# Cursor in filenew (a new file)
A anything in filenew: empirically it does not count\<Esc>
\<Bs>
# Cursor at Test2/filenew
\<Bs>
# Cursor at Test1/test2
\<Bs>
# Cursor at Contents/test1
A second shot
Expect (Just Contents/test1 got the second shot):
# Contents
- [Test1](#Test1) first shot second shot
- [Test2](#Test2)
# Test1
- [Test1](#Test1)
- [Test2](#Test2) first shot
- [filenew](filenew)
# Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew) first shot
Execute (Delete filenew buffer):
call DeleteFile('/testplugin/filenew.md')
Do (Navigate with <Tab> comeback with <Bs> too far):
\<Tab>
# Cursor at Contents/test1
\<Enter>
\<Tab>
\<Tab>
# Cursor at Test1/test2
\<Enter>
\<Tab>
# Cursor at Test2/test1
\<Enter>
\<Tab>
\<Tab>
# Cursor at Test1/test2
\<Enter>
A first test2\<Esc>
\<Tab>
# Cursor at Test2/test1
\<Enter>
A first test1\<Esc>
# Back
\<Bs>
# Cursor at Test2/test1
A second test2/test1\<Esc>
\<Bs>
# Cursor at Test1/test2
A second test1/test2\<Esc>
\<Bs>
# Cursor at Test2/test1
\<Bs>
# Cursor at Test1/test2
\<Bs>
# Cursor at Contents/test1
# Finished
\<Bs>
\<Bs>
\<Bs>
\<Bs>
A 1\<Esc>
\<Bs>
A 2\<Esc>
\<Bs>
A 3\<Esc>
\<Bs>
A 4\<Esc>
Expect (After too many <Bs>, cursor stays at the first <Enter> spot in first file: Contents/test1):
# Contents
- [Test1](#Test1) 1 2 3 4
- [Test2](#Test2)
# Test1 first test1
- [Test1](#Test1)
- [Test2](#Test2) second test1/test2
- [filenew](filenew)
# Test2 first test2
- [Test1](#Test1) second test2/test1
- [Test2](#Test2)
- [filenew](filenew)
Given vimwiki (link to self):
- [Bad link](Very bad.html)
- [My own file](wiki_test)
- [Test1](#Test1)
- [Test2](#Test2)
Do (Follow link to self and append chars):
\<Tab>
\<Tab>
\<Enter>
a this_is_18_chars \<Esc>
Expect (Some chars appended at self link):
- [Bad link](Very bad.html)
- [ this_is_18_chars My own file](wiki_test)
- [Test1](#Test1)
- [Test2](#Test2)
# vim: foldmethod=marker foldlevel=30 sw=2

View File

@@ -0,0 +1,474 @@
# Link creation: my favorite (tinmarino)
# You know, when pressing Enter:
# in mode normal, visual
# in OS windows, linux
# Seems easy but tests are reaaly needed here
# Links Renaming inside #1138 {{{1
Given vimwiki (Link with toto):
[if nothing goes right, go left](www.the_bad_jokes.com)
Do(Rename description):
# Change in bracket
ci[
new description
\<Esc>
Expect(New description):
[new description](www.the_bad_jokes.com)
Do(Rename url):
# Move to (
%l
# Change in parenthesis
ci(
www.new_url.com
Expect(New URL):
[if nothing goes right, go left](www.new_url.com)
# Links with dot {{{1
# Issue #924
# See for spec: https://github.com/vimwiki/vimwiki/issues/924#issuecomment-672837685
####################
Given vimwiki (filename filename.dot):
filename
filename.dot
Do():
:call SetSyntax('default')\<CR>
\<CR>\<CR>
:AssertEqual 'filename.wiki', expand('%:t')\<CR>
:call DeleteFile('%')\<CR>
Do():
j
\<CR>\<CR>
:AssertEqual 'filename.dot', expand('%:t')\<CR>
:call DeleteFile('%')\<CR>
Expect(Nothing left):
# Linkify function {{{1
# Issue #994
####################
Given vimwiki (abc def ghi jkl):
https://github.com/vimwiki/vimwiki
Do(wiki: call linkify):
:if v:version >= 704\<CR>
call vimwiki#base#linkify()\<CR>
else\<CR>
let stg = '[[https://github.com/vimwiki/vimwiki|GitHub - vimwiki/vimwiki: Personal Wiki for Vim]]'\<CR>
0put =stg\<CR>
$d\<CR>
endif\<CR>
# else\<CR>
# endif\<CR>
Expect(Wiki link):
[[https://github.com/vimwiki/vimwiki|GitHub - vimwiki/vimwiki: Personal Wiki for Vim]]
Do(md: call linkify):
:call SetSyntax('markdown')\<CR>
:if v:version >= 704\<CR>
call vimwiki#base#linkify()\<CR>
else\<CR>
0put ='[GitHub - vimwiki/vimwiki: Personal Wiki for Vim](https://github.com/vimwiki/vimwiki)'\<CR>
$d\<CR>
endif\<CR>
Expect(Markdown link):
[GitHub - vimwiki/vimwiki: Personal Wiki for Vim](https://github.com/vimwiki/vimwiki)
# Link Normalisation {{{1
# And configuration
# Issues: #892
####################
Execute (Log):
Log 'Markdown change Link1 : Pressing enter to create a [[double bracket]] #892'
Given vimwiki (abc def ghi jkl):
abc def ghi jkl
Execute (Set filename wiki_test.md):
call SetSyntax('markdown')
let save_link = g:vimwiki_syntaxlocal_vars.markdown.Link1
let g:vimwiki_syntaxlocal_vars.markdown.Link1 = vimwiki#vars#get_global('WikiLinkTemplate1')
Do (vee<CR>):
vee\<CR>
Expect (append md suffix):
[[abc def]] ghi jkl
Execute (restore):
let g:vimwiki_syntaxlocal_vars.markdown.Link1 = save_link
# vimwiki_markdown_link_ext {{{1
####################
Execute (Log):
Log 'vimwiki_markdown_link_ext'
Given vimwiki (abc def ghi jkl):
abc def ghi jkl
Execute (Set filename wiki_test.md):
Log '>> Visual creation, markdown syntax'
file wiki_test.md
let g:vimwiki_markdown_link_ext = 1
call ReloadVars()
call SetSyntax('markdown')
AssertEqual vimwiki#vars#get_wikilocal('syntax'), 'markdown'
AssertEqual vimwiki#vars#get_wikilocal('markdown_link_ext'), 1
Do (vee<CR>):
vee\<CR>
Expect (append md suffix):
[abc def](abc def.md) ghi jkl
Execute (Restore variable g:vimwiki_markdown_link_ext):
unlet g:vimwiki_markdown_link_ext
call ReloadVars()
# Visual Creation {{{1
# Issues: #382
####################
Execute (Log):
Log 'Visual Creation'
# For markdown {{{2
# ------------------
Given vimwiki (abc def ghi jkl):
abc def ghi jkl
Execute (Set filename wiki_test.md):
Log '>> Visual creation, markdown syntax'
file wiki_test.md
call SetSyntax('markdown')
AssertEqual vimwiki#vars#get_wikilocal('syntax'), 'markdown'
Do (v3e):
v3e\<Cr>
Expect (3 Words []()):
[abc def ghi](abc def ghi) jkl
Do (v3e):
wv2e\<Cr>
Expect (2 Words []()):
abc [def ghi](def ghi) jkl
Do (selection=exclusive v3e):
:set selection=exclusive\<Cr>
wv2e\<Cr>
Expect (2 Words []()):
abc [def ghi](def ghi) jkl
Do (selection=exclusive wv$):
:set selection=exclusive\<Cr>
wv$\<Cr>
Expect (3 Words []()):
abc [def ghi jkl](def ghi jkl)
# For Wiki {{{2
# ------------------
Given vimwiki (abc def ghi jkl):
abc def ghi jkl
Execute (Set filename wiki_test.md):
Log '>> Visual creation, wiki syntax'
file wiki_test.wiki
call SetSyntax('default')
Do (v3e):
v3e\<Cr>
Expect (3 Words []()):
[[abc def ghi]] jkl
Do (v3e):
wv2e\<Cr>
Expect (2 Words []()):
abc [[def ghi]] jkl
Do (selection=exclusive v3e):
:set selection=exclusive\<Cr>
wv2e\<Cr>
Expect (2 Words []()):
abc [[def ghi]] jkl
Do (selection=exclusive wv$):
:set selection=exclusive\<Cr>
wv$\<Cr>
Expect (3 Words []()):
abc [[def ghi jkl]]
# Absolute links {{{1
####################
Execute (Log):
Log 'Absolute links: full paths and in-wiki'
# For markdown {{{2
# ------------------
Execute (Set filename wiki_test.md):
Log '>> Absolute link, markdown syntax'
file wiki_test.md
call SetSyntax('markdown')
Given vimwiki(some wiki link):
[test1](//$HOME/in_home1)
[test2](//~/in_home2)
[test3](///tmp/in_tmp)
[test4](/in_current_wiki)
Do (Check in_home1):
\<Cr>
:AssertEqual expand('%'), $HOME.'/in_home1.md'\<Cr>
Do (Check in_home2):
j\<Cr>
:AssertEqual expand('%'), $HOME.'/in_home2.md'\<Cr>
Do (Check in_tmp):
jj\<Cr>
:AssertEqual expand('%'), '/tmp/in_tmp.md'\<Cr>
# Here, assuming that "current wiki" means the working directory, since
# no wiki is currently defined:
Do (Check in_current_wiki):
jjj\<Cr>
:AssertEqual expand('%'), '/testplugin/in_current_wiki.md'\<Cr>
# For Wiki {{{2
# ------------------
Execute (Set filename wiki_test.wiki):
Log '>> Absolute link, wiki syntax'
file wiki_test.wiki
call SetSyntax('default')
Given vimwiki(some wiki link):
[[//$HOME/in_home1]]
[[//~/in_home2]]
[[///tmp/in_tmp]]
[[/in_current_wiki]]
Do (Check in_home1):
\<Cr>
:AssertEqual expand('%'), $HOME.'/in_home1.wiki'\<Cr>
Do (Check in_home2):
j\<Cr>
:AssertEqual expand('%'), $HOME.'/in_home2.wiki'\<Cr>
Do (Check in_tmp):
jj\<Cr>
:AssertEqual expand('%'), '/tmp/in_tmp.wiki'\<Cr>
# Here, assuming that "current wiki" means the working directory, since
# no wiki is currently defined:
Do (Check in_current_wiki):
jjj\<Cr>
:AssertEqual expand('%'), '/testplugin/in_current_wiki.wiki'\<Cr>
Execute(Clean: temporary):
call ReloadVimwiki()
call DeleteFile('$HOME/in_home1.md')
call DeleteFile('~/in_home2.md')
call DeleteFile('/tmp/in_tmp.md')
# Link with dot {{{1
####################
Execute (Log):
Log 'Link with dot'
Given vimwiki (filenames with dots):
part1.part2.part3
part1.part2.part3.md
noext
Execute (Set filename wiki_test.md):
file wiki_test.md
call SetSyntax('markdown')
Do (Linkify all):
\<Cr>
j\<Cr>
j\<Cr>
Expect (Full Words are made as links, no extension addded . -> space):
[part1 part2 part3](part1.part2.part3)
[part1 part2 part3](part1.part2.part3.md)
[noext](noext)
Given vimwiki (filnames with dots):
part1.part2.part3
part1.part2.part3.md
noext
Do (Fllow link witout markdown):
\<Cr>\<Cr>
:AssertEqual expand('%:t'), 'part1.part2.part3'\<Cr>
Do (j<Cr><Cr>):
j\<Cr>\<Cr>
:AssertEqual expand('%:t'), 'part1.part2.part3.md'\<Cr>
# Rest {{{1
##########################
Execute (Log):
Log 'And more'
Given vimwiki (Text that is not a wikilink):
test
www.google.com
https://www.google.com
multiple words
let's
let's
file.wiki
file.md
file.mw
Execute (Set syntax to default):
call SetSyntax('default')
Do (Create links default syntax):
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
\<Enter>
j
\<Enter>
j
\<Enter>
j
\<Enter>
Expect (Vimwiki links):
[[test]]
[[www.google.com]]
[[https://www.google.com]]
[[multiple words]]
[[let's]]
[[let]]'s
[[file.wiki]]
[[file.md]]
[[file.mw]]
Execute (Set syntax to markdown):
call SetSyntax('markdown')
Do (Create links markdown syntax):
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
\<Enter>
j
\<Enter>
j
\<Enter>
j
\<Enter>
Expect (Markdown links):
[test](test)
[www.google.com](www.google.com)
[https://www.google.com](https://www.google.com)
[multiple words](multiple words)
[let's](let's)
[let](let)'s
[file wiki](file.wiki)
[file](file.md)
[file mw](file.mw)
Execute (Set syntax to mediawiki):
call SetSyntax('media')
Do (Create links mediawiki syntax):
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
v$
\<Enter>
j
\<Enter>
j
\<Enter>
j
\<Enter>
j
\<Enter>
Expect (Mediawiki links):
[[test]]
[[www.google.com]]
[[https://www.google.com]]
[[multiple words]]
[[let's]]
[[let]]'s
[[file.wiki]]
[[file.md]]
[[file.mw]]
Execute(Clean: Icreated many temporary wiki):
call ReloadVimwiki()
# vim: foldmethod=marker foldlevel=30

View File

@@ -0,0 +1,262 @@
# Automatic link generation
# Related to:
# - wiki file discovery
# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
Execute (Reset sw to default (due to batch)):
set sw=8
# 1 VimwikiGenerateLinks {{{1
##########################
# Wiki Syntax (no caption, default) {{{2
#################
Execute (Log):
Log 'Wiki Syntax (no caption, default)'
call ReloadVimwiki()
AssertEqual '-1_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
Given (Void):
Execute (VimwikiGenerateLinks):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
Expect (The links with a header):
= Generated Links =
- [[buzz_bozz]]
- [[index]]
- [[link_syntax]]
- [[link_syntax/nested]]
Execute (VimwikiGenerateLinks x 2):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
call append('$', 'Last Line')
VimwikiGenerateLinks
Expect (The links with a header (bis)):
= Generated Links =
- [[buzz_bozz]]
- [[index]]
- [[link_syntax]]
- [[link_syntax/nested]]
Last Line
Execute (Clean Test.wiki):
call DeleteFile('$HOME/testwiki/Test.wiki')
# Wiki Syntax (with caption) {{{2
#################
Execute (Log):
Log 'Wiki Syntax (with caption)'
let vimwiki_default.generated_links_caption = 1
call ReloadVimwiki()
AssertEqual '-1_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
Given (Void):
Execute (VimwikiGenerateLinks):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
Expect (The links with a header):
= Generated Links =
- [[buzz_bozz|Buzz Bozz]]
- [[index|Test Wiki]]
- [[link_syntax]]
- [[link_syntax/nested]]
Execute (VimwikiGenerateLinks x 2):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
call append('$', 'Last Line')
VimwikiGenerateLinks
Expect (The links with a header (bis)):
= Generated Links =
- [[buzz_bozz|Buzz Bozz]]
- [[index|Test Wiki]]
- [[link_syntax]]
- [[link_syntax/nested]]
Last Line
Execute (Clean Test.wiki):
call DeleteFile('$HOME/testwiki/Test.wiki')
# Markdown Syntax {{{2
#################
Execute (Log):
Log 'Markdown Syntax'
Given (Void):
Execute (Goto markdown resource wiki):
VimwikiIndex 2
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
Execute (Edit Test file / VimwikiGenerateLinks):
edit $HOME/testmarkdown/Test.md
AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
VimwikiGenerateLinks
Expect (The links with a header):
# Generated Links
- [Buzz Bozz](buzz_bozz)
- [Test Wiki](index)
- [link_syntax](link_syntax)
- [link_syntax/nested](link_syntax/nested)
Do (Save Test.md && Re-GenerateLinks):
:edit $HOME/testmarkdown/Test.md\<CR>
:call WriteMe()\<CR>
:VimwikiGenerateLinks\<CR>
:VimwikiGenerateLinks\<CR>
Expect (The links with a header with file Test):
# Generated Links
- [Generated Links](Test)
- [Buzz Bozz](buzz_bozz)
- [Test Wiki](index)
- [link_syntax](link_syntax)
- [link_syntax/nested](link_syntax/nested)
Execute (Clean: Remove Test.md):
call DeleteFile('$HOME/testmarkdown/Test.md')
# 2 VimwikiDiaryGenerateLinks {{{1
#############################
# Wiki Syntax {{{1
#################
Execute (Log):
Log 'Wiki Syntax'
Do (Create diary files):
:edit $HOME/testwiki/diary/2019-12-10.wiki\<Cr>
:call append('$', 'Content')\<Cr>
:call WriteMe()\<Cr>
:edit $HOME/testwiki/diary/2019-07-13.wiki\<Cr>
:call append('$', 'Content')\<Cr>
:call WriteMe()\<Cr>
:edit $HOME/testwiki/diary/2019-03-01.wiki\<Cr>
:call append('$', 'Content')\<Cr>
:call WriteMe()\<Cr>
Do (Edit diary.wiki && GenerateDiaryLinks):
:edit $HOME/testwiki/diary/diary.wiki\<CR>
:VimwikiDiaryGenerateLinks\<CR>
Expect (diary index generated):
= Diary =
== 2020 ==
=== July ===
- [[2020-07-25|day 4]]
- [[2020-07-24|day 3]]
- [[2020-07-23|Day 2]]
- [[2020-07-22]]
== 2019 ==
=== December ===
- [[2019-12-10]]
=== July ===
- [[2019-07-13]]
=== March ===
- [[2019-03-01]]
Execute (Clean):
Log "End: Clean"
call DeleteFile('$HOME/testwiki/diary/2019-12-10.wiki')
call DeleteFile('$HOME/testwiki/diary/2019-07-13.wiki')
call DeleteFile('$HOME/testwiki/diary/2019-03-01.wiki')
Log "End: Reset shiftwidth to the default: 8"
# Wiki Markdown {{{1
#################
Execute (Log):
Log 'Markdown Syntax'
Execute (New Command):
Log "2. Testing VimwikiDiaryGenerateLinks TODO"
set sw=4
AssertEqual 4, &sw
Do (Edit diary/2019-12-10):
:edit $HOME/testmarkdown/diary/2019-12-10.md\<CR>
iinformative content\<Esc>
:call WriteMe()\<CR>
Do (Edit and save diary/2019-07-13):
:edit $HOME/testmarkdown/diary/2019-07-13.md\<CR>
i# informative title\<Esc>
:call WriteMe()\<CR>
Do (Edit and save diary/2018-03-01):
:edit $HOME/testmarkdown/diary/2019-03-01.md\<CR>
:call WriteMe()\<CR>
Do (Edit diary.md && GenerateDiaryLinks):
:edit $HOME/testmarkdown/diary/diary.md\<CR>
:VimwikiDiaryGenerateLinks\<CR>
Expect (diary index generated):
# Diary
## 2020
### July
- [2020-07-22](2020-07-22)
## 2019
### December
- [2019-12-10](2019-12-10)
### July
- [informative title](2019-07-13)
### March
- [2019-03-01](2019-03-01)
Execute (Clean):
call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')
Log "End: Reset shiftwidth to the default: 8"
set sw&
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:

View File

@@ -0,0 +1,295 @@
# VimwikiRenameFile
# Related to link, file navigation
# Many commands are made with Do: They block with Execute
# Create directories I remove at end {{{1
##########################################
Execute (Mkdir dir1 dir2 dir11 dir12):
call system("mkdir $HOME/testmarkdown/dir1")
call system("mkdir $HOME/testmarkdown/dir1/dir11")
call system("mkdir $HOME/testmarkdown/dir1/dir12")
call system("mkdir $HOME/testmarkdown/dir2")
Do(Link with / are relative to root #617):
:edit $HOME/testmarkdown/test.md\<Cr>
:Log 'Is this wiki 2'\<Cr>
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<Cr>
:Log 'Editing'\<Cr>
i/dir1/old_name\<Esc>
\<CR>\<CR>
:AssertEqual 'old_name', expand('%:t:r')\<Cr>
:call WriteMe()\<Cr>
:VimwikiRenameFile new_name\<Cr>
:AssertEqual 'new_name', expand('%:t:r')\<Cr>
:edit $HOME/testmarkdown/test.md\<Cr>
:AssertEqual '[dir1 old_name](/dir1/new_name)', getline(1)\<Cr>
# TEST TRANSDIRECTORY AND ARGUMENT {{{1
# NEW FEATURE #926
# Create smaller unit {{{2
# we stick all along with these 3 files,
# Follow them !
Execute (Create 3 files):
edit $HOME/testmarkdown/Test-Rename-zzz.md
call WriteMe()
edit $HOME/testmarkdown/dir1/dir11/Test-Rename.md
call WriteMe()
edit $HOME/testmarkdown/Test-Rename-Completion.md
call WriteMe()
Do (Testing Old buffer has been wiped out {{{2):
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
:Log 'Get current Buffer'\<Cr>
:let buf_old = bufnr('%')\<Cr>
:Log 'Is this wiki 2'\<Cr>
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<Cr>
:Log 'Delete for loosers'\<Cr>
:call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')\<Cr>
:Log 'Rewrite ...'\<Cr>
:call WriteMe()\<Cr>
:Log 'Rename 1'\<Cr>
:VimwikiRenameFile Test-Rename-new1\<Cr>
:Log 'Assert 1'\<Cr>
:AssertEqual 'Test-Rename-new1', expand('%:t:r')\<Cr>
:Log 'Rename 2'\<Cr>
:VimwikiRenameFile Test-Rename-Completion\<Cr>
:Log 'Assert 2'\<Cr>
:AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
Do (Testing Completion {{{2):
# Rename and test (zzz)
:VimwikiRenameFile Test-Rename-z\<C-l>1\<Cr>
:AssertEqual $HOME . '/testmarkdown/Test-Rename-zzz1.md', expand('%')\<CR>\<Esc>
# Restore old name
:call WriteMe()\<Cr>
:VimwikiRenameFile Test-Rename-zzz\<Cr>
Do (Testing transforward {{{2):
:Log 'Forward: root -> dir1/dir11 {{{3'\<Cr>
# Create dir1/dir11/Test-Rename and link to it
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
ggdG
idir1/dir11/Test-Rename.md\<Esc>
\<Cr>\<Cr>
:VimwikiRenameFile ../Test-Rename-2\<Cr>
:AssertEqual expand('%'), $HOME . '/testmarkdown/dir1/Test-Rename-2.md'\<CR>\<Esc>
# See what happend in root
:call WriteMe()\<Cr>
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
:AssertEqual getline(1), '[dir1 dir11 Test Rename](dir1/Test-Rename-2.md)'\<Cr>
:Log 'Backward dir1/dir11 -> root {{{3'\<Cr>
# See what happend in dir1/dir11
# I am in root so pressing Enter sends me to dir1/dir11
\<Cr>
# Write forward path
dd
i../Test-Rename-Completion\<Esc>
# Convert it to link
0\<Cr>\<Cr>
# Now in root
:AssertEqual $HOME . '/testmarkdown/Test-Rename-Completion.md', expand('%')\<Cr>
:VimwikiRenameFile dir1/Test-Rename-Completion-2\<Cr>
:Log 'Rename -> dir1/Test...{{{3'\<Cr>
:AssertEqual $HOME . '/testmarkdown/dir1/Test-Rename-Completion-2.md', expand('%')\<Cr>
Execute (Delete smaller unit changed {{{2):
call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')
call DeleteFile('$HOME/testmarkdown/Test-Rename-zzz.md')
call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-Completion_2.md')
call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md')
# VimwikiRename Test same directory {{{1
# Old big conf, from bad unit test design
# Changing file in a single dir
# Feel free to modify but as long as it works
# I delay the cleaning
####################################
Given vimwiki (Void):
Execute (Create Test-Rename -> dir1/dir11/in_dir11.md and dir1/dir12/in_dir12.md and dir2/in_dir2.md):
edit $HOME/testmarkdown/Test-Rename.md
AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
call append(0, ['# Test Rename', 'in_root.md', 'dir1/dir11/in_dir11.md', 'dir1/dir12/in_dir12.md', 'dir2/in_dir2.md'])
call WriteMe()
Do (Create in_root):
:Log 'Open Test-Rename.md'\<CR>
:edit $HOME/testmarkdown/Test-Rename.md\<CR>
:AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')\<CR>\<Esc>
:Log 'Delete last line (easyer latter checks without trailing spaces)'\<CR>
Gdd
:Log 'Open in_root.md'\<CR>
gg
j\<CR>
j\<CR>
j\<CR>
j\<CR>
ggj0y$
:AssertEqual '[in_root](in_root.md)', @"\<CR>
0\<CR>
:AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
:Log 'Add link in_root.md -> dir1/dir11/in_dir11'\<CR>
ggi# Title in root\<CR>\<Esc>
idir1/dir11/in_dir11\<Esc>
:call WriteMe()\<CR>
:AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
:Log 'Open in_dir11.md: creating dirs'\<CR>
ggj"ay$
:AssertEqual 'reg dir1/dir11/in_dir11', 'reg ' . @a\<CR>
0\<CR>\<CR>
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
:Log 'One backspace for fun'\<CR>
\<BS>
:AssertEqual 'file ' . $HOME . '/testmarkdown/in_root.md', 'file ' . expand('%')\<CR>
Do (Create dir_11 -> dir_11):
:edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md\<CR>
:Log 'Add link in_dir11_fix.md -> in_dir11'\<CR>
ggi# Title in dir11 fix\<CR>\<Esc>
iin_dir11\<Esc>
:call WriteMe()\<CR>
:Log 'Open in_dir11.md: creating dirs'\<CR>
ggj"ay$
:AssertEqual 'reg in_dir11', 'reg ' . @a\<CR>
0\<CR>\<CR>
y\<CR>
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
:Log 'One backspace for fun'\<CR>
\<BS>
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11_fix.md', 'file ' . expand('%')\<CR>
Execute (Fill in_dir11 content):
edit $HOME/testmarkdown/dir1/dir11/in_dir11.md
call append(0, ['# Title in_dir11', '[dir2 link](../../dir2/in_dir2.md)'])
call WriteMe()
# Rename local {{{1
###################
Do (RenameLink in_dir11 -> in_dir11_new):
:edit $HOME/testmarkdown/dir1/dir11/in_dir11.md\<CR>
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<CR>
:Log 'Rename'\<CR>
:call WriteMe()\<CR>
:VimwikiRenameFile\<CR>
y\<CR>
in_dir11_new\<CR>
:call WriteMe()\<Cr>
:Log 'Append filename'\<CR>
:call append('$', [expand('%')])\<CR>
Expect(With new filename at the end):
# Title in_dir11
[dir2 link](../../dir2/in_dir2.md)
/home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
Execute (edit in_dir11_fix):
edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md
Expect(Link to in_dir11_new):
# Title in dir11 fix
[in_dir11](in_dir11_new)
Execute (edit Test-Rename.md):
edit $HOME/testmarkdown/Test-Rename.md
Expect (Link to in_dir11_new):
# Test Rename
[in_root](in_root.md)
[dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
[dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
[dir2 in_dir2](dir2/in_dir2.md)
Do (in_dir2 -> in_dir2_new):
:edit $HOME/testmarkdown/dir2/in_dir2.md\<CR>
:Log 'Append filename'\<CR>
:call append('$', [expand('%')])\<CR>
:Log 'Rename'\<CR>
:call WriteMe()\<CR>
:VimwikiRenameFile\<CR>
y\<CR>
in_dir2_new\<CR>
:call WriteMe()\<Cr>
:Log 'Append filename'\<CR>
:call append('$', [expand('%')])\<CR>
Expect (old and new filenames):
/home/vimtest/testmarkdown/dir2/in_dir2.md
/home/vimtest/testmarkdown/dir2/in_dir2_new.md
Execute (edit Test-Rename.md):
edit $HOME/testmarkdown/Test-Rename.md
Expect (Link to in_dir11_new):
# Test Rename
[in_root](in_root.md)
[dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
[dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
[dir2 in_dir2](dir2/in_dir2_new.md)
Execute (edit in_dir11.md):
edit $HOME/testmarkdown/dir1/dir11/in_dir11_new.md
Expect (Link to in_dir2_new):
# Title in_dir11
[dir2 link](../../dir2/in_dir2_new.md)
/home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
Execute (Clean dir1 and dir2):
Log "End: Clean"
call DeleteHiddenBuffers()
call system('rm $HOME/testmarkdown/Test-Rename.md')
call system('rm $HOME/testmarkdown/in_root.md')
call system('rm -r $HOME/testmarkdown/dir1')
call system('rm -r $HOME/testmarkdown/dir2')
# vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#

View File

@@ -0,0 +1,122 @@
# Test resolution of as many link types as possible in Markdown syntax
# This relies on the line numbers for each type of link in link_syntax.md and
# link_syntax/nested.md, which seems primitive, but does seem to work.
# Links in a top-level page {{{
Execute (Assure link_syntax.md exists):
Log "Testing links in a top-level page with native syntax."
VimwikiIndex 2
VimwikiGoto link_syntax
AssertEqual $HOME . '/testmarkdown/link_syntax.md', expand('%')
Do (Check plain wiki page link to index):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
Do (Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.md', expand('%')\<CR>
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
Do (Check diary link):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/diary/2020-07-22.md', expand('%')\<CR>
Do (Check link to nested page):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
Do (Check relative link to nested page with ./link_syntax/nested):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:7\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
# }}}
# Links in a nested file {{{
Execute (Assure link_syntax/nested.md exists):
Log "Testing links in a nested page with native syntax."
VimwikiIndex 2
VimwikiGoto link_syntax/nested
AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')
Do (Nested: Check plain wiki page link to self - link_syntax/nested.md):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.md', expand('%')\<CR>
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
Do (Nested: Check diary link):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/diary/2020-07-22.md', expand('%')\<CR>
Do (Nested: Check relative link to page in parent directory):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax.md', expand('%')\<CR>
# }}}
# To be perfectly honest I don't know why or if this is necessary, but without
# it I was getting leftover tabs for the last file visited here. -- brennen
Execute (Clean):
call ReloadVimwiki()

View File

@@ -0,0 +1,122 @@
# Test resolution of as many link types as possible in VimWiki syntax
# This relies on the line numbers for each type of link in link_syntax.wiki and
# link_syntax/nested.wiki, which seems primitive, but does seem to work.
# Links in a top-level page {{{
Execute (Assure link_syntax.wiki exists):
Log "Testing links in a top-level page with native syntax."
VimwikiIndex 1
VimwikiGoto link_syntax
AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')
Do (Check plain wiki page link to index):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Check diary link):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
Do (Check link to nested page):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
Do (Check relative link to nested page with ./link_syntax/nested):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:7\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
# }}}
# Links in a nested file {{{
Execute (Assure link_syntax/nested.wiki exists):
Log "Testing links in a nested page with native syntax."
VimwikiIndex 1
VimwikiGoto link_syntax/nested
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')
Do (Nested: Check plain wiki page link to self - link_syntax/nested.wiki):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Nested: Check diary link):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
Do (Nested: Check relative link to page in parent directory):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')\<CR>
# }}}
# To be perfectly honest I don't know why or if this is necessary, but without
# it I was getting leftover tabs for the last file visited here. -- brennen
Execute (Clean):
call ReloadVimwiki()

View File

@@ -0,0 +1,413 @@
# VimwikiTOC {{{1
#
# Just generate the TOC
# See: link_* for link movement and creation
#
# TODO (10min) test if g:vimwiki_to_header well readen
# TODO (10min) test vimviki_toc_link_format
# TODO (1h) test if really wiki dependant (for 2 diffrent wikis)
# TODO if link in heading
Given vimwiki (Wiki with spaces {{{1):
= h1 h2 h3 h4 =
Execute (Toc and enter (alpha)):
call SetSyntax('default')
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
AssertEqual -1, vimwiki#vars#get_wikilocal('list_margin')
VimwikiTOC
Expect (Toc alpha):
= Contents =
- [[#h1 h2 h3 h4]]
= h1 h2 h3 h4 =
Given vimwiki (Wiki with bad characters {{{1):
= h!@$%^&() =
Execute (Toc and beta):
call SetSyntax('default')
file wiki.wiki
VimwikiTOC
Expect (Toc and jumpes well):
= Contents =
- [[#h!@$%^&()]]
= h!@$%^&() =
Given vimwiki (One word headings (#981) {{{1):
= head1 =
== head2 ==
=== head3 ===
Execute (Wiki: toc_link_format=1 (to restore) VimwikiTOC x 1):
set sw=2
let vimwiki_toc_link_format = 1
call ReloadVimwiki()
call SetSyntax('default')
VimwikiTOC
Expect(Headinds TOC one word (1)):
= Contents =
- [[#head1|head1]]
- [[#head1#head2|head2]]
- [[#head1#head2#head3|head3]]
= head1 =
== head2 ==
=== head3 ===
Execute (Wiki: toc_link_format=0 (restoring default) VimwikiTOC x 1):
let vimwiki_toc_link_format = 0
call ReloadVimwiki()
call SetSyntax('default')
VimwikiTOC
Expect(Headinds TOC one word (0)):
= Contents =
- [[#head1]]
- [[#head2]]
- [[#head3]]
= head1 =
== head2 ==
=== head3 ===
Execute (Clean wiki TOC):
Given vimwiki (One heading: May delete last line (#910) {{{1):
# Basic-title
Execute (VimwikiTOC x 1):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect(Good content with 1 item x 1):
# Contents
- [Basic-title](#basic-title)
# Basic-title
Execute (VimwikiTOC x 2):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
VimwikiTOC
Expect(Good content with 1 item x 1):
# Contents
- [Basic-title](#basic-title)
# Basic-title
Given vimwiki (With link header (#182) {{{1):
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
Execute (VimwikiTOC: Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect vimwiki (With link header (#182) {{{1):
# Contents
- [A link B](#a-link-b)
- [tlink](#tlink)
- [7.4.1528](#741528)
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
Given vimwiki (Underline header (SetExt) (#209) {{{1):
First with spaces
=====
toto
Second
-------
toto
Third
-----
toto
Four
=====
toto
Last
----
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Heading SetExt created):
# Contents
- [First with spaces](#first-with-spaces)
- [Second](#second)
- [Third](#third)
- [Four](#four)
- [Last](#last)
First with spaces
=====
toto
Second
-------
toto
Third
-----
toto
Four
=====
toto
Last
----
Given vimwiki (Two same heading (#968) {{{1):
# One
toto
# ONE
like
## oNe
you
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Suffix -2 and -3):
# Contents
- [One](#one)
- [ONE](#one-2)
- [oNe](#one-3)
# One
toto
# ONE
like
## oNe
you
Given vimwiki (Heading with many bad caracters {{{1):
# One !@#@#(!%#&$^(!@
## Two !!~!!:"@!>@!>?<
Execute (Set syntax markdown && VimwikiTOC):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Bad characters are removed):
# Contents
- [One !@#@#(!%#&$^(!@](#one-)
- [Two !!~!!:"@!>@!>?<](#two-)
# One !@#@#(!%#&$^(!@
## Two !!~!!:"@!>@!>?<
# Large previous tests {{{1
Execute (Reset TOC header to default):
call vimwiki#vars#set_wikilocal('toc_header', 'Contents')
Given vimwiki (Headings):
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
Execute (VimwikiTOC):
VimwikiTOC
Expect (With a TOC sw=8):
# Contents
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (Set sw=4 && VimwikiTOC):
set sw=4
VimwikiTOC
Expect (With a TOC sw=4):
# Contents
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Do (Destroy some stuff):
jj
dd
jj
dd
Execute (VimwikiTOC):
VimwikiTOC
Expect (Brand new TOC):
# Contents
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (Let toc_header = Sommaire && VimwikiTOC):
call vimwiki#vars#set_wikilocal('toc_header', 'Sommaire')
VimwikiTOC
Expect (Append a Sommaire && Leave Contents alone):
# Sommaire
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Do (Destroy some stuff):
jj
dd
jj
dd
Execute (VimwikiTOC):
VimwikiTOC
Expect (Brand new TOC with sommaire):
# Sommaire
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (call vimwiki#vars#set_global('toc_header_level', 6):
call vimwiki#vars#set_wikilocal('toc_header_level', 6)
VimwikiTOC
# Reset default
call vimwiki#vars#set_wikilocal('toc_header_level', 1)
Expect (Content prepended):
###### Sommaire
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
" vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#

View File

@@ -0,0 +1,196 @@
# Task List with commands
Given vimwiki (simple list):
* [X] Done 1
* [ ] Todo 1
* [X] Done 2
* [ ] Todo 2
Execute (Set syntax to default):
call SetSyntax('default')
Do (clean done, without recursion):
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
Expect (two removed):
* [ ] Todo 1
* [ ] Todo 2
Given vimwiki (simple list):
* [X] Done 1
* [ ] Todo 1
* [X] Done 2
* [ ] Todo 2
Do (clean done with recursion, function):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (two removed):
* [ ] Todo 1
* [ ] Todo 2
Given vimwiki (simple list):
* [X] Done 1
* [ ] Todo 1
* [X] Done 2
* [ ] Todo 2
Do (clean done with recursion, command):
:VimwikiRemoveDone\<Enter>
Expect (two removed):
* [ ] Todo 1
* [ ] Todo 2
Given vimwiki (with sub items):
* [X] Done 1
* [X] Subdone 1
* [ ] Todo 1
* [o] Done 2
* [X] Subdone1
* [ ] Subtodo
* [ ] Todo 2
Do (clean done, without recursion):
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
Expect (first removed):
* [ ] Todo 1
* [o] Done 2
* [X] Subdone1
* [ ] Subtodo
* [ ] Todo 2
Given vimwiki (with sub items):
* [ ] Todo 1
* [o] Done 2
* [X] Subdone1
* [ ] Subtodo
* [ ] Todo 2
Do (clean done, with recursion):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (all removed):
* [ ] Todo 1
* [ ] Done 2
* [ ] Subtodo
* [ ] Todo 2
Given vimwiki (nested list with space and code):
* [X] Done 1
* [ ] Todo 1
* [ ] Todo Post space
* [X] Done Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
* [X] Post code Done
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
Do (clean done, without recursion):
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
Expect (removed):
* [ ] Todo 1
* [ ] Todo Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
Given vimwiki (nested list with space and code):
* [X] Done 1
* [ ] Todo 1
* [ ] Todo Post space
* [X] Done Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
* [X] Post code Done
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
Do (clean done, with recursion):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (removed):
* [ ] Todo 1
* [ ] Todo Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
Given vimwiki (two lists):
* [X] Done 1
* [ ] Todo 1
Line in between.
* [ ] Todo Post space
* [X] Done Post space
Do (clean done, with recursion):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (only first is removed):
* [ ] Todo 1
Line in between.
* [ ] Todo Post space
* [X] Done Post space
Given vimwiki (list):
* [X] Done 1
* [ ] Todo 1
Line in between.
* [X] Done 2
* [X] Done 3
* [ ] Todo 2
* [X] Done 4
Do (clean done, with range):
:1,6VimwikiRemoveDone\<Enter>
Expect (only first is removed):
* [ ] Todo 1
Line in between.
* [X] Done 3
* [ ] Todo 2
* [X] Done 4

View File

@@ -0,0 +1,112 @@
# List indentation <= shiftwidth
Execute (Create temp directory):
silent execute '!mkdir -p $HOME/list_margin/'
cd $HOME/list_margin
Execute (Create wiki files):
write page1.wiki
write page2.wiki
write page3.wiki
write page1.mw
write page2.mw
write page3.mw
write page1.md
write page2.md
write page3.md
Given vimwiki (Scratch file):
Execute (Set syntax default):
set shiftwidth=8
AssertEqual 8, &shiftwidth
call SetSyntax('default')
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Execute (Generate Links):
VimwikiGenerateLinks
Expect (Links with default margin):
= Generated Links =
- [[page1]]
- [[page2]]
- [[page3]]
Execute (Set list margin == 2):
call vimwiki#vars#set_wikilocal('list_margin', 2, vimwiki#vars#get_bufferlocal('wiki_nr'))
VimwikiGenerateLinks
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Expect (Links with margin == 2):
= Generated Links =
- [[page1]]
- [[page2]]
- [[page3]]
Execute (Set syntax media):
call SetSyntax('media')
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Execute (Generate Links):
VimwikiGenerateLinks
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Expect (Links with default margin):
= Generated Links =
* [[page1]]
* [[page2]]
* [[page3]]
Execute (Set list margin == 1):
call vimwiki#vars#set_wikilocal('list_margin', 1, vimwiki#vars#get_bufferlocal('wiki_nr'))
VimwikiGenerateLinks
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Expect (Links with margin == 1):
= Generated Links =
* [[page1]]
* [[page2]]
* [[page3]]
Execute (Set syntax markdown):
call SetSyntax('markdown')
" list margin should default to 0 for markdown
Execute (Generate Links):
VimwikiGenerateLinks
Expect (Links with default margin):
# Generated Links
- [page1](page1)
- [page2](page2)
- [page3](page3)
Execute (Set list margin == 5):
call vimwiki#vars#set_wikilocal('list_margin', 5, vimwiki#vars#get_bufferlocal('wiki_nr'))
VimwikiGenerateLinks
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Expect (Links with margin == 5):
# Generated Links
- [page1](page1)
- [page2](page2)
- [page3](page3)
Execute (Return to default location & cleanup):
cd /testplugin
# vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,45 @@
# Move and edit a list (autocommand, config_
# Test J {{{1
############################################################
Given vimwiki (Markdown * [ ] list {{{2):
* [ ] Top Level
* [o] Child 1
* [X] Child 2
* [X] Post space
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (JJJJ):
JJJJ
0y$
:call AssertIfVersion(704, '* [ ] Top Level Child 1 Child 2 Post space', @")\<Cr>
Given vimwiki (Markdown * and - list {{{2):
* one
* two
- three
- for
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (JjJ):
JjJ
gg
0y$
:call AssertIfVersion(704, '* one two', @")\<Cr>
G
0y$
:call AssertIfVersion(704, '- three for', @")\<Cr>
# vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,379 @@
# Testting <CR> keypress in insert mode on list item
#
# Note: some trailing spaces are necessary at the end of list items like `1.`
# better read this file with `set list`
#
# Warning: Foldmethod dependant (and foldlevel ...)
Execute (Save State):
let msg = 'Error: foldmethod must be manual for theses tests to work,'
let msg .= ' it is the default, so please restore it in the test that changed it'
AssertEqual &foldmethod, 'manual', msg
Given vimwiki (List Blockquote (Issue #55) {{{2):
1. Outer Item 1
1. Inner Item 1
> quote 1
2. Inner Item 2
2. Outer Item 2
> quote 2
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (o):
o
toto
Expect (Good number 1):
1. Outer Item 1
2. toto
1. Inner Item 1
> quote 1
2. Inner Item 2
3. Outer Item 2
> quote 2
Do (jo):
jo
toto
Expect (Good number 2):
1. Outer Item 1
1. Inner Item 1
2. toto
> quote 1
3. Inner Item 2
2. Outer Item 2
> quote 2
Given vimwiki (List will hard wrap (Issue #991) {{{2):
- one two three four five six seven
Execute (Change textwith):
let textwidth = &textwidth
let linebreak = &linebreak
Log 'Textwidth, Linebreak was: ' . textwidth . ', ' . linebreak
set textwidth=40
set linebreak
Do (Insert more than tw and press return):
A indented line 1
\<Cr>
indented line 2
Expect (Indentation after autowrap and <CR>):
- one two three four five six seven
indented line 1
indented line 2
Do (o new item):
A indented line 1
\<Esc>o
new item
Expect (New item created):
- one two three four five six seven
indented line 1
- new item
Do (VimwikiReturn 3 5):
A indented line 1\<Esc>
:VimwikiReturn 3 5\<Cr>
new item
Expect (New item created):
- one two three four five six seven
indented line 1
- new item
Execute (Restore textwith):
let &textwidth = textwidth
let &linebreak = linebreak
Given vimwiki (List with hard wraps):
- Item 1
- Item 2
- Item 3 that is split across multiple lines
This is the second line.
This is the third line.
- Item 4
- Sub item 1
- Sub item split across multiple lines
This is the second line.
This is the third line.
- Item 5
Execute (Map CR):
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 3 5<CR>
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Extend list):
4j
A\<CR>Another item\<Esc>
5j
A\<CR>New sub item\<Esc>
Expect (Extended list):
- Item 1
- Item 2
- Item 3 that is split across multiple lines
This is the second line.
This is the third line.
- Another item
- Item 4
- Sub item 1
- Sub item split across multiple lines
This is the second line.
This is the third line.
- New sub item
- Item 5
Given vimwiki (List with code block):
- Item 1
- Item 2
- Item 3 that is split across multiple lines
This is the second line.
This is the third line.
- Item 4
- Sub item 1
- Sub item split across multiple lines
This is the second line.
This is the third line.
```
int x = 2 + 2;
return 0;
```
- Item 5
```c
int x = 2 + 2;
return 0;
```
- Item 6 that is split
Across multiple lines.
Done.
Do (CR and CR in code block):
4j
A\<CR>Another item\<Esc>
6j
A\<CR>int y = 1;\<Esc>
1j
A\<CR>x = x + y;\<Esc>
4j
A\<CR>int y = 2;\<Esc>
3j
A\<CR>A new bullet doesn't get added here, oh well.\<Esc>
3j
A\<CR>Done and Done\<Esc>
Expect (No list continuation in code block):
- Item 1
- Item 2
- Item 3 that is split across multiple lines
This is the second line.
This is the third line.
- Another item
- Item 4
- Sub item 1
- Sub item split across multiple lines
This is the second line.
This is the third line.
```
int y = 1;
int x = 2 + 2;
x = x + y;
return 0;
```
- Item 5
```c
int y = 2;
int x = 2 + 2;
return 0;
```
A new bullet doesn't get added here, oh well.
- Item 6 that is split
Across multiple lines.
Done.
- Done and Done
Given vimwiki (List from help file):
1. item
---
1. item
continue
---
1.
---
1.
---
Execute (Map CR):
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 1<CR>
Do (List ops):
A\<CR>\<Esc>
4j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
# Note: trailing space <- autoindent
Expect (List per VimwikiReturn 1 1):
1. item
2.
---
1. item
continue
---
1.
2.
---
1.
2.
---
Execute (Map CR):
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 2 2<CR>
Do (List ops):
A\<CR>\<Esc>
4j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
# Note: some trailing space added
Expect (List per VimwikiReturn 2 2):
1. item
---
1. item
continue
2.
---
1.
---
1.
---
Execute (Map CR):
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 3 3<CR>
Do (List ops):
A\<CR>\<Esc>
4j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
Expect (List per VimwikiReturn 3 3):
1. item
2.
---
1. item
continue
2.
---
---
---
Execute (Map CR):
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 4 4<CR>
Do (List ops):
A\<CR>\<Esc>
4j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
Expect (List per VimwikiReturn 4 4):
1. item
---
1. item
continue
---
---
---
Execute (Map CR):
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 3 5<CR>
Do (List ops):
A\<CR>\<Esc>
4j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
3j
A\<CR>\<Esc>
Expect (List per VimwikiReturn 3 5):
1. item
2.
---
1. item
continue
2.
---
---
1.
---
# vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,249 @@
# Todo lists
Given vimwiki (Todo list):
* [ ] Chap1
* [ ] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Toogle Chap2: <C-Space>):
Gk\<C-Space>
Expect (Toogle Chap2):
* [ ] Chap1
* [ ] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [ ] Chap2
End
Do (Toogle Chap1: <C-Space>):
\<C-Space>
Expect (Remove nested [ ] -> [X]):
* [X] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [X] Section1.5
* [X] Section1.6
* [X] Section1.7
* [X] Section1.8
* [X] Section1.9
* [X] Section1.10
* [X] Chap2
End
Do (Toogle sub 1):
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [.] Chap1
* [X] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle sub4):
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [o] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle sub7):
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [O] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [X] Section1.5
* [X] Section1.6
* [X] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle sub10):
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [X] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [X] Section1.5
* [X] Section1.6
* [X] Section1.7
* [X] Section1.8
* [X] Section1.9
* [X] Section1.10
* [X] Chap2
End
Do (Toogle delete todo box [gl]):
gl\<Space>
Expect (Chap1 no checkbox):
* Chap1
* [ ] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle delete todo boxes [gL<Space>]):
jgL\<Space>
Expect (Chap1.x no checkbox):
* [ ] Chap1
* Section1.1
* Section1.2
* Section1.3
* Section1.4
* Section1.5
* Section1.6
* Section1.7
* Section1.8
* Section1.9
* Section1.10
* [X] Chap2
End
Do (Visual toogl [v<C-Space>]):
jvjjj\<C-Space>
Expect (4 items toogled):
* [o] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
################################################################################
# Todo list with text above
Given vimwiki (TODO list):
Some other text
- [ ] Todo Item
Execute (:VimwikiNextTask):
:execute "VimwikiNextTask" | execute 'normal yyp'
Expect (Introduce new todo item):
Some other text
- [ ] Todo Item
- [ ] Todo Item
################################################################################
# Numbered Todo list
Given vimwiki (Number TODO list):
1. [ ] Chap1
2. [ ] Chap2
Do (Go):
Go
# Note the space at the end of 3
Expect (Introduce new Number todo item):
1. [ ] Chap1
2. [ ] Chap2
3. [ ]
Do (New item and ident):
o\<C-t>Chap1.1
# Note the tab
Expect (Introduce Chap1.1):
1. [ ] Chap1
1. [ ] Chap1.1
2. [ ] Chap2
Do (Toogle <C-Space>):
\<C-Space>
Expect (Chap1 Done):
1. [X] Chap1
2. [ ] Chap2

View File

@@ -0,0 +1,191 @@
# Task list update
Given vimwiki (Sample nested list, vimwiki syntax):
* [ ] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Post space
{{{code
* [ ] print "hello, world"
}}}
{{{morecode
print "hello again"
}}}
* [ ] Post code
* [ ] Sub-child
* [ ] Sub-sub-child
Execute (Set syntax to default):
call SetSyntax('default')
Do (Toggle top-level):
\<C-Space>
Expect (All tree toggled):
* [X] Top Level
* [X] Child 1
* [X] Child 2
* [X] Post space
{{{code
* [ ] print "hello, world"
}}}
{{{morecode
print "hello again"
}}}
* [X] Post code
* [X] Sub-child
* [X] Sub-sub-child
Do (Toggle child):
j
\<C-Space>
Expect (Child toggled, top updated):
* [.] Top Level
* [X] Child 1
* [ ] Child 2
* [ ] Post space
{{{code
* [ ] print "hello, world"
}}}
{{{morecode
print "hello again"
}}}
* [ ] Post code
* [ ] Sub-child
* [ ] Sub-sub-child
Do (Toggle sub-child):
G
\<C-Space>
Expect (Sub-child toggled, parents updated):
* [.] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Post space
{{{code
* [ ] print "hello, world"
}}}
{{{morecode
print "hello again"
}}}
* [o] Post code
* [ ] Sub-child
* [X] Sub-sub-child
Given markdown (Sample nested list, markdown syntax):
* [ ] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Post space
```code
* [ ] print "hello, world"
```
```morecode
print "hello again"
```
* [ ] Post code
* [ ] Sub-child
* [ ] Sub-sub-child
Execute (Set syntax to markdown):
call SetSyntax('markdown')
Do (Toggle top-level):
\<C-Space>
Expect (All tree toggled):
* [X] Top Level
* [X] Child 1
* [X] Child 2
* [X] Post space
```code
* [ ] print "hello, world"
```
```morecode
print "hello again"
```
* [X] Post code
* [X] Sub-child
* [X] Sub-sub-child
Do (Toggle child):
j
\<C-Space>
Expect (Child toggled, top updated):
* [.] Top Level
* [X] Child 1
* [ ] Child 2
* [ ] Post space
```code
* [ ] print "hello, world"
```
```morecode
print "hello again"
```
* [ ] Post code
* [ ] Sub-child
* [ ] Sub-sub-child
Do (Toggle sub-child):
G
\<C-Space>
Expect (Sub-child toggled, parents updated):
* [.] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Post space
```code
* [ ] print "hello, world"
```
```morecode
print "hello again"
```
* [o] Post code
* [ ] Sub-child
* [X] Sub-sub-child
# vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,87 @@
# Task list update, propagation disabled
Given vimwiki (Sample nested list, vimwiki syntax):
* [ ] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Child 3
Execute (Set syntax to default):
set sw=2
call SetSyntax('default')
call vimwiki#vars#set_wikilocal('listsyms_propagate', 0)
Do (Toggle top-level):
\<C-Space>
Expect vimwiki (Only top updated):
* [X] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Child 3
Do (Toggle child 1):
j
\<C-Space>
Expect vimwiki (Only child 1 updated):
* [ ] Top Level
* [X] Child 1
* [ ] Child 2
* [ ] Child 3
Do (Toggle all children):
j
\<C-Space>
j
\<C-Space>
j
\<C-Space>
Expect vimwiki (Only children updated):
* [ ] Top Level
* [X] Child 1
* [X] Child 2
* [X] Child 3
Given vimwiki (Deeply nested list, vimwiki syntax):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
Do (Indent child 2):
jj
a\<C-D>
Expect vimwiki (Child 2 indent changed, checkmarks unchanged):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
Do (Add child 3):
jj
o
Child 3
Expect vimwiki (Child 3 added, checkmarks unchanged):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
* [ ] Child 3
Do (Add and indent child 3):
jj
o
\<C-T>
Child 3
Expect vimwiki (Child 3 added, checkmarks unchanged):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
* [ ] Child 3
Execute (Clean):
set sw&
# vim: sw=2:foldlevel=30:foldmethod=indent:

View File

@@ -0,0 +1,654 @@
# Maps
# TODO make it without side effects
# -- Use the normal vimwiki or reset it
# 0 Configure {{{1
##################
Execute (VimwikiIndex):
call SetSyntax('markdown')
VimwikiIndex 2
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
AssertEqual 'vimwiki', &filetype
AssertEqual $HOME . '/testmarkdown/', vimwiki_wikilocal_vars[1]['path']
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
Execute (Open buzz bozz):
edit $HOME/testmarkdown/buzz_bozz.md
AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
# 1 Global {{{1
###############
Execute (===========================================================):
Log "Checking global map"
Do (,ww -> open index [Assert]):
,ww
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wt -> open index in tab [Assert]):
,wt
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(2)
\<CR>
Do (,w,w -> open diary [Assert]):
,w,w
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,t -> open diary in tab [Assert]):
,w,t
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
\<CR>
:call AssertTab(2)
\<CR>
Do (,ws -> list and select wiki [Assert]):
,ws
1
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wi -> open diary index [Assert]):
,wi
:AssertEqual $HOME . '/testmarkdown/diary/diary.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,y -> open yesterday [Assert]):
,w,y
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() - 60*60*24) . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,m -> open tomorrow [Assert]):
,wm
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() + 60*60*24) . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
# 2 Local {{{1
##############
#Execute (===========================================================):
# Log "Checking local map"
#
#
## 2.3 Font color {{{2
Given (Some paragraphs):
Some paragraph with some words 1
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Execute(Colorize1: Current line):
set ft=vimwiki
call SetSyntax('markdown')
AssertEqual 3, vimwiki#vars#get_bufferlocal('wiki_nr')
AssertEqual 'vimwiki', &ft
"AssertEqual ',', mapleader
" Returns: Undefeind mapleader
VimwikiColorize red
Expect (Some paragraphs):
<span style="color:#cc241d;">Some paragraph with some words 1</span>
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Execute(Colorize2: 2 lines):
2,3VimwikiColorize red
Expect (Some paragraphs):
Some paragraph with some words 1
<span style="color:#cc241d;">Some paragraph with some words 2
Some paragraph with some words 3</span>
Some paragraph with some words 4
Do(,wc):
\wc1\<Cr>\<Cr>
Expect (Some paragraphs):
<span style="background:#458588;">Some paragraph with some words 1</span>
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Do(User leave menu):
,wc\<Esc>
Expect (Some paragraphs, nothing changed):
Some paragraph with some words 1
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Do(v,wc):
jwll
v
jjllll
\wc14\<Cr>
Expect (Some paragraphs):
Some paragraph with some words 1
Some pa<span style="color:#cc241d;">ragraph with some words 2
Some paragraph with some words 3
Some paragra</span>ph with some words 4
Do(With emoji):
Go
🤥 abcdefghi 🤥 🤥\<Cr>
🤥 abcdefghi 🤥 🤥\<Cr>
🤥 abcdefghi 🤥 🤥\<Esc>
/abc\<Cr>
ll
\<esc>\<C-v>
jjllll
\wc1\<Cr>
Expect (Some paragraphs):
Some paragraph with some words 1
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
🤥 ab<span style="background:#458588;">cdefghi 🤥 🤥
🤥 abcdefghi 🤥 🤥
🤥 abcdefg</span>hi 🤥 🤥
# 2.1 Heading {{{2
##############
Do (,wn -> Create new wiki [Assert]):
,wn
new_file1
\<CR>
:AssertEqual $HOME . '/testmarkdown/new_file1.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wd -> Delete wiki yes [Assert]):
:edit $HOME . '/testmarkdown/file_new1.md'
\<CR>
,wn
new_file2
\<CR>
ithis is content 2
\<Esc>
,wd
yes
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
Do (,wd -> Delete wiki no [Assert]):
:edit $HOME . '/testmarkdown/file_new1.md'
\<CR>
,wn
new_file2
\<CR>
ithis is content 1
\<Esc>
,wd
no
\<CR>
:AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
\<CR>
Do (,wn -> Rename wiki [Assert]):
,wn
new_file1
\<CR>
ithis is content 1
\<Esc>
,wn
new_file2
\<CR>
:AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
\<CR>
Given (Some headings):
# Head 1
## Head 1.1
content 1
# Head2
content 2
Execute (file .md):
file toto.md
edit!
AssertEqual 'vimwiki', &ft
Do (= -> add header level):
=
Expect (Inc header level):
## Head 1
## Head 1.1
content 1
# Head2
content 2
Do (- -> Dec header level):
j
-
Expect (Dec header level):
# Head 1
# Head 1.1
content 1
# Head2
content 2
# TODO fix for vim_7.3.429
# Do ([[ -> Go to the previous header):
# G
# k
# [[
# A placeholder
#
# Expect (placeholder):
# # Head 1
# ## Head 1.1 placeholder
# content 1
#
# # Head2
# content 2
#
# Do (]] -> Go to the next header):
# ]]
# A placeholder
#
# Expect (placeholder):
# # Head 1
# ## Head 1.1 placeholder
# content 1
#
# # Head2
# content 2
#
# Do ([= -> Go to the previous header which has the same level):
# G
# k
# [=
# A placeholder
#
# Expect (placeholder):
# # Head 1 placeholder
# ## Head 1.1
# content 1
#
# # Head2
# content 2
#
# Do (]= -> Go to the next header which has the same level):
# ]=
# A placeholder
#
# Expect (placeholder):
# # Head 1
# ## Head 1.1
# content 1
#
# # Head2 placeholder
# content 2
#
# Do (]u Go one level up):
# j
# ]u
# A placeholder
#
# Expect (placeholder):
# # Head 1 placeholder
# ## Head 1.1
# content 1
#
# # Head2
# content 2
#
# Do ([u Go one level up):
# j
# [u
# A placeholder
#
# Expect (placeholder):
# # Head 1 placeholder
# ## Head 1.1
# content 1
#
# # Head2
# content 2
# 2.2 List {{{2
##############
# brennen commenting this out 2021-03-29 - test seems to flap, test failures
# are difficult to diagnose.
#
# Given vimwiki (Completion list #813 {{{3):
# complete1
# complete2
# complete3
#
# Do (Insert a list item and complete):
# Go
# * comp\<C-n>\<C-n>\<Cr>\<Esc>
# # -Es -> Delete trailing *
# :let mode = mode(1)\<Cr>
# :Log 'Mode : ' .mode\<Cr>
# :if mode ==# 'ce' || mode ==# 'cv' || v:version < 704\<Cr>
# Log 'Cheating'\<Cr>
# try\<Cr>
# g/^\* \?$/d\<Cr>
# endtry\<Cr>
# endif\<Cr>
#
# Expect (With a completion but no new list item):
# complete1
# complete2
# complete3
# * complete2
#
Given (Number list):
1. I
1. Relly
2. Love
1. Very
1. Much
3. You
Execute (file .md):
file toto.md
edit!
AssertEqual 'vimwiki', &ft
set sw=2
Do (gll):
gll
Expect (Increase):
1. I
2. Relly
1. Love
1. Very
1. Much
2. You
Do (gLl):
gLl
Expect (Increase self + child):
1. I
1. Relly
1. Love
1. Very
1. Much
2. You
Do (glh):
jjj
glh
Expect (Decrease):
1. I
1. Relly
2. Love
3. Very
1. Much
4. You
Do (gLh):
jjj
gLh
Expect (Decrease self + child):
1. I
1. Relly
2. Love
3. Very
1. Much
4. You
Do (glr):
\<C-A>\<C-A>
glr
Expect (Renumber):
1. I
1. Relly
2. Love
1. Very
1. Much
3. You
# New launch
#
Given (Number list):
1. I
1. Relly
2. Love
1. Very
1. Much
3. You
Execute (file .md):
file toto.md
edit!
AssertEqual 'vimwiki', &ft
set sw=2
Do (gl*):
gl*
Expect (item -> *):
* I
1. Relly
1. Love
1. Very
1. Much
2. You
Do (gL*):
gL*
Expect (list -> *):
* I
1. Relly
* Love
1. Very
1. Much
* You
# New launch
#
Given (Bulleted list):
* I
- Relly
* Love
- Very
+ Much
* You
Execute (file .md):
set sw=2
file toto.md
edit!
let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
let g:vimwiki_syntaxlocal_vars['markdown']['bullet_types'] = ['*', '-', '+']
AssertEqual 'vimwiki', &ft
Do (gLl):
gLl
Expect (Increase):
- I
+ Relly
* Love
- Very
+ Much
* You
Do (3glh):
gLh
Expect (Decrease):
* I
- Relly
* Love
- Very
+ Much
* You
Given (Bulleted list 2):
* Love
- Very
- Much
Do (Go):
Go
Expect (New item):
* Love
- Very
- Much
-
# New launch
#
Given (List ->):
* Item1
Execute (file toto.md):
" Note: let s:markdown_syntax.bullet_types = ['*', '-', '+']
file toto.md
edit!
Log "Cycle bullets"
let g:vimwiki_syntaxlocal_vars['bullet_types'] = ['*', '-']
let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
AssertEqual g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'], 1
AssertEqual 'vimwiki', &ft
set sw=2
set expandtab " Otherwise, getting some tab before some items, when enought space
Do (o):
oItem2
Expect (Good bullet type):
* Item1
* Item2
# TODO test more, (see real cycle, but do not work with low vim)
Do (o + <C-t>):
o2
\<C-t>\<Esc>
o3
\<C-t>\<Esc>
Expect (Good bullet type):
* Item1
- 2
+ 3
Do (o + <Cr>):
A1\<Cr>
2\<C-t>\<Cr>
3\<C-t>
Expect (Good nested bullet type):
* Item11
- 2
+ 3
# TODO test: let g:vimwiki_bullet_types = ['-', '•', '→', '*']
# 3 Text Object {{{1
####################
Execute (===========================================================):
Log "Checking text object"
# 3.1 HEading Object {{{2
####################
Given (Some headings):
# Head 1
## Head 1.1
content 1
# Head2
content 2
Do (ah):
j
dah
Expect (Change A header including its content up to the next header):
# Head 1
# Head2
content 2
Do (ih):
j
dih
Expect (The content under a header):
# Head 1
## Head 1.1
# Head2
content 2
Do (aH):
daH
Expect (A header including all of its subheaders):
# Head2
content 2
Do (iH):
diH
Expect (Like 'aH', but excluding the header itself):
# Head 1
# Head2
content 2
# vim: foldmethod=marker foldlevel=30 sw=2

Some files were not shown because too many files have changed in this diff Show More