8 Commits

Author SHA1 Message Date
EinfachToll 86289a8493 Merge branch 'dev' into path-handling
Conflicts:
	autoload/vimwiki/base.vim
	autoload/vimwiki/diary.vim
	autoload/vimwiki/vars.vim
	ftplugin/vimwiki.vim
2019-01-28 07:30:08 +01:00
EinfachToll e45380e3d2 Unify path handling -- part 6 2018-05-15 20:47:12 +02:00
EinfachToll 21e65cf4da Unify path handling -- part 5 2018-04-30 21:27:00 +02:00
EinfachToll b1393a34f7 Merge branch 'dev' into path-handling
Conflicts:
	autoload/vimwiki/base.vim
	autoload/vimwiki/diary.vim
	autoload/vimwiki/html.vim
	autoload/vimwiki/path.vim
	autoload/vimwiki/tags.vim
	autoload/vimwiki/u.vim
	autoload/vimwiki/vars.vim
	ftplugin/vimwiki.vim
	plugin/vimwiki.vim
2018-04-25 21:46:00 +02:00
EinfachToll ca07da33c8 Unify path handling -- part 4 2018-04-25 18:02:23 +02:00
EinfachToll f76e75d117 Unify path handling -- part 3 2018-02-22 08:21:23 +01:00
EinfachToll 12d6265193 Unify path handling -- part 2 2017-11-08 21:56:59 +01:00
EinfachToll 8d0d1561c5 Unify path handling 2017-04-16 16:41:43 +02:00
100 changed files with 4306 additions and 31698 deletions
-6
View File
@@ -1,6 +0,0 @@
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`.
-9
View File
@@ -1,9 +0,0 @@
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.
-99
View File
@@ -1,99 +0,0 @@
# Copied from previous .travis.yml by tinmarino the 2023-03-09
# Commented out to avoid verbosity on github commit status
#name: Main
#description: Vimwiki CI test bank
on: [push, pull_request, workflow_dispatch]
jobs:
Typos:
# Copyed from: https://github.com/junegunn/fzf/blob/master/.github/workflows/typos.yml
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: crate-ci/typos@v1.13.16
with:
config: ./test/resources/typos_config.toml
Vint:
# Copyed from: https://github.com/LudvigHz/vint-action
# And local test/run_test.sh
name: Vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ludvighz/vint-action@v1
with:
path: .
args: --style-problem
- uses: ludvighz/vint-action@v1
with:
path: test/vimrc
args: --style-problem
Check:
name: Check ${{ matrix.opt }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
opt: [
#"vint",
"-n vim_7.3.429",
"-n vim_8.1.0519",
# TODO add me when test works on Vim, 9.0
# -- Currently I experienced some surprised due to defaults
# -- tinmarino 2023-03-10
# "-n v9.0.1396",
"-n nvim_0.3.8",
# Cannot quote as it is expanded from $OPT after quote removal
# So I decided to escape the *
"-n vim_7.4.1099 -f '[a-k]*.vader'",
"-n vim_7.4.1546 -f 'l*.vader'",
"-n vim_8.0.0027 -f '[m-z]*.vader'",
]
steps:
# This action is required to fetch the code to test
- uses: actions/checkout@v3
with:
fetch-depth: 0
# This action is crafting the docker image from the root Docker file
# or will use it is exists in cache
# It caches in GHA for GitHub Actions with 10 Gb
# See: https://github.com/moby/buildkit#github-actions-cache-experimental
# Examples at: https://github.com/docker/build-push-action/blob/
# e27bcee4eb9e7b4bc168418e3364c4482120393a/docs/advanced/cache.md
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v2
with:
context: .
push: false
tags: vimwiki:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Check
run: |
pushd test
if [[ "$OPT" == 'vint' ]]; then
bash run_tests.sh -v -t vint;
else
bash run_tests.sh -v -t vader $OPT;
fi
popd
env:
OPT: ${{ matrix.opt }}
-2
View File
@@ -2,7 +2,6 @@
# This section is devoted to this project # This section is devoted to this project
############################## ##############################
doc/tags doc/tags
.tags
# Vim stuff # Vim stuff
############################## ##############################
@@ -21,4 +20,3 @@ Session.vim
.Trashes .Trashes
ehthumbs.db ehthumbs.db
Thumbs.db Thumbs.db
vimtest
-50
View File
@@ -1,50 +0,0 @@
# No language: we download vim and compile it oursselves
# WARNING: This file is OBSOLETE since travis CI is making us pay
# to get execution.
# See Github Actions at .github/workflows/test-vader-action.yml
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:
+35 -57
View File
@@ -1,68 +1,46 @@
# Contributing to VimWiki
# Filing a bug # Filing a bug
Before filing a bug or starting to write a patch, check the latest development Before filing a bug or starting to write a patch, check the latest development version from
version from https://github.com/vimwiki/vimwiki/tree/dev to see if your problem https://github.com/vimwiki/vimwiki/tree/dev to see if your problem is already fixed.
is already fixed.
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/ 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 # Creating a pull request
If you want to provide a pull request on GitHub, please start from the `dev` branch, not from the
`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.)
If you want to provide a pull request on GitHub, start from the `dev` branch,
not from the `master` branch.
Version bureaucracy: # More info for (aspiring) core developers
## Git branching model
- there are two branches with eternal lifetime:
- `dev`: This is where the main development happens. Tasks which are done in one or only a few
commits go here directly. Always try to keep this branch in a working state, that is, if the
task you work on requires multiple commits, make sure intermediate commits don't make Vimwiki
unusable (or at least push these commits at one go).
- `master`: This branches is for released states only. Whenever a reasonable set of changes has
piled up in the `dev` branch, a [release is done](#Preparing a release). After a release,
`dev` has been merged into `master` and `master` got exactly one additional commit in which
the version number in `plugin/vimwiki.vim` is updated. Apart from these commits and the merge
commit from `dev`, nothing happens on `master`. Never should `master` merge into `dev`. When
the users ask, we should recommend this branch for them to use.
- Larger changes which require multiple commits are done in feature branches. They are based on
`dev` and merge into `dev` when the work is done.
1. Pick a new version number according to the current date: ## Preparing a release
`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. `git checkout dev`
2. Update the changelog in the doc, nicely grouped, with a new version number and release date.
3. Update the list of contributors.
4. Update the version number at the top of the doc file.
5. If necessary, update the Readme and the home page.
6. `git checkout master && git merge dev`
7. Update the version number at the top of plugin/vimwiki.vim.
8. Set a tag with the version number in Git: `git tag vX.Y`
9. `git push --tags`
10. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag, convert the changelog from the
doc to markdown and post it there. Make plans to build an automatic converter and immediately
forget this plan.
11. Tell the world.
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 %% vim:tw=99
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/
-26
View File
@@ -1,26 +0,0 @@
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
WORKDIR /
RUN install_vim -tag v7.3.429 -name vim_7.3.429 -build
RUN install_vim -tag v7.4.1099 -name vim_7.4.1099 -build
RUN install_vim -tag v7.4.1546 -name vim_7.4.1546 -build
RUN install_vim -tag v8.0.0027 -name vim_8.0.0027 -build
RUN install_vim -tag v8.1.0519 -name vim_8.1.0519 -build
RUN install_vim -tag v9.0.1396 -name v9.0.1396 -build
RUN install_vim -tag neovim:v0.3.8 -name nvim_0.3.8 -build
View File
+55 -85
View File
@@ -1,62 +1,63 @@
VimWiki —— Vim 个人 Wiki 插件 一个私人的维基——vim插件
============================================================================== ==============================================================================
[English](README.md)
![screenshot1](doc/screenshot_1.png) ![screenshot1](doc/screenshot_1.png)
![screenshot2](doc/screenshot_2.png) * ![screenshot2](doc/screenshot_2.png)
介绍 介绍
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法高亮的文本文件。 Vimwiki是私人维基的vim插件 -- 许多有自己代码高亮的text文件。
通过 Vimwiki,你可以: 通过Vimwiki,你可以:
* 组织笔记和想法 * 组织笔记和想法
* 管理待办事项 * 制作代办事项
* 写文档 * 写文档
* 坚持写日记
* 将这一切导出成 HTML 网页
马上开始!按下 `<Leader>ww`(通常是 `\ww`)进入作为目录页的 wiki 文件,这个文件默认存放在 `~/vimwiki/index.wiki` 一个快速的开始,通常使用`<Leader>ww`(一般是`\ww`),然后创建你的index wiki文件
通常,它在:
在该文件中输入以下示例: ~/vimwiki/index.wiki
= 我的个人知识库 = 在这个文件,输入如下的例子:
* 任务列表 -- _昨天_ 就该完成的事!!!
* Gutenberg 计划 -- 好书给我力量。
* 草稿 -- 临时记录一些东西。
把光标移到 `任务` 二字上,按 Enter(回车)创建链接。按下后,`任务`二字会变成 `[[任务]]` —— 这是一个 Vimwiki 链接。再次按 Enter 即可进入这个链接(打开新的 wiki 文件)。编辑这个新文件,保存,然后按 Backspace(退格)就能回到目录页。 = My knowledge base =
* Tasks -- things to be done _yesterday_!!!
* Project Gutenberg -- good books are power.
* Scratchpad -- various temporary stuff.
如果 Vimwiki 链接长度不止一个单词(指的是英文单词),只需在 Visual 模式选择这段文本后按 Enter 即可。用上面的 `Gutenberg 计划` 试试吧。最终结果是这样: 将你的光标放到`Tasks`(任务)上,并且按回车键去创建一个链接。一旦按下,`Task`将会
变成`[[Tasks]]` -- 一个vimwiki的链接。再按一次回车去打开它。编辑文件,保存它,
然后按backspace来返回你的index。
= 我的个人知识库 = 一个vimwiki链接可以一句话创建。只需要通过选择visual模式选择这个句子,然后按回车。
* [[任务列表]] -- _昨天_ 就该完成的事!!! 你可以通过选择`Project Gutenberg`来尝试。结果像是这个样子:
* [[Gutenberg 计划]] -- 好书给我力量。
* 草稿 -- 临时记录一些东西。 = My knowledge base =
* [[Tasks]] -- things to be done _yesterday_!!!
* [[Project Gutenberg]] -- good books are power.
* Scratchpad -- various temporary stuff.
基本标记 基本标记
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
= 一级标题 = = Header1 =
== 二级标题 == == Header2 ==
=== 三级标题 === === Header3 ===
*bold* -- 粗体文本 *bold* -- bold text
_italic_ -- 斜体文本 _italic_ -- italic text
(应用于句中的汉字文本时,必须在标记前后加空格,例如:一段 *中文* 文本)
[[wiki link]] -- wiki 链接 [[wiki link]] -- wiki link
[[wiki link|description]] -- 带有描述文本的 wiki 链接 [[wiki link|description]] -- wiki link with description
列表 列表:
* bullet list item 1(无编号列表) * bullet list item 1
- bullet list item 2 - bullet list item 2
- bullet list item 3 - bullet list item 3
* bullet list item 4 * bullet list item 4
@@ -66,13 +67,13 @@ Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法
- bullet list item 8 - bullet list item 8
- bullet list item 9 - bullet list item 9
1. numbered list item 1(有编号列表) 1. numbered list item 1
2. numbered list item 2 2. numbered list item 2
a) numbered list item 3 a) numbered list item 3
b) numbered list item 4 b) numbered list item 4
更多格式说明,请阅 `:h vimwiki-syntax` 查看`:h vimwiki-syntax`
键位绑定 键位绑定
@@ -80,49 +81,46 @@ Vimwiki 是 Vim 中的个人 Wiki —— 一组链接起来的、有独特语法
normal 模式: normal 模式:
* `<Leader>ww` -- 打开默认的 wiki 目录文件 * `<Leader>ww` -- 打开默认的wiki index文件
* `<Leader>wt` -- 在新标签(Tab)中打开 wiki 目录文件 * `<Leader>wt` -- 通过tab实现上一个功能
* `<Leader>ws` -- 在多个 wiki 中选择并打开该 wiki 的目录文件 * `<Leader>ws` -- 选择并打开index文件
* `<Leader>wd` -- 删除当前 wiki 文件 * `<Leader>wd` -- 删除进入的wiki文件
* `<Leader>wr` -- 重命名当前 wiki 文件 * `<Leader>wr` -- 重命名你进入的wiki文件
* `<Enter>` -- 创建或打开 wiki 链接 * `<Enter>` -- 进入/创建 wiki 链接
* `<Shift-Enter>` -- 先上下分屏再打开 wiki 链接(若非链接则先创建) * `<Shift-Enter>` -- 通过分屏模式sp,进入/创建wiki链接
* `<Ctrl-Enter>` -- 先左右分屏再打开 wiki 链接(若非链接则先创建) * `<Ctrl-Enter>` -- 通过分屏模式vs,进入/创建wiki链接
* `<Backspace>` -- 返回之前浏览的 wiki 文件 * `<Backspace>` -- 返回父节点
* `<Tab>` -- 跳到本文件中下一个 wiki 链接 * `<Tab>` -- 寻找下一个wiki链接
* `<Shift-Tab>` -- 跳到本文件中上一个 wiki 链接 * `<Shift-Tab>` -- 寻找上一个wiki链接
更多快捷键说明,请阅 `:h vimwiki-mappings` 查看`:h vimwiki-mappings`
命令 命令
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* `:Vimwiki2HTML` -- 当前 wiki 文件转换成 HTML 网页 * `:Vimwiki2HTML` -- 转换当前wiki成为html
* `:VimwikiAll2HTML` -- 把所有 wiki 文件转换成 HTML 网页 * `:VimwikiAll2HTML` -- 转化你的全部wiki到html
* `:help vimwiki-commands` -- 显示全部命令 * `:help vimwiki-commands` -- 显示全部命令
安装 安装细节
============================================================================== ==============================================================================
准备工作 在安装之前,你需要做的
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
保在 `vimrc` 中加入了以下设置: 定在`vimrc`中,你的设置是这样的。
set nocompatible set nocompatible
filetype plugin on filetype plugin on
syntax on syntax on
没有这些设置Vimwiki 将无法正常工作。 如果没有他们Vimwiki将无法正常工作。
通过 [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) 安装(Vim 7.4.1528 后)
------------------------------------------------------------------------------
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
通过 [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) 安装 使用 pathogen (译者注:一个插件) (http://www.vim.org/scripts/script.php?script_id=2332 )
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
cd ~/.vim cd ~/.vim
@@ -130,32 +128,4 @@ normal 模式:
cd bundle cd bundle
git clone https://github.com/vimwiki/vimwiki.git git clone https://github.com/vimwiki/vimwiki.git
通过 [Vim-Plug](https://github.com/junegunn/vim-plug) 安装 然后启动vim,使用`:Helptags` 然后 `:help vimwiki`来确保他已经被安装了。
------------------------------------------------------------------------------
`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) 插件。
+133 -246
View File
@@ -1,294 +1,181 @@
![VimWiki: A Personal Wiki For Vim](doc/splash.png) A Personal Wiki For Vim
==============================================================================
[中文](README-cn.md) ![screenshot1](doc/screenshot_1.png)
![screenshot2](doc/screenshot_2.png) *
- [Intro](#introduction) Intro
- [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)
---- Vimwiki is a personal wiki for Vim -- a number of linked text files that have
their own syntax highlighting.
## Introduction With Vimwiki you can:
VimWiki is a personal wiki for Vim -- a number of linked text files that have * organize notes and ideas
their own syntax highlighting. See the [VimWiki Wiki](https://vimwiki.github.io/vimwikiwiki/) * manage todo-lists
for an example website built with VimWiki! * write documentation
* maintain a diary
* export everything to HTML
For the latest features and fixes checkout the [dev branch](https://github.com/vimwiki/vimwiki/tree/dev). To do a quick start press `<Leader>ww` (this is usually `\ww`) to go to your index
If you are interested in contributing see [this section](#helping-vimwiki). wiki file. By default it is located in `~/vimwiki/index.wiki`.
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: Feed it with the following example:
```text = My knowledge base =
= My knowledge base = * Tasks -- things to be done _yesterday_!!!
* Tasks -- things to be done _yesterday_!!! * Project Gutenberg -- good books are power.
* Project Gutenberg -- good books are power. * Scratchpad -- various temporary stuff.
* Scratchpad -- various temporary stuff.
```
Place your cursor on `Tasks` and press Enter to create a link. Once pressed, 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 `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 open it. Edit the file, save it, and then press Backspace to jump back to your
index. index.
A VimWiki link can be constructed from more than one word. Just visually 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`. select the words to be linked and press Enter. Try it with `Project Gutenberg`.
The result should look something like: The result should look something like:
```text = My knowledge base =
= My knowledge base = * [[Tasks]] -- things to be done _yesterday_!!!
* [[Tasks]] -- things to be done _yesterday_!!! * [[Project Gutenberg]] -- good books are power.
* [[Project Gutenberg]] -- good books are power. * Scratchpad -- various temporary stuff.
* 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 Basic Markup
_italic_ -- italic text ------------------------------------------------------------------------------
[[wiki link]] -- wiki link = Header1 =
[[wiki link|description]] -- wiki link with description == Header2 ==
``` === Header3 ===
### Lists
```text *bold* -- bold text
* bullet list item 1 _italic_ -- italic text
- bullet list item 2
- bullet list item 3 [[wiki link]] -- wiki link
* bullet list item 4 [[wiki link|description]] -- wiki link with description
* bullet list item 5
* bullet list item 6
* bullet list item 7 Lists:
- bullet list item 8
- bullet list item 9 * 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
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` For other syntax elements, see `:h vimwiki-syntax`
## Key bindings
### Normal mode Key bindings
------------------------------------------------------------------------------
**Note:** your terminal may prevent capturing some of the default bindings normal mode:
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
- `<Leader>ww` -- Open default wiki index file. For more keys, see `:h vimwiki-mappings`
- `<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 Commands
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
- `: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 Changing Wiki Syntax
------------------------------------------------------------------------------
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown Vimwiki currently ships with 3 syntaxes: Vimwiki (default), Markdown (markdown), and MediaWiki (media)
(markdown), and MediaWiki (media).
**NOTE:** Only the default syntax ships with a built-in HTML converter. For If you would prefer to use either Markdown or MediaWiki syntaxes, set the following option in your .vimrc:
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). let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
```
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
following option in your `.vimrc`:
```vim Installation
==============================================================================
let g:vimwiki_list = [{'path': '~/vimwiki/', Prerequisites
\ 'syntax': 'markdown', 'ext': '.md'}] ------------------------------------------------------------------------------
``` Make sure you have these settings in your vimrc file:
This option will treat all markdown files in your system as part of vimwiki (check `set filetype?`). Add set nocompatible
```vim filetype plugin on
let g:vimwiki_global_ext = 0 syntax on
```
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 Without them Vimwiki will not work properly.
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
method for raising bug reports or feature requests.
Additional resources: Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
------------------------------------------------------------------------------
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on irc.libera.chat git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
- [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 Installation using [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332)
------------------------------------------------------------------------------
VimWiki has a lot of users but only very few recurring developers or people cd ~/.vim
helping the community. Your help is therefore appreciated. Everyone can help! mkdir bundle
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how you can help. 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:
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
Then run `:PlugInstall`.
Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
------------------------------------------------------------------------------
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run
vim +PluginInstall +qall
Or download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip) and extract it in `~/.vim/bundle/`
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was installed.
Getting help
==============================================================================
Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki))
or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md) and [design_notes.md](doc/design_notes.md)
---- ----
\* Screenshots made with the [solarized colorscheme](https://github.com/altercation/vim-colors-solarized)
## License and [lightline](https://github.com/itchyny/lightline.vim)
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.
+605 -1619
View File
File diff suppressed because it is too large Load Diff
+13 -12
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/bin/bash
# #
# This script converts markdown into html, to be used with vimwiki's # This script converts markdown into html, to be used with vimwiki's
# "customwiki2html" option. Experiment with the two proposed methods by # "customwiki2html" option. Experiment with the two proposed methods by
# commenting / uncommenting the relevant lines below. # commenting / uncommenting the relevant lines below.
# #
# NEW! An alternative converter was developed by Jason6Anderson, and can # NEW! An alternative converter was developed by Jason6Anderson, and can
@@ -13,23 +13,23 @@
# #
# http://www.pell.portland.or.us/~orc/Code/discount/ # http://www.pell.portland.or.us/~orc/Code/discount/
# #
# To verify your installation, check that the commands markdown and mkd2html, # To verify your installation, check that the commands markdown and mkd2text,
# are on your path. # are on your path.
# #
# Also verify that this file is executable. # Also verify that this file is executable.
# #
# Then, in your .vimrc file, set: # Then, in your .vimrc file, set:
# #
# g:vimwiki_custom_wiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh' # g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
# #
# On your next restart, Vimwiki will run this script instead of using the # On your next restart, Vimwiki will run this script instead of using the
# internal wiki2html converter. # internal wiki2html converter.
# #
MARKDOWN=markdown
MKD2HTML=mkd2html MKD2HTML=mkd2html
# shellcheck disable=SC2034 # FORCE appears unused
FORCE="$1" FORCE="$1"
SYNTAX="$2" SYNTAX="$2"
EXTENSION="$3" EXTENSION="$3"
@@ -37,18 +37,16 @@ OUTPUTDIR="$4"
INPUT="$5" INPUT="$5"
CSSFILE="$6" CSSFILE="$6"
FORCEFLAG=
[[ "$SYNTAX" == "markdown" ]] || { echo "Error: Unsupported syntax"; exit 2; }; [ $FORCE -eq 0 ] || { FORCEFLAG="-f"; };
[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; };
OUTPUT="$OUTPUTDIR/$(basename "$INPUT" ."$EXTENSION").html" OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
# # Method 1: # # 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] # # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile]
# #
# URLBASE=http://example.com # URLBASE=http://example.com
# $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT # $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT
@@ -59,3 +57,6 @@ OUTPUT="$OUTPUTDIR/$(basename "$INPUT" ."$EXTENSION").html"
$MKD2HTML -css "$CSSFILE" "$INPUT" $MKD2HTML -css "$CSSFILE" "$INPUT"
OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html
mv -f "$OUTPUTTMP" "$OUTPUT" mv -f "$OUTPUTTMP" "$OUTPUT"
-2
View File
@@ -2,10 +2,8 @@
<html> <html>
<head> <head>
<link rel="Stylesheet" type="text/css" href="%root_path%%css%"> <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> <title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%"> <meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
<body> <body>
%content% %content%
+105 -318
View File
@@ -4,15 +4,16 @@
" Home: https://github.com/vimwiki/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
" Clause: load only once if exists("g:loaded_vimwiki_diary_auto") || &cp
if exists('g:loaded_vimwiki_diary_auto') || &compatible
finish finish
endif endif
let g:loaded_vimwiki_diary_auto = 1 let g:loaded_vimwiki_diary_auto = 1
function! s:prefix_zero(num) abort let s:vimwiki_max_scan_for_caption = 5
" Add zero prefix to a number
function! s:prefix_zero(num)
if a:num < 10 if a:num < 10
return '0'.a:num return '0'.a:num
endif endif
@@ -20,94 +21,33 @@ function! s:prefix_zero(num) abort
endfunction endfunction
function! s:diary_path(...) abort function! s:diary_path(...)
" Return: diary directory path <String>
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1 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) return vimwiki#vars#get_wikilocal('diary_path', idx)
endfunction endfunction
function! s:diary_index(...) abort function! s:diary_index(...)
" Return: diary index file path <String>
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1 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). return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).
\ vimwiki#vars#get_wikilocal('ext', idx) \ vimwiki#vars#get_wikilocal('ext', idx)
endfunction endfunction
function! vimwiki#diary#diary_date_link(...) abort function! vimwiki#diary#diary_date_link(...)
" 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 if a:0
let l:timestamp = a:1 return strftime('%Y-%m-%d', a:1)
else else
let l:timestamp = localtime() return strftime('%Y-%m-%d')
endif 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 endfunction
function! s:get_position_links(link) abort function! s:get_position_links(link)
" Return: <int:index, list:links>
let idx = -1 let idx = -1
let links = [] let links = []
if a:link =~# '^\d\{4}-\d\d-\d\d' if a:link =~# '^\d\{4}-\d\d-\d\d'
let links = map(vimwiki#diary#get_diary_files(), 'fnamemodify(v:val, ":t:r")') let links = map(s:get_diary_files(), 'fnamemodify(v:val, ":t:r")')
" include 'today' into links " include 'today' into links
if index(links, vimwiki#diary#diary_date_link()) == -1 if index(links, vimwiki#diary#diary_date_link()) == -1
call add(links, vimwiki#diary#diary_date_link()) call add(links, vimwiki#diary#diary_date_link())
@@ -119,118 +59,38 @@ function! s:get_position_links(link) abort
endfunction endfunction
function! s:get_month_name(month) abort function! s:get_month_name(month)
" Convert month: number -> name
return vimwiki#vars#get_global('diary_months')[str2nr(a:month)] return vimwiki#vars#get_global('diary_months')[str2nr(a:month)]
endfunction endfunction
function! s:get_first_header(fl) abort function! s:read_captions(files)
" 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 caption in 1. <List>files
" Return: <Dic>: key -> caption
let result = {} let result = {}
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level') let rx_header = vimwiki#vars#get_syntaxlocal('rxHeader')
for fl in a:files for fl in a:files
" Remove paths and extensions " remove paths and extensions
let fl_captions = {} let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
" Default; no captions from the file. if filereadable(fl)
let fl_captions['top'] = '' for line in readfile(fl, '', s:vimwiki_max_scan_for_caption)
let fl_captions['rest'] = [] if line =~# rx_header && !has_key(result, fl_key)
let result[fl_key] = vimwiki#u#trim(matchstr(line, rx_header))
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 endfor
endif
if !has_key(result, fl_key)
let result[fl_key] = ''
endif endif
let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
let result[fl_key] = fl_captions
endfor endfor
return result return result
endfunction endfunction
function! vimwiki#diary#get_diary_files() abort function! s:get_diary_files()
" Return: <list> diary file names
let rx = '^\d\{4}-\d\d-\d\d' let rx = '^\d\{4}-\d\d-\d\d'
let s_files = glob(vimwiki#vars#get_wikilocal('path'). let s_files = glob(vimwiki#vars#get_wikilocal('diary_path') . '*' . vimwiki#vars#get_wikilocal('ext'))
\ vimwiki#vars#get_wikilocal('diary_rel_path').'*'.vimwiki#vars#get_wikilocal('ext'))
let files = split(s_files, '\n') let files = split(s_files, '\n')
call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"') call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
@@ -241,8 +101,7 @@ function! vimwiki#diary#get_diary_files() abort
endfunction endfunction
function! s:group_links(links) abort function! s:group_links(links)
" Return: <dic> nested -> links
let result = {} let result = {}
let p_year = 0 let p_year = 0
let p_month = 0 let p_month = 0
@@ -264,8 +123,7 @@ function! s:group_links(links) abort
endfunction endfunction
function! s:sort(lst) abort function! s:sort(lst)
" Sort list
if vimwiki#vars#get_wikilocal('diary_sort') ==? 'desc' if vimwiki#vars#get_wikilocal('diary_sort') ==? 'desc'
return reverse(sort(a:lst)) return reverse(sort(a:lst))
else else
@@ -273,15 +131,52 @@ function! s:sort(lst) abort
endif endif
endfunction endfunction
function! vimwiki#diary#diary_sort(lst) abort
return s:sort(a:lst) function! s:format_diary()
let result = []
let links_with_captions = s:read_captions(s:get_diary_files())
let g_files = s:group_links(links_with_captions)
for year in s:sort(keys(g_files))
call add(result, '')
call add(result,
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', year , ''))
for month in s:sort(keys(g_files[year]))
call add(result, '')
call add(result, substitute(vimwiki#vars#get_syntaxlocal('rxH3_Template'),
\ '__Header__', s:get_month_name(month), ''))
for [fl, cap] in s:sort(items(g_files[year][month]))
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(cap) " When using markdown syntax, we should ensure we always have a link description.
let cap = fl
endif
elseif empty(cap)
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
endif
let entry = substitute(link_tpl, '__LinkUrl__', fl, '')
let entry = substitute(entry, '__LinkDescription__', cap, '')
call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry)
endfor
endfor
endfor
return result
endfunction 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
" 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
" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki " is used.
" is used. function! vimwiki#diary#make_note(wnum, ...)
if a:wnum == 0 if a:wnum == 0
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr') 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 if wiki_nr < 0 " this happens when e.g. VimwikiMakeDiaryNote was called outside a wiki buffer
@@ -292,31 +187,22 @@ function! vimwiki#diary#make_note(wnum, ...) abort
endif endif
if wiki_nr >= vimwiki#vars#number_of_wikis() if wiki_nr >= vimwiki#vars#number_of_wikis()
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!') echomsg 'Vimwiki Error: Wiki '.wiki_nr.' is not registered in g:vimwiki_list!'
return return
endif endif
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr). " TODO: refactor it. base#goto_index uses the same
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
let cmd = ':edit' call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('diary_path', wiki_nr))
let cmd = 'edit'
if a:0 if a:0
if a:1 == 1 if a:1 == 1
let cmd = ':tabedit' let cmd = 'tabedit'
elseif a:1 == 2 elseif a:1 == 2
let cmd = ':split' let cmd = 'split'
elseif a:1 == 3 elseif a:1 == 3
let cmd = ':vsplit' let cmd = 'vsplit'
elseif a:1 == 4
let cmd = ':tab edit'
if exists(':drop') == 2
let cmd = ':tab drop'
endif
elseif a:1 == 5
let cmd = ':edit'
if exists(':drop') == 2
let cmd = ':drop'
endif
endif endif
endif endif
if a:0>1 if a:0>1
@@ -329,21 +215,17 @@ function! vimwiki#diary#make_note(wnum, ...) abort
endfunction endfunction
function! vimwiki#diary#goto_diary_index(wnum) abort function! vimwiki#diary#goto_diary_index(wnum)
" Jump to diary index of 1. <Int> wikinumber if a:wnum > vimwiki#vars#number_of_wikis()
" if wnum = 0 the current wiki is used echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
if a:wnum == 0 return
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 endif
if a:wnum > vimwiki#vars#number_of_wikis() " TODO: refactor it. base#goto_index uses the same
call vimwiki#u#error('Wiki '.a:wnum.' is not registered in g:vimwiki_list!') if a:wnum > 0
return let idx = a:wnum - 1
else
let idx = 0
endif endif
call vimwiki#base#edit_file('e', s:diary_index(idx), '') call vimwiki#base#edit_file('e', s:diary_index(idx), '')
@@ -355,8 +237,7 @@ function! vimwiki#diary#goto_diary_index(wnum) abort
endfunction endfunction
function! vimwiki#diary#goto_next_day() abort function! vimwiki#diary#goto_next_day()
" Jump to next day
let link = '' let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r')) let [idx, links] = s:get_position_links(expand('%:t:r'))
@@ -377,8 +258,7 @@ function! vimwiki#diary#goto_next_day() abort
endfunction endfunction
function! vimwiki#diary#goto_prev_day() abort function! vimwiki#diary#goto_prev_day()
" Jump to previous day
let link = '' let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r')) let [idx, links] = s:get_position_links(expand('%:t:r'))
@@ -399,106 +279,21 @@ function! vimwiki#diary#goto_prev_day() abort
endfunction endfunction
function! vimwiki#diary#generate_diary_section() abort function! vimwiki#diary#generate_diary_section()
" Create diary index content let current_file = vimwiki#path#path_norm(expand("%:p"))
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 multiple 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()) let diary_file = vimwiki#path#path_norm(s:diary_index())
if vimwiki#path#is_equal(current_file, diary_file) if vimwiki#path#is_equal(current_file, diary_file)
let content_rx = '^\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)\|'. let content_rx = '^\%(\s*\* \)\|\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)'
\ '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)' call vimwiki#base#update_listing_in_buffer(s:format_diary(),
\ vimwiki#vars#get_wikilocal('diary_header'), content_rx, line('$')+1, 1)
call vimwiki#base#update_listing_in_buffer(
\ GeneratorDiary,
\ vimwiki#vars#get_wikilocal('diary_header'),
\ content_rx,
\ 1,
\ 1,
\ 1)
else else
call vimwiki#u#error('You can generate diary links only in a diary index page!') echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
endif endif
endfunction endfunction
function! vimwiki#diary#calendar_action(day, month, year, week, dir) abort " Callback function for Calendar.vim
" Callback function for Calendar.vim function! vimwiki#diary#calendar_action(day, month, year, week, dir)
let day = s:prefix_zero(a:day) let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month) let month = s:prefix_zero(a:month)
@@ -520,19 +315,11 @@ function! vimwiki#diary#calendar_action(day, month, year, week, dir) abort
endfunction endfunction
function! vimwiki#diary#calendar_sign(day, month, year) abort function vimwiki#diary#calendar_sign(day, month, year)
" 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 day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month) let month = s:prefix_zero(a:month)
let sfile = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path') let sfile = vimwiki#vars#get_wikilocal('diary_path') .
\ . a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext') \ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
return filereadable(expand(sfile)) return filereadable(expand(sfile))
endfunction 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
+399 -901
View File
File diff suppressed because it is too large Load Diff
+258 -405
View File
File diff suppressed because it is too large Load Diff
+51 -16
View File
@@ -4,14 +4,14 @@
" Home: https://github.com/vimwiki/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
function! s:safesubstitute(text, search, replace, mode) abort function! s:safesubstitute(text, search, replace, mode)
" Substitute regexp but do not interpret replace " Substitute regexp but do not interpret replace
let escaped = escape(a:replace, '\&') let escaped = escape(a:replace, '\&')
return substitute(a:text, a:search, escaped, a:mode) return substitute(a:text, a:search, escaped, a:mode)
endfunction endfunction
function! vimwiki#markdown_base#scan_reflinks() abort function! vimwiki#markdown_base#scan_reflinks()
let mkd_refs = {} let mkd_refs = {}
" construct list of references using vimgrep " construct list of references using vimgrep
try try
@@ -25,7 +25,7 @@ function! vimwiki#markdown_base#scan_reflinks() abort
let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ') let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ')
let descr = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchDescr')) let descr = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchDescr'))
let url = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchUrl')) let url = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchUrl'))
if descr !=? '' && url !=? '' if descr != '' && url != ''
let mkd_refs[descr] = url let mkd_refs[descr] = url
endif endif
endfor endfor
@@ -34,8 +34,9 @@ function! vimwiki#markdown_base#scan_reflinks() abort
endfunction endfunction
function! vimwiki#markdown_base#open_reflink(link) abort " try markdown reference links
" try markdown reference links function! vimwiki#markdown_base#open_reflink(link)
" echom "vimwiki#markdown_base#open_reflink"
let link = a:link let link = a:link
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs') let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
if has_key(mkd_refs, link) if has_key(mkd_refs, link)
@@ -48,7 +49,7 @@ function! vimwiki#markdown_base#open_reflink(link) abort
endfunction endfunction
function! s:normalize_link_syntax_n() abort function! s:normalize_link_syntax_n()
let lnum = line('.') let lnum = line('.')
" try WikiIncl " try WikiIncl
@@ -96,20 +97,54 @@ function! s:normalize_link_syntax_n() abort
" normalize_link_syntax_v " normalize_link_syntax_v
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord')) let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord'))
if !empty(lnk) if !empty(lnk)
if vimwiki#base#is_diary_file(expand('%:p')) let sub = vimwiki#base#normalize_link_helper(lnk,
let sub = vimwiki#base#normalize_link_in_diary(lnk) \ vimwiki#vars#get_global('rxWord'), '',
else \ vimwiki#vars#get_syntaxlocal('Weblink1Template'))
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) call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
return return
endif endif
endfunction endfunction
function! vimwiki#markdown_base#normalize_link() abort function! s:normalize_link_syntax_v()
" TODO mutualize with base let lnum = line('.')
call s:normalize_link_syntax_n() let sel_save = &selection
let &selection = "old"
let rv = @"
let rt = getregtype('"')
let done = 0
try
norm! gvy
let visual_selection = @"
let link = s:safesubstitute(vimwiki#vars#get_syntaxlocal('Weblink1Template'),
\ '__LinkUrl__', visual_selection, '')
let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '')
call setreg('"', substitute(link, '\n', '', ''), visualmode())
" paste result
norm! `>""pgvd
finally
call setreg('"', rv, rt)
let &selection = sel_save
endtry
endfunction endfunction
function! vimwiki#markdown_base#normalize_link(is_visual_mode)
if 0
" Syntax-specific links
else
if !a:is_visual_mode
call s:normalize_link_syntax_n()
elseif line("'<") == line("'>")
" action undefined for multi-line visual mode selections
call s:normalize_link_syntax_v()
endif
endif
endfunction
+324 -132
View File
@@ -4,55 +4,28 @@
" Home: https://github.com/vimwiki/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
function! vimwiki#path#chomp_slash(str)
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 conversion
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, '[/\\]\+$', '', '') return substitute(a:str, '[/\\]\+$', '', '')
endfunction endfunction
" Define: path-compare function, either case-sensitive or not, depending on OS. " Define path-compare function, either case-sensitive or not, depending on OS.
if vimwiki#u#is_windows() if vimwiki#u#is_windows()
function! vimwiki#path#is_equal(p1, p2) abort function! vimwiki#path#is_equal(p1, p2)
return a:p1 ==? a:p2 return a:p1 ==? a:p2
endfunction endfunction
else else
function! vimwiki#path#is_equal(p1, p2) abort function! vimwiki#path#is_equal(p1, p2)
return a:p1 ==# a:p2 return a:p1 ==# a:p2
endfunction endfunction
endif endif
function! vimwiki#path#normalize(path) abort " collapse sections like /a/b/../c to /a/c
" Collapse Sections: like /a/b/../c to /a/c and /a/b/./c to /a/b/c function! vimwiki#path#normalize(path)
let path = a:path let path = a:path
while 1 while 1
let intermediateResult = substitute(path, '/[^/]\+/\.\.', '', '') let result = substitute(path, '/[^/]\+/\.\.', '', '')
let result = substitute(intermediateResult, '/\./', '/', '')
if result ==# path if result ==# path
break break
endif endif
@@ -62,35 +35,28 @@ function! vimwiki#path#normalize(path) abort
endfunction endfunction
function! vimwiki#path#path_norm(path) abort function! vimwiki#path#path_norm(path)
" Normalize Path: \ -> / && /// -> / && resolve(symlinks) " /-slashes
" return if scp if a:path !~# '^scp:'
if a:path =~# '^scp:' | return a:path | endif let path = substitute(a:path, '\', '/', 'g')
" convert backslash to slash " treat multiple consecutive slashes as one path separator
let path = substitute(a:path, '\', '/', 'g') let path = substitute(path, '/\+', '/', 'g')
" treat multiple consecutive slashes as one path separator " ensure that we are not fooled by a symbolic link
let path = substitute(path, '/\+', '/', 'g') return resolve(path)
" ensure that we are not fooled by a symbolic link else
return resolve(path) return a:path
endif
endfunction endfunction
function! vimwiki#path#is_link_to_dir(link) abort function! vimwiki#path#abs_path_of_link(link)
" Check: if link is to a directory return vimwiki#path#normalize(expand("%:p:h").'/'.a:link)
" It should be ended with \ or /.
return a:link =~# '\m[/\\]$'
endfunction endfunction
function! vimwiki#path#abs_path_of_link(link) abort " return longest common path prefix of 2 given paths.
" Get: absolute path <- path relative to current file " '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
return vimwiki#path#normalize(expand('%:p:h').'/'.a:link) function! vimwiki#path#path_common_pfx(path1, path2)
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 p1 = split(a:path1, '[/\\]', 1)
let p2 = split(a:path2, '[/\\]', 1) let p2 = split(a:path2, '[/\\]', 1)
@@ -107,8 +73,7 @@ function! vimwiki#path#path_common_pfx(path1, path2) abort
endfunction endfunction
function! vimwiki#path#wikify_path(path) abort function! vimwiki#path#wikify_path(path)
" Convert: path -> full resolved slashed path
let result = resolve(fnamemodify(a:path, ':p')) let result = resolve(fnamemodify(a:path, ':p'))
if vimwiki#u#is_windows() if vimwiki#u#is_windows()
let result = substitute(result, '\\', '/', 'g') let result = substitute(result, '\\', '/', 'g')
@@ -118,134 +83,361 @@ function! vimwiki#path#wikify_path(path) abort
endfunction endfunction
function! vimwiki#path#current_wiki_file() abort function! vimwiki#path#current_wiki_file()
" Return: Current file path relative
return vimwiki#path#wikify_path(expand('%:p')) return vimwiki#path#wikify_path(expand('%:p'))
endfunction endfunction
function! vimwiki#path#relpath(dir, file) abort " Returns: the relative path from a:dir to a:file
" Return: the relative path from a:dir to a:file function! vimwiki#path#relpath(dir, file)
" Check if dir here ('.') -> return file let result = []
if empty(a:dir) || a:dir =~# '^\.[/\\]\?$' let dir = split(a:dir, '/')
return a:file let file = split(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]) while (len(dir) > 0 && len(file) > 0) && vimwiki#path#is_equal(dir[0], file[0])
call remove(dir, 0) call remove(dir, 0)
call remove(file, 0) call remove(file, 0)
endwhile endwhile
" Return './' if nothing left
if empty(dir) && empty(file) if empty(dir) && empty(file)
return s:osxify('./') return './'
endif endif
" Build path segment
let segments = []
for segment in dir for segment in dir
let segments += ['..'] let result += ['..']
endfor endfor
for segment in file for segment in file
let segments += [segment] let result += [segment]
endfor endfor
let result_path = join(result, '/')
" Join segments if a:file =~ '\m/$'
let result_path = join(segments, '/')
if a:file =~# '\m/$'
let result_path .= '/' let result_path .= '/'
endif endif
return result_path return result_path
endfunction endfunction
function! vimwiki#path#mkdir(path, ...) abort " If the optional argument provided and nonzero,
" Mkdir: " it will ask before creating a directory
" if the optional argument provided and nonzero, " Returns: 1 iff directory exists or successfully created
" it will ask before creating a directory function! vimwiki#path#mkdir(dir_obj, ...)
" returns: 1 iff directory exists or successfully created
let path = expand(a:path)
if path =~# '^scp:' if a:dir_obj.protocoll ==# 'scp'
" we can not do much, so let's pretend everything is ok " we can not do much, so let's pretend everything is ok
return 1 return 1
endif endif
if isdirectory(path) if vimwiki#path#exists(a:dir_obj)
return 1 return 1
else else
if !exists('*mkdir') if !exists("*mkdir")
return 0 return 0
endif endif
let path = vimwiki#path#chomp_slash(path) let path = vimwiki#path#to_string(a:dir_obj)
if vimwiki#u#is_windows() && !empty(vimwiki#vars#get_global('w32_dir_enc')) 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')) let path = iconv(path, &enc, vimwiki#vars#get_global('w32_dir_enc'))
endif endif
if a:0 && a:1 && input('Vimwiki: Make new directory: '.path."\n [y]es/[N]o? ") !~? '^y' if a:0 && a:1 && input("Vimwiki: Make new directory: ".path."\n [y]es/[N]o? ") !~? '^y'
return 0 return 0
endif endif
call mkdir(path, 'p') call mkdir(path, "p")
return 1 return 1
endif endif
endfunction endfunction
function! vimwiki#path#is_absolute(path) abort function! vimwiki#path#is_absolute(path_string)
" Check: if path is absolute
let res=0
" Match 'C:' or '/' or '~'
if vimwiki#u#is_windows() if vimwiki#u#is_windows()
let res += a:path =~? '\m^\a:' return a:path_string =~? '\m^\a:'
else else
let res += a:path =~# '\m^/\|\~/' return a:path_string =~# '\m^/\|\~/'
endif 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 endfunction
" Combine a directory and a file into one path, doesn't generate duplicate
" path separator in case the directory is also having an ending / or \. This
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
" valid path.
if vimwiki#u#is_windows() if vimwiki#u#is_windows()
" Combine: a directory and a file into one path, doesn't generate duplicate function! vimwiki#path#join_path(directory, file)
" 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 directory = vimwiki#path#chomp_slash(a:directory)
let file = substitute(a:file, '\m^[\\/]\+', '', '') let file = substitute(a:file, '\m^[\\/]\+', '', '')
return directory . '/' . file return directory . '/' . file
endfunction endfunction
else else
function! vimwiki#path#join_path(directory, file) abort function! vimwiki#path#join_path(directory, file)
let directory = substitute(a:directory, '\m/\+$', '', '') let directory = substitute(a:directory, '\m/\+$', '', '')
let file = substitute(a:file, '\m^/\+', '', '') let file = substitute(a:file, '\m^/\+', '', '')
return directory . '/' . file return directory . '/' . file
endfunction endfunction
endif endif
"----------------------------------------------------------
" Path manipulation, i.e. functions which do stuff with the paths of (not necessarily existing) files
"----------------------------------------------------------
" The used data types are
"
" - directory object:
" - used for an absolute path to a directory
" - internally, it is a dictionary with the following entries:
" - 'protocoll' -- how to access the file. Supported are 'scp' or 'file'
" - 'is_unix' -- 1 if it's supposed to be a unix-like path
" - 'path' -- a list containing the directory names starting at the root
" - file object:
" - for an absolute path to a file
" - internally a list [dir_obj, file name]
" - file segment:
" - for a relative path to a file or a part of an absolute path
" - internally a list where the first element is a list of directory names and the second the
" file name
" - directory segment:
" - for a relative path to a directory or a part of an absolute path
" - internally a list of directory names
" create and return a file object from a string. It is assumed that the given
" path is absolute and points to a file (not a directory)
function! vimwiki#path#file_obj(filepath)
if a:filepath == ''
return vimwiki#path#null_file()
else
let filename = fnamemodify(a:filepath, ':p:t')
let path = fnamemodify(a:filepath, ':p:h')
return [vimwiki#path#dir_obj(path), filename]
endif
endfunction
function! vimwiki#path#null_file()
return []
endfunction
function! vimwiki#path#is_null(file)
return empty(a:file)
endfunction
" create and return a dir object from a string. The given path should be
" absolute and point to a directory.
function! vimwiki#path#dir_obj(dirpath)
if a:dirpath =~# '^scp:'
let dirpath = a:dirpath[4:]
let protocoll = 'scp'
else
let dirpath = resolve(fnamemodify(a:dirpath, ':p'))
let protocoll = 'file'
endif
let path = split(vimwiki#path#chomp_slash(dirpath), '\m[/\\]', 1)
let is_unix = dirpath[0] ==# '/'
let result = {
\ 'is_unix' : is_unix,
\ 'protocoll' : protocoll,
\ 'path' : path,
\}
return result
endfunction
" Assume it is not an absolute path
function! vimwiki#path#file_segment(path_segment)
let filename = fnamemodify(a:path_segment, ':t')
let path = fnamemodify(a:path_segment, ':h')
let path_list = (path ==# '.' ? [] : split(path, '\m[/\\]', 1))
return [path_list, filename]
endfunction
" Assume it is not an absolute path
function! vimwiki#path#dir_segment(path_segment)
return split(a:path_segment, '\m[/\\]', 1)
endfunction
function! vimwiki#path#extension(file_object)
return fnamemodify(a:file_object[1], ':e')
endfunction
function! vimwiki#path#set_extension(file_obj, new_ext)
let new_filename = vimwiki#path#filename_without_extension(a:file_obj) . '.' . a:new_ext
let a:file_obj[1] = new_filename
return a:file_obj
endfunction
function! vimwiki#path#filename_without_extension(file_object)
return fnamemodify(a:file_object[1], ':r')
endfunction
" Returns: the dir of the file object as dir object
function! vimwiki#path#directory_of_file(file_object)
return copy(a:file_object[0])
endfunction
" Returns: the file_obj's file name as a string
function! vimwiki#path#filename(file_object)
return a:file_object[1]
endfunction
" Returns: the dir_obj, file_obj, file segment or dir segment as string, ready
" to be used with the regular path handling functions in Vim
function! vimwiki#path#to_string(obj)
if type(a:obj) == 4 " dir object
let separator = a:obj.is_unix ? '/' : '\'
let address = join(dir_obj.path, separator) . separator
return address
elseif type(a:obj[0]) == 4 " file object
let dir_obj = type(a:obj) == 4 ? a:obj : a:obj[0]
let separator = a:obj[0].is_unix ? '/' : '\'
let address = join(a:obj[0].path, separator) . separator . a:obj[1]
return address
elseif type(a:obj[0]) == 3 " file segment
" XXX: what about the separator?
return join(a:obj[0], '/') . '/' . a:obj[1]
elseif type(a:obj[0]) == 1 " directory segment
return join(a:obj, '/') . '/'
else
call vimwiki#u#error('Invalid argument ' . string(a:obj))
endif
endfunction
" Returns: the given a:dir_obj with a:str appended to the dir name
function! vimwiki#path#append_to_dirname(dir_obj, str)
let a:dir_obj.path[-1] .= a:str
return a:dir_obj
endfunction
" Returns a file object made from a dir object plus a file semgent
function! vimwiki#path#join(dir_obj, file_segment)
let new_dir_object = copy(a:dir_obj)
let new_dir_object.path += a:file_segment[0]
return [new_dir_object, a:file_segment[1]]
endfunction
" Returns a dir object made from a dir object plus a dir semgent
function! vimwiki#path#join_dir(dir_path, dir_segment)
let new_dir_object = copy(a:dir_path)
let new_dir_object.path += a:dir_segment
return new_dir_object
endfunction
" returns the file segment fs, so that join(dir, fs) == file
" we just assume the file is somewhere in dir
function! vimwiki#path#subtract(dir_object, file_object)
let path_rest = a:file_object[0].path[len(a:dir_object.path):]
return [path_rest, file_object[1]]
endfunction
" Returns: the relative path from a:dir to a:file
" XXX wenn die beiden identisch sind, sollte . rauskommen
function! vimwiki#path#relpath(dir1_object, dir2_object)
let dir1_path = copy(a:dir1_object.path)
let dir2_path = copy(a:dir2_object.path)
let result_path = []
while (len(dir) > 0 && len(file) > 0) && vimwiki#path#is_equal(dir1_path[0], dir2_path[0])
call remove(dir1_path, 0)
call remove(dir2_path, 0)
endwhile
for segment in dir1_path
let result += ['..']
endfor
for segment in dir2_path
let result += [segment]
endfor
let result = {
\ 'is_unix' : a:dir1_object.is_unix,
\ 'protocoll' : a:dir1_object.protocoll,
\ 'path' : result_path,
\}
return result
endfunction
function! vimwiki#path#is_file_in_dir(file, dir)
let file_path_segments = a:file[0].path
let dir_path_segments = a:dir.path
if len(dir_path_segments) > len(file_path_segments)
return 0
endif
for i in range(len(a:dir.path))
if !vimwiki#path#is_equal(a:dir.path[i], file_path_segments[i])
return 0
endif
endfor
return 1
endfunction
"-----------------
" File manipulation, i.e. do stuff with actually existing files
"-----------------
function! vimwiki#path#current_file()
return vimwiki#path#file_obj(expand('%:p'))
endfunction
function! vimwiki#path#exists(object)
if type(a:object) == 4
return isdirectory(vimwiki#path#to_string(a:object))
else
if vimwiki#path#is_null(a:object)
return 0
endif
" glob() checks whether or not a file exists (readable or writable)
return glob(vimwiki#path#to_string(a:object)) != ''
endif
endfunction
function! vimwiki#path#is_executable(file)
return vimwiki#path#exists(a:file) && executable(vimwiki#path#to_string(a:file))
endfunction
" this must be outside a function, because only outside a function <sfile> expands
" to the directory where this file is in
let s:vimwiki_autoload_dir = expand('<sfile>:p:h')
function! vimwiki#path#find_autoload_file(filename)
let autoload_dir = vimwiki#path#dir_obj(s:vimwiki_autoload_dir)
let filename_obj = vimwiki#path#file_segment(a:filename)
let file = vimwiki#path#join(autoload_dir, filename_obj)
if !vimwiki#path#exists(file)
echom 'Vimwiki Error: ' . vimwiki#path#to_string(file) . ' not found'
endif
return file
endfunction
function! vimwiki#path#copy_file(file_obj, dir_obj)
call vimwiki#path#mkdir(a:dir_obj)
let new_file = deepcopy(a:file_obj)
let new_file[0] = copy(a:dir_obj)
let lines = readfile(vimwiki#path#to_string(a:file_obj))
let ok = writefile(lines, vimwiki#path#to_string(new_file))
if ok < 0
call vimwiki#u#error('Could not write ' . vimwiki#path#to_string(new_file))
endif
endfunction
" Returns: a list of all files somewhere in a:dir_obj with extension a:ext
function! vimwiki#path#files_in_dir_recursive(dir_obj, ext)
let separator = a:dir_obj.is_unix ? '/' : '\'
let glob_expression = vimwiki#path#to_string(a:dir_obj) . '**' . separator . '*.' . a:ext
let file_strings = split(glob(glob_expression), '\n')
return map(file_strings, 'vimwiki#path#file_obj(v:val)')
endfunction
+64 -169
View File
@@ -1,187 +1,82 @@
body { body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;; h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
margin: 2em 4em 2em 4em; h1 {font-size: 2.6em; color: #000000;}
font-size: 120%; h2 {font-size: 2.2em; color: #404040;}
line-height: 130%; h3 {font-size: 1.8em; color: #707070;}
}
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;} h4 {font-size: 1.4em; color: #909090;}
h5 {font-size: 1.2em; color: #989898;} h5 {font-size: 1.3em; color: #989898;}
h6 {font-size: 1em; color: #9c9c9c;} h6 {font-size: 1.2em; color: #9c9c9c;}
p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
p, pre, blockquote, table, ul, ol, dl { ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
margin-top: 1em; li {margin: 0.3em auto;}
margin-bottom: 1em; ul {margin-left: 2em; padding-left: 0.5em;}
} dt {font-weight: bold;}
img {border: none;}
ul ul, ul ol, ol ol, ol ul { pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
margin-top: 0.5em; blockquote {padding: 0.4em; background-color: #f6f5eb;}
margin-bottom: 0.5em; th, td {border: 1px solid #ccc; padding: 0.3em;}
} th {background-color: #f0f0f0;}
hr {border: none; border-top: 1px solid #ccc; width: 100%;}
li { margin: 0.3em auto; } del {text-decoration: line-through; color: #777777;}
.toc li {list-style-type: none;}
ul { .todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
margin-left: 2em; .justleft {text-align: left;}
padding-left: 0; .justright {text-align: right;}
} .justcenter {text-align: center;}
.center {margin-left: auto; margin-right: auto;}
dt { font-weight: bold; } .tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
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 */ /* classes for items of todo lists */
.rejected { .rejected {
/* list-style: none; */ /* 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-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-repeat: no-repeat;
background-position: 0 .2em; background-position: 0 .2em;
padding-left: 1.5em; padding-left: 1.5em;
} }
.done0 { .done0 {
/* list-style: none; */ /* list-style: none; */
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0 .2em; background-position: 0 .2em;
padding-left: 1.5em; padding-left: 1.5em;
} }
.done1 { .done1 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0 .15em; background-position: 0 .15em;
padding-left: 1.5em; padding-left: 1.5em;
} }
.done2 { .done2 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0 .15em; background-position: 0 .15em;
padding-left: 1.5em; padding-left: 1.5em;
} }
.done3 { .done3 {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0 .15em; background-position: 0 .15em;
padding-left: 1.5em; padding-left: 1.5em;
} }
.done4 { .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-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-repeat: no-repeat;
background-position: 0 .15em; background-position: 0 .15em;
padding-left: 1.5em; padding-left: 1.5em;
} }
code { code {
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; font-family: Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;
-webkit-border-radius: 1px; -webkit-border-radius: 1px;
-moz-border-radius: 1px; -moz-border-radius: 1px;
border-radius: 1px; border-radius: 1px;
-moz-background-clip: padding; -moz-background-clip: padding;
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
padding: 0px 3px; padding: 0px 3px;
display: inline-block; display: inline-block;
color: #52595d; color: #52595d;
border: 1px solid #ccc; border: 1px solid #ccc;
background-color: #f9f9f9; background-color: #f9f9f9;
} }
+117 -219
View File
@@ -1,16 +1,18 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99 " vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Description: Tag manipulation functions
" Home: https://github.com/vimwiki/vimwiki/
" let s:TAGS_METADATA_FILE_NAME = '.tags'
" Tags metadata in-memory format: " Tags metadata in-memory format:
" metadata := { 'pagename': [entries, ...] } " metadata := { 'pagename': [entries, ...] }
" entry := { 'tagname':..., 'lineno':..., 'link':... } " entry := { 'tagname':..., 'lineno':..., 'link':... }
" Tags metadata in-file format: " Tags metadata in-file format:
" "
" Is based on CTags format (see |tags-file-format|) and " Is based on CTags format (see |tags-file-format|).
" https://ctags.sourceforge.net/FORMAT
" "
" {tagaddress} is set to lineno. We'll let vim search by exact line number; we " {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. " can afford that, we assume metadata file is always updated before use.
@@ -20,18 +22,16 @@
" of missing parameters -- "pagename" and "link". " of missing parameters -- "pagename" and "link".
let s:TAGS_METADATA_FILE_NAME = '.vimwiki_tags'
" Update tags metadata.
function! vimwiki#tags#update_tags(full_rebuild, all_files) abort " a:full_rebuild == 1: re-scan entire wiki
" Update tags metadata. " a:full_rebuild == 0: only re-scan current page
" Param: a:full_rebuild == 1: re-scan entire wiki " a:all_files == '': only if the file is newer than .tags
" Param: a:full_rebuild == 0: only re-scan current page function! vimwiki#tags#update_tags(full_rebuild, all_files)
" a:all_files == '': only if the file is newer than .tags let all_files = a:all_files != ''
let all_files = a:all_files !=? ''
if !a:full_rebuild if !a:full_rebuild
" Updating for one page (current) " Updating for one page (current)
let page_name = vimwiki#vars#get_bufferlocal('subdir') . expand('%:t:r') let page_name = s:page_name(vimwiki#path#current_file())
" Collect tags in current file " Collect tags in current file
let tags = s:scan_tags(getline(1, '$'), page_name) let tags = s:scan_tags(getline(1, '$'), page_name)
" Load metadata file " Load metadata file
@@ -44,13 +44,12 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files) abort
call s:write_tags_metadata(metadata) call s:write_tags_metadata(metadata)
else " full rebuild else " full rebuild
let files = vimwiki#base#find_files(vimwiki#vars#get_bufferlocal('wiki_nr'), 0) 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 =
let tags_file_last_modification = getftime(vimwiki#tags#metadata_file_path()) \ getftime(vimwiki#path#to_string(vimwiki#tags#metadata_file_path()))
let metadata = s:load_tags_metadata() let metadata = s:load_tags_metadata()
for file in files for file in files
if all_files || getftime(file) >= tags_file_last_modification if all_files || getftime(vimwiki#path#to_string(file)) >= tags_file_last_modification
let subdir = vimwiki#base#subdir(wiki_base_dir, file) let page_name = s:page_name(file)
let page_name = subdir . fnamemodify(file, ':t:r')
let tags = s:scan_tags(readfile(file), page_name) let tags = s:scan_tags(readfile(file), page_name)
let metadata = s:remove_page_from_tags(metadata, page_name) let metadata = s:remove_page_from_tags(metadata, page_name)
let metadata = s:merge_tags(metadata, page_name, tags) let metadata = s:merge_tags(metadata, page_name, tags)
@@ -61,25 +60,23 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files) abort
endfunction endfunction
function! s:safesubstitute(text, search, replace, mode) abort function! s:page_name(file_obj)
" Substitute regexp but do not interpret replace let wiki_base_dir = vimwiki#vars#get_wikilocal('path')
" TODO mutualize with same function in base let segment = vimwiki#path#subtract(wiki_base_dir, a:file_obj)
let escaped = escape(a:replace, '\&') return vimwiki#path#to_string(segment)
return substitute(a:text, a:search, escaped, a:mode)
endfunction endfunction
function! s:scan_tags(lines, page_name) abort " Scans the list of text lines (argument) and produces tags metadata as a list of tag entries.
" Scan the list of text lines (argument) and produces tags metadata as a list of tag entries. function! s:scan_tags(lines, page_name)
" Code wireframe to scan for headers -- borrowed from
" vimwiki#base#get_anchors(), with minor modifications.
let entries = [] let entries = []
" Get syntax wide regex " Code wireframe to scan for headers -- borrowed from
" vimwiki#base#get_anchors(), with minor modifications.
let rxheader = vimwiki#vars#get_syntaxlocal('header_search') let rxheader = vimwiki#vars#get_syntaxlocal('header_search')
let tag_search_rx = vimwiki#vars#get_syntaxlocal('tag_search') let rxtag = vimwiki#vars#get_syntaxlocal('tag_search')
let tag_format = vimwiki#vars#get_syntaxlocal('tag_format')
let anchor_level = ['', '', '', '', '', '', ''] let anchor_level = ['', '', '', '', '', '', '']
let current_complete_anchor = '' let current_complete_anchor = ''
@@ -90,17 +87,11 @@ function! s:scan_tags(lines, page_name) abort
for line_nr in range(1, len(a:lines)) for line_nr in range(1, len(a:lines))
let line = a:lines[line_nr - 1] let line = a:lines[line_nr - 1]
" ignore verbatim blocks
if vimwiki#u#is_codeblock(line_nr)
continue
endif
" process headers " process headers
let h_match = matchlist(line, rxheader) let h_match = matchlist(line, rxheader)
if !empty(h_match) " got a header if !empty(h_match) " got a header
let header_line_nr = line_nr let header_line_nr = line_nr
let header = vimwiki#base#normalize_anchor(h_match[2]) let header = vimwiki#u#trim(h_match[2])
let current_header_description = vimwiki#u#trim(h_match[2])
let level = len(h_match[1]) let level = len(h_match[1])
let anchor_level[level-1] = header let anchor_level[level-1] = header
for l in range(level, 6) for l in range(level, 6)
@@ -111,7 +102,7 @@ function! s:scan_tags(lines, page_name) abort
else else
let current_complete_anchor = '' let current_complete_anchor = ''
for l in range(level-1) for l in range(level-1)
if anchor_level[l] !=? '' if anchor_level[l] != ''
let current_complete_anchor .= anchor_level[l].'#' let current_complete_anchor .= anchor_level[l].'#'
endif endif
endfor endfor
@@ -120,38 +111,33 @@ function! s:scan_tags(lines, page_name) abort
continue " tags are not allowed in headers continue " tags are not allowed in headers
endif endif
" TODO ignore verbatim blocks
" Scan line for tags. There can be many of them. " Scan line for tags. There can be many of them.
let str = line let str = line
while 1 while 1
" Get all matches let tag_group = matchstr(str, rxtag)
let tag_groups = [] if tag_group == ''
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
if tag_groups == []
break break
endif endif
let tagend = matchend(str, tag_search_rx) let tagend = matchend(str, rxtag)
let str = str[(tagend):] let str = str[(tagend):]
for tag_group in tag_groups for tag in split(tag_group, ':')
for tag in split(tag_group, tag_format.sep) " Create metadata entry
" Create metadata entry let entry = {}
let entry = {} let entry.tagname = tag
let entry.tagname = tag let entry.lineno = line_nr
let entry.lineno = line_nr if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0 " Tag appeared at the top of the file
" Tag appeared at the top of the file let entry.link = a:page_name
let entry.link = a:page_name elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
let entry.description = entry.link " Tag appeared right below a header
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR) let entry.link = a:page_name . '#' . current_complete_anchor
" Tag appeared right below a header else
let entry.link = a:page_name . '#' . current_complete_anchor " Tag stands on its own
let entry.description = current_header_description let entry.link = a:page_name . '#' . tag
else endif
" Tag stands on its own call add(entries, entry)
let entry.link = a:page_name . '#' . tag
let entry.description = entry.link
endif
call add(entries, entry)
endfor
endfor endfor
endwhile endwhile
@@ -160,26 +146,26 @@ function! s:scan_tags(lines, page_name) abort
endfunction endfunction
" Returns tags metadata file path
function! vimwiki#tags#metadata_file_path() abort function! vimwiki#tags#metadata_file_path() abort
" Return: tags metadata file path return vimwiki#path#join(vimwiki#vars#get_wikilocal('path'),
return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'), \ vimwiki#path#file_segment(s:TAGS_METADATA_FILE_NAME))
\ s:TAGS_METADATA_FILE_NAME), ':p')
endfunction endfunction
" Loads tags metadata from file, returns a dictionary
function! s:load_tags_metadata() abort function! s:load_tags_metadata() abort
" Load tags metadata from file, returns a dictionary
let metadata_path = vimwiki#tags#metadata_file_path() let metadata_path = vimwiki#tags#metadata_file_path()
if !filereadable(metadata_path) if !filereadable(metadata_path)
return {} return {}
endif endif
let metadata = {} let metadata = {}
for line in readfile(metadata_path) for line in readfile(metadata_path)
if line =~# '^!_TAG_.*$' if line =~ '^!_TAG_FILE_'
continue continue
endif endif
let parts = matchlist(line, '^\(.\{-}\);"\(.*\)$') let parts = matchlist(line, '^\(.\{-}\);"\(.*\)$')
if parts[0] ==? '' || parts[1] ==? '' || parts[2] ==? '' if parts[0] == '' || parts[1] == '' || parts[2] == ''
throw 'VimwikiTags1: Metadata file corrupted' throw 'VimwikiTags1: Metadata file corrupted'
endif endif
let std_fields = split(parts[1], '\t') let std_fields = split(parts[1], '\t')
@@ -187,11 +173,11 @@ function! s:load_tags_metadata() abort
throw 'VimwikiTags2: Metadata file corrupted' throw 'VimwikiTags2: Metadata file corrupted'
endif endif
let vw_part = parts[2] let vw_part = parts[2]
if vw_part[0] !=? "\t" if vw_part[0] != "\t"
throw 'VimwikiTags3: Metadata file corrupted' throw 'VimwikiTags3: Metadata file corrupted'
endif endif
let vw_fields = split(vw_part[1:], "\t") let vw_fields = split(vw_part[1:], "\t")
if len(vw_fields) != 1 || vw_fields[0] !~# '^vimwiki:' if len(vw_fields) != 1 || vw_fields[0] !~ '^vimwiki:'
throw 'VimwikiTags4: Metadata file corrupted' throw 'VimwikiTags4: Metadata file corrupted'
endif endif
let vw_data = substitute(vw_fields[0], '^vimwiki:', '', '') let vw_data = substitute(vw_fields[0], '^vimwiki:', '', '')
@@ -200,7 +186,7 @@ function! s:load_tags_metadata() abort
let vw_data = substitute(vw_data, '\\t', "\t", 'g') let vw_data = substitute(vw_data, '\\t', "\t", 'g')
let vw_data = substitute(vw_data, '\\\\', "\\", 'g') let vw_data = substitute(vw_data, '\\\\', "\\", 'g')
let vw_fields = split(vw_data, "\t") let vw_fields = split(vw_data, "\t")
if len(vw_fields) != 3 if len(vw_fields) != 2
throw 'VimwikiTags5: Metadata file corrupted' throw 'VimwikiTags5: Metadata file corrupted'
endif endif
let pagename = vw_fields[0] let pagename = vw_fields[0]
@@ -208,7 +194,6 @@ function! s:load_tags_metadata() abort
let entry.tagname = std_fields[0] let entry.tagname = std_fields[0]
let entry.lineno = std_fields[2] let entry.lineno = std_fields[2]
let entry.link = vw_fields[1] let entry.link = vw_fields[1]
let entry.description = vw_fields[2]
if has_key(metadata, pagename) if has_key(metadata, pagename)
call add(metadata[pagename], entry) call add(metadata[pagename], entry)
else else
@@ -219,9 +204,9 @@ function! s:load_tags_metadata() abort
endfunction endfunction
function! s:remove_page_from_tags(metadata, page_name) abort " Removes all entries for given page from metadata in-place. Returns updated
" Remove all entries for given page from metadata in-place. Returns updated " metadata (just in case).
" metadata (just in case). function! s:remove_page_from_tags(metadata, page_name)
if has_key(a:metadata, a:page_name) if has_key(a:metadata, a:page_name)
call remove(a:metadata, a:page_name) call remove(a:metadata, a:page_name)
return a:metadata return a:metadata
@@ -231,24 +216,24 @@ function! s:remove_page_from_tags(metadata, page_name) abort
endfunction endfunction
function! s:merge_tags(metadata, pagename, file_metadata) abort " Merges metadata of one file into a:metadata
" Merge metadata of one file into a:metadata function! s:merge_tags(metadata, pagename, file_metadata)
let metadata = a:metadata let metadata = a:metadata
let metadata[a:pagename] = a:file_metadata let metadata[a:pagename] = a:file_metadata
return metadata return metadata
endfunction endfunction
function! s:tags_entry_cmp(i1, i2) abort " Compares two actual lines from tags file. Return value is in strcmp style.
" 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 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
" See also s:write_tags_metadata below -- that's where we compose these tags " file lines.
" file lines. "
" " This function is needed for tags sorting, since plain sort() compares line
" 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
" 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
" precedes the same tags on the same page at line 9. (Because string "14" is " alphabetically 'less than' string "9".)
" alphabetically 'less than' string "9".) function! s:tags_entry_cmp(i1, i2)
let items = [] let items = []
for orig_item in [a:i1, a:i2] for orig_item in [a:i1, a:i2]
let fields = split(orig_item, "\t") let fields = split(orig_item, "\t")
@@ -271,13 +256,13 @@ function! s:tags_entry_cmp(i1, i2) abort
endfunction endfunction
function! s:write_tags_metadata(metadata) abort " Saves metadata object into a file. Throws exceptions in case of problems.
" Save metadata object into a file. Throws exceptions in case of problems. function! s:write_tags_metadata(metadata)
let metadata_path = vimwiki#tags#metadata_file_path() let metadata_path = vimwiki#tags#metadata_file_path()
let tags = [] let tags = []
for pagename in keys(a:metadata) for pagename in keys(a:metadata)
for entry in a:metadata[pagename] for entry in a:metadata[pagename]
let entry_data = pagename . "\t" . entry.link . "\t" . entry.description let entry_data = pagename . "\t" . entry.link
let entry_data = substitute(entry_data, "\\", '\\\\', 'g') let entry_data = substitute(entry_data, "\\", '\\\\', 'g')
let entry_data = substitute(entry_data, "\t", '\\t', '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, "\r", '\\r', 'g')
@@ -287,29 +272,18 @@ function! s:write_tags_metadata(metadata) abort
\ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t" \ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t"
\ . entry.lineno \ . entry.lineno
\ . ';"' \ . ';"'
\ . "\t" . 'vimwiki:' . entry_data \ . "\t" . "vimwiki:" . entry_data
\) \)
endfor endfor
endfor endfor
call sort(tags, 's:tags_entry_cmp') call sort(tags, "s:tags_entry_cmp")
let tag_comments = [ call insert(tags, "!_TAG_FILE_SORTED\t1\t")
\ "!_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) call writefile(tags, metadata_path)
endfunction endfunction
function! vimwiki#tags#get_tags() abort " Returns list of unique tags found in the .tags file
" Return: list of unique tags found in the .tags file function! vimwiki#tags#get_tags()
let metadata = s:load_tags_metadata() let metadata = s:load_tags_metadata()
let tags = {} let tags = {}
for entries in values(metadata) for entries in values(metadata)
@@ -321,130 +295,54 @@ function! vimwiki#tags#get_tags() abort
endfunction endfunction
function! vimwiki#tags#generate_tags(create, ...) abort " Similar to vimwiki#base#generate_links. In the current buffer, appends
" Generate tags in current buffer " tags and references to all their instances. If no arguments (tags) are
" Similar to vimwiki#base#generate_links. In the current buffer, appends " specified, outputs all tags.
" tags and references to all their instances. If no arguments (tags) are function! vimwiki#tags#generate_tags(...) abort
" specified, outputs all tags. let need_all_tags = (a:0 == 0)
let header_level = vimwiki#vars#get_global('tags_header_level') let specific_tags = a:000
let tags_header_text = vimwiki#vars#get_global('tags_header')
" If tag headers should only be updated, search for already present tag headers let metadata = s:load_tags_metadata()
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. " make a dictionary { tag_name: [tag_links, ...] }
if inside_tag_headers let tags_entries = {}
call add(specific_tags, header[2]) for entries in values(metadata)
endif for entry in entries
if has_key(tags_entries, entry.tagname)
" If we found the start of the tag headers section, remember that the following headers are now inside of it call add(tags_entries[entry.tagname], entry.link)
if header[1] == header_level && header[2] ==# tags_header_text else
let inside_tag_headers = 1 let tags_entries[entry.tagname] = [entry.link]
endif endif
endfor endfor
else endfor
let specific_tags = a:000
endif
" use a dictionary function for closure like capability let lines = []
" copy all local variables into dict (add a: if arguments are needed) let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
let GeneratorTags = copy(l:) for tagname in sort(keys(tags_entries))
function! GeneratorTags.f() abort if need_all_tags || index(specific_tags, tagname) != -1
let need_all_tags = empty(self.specific_tags) call extend(lines, [
let metadata = s:load_tags_metadata() \ '',
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', tagname, ''),
" make a dictionary { tag_name: [tag_links, ...] } \ '' ])
let tags_entries = {} for taglink in sort(tags_entries[tagname])
for entries in values(metadata) call add(lines, bullet . substitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
for entry in entries \ '__LinkUrl__', taglink, ''))
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 endfor
unlet entry " needed for older vims with sticky type checking since name is reused endif
endfor endfor
let lines = [] let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*'
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' ' \ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
let current_dir = vimwiki#base#current_subdir() \ .vimwiki#vars#get_syntaxlocal('rxWikiLink').'$\)'
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 vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx, line('$')+1, 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 endfunction
function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
" Complete tags
" We can safely ignore args if we use -custom=complete option, Vim engine " We can safely ignore args if we use -custom=complete option, Vim engine
" will do the job of filtering. " will do the job of filtering.
let taglist = vimwiki#tags#get_tags() let taglist = vimwiki#tags#get_tags()
return join(taglist, "\n") return join(taglist, "\n")
endfunction endfunction
+226 -379
View File
@@ -8,29 +8,24 @@
" Home: https://github.com/vimwiki/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
" Clause: Load only once
if exists('g:loaded_vimwiki_tbl_auto') || &compatible if exists("g:loaded_vimwiki_tbl_auto") || &cp
finish finish
endif endif
let g:loaded_vimwiki_tbl_auto = 1 let g:loaded_vimwiki_tbl_auto = 1
function! s:s_sep() abort let s:textwidth = &tw
" Return string column separator
function! s:rxSep()
return vimwiki#vars#get_syntaxlocal('rxTableSep') return vimwiki#vars#get_syntaxlocal('rxTableSep')
endfunction 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 function! s:wide_len(str)
" vim73 has new function that gives correct string width. " vim73 has new function that gives correct string width.
if exists('*strdisplaywidth') if exists("*strdisplaywidth")
return strdisplaywidth(a:str) return strdisplaywidth(a:str)
endif endif
@@ -41,8 +36,8 @@ function! s:wide_len(str) abort
let savemodified = &modified let savemodified = &modified
let save_cursor = getpos('.') let save_cursor = getpos('.')
exe "norm! o\<esc>" exe "norm! o\<esc>"
call setline(line('.'), a:str) call setline(line("."), a:str)
let ret = virtcol('$') - 1 let ret = virtcol("$") - 1
d d
call setpos('.', save_cursor) call setpos('.', save_cursor)
let &modified = savemodified let &modified = savemodified
@@ -51,48 +46,46 @@ function! s:wide_len(str) abort
endfunction endfunction
function! s:cell_splitter() abort function! s:cell_splitter()
return '\s*'.s:r_sep().'\s*' return '\s*'.s:rxSep().'\s*'
endfunction endfunction
function! s:sep_splitter() abort function! s:sep_splitter()
return '-'.s:r_sep().'-' return '-'.s:rxSep().'-'
endfunction endfunction
function! s:is_table(line) abort function! s:is_table(line)
" Check if param:line is in a table
return s:is_separator(a:line) || return s:is_separator(a:line) ||
\ (a:line !~# s:r_sep().s:r_sep() && a:line =~# '^\s*'.s:r_sep().'.\+'.s:r_sep().'\s*$') \ (a:line !~# s:rxSep().s:rxSep() && a:line =~# '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
endfunction endfunction
function! s:is_separator(line) abort function! s:is_separator(line)
" Check if param:line is a separator (ex: | --- | --- |) return a:line =~# '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
return a:line =~# '^\s*'.s:r_sep().'\(:\=--\+:\='.s:r_sep().'\)\+\s*$'
endfunction endfunction
function! s:is_separator_tail(line) abort function! s:is_separator_tail(line)
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:r_sep().'-\+\)\+'.s:r_sep().'\s*$' return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
endfunction endfunction
function! s:is_last_column(lnum, cnum) abort function! s:is_last_column(lnum, cnum)
let line = strpart(getline(a:lnum), a:cnum - 1) let line = strpart(getline(a:lnum), a:cnum - 1)
return line =~# s:r_sep().'\s*$' && line !~# s:r_sep().'.*'.s:r_sep().'\s*$' return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
endfunction endfunction
function! s:is_first_column(lnum, cnum) abort function! s:is_first_column(lnum, cnum)
let line = strpart(getline(a:lnum), 0, a:cnum - 1) let line = strpart(getline(a:lnum), 0, a:cnum - 1)
return line =~# '^\s*$' || return line =~# '^\s*$' ||
\ (line =~# '^\s*'.s:r_sep() && line !~# '^\s*'.s:r_sep().'.*'.s:r_sep()) \ (line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
endfunction endfunction
function! s:count_separators_up(lnum) abort function! s:count_separators_up(lnum)
let lnum = a:lnum - 1 let lnum = a:lnum - 1
while lnum > 1 while lnum > 1
if !s:is_separator(getline(lnum)) if !s:is_separator(getline(lnum))
@@ -105,7 +98,7 @@ function! s:count_separators_up(lnum) abort
endfunction endfunction
function! s:count_separators_down(lnum) abort function! s:count_separators_down(lnum)
let lnum = a:lnum + 1 let lnum = a:lnum + 1
while lnum < line('$') while lnum < line('$')
if !s:is_separator(getline(lnum)) if !s:is_separator(getline(lnum))
@@ -118,10 +111,9 @@ function! s:count_separators_down(lnum) abort
endfunction endfunction
function! s:create_empty_row(cols) abort function! s:create_empty_row(cols)
" Create an empty row of a:cols columns let row = s:rxSep()
let row = s:s_sep() let cell = " ".s:rxSep()
let cell = ' '.s:s_sep()
for c in range(a:cols) for c in range(a:cols)
let row .= cell let row .= cell
@@ -131,10 +123,9 @@ function! s:create_empty_row(cols) abort
endfunction endfunction
function! s:create_row_sep(cols) abort function! s:create_row_sep(cols)
" Create an empty separator row of a:cols columns let row = s:rxSep()
let row = s:s_sep() let cell = "---".s:rxSep()
let cell = '---'.s:s_sep()
for c in range(a:cols) for c in range(a:cols)
let row .= cell let row .= cell
@@ -144,72 +135,66 @@ function! s:create_row_sep(cols) abort
endfunction endfunction
function! vimwiki#tbl#get_cells(line, ...) abort function! vimwiki#tbl#get_cells(line)
let result = [] let result = []
let cell = ''
let quote = ''
let state = 'NONE' let state = 'NONE'
let cell_start = 0
let quote_start = 0
let len = strlen(a:line) - 1
" 'Simple' FSM " 'Simple' FSM
while state !=# 'CELL' for idx in range(strlen(a:line))
if quote_start != 0 && state !=# 'CELL' " The only way I know Vim can do Unicode...
let state = 'CELL' let ch = a:line[idx]
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' if state ==# 'NONE'
break if ch == '|'
let state = 'CELL'
endif
elseif state ==# 'CELL'
if ch == '[' || ch == '{'
let state = 'BEFORE_QUOTE_START'
let quote = ch
elseif ch == '|'
call add(result, vimwiki#u#trim(cell))
let cell = ""
else
let cell .= ch
endif
elseif state ==# 'BEFORE_QUOTE_START'
if ch == '[' || ch == '{'
let state = 'QUOTE'
let quote .= ch
else
let state = 'CELL'
let cell .= quote.ch
let quote = ''
endif
elseif state ==# 'QUOTE'
if ch == ']' || ch == '}'
let state = 'BEFORE_QUOTE_END'
endif
let quote .= ch
elseif state ==# 'BEFORE_QUOTE_END'
if ch == ']' || ch == '}'
let state = 'CELL'
endif
let cell .= quote.ch
let quote = ''
endif endif
endwhile endfor
if cell.quote != ''
call add(result, vimwiki#u#trim(cell.quote, '|'))
endif
return result return result
endfunction endfunction
function! s:col_count(lnum) abort function! s:col_count(lnum)
return len(vimwiki#tbl#get_cells(getline(a:lnum))) return len(vimwiki#tbl#get_cells(getline(a:lnum)))
endfunction endfunction
function! s:get_indent(lnum, depth) abort function! s:get_indent(lnum)
if !s:is_table(getline(a:lnum)) if !s:is_table(getline(a:lnum))
return return
endif endif
@@ -224,123 +209,50 @@ function! s:get_indent(lnum, depth) abort
break break
endif endif
let lnum -= 1 let lnum -= 1
if a:depth > 0 && lnum < a:lnum - a:depth
break
endif
endwhile endwhile
return indent return indent
endfunction endfunction
function! s:get_rows(lnum, ...) abort function! s:get_rows(lnum)
let rows = []
if !s:is_table(getline(a:lnum)) if !s:is_table(getline(a:lnum))
return rows return
endif endif
let upper_rows = []
let lower_rows = []
let lnum = a:lnum - 1 let lnum = a:lnum - 1
let depth = a:0 > 0 ? a:1 : 0 while lnum >= 1
let ldepth = 0
while lnum >= 1 && (depth == 0 || ldepth < depth)
let line = getline(lnum) let line = getline(lnum)
if s:is_table(line) if s:is_table(line)
call insert(rows, [lnum, line]) call add(upper_rows, [lnum, line])
else else
break break
endif endif
let lnum -= 1 let lnum -= 1
let ldepth += 1
endwhile endwhile
call reverse(upper_rows)
let lnum = a:lnum let lnum = a:lnum
while lnum <= line('$') while lnum <= line('$')
let line = getline(lnum) let line = getline(lnum)
if s:is_table(line) if s:is_table(line)
call add(rows, [lnum, line]) call add(lower_rows, [lnum, line])
else else
break break
endif endif
if depth > 0
break
endif
let lnum += 1 let lnum += 1
endwhile endwhile
return rows return upper_rows + lower_rows
endfunction endfunction
function! s:get_cell_aligns(lnum, ...) abort function! s:get_cell_max_lens(lnum, ...)
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 max_lens = {}
let rows = a:0 > 2 ? a:3 : s:get_rows(a:lnum) for [lnum, row] in s:get_rows(a:lnum)
for [lnum, row] in rows
if s:is_separator(row) if s:is_separator(row)
continue continue
endif endif
@@ -358,67 +270,20 @@ function! s:get_cell_max_lens(lnum, ...) abort
endfunction endfunction
function! s:get_aligned_rows(lnum, col1, col2, depth) abort function! s:get_aligned_rows(lnum, col1, col2)
let rows = [] let rows = s:get_rows(a:lnum)
let aligns = {} let startlnum = rows[0][0]
let startlnum = 0
let cells = [] let cells = []
let max_lens = {} for [lnum, row] in rows
let check_all = 1 call add(cells, vimwiki#tbl#get_cells(row))
if a:depth > 0 endfor
let rows = s:get_rows(a:lnum, a:depth) let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum)
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 = [] let result = []
for [lnum, row] in rows for [lnum, row] in rows
if s:is_separator(row) if s:is_separator(row)
let new_row = s:fmt_sep(max_lens, aligns, a:col1, a:col2) let new_row = s:fmt_sep(max_lens, a:col1, a:col2)
else else
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, aligns, a:col1, a:col2) let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, a:col1, a:col2)
endif endif
call add(result, [lnum, new_row]) call add(result, [lnum, new_row])
endfor endfor
@@ -426,8 +291,8 @@ function! s:get_aligned_rows(lnum, col1, col2, depth) abort
endfunction endfunction
function! s:cur_column() abort " Number of the current column. Starts from 0.
" Number of the current column. Starts from 0. function! s:cur_column()
let line = getline('.') let line = getline('.')
if !s:is_table(line) if !s:is_table(line)
return -1 return -1
@@ -435,10 +300,10 @@ function! s:cur_column() abort
" TODO: do we need conditional: if s:is_separator(line) " TODO: do we need conditional: if s:is_separator(line)
let curs_pos = col('.') let curs_pos = col('.')
let mpos = match(line, s:r_sep(), 0) let mpos = match(line, s:rxSep(), 0)
let col = -1 let col = -1
while mpos < curs_pos && mpos != -1 while mpos < curs_pos && mpos != -1
let mpos = match(line, s:r_sep(), mpos+1) let mpos = match(line, s:rxSep(), mpos+1)
if mpos != -1 if mpos != -1
let col += 1 let col += 1
endif endif
@@ -447,26 +312,21 @@ function! s:cur_column() abort
endfunction endfunction
function! s:fmt_cell(cell, max_len, align) abort function! s:fmt_cell(cell, max_len)
let cell = ' '.a:cell.' ' let cell = ' '.a:cell.' '
let diff = a:max_len - s:wide_len(a:cell) let diff = a:max_len - s:wide_len(a:cell)
if diff == 0 && empty(a:cell) if diff == 0 && empty(a:cell)
let diff = 1 let diff = 1
endif endif
if a:align ==# 'left'
let cell .= repeat(' ', diff) 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 return cell
endfunction endfunction
function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort function! s:fmt_row(cells, max_lens, col1, col2)
let new_line = s:s_sep() let new_line = s:rxSep()
for idx in range(len(a:cells)) for idx in range(len(a:cells))
if idx == a:col1 if idx == a:col1
let idx = a:col2 let idx = a:col2
@@ -474,96 +334,81 @@ function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort
let idx = a:col1 let idx = a:col1
endif endif
let value = a:cells[idx] let value = a:cells[idx]
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:s_sep() let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep()
endfor endfor
let idx = len(a:cells) let idx = len(a:cells)
while idx < len(a:max_lens) while idx < len(a:max_lens)
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:s_sep() let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep()
let idx += 1 let idx += 1
endwhile endwhile
return new_line return new_line
endfunction endfunction
function! s:fmt_cell_sep(max_len, align) abort function! s:fmt_cell_sep(max_len)
let cell = ''
if a:max_len == 0 if a:max_len == 0
let cell .= '-' return repeat('-', 3)
else else
let cell .= repeat('-', a:max_len) return repeat('-', a:max_len+2)
endif
if a:align ==# 'right'
return cell.'-:'
elseif a:align ==# 'left'
return cell.'--'
else
return ':'.cell.':'
endif endif
endfunction endfunction
function! s:fmt_sep(max_lens, aligns, col1, col2) abort function! s:fmt_sep(max_lens, col1, col2)
let new_line = s:s_sep() let new_line = s:rxSep()
for idx in range(len(a:max_lens)) for idx in range(len(a:max_lens))
if idx == a:col1 if idx == a:col1
let idx = a:col2 let idx = a:col2
elseif idx == a:col2 elseif idx == a:col2
let idx = a:col1 let idx = a:col1
endif endif
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:s_sep() let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep()
endfor endfor
return new_line return new_line
endfunction endfunction
function! s:kbd_create_new_row(cols, goto_first) abort function! s:kbd_create_new_row(cols, goto_first)
let cmd = "\<ESC>o".s:create_empty_row(a:cols) let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'), 2)\<CR>" let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
let cmd .= "\<ESC>0" let cmd .= "\<ESC>0"
if a:goto_first if a:goto_first
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'c', line('.'))\<CR>" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
else else
let cmd .= (col('.')-1).'l' let cmd .= (col('.')-1)."l"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
endif endif
let cmd .= 'a' let cmd .= "a"
return cmd return cmd
endfunction endfunction
function! s:kbd_goto_next_row() abort function! s:kbd_goto_next_row()
let cmd = "\<ESC>j" let cmd = "\<ESC>j"
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>" let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a' let cmd .= "a"
return cmd return cmd
endfunction endfunction
function! s:kbd_goto_prev_row() abort function! s:kbd_goto_prev_row()
let cmd = "\<ESC>k" let cmd = "\<ESC>k"
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>" let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a' let cmd .= "a"
return cmd return cmd
endfunction endfunction
function! vimwiki#tbl#goto_next_col() abort " Used in s:kbd_goto_next_col
" Used in s:kbd_goto_next_col function! vimwiki#tbl#goto_next_col()
let curcol = virtcol('.') let curcol = virtcol('.')
let lnum = line('.') let lnum = line('.')
let depth = 2 let newcol = s:get_indent(lnum)
let newcol = s:get_indent(lnum, depth) let max_lens = s:get_cell_max_lens(lnum)
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) for cell_len in values(max_lens)
if newcol >= curcol-1 if newcol >= curcol-1
break break
@@ -575,30 +420,23 @@ function! vimwiki#tbl#goto_next_col() abort
endfunction endfunction
function! s:kbd_goto_next_col(jumpdown) abort function! s:kbd_goto_next_col(jumpdown)
let cmd = "\<ESC>" let cmd = "\<ESC>"
if a:jumpdown if a:jumpdown
let seps = s:count_separators_down(line('.')) let seps = s:count_separators_down(line('.'))
let cmd .= seps.'j0' let cmd .= seps."j0"
endif endif
let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a" let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a"
return cmd return cmd
endfunction endfunction
function! vimwiki#tbl#goto_prev_col() abort " Used in s:kbd_goto_prev_col
" Used in s:kbd_goto_prev_col function! vimwiki#tbl#goto_prev_col()
let curcol = virtcol('.') let curcol = virtcol('.')
let lnum = line('.') let lnum = line('.')
let depth = 2 let newcol = s:get_indent(lnum)
let newcol = s:get_indent(lnum, depth) let max_lens = s:get_cell_max_lens(lnum)
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 let prev_cell_len = 0
for cell_len in values(max_lens) for cell_len in values(max_lens)
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space> let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
@@ -616,24 +454,25 @@ function! vimwiki#tbl#goto_prev_col() abort
endfunction endfunction
function! s:kbd_goto_prev_col(jumpup) abort function! s:kbd_goto_prev_col(jumpup)
let cmd = "\<ESC>" let cmd = "\<ESC>"
if a:jumpup if a:jumpup
let seps = s:count_separators_up(line('.')) let seps = s:count_separators_up(line('.'))
let cmd .= seps.'k' let cmd .= seps."k"
let cmd .= '$' let cmd .= "$"
endif endif
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a" let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
" let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'b', line('.'))\<CR>" " let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'b', line('.'))\<CR>"
" let cmd .= "a" " let cmd .= "a"
"echomsg "DEBUG kbd_goto_prev_col> ".cmd
return cmd return cmd
endfunction endfunction
function! vimwiki#tbl#kbd_cr() abort function! vimwiki#tbl#kbd_cr()
let lnum = line('.') let lnum = line('.')
if !s:is_table(getline(lnum)) if !s:is_table(getline(lnum))
return '' return ""
endif endif
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1)) if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
@@ -645,7 +484,7 @@ function! vimwiki#tbl#kbd_cr() abort
endfunction endfunction
function! vimwiki#tbl#kbd_tab() abort function! vimwiki#tbl#kbd_tab()
let lnum = line('.') let lnum = line('.')
if !s:is_table(getline(lnum)) if !s:is_table(getline(lnum))
return "\<Tab>" return "\<Tab>"
@@ -653,7 +492,7 @@ function! vimwiki#tbl#kbd_tab() abort
let last = s:is_last_column(lnum, col('.')) let last = s:is_last_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum)) let is_sep = s:is_separator_tail(getline(lnum))
"vimwiki#u#debug("DEBUG kbd_tab> last=".last.", is_sep=".is_sep) "echomsg "DEBUG kbd_tab> last=".last.", is_sep=".is_sep
if (is_sep || last) && !s:is_table(getline(lnum+1)) if (is_sep || last) && !s:is_table(getline(lnum+1))
let cols = len(vimwiki#tbl#get_cells(getline(lnum))) let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
return s:kbd_create_new_row(cols, 1) return s:kbd_create_new_row(cols, 1)
@@ -662,7 +501,7 @@ function! vimwiki#tbl#kbd_tab() abort
endfunction endfunction
function! vimwiki#tbl#kbd_shift_tab() abort function! vimwiki#tbl#kbd_shift_tab()
let lnum = line('.') let lnum = line('.')
if !s:is_table(getline(lnum)) if !s:is_table(getline(lnum))
return "\<S-Tab>" return "\<S-Tab>"
@@ -670,17 +509,16 @@ function! vimwiki#tbl#kbd_shift_tab() abort
let first = s:is_first_column(lnum, col('.')) let first = s:is_first_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum)) let is_sep = s:is_separator_tail(getline(lnum))
"vimwiki#u#debug("kbd_tab> ".first) "echomsg "DEBUG kbd_tab> ".first
if (is_sep || first) && !s:is_table(getline(lnum-1)) if (is_sep || first) && !s:is_table(getline(lnum-1))
return '' return ""
endif endif
return s:kbd_goto_prev_col(is_sep || first) return s:kbd_goto_prev_col(is_sep || first)
endfunction endfunction
function! vimwiki#tbl#format(lnum, ...) abort function! vimwiki#tbl#format(lnum, ...)
" Clause in if !(&filetype ==? 'vimwiki')
if !vimwiki#u#ft_is_vw()
return return
endif endif
let line = getline(a:lnum) let line = getline(a:lnum)
@@ -688,11 +526,6 @@ function! vimwiki#tbl#format(lnum, ...) abort
return return
endif endif
" Backup textwidth
let textwidth = &textwidth
let depth = a:0 == 1 ? a:1 : 0
if a:0 == 2 if a:0 == 2
let col1 = a:1 let col1 = a:1
let col2 = a:2 let col2 = a:2
@@ -701,27 +534,23 @@ function! vimwiki#tbl#format(lnum, ...) abort
let col2 = 0 let col2 = 0
endif endif
let indent = s:get_indent(a:lnum, depth) let indent = s:get_indent(a:lnum)
if &expandtab if &expandtab
let indentstring = repeat(' ', indent) let indentstring = repeat(' ', indent)
else else
execute "let indentstring = repeat('\<TAB>', indent / &tabstop) . repeat(' ', indent % &tabstop)" let indentstring = repeat(' ', indent / &tabstop) . repeat(' ', indent % &tabstop)
endif 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)
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2, depth)
let row = indentstring.row let row = indentstring.row
if getline(lnum) != row call setline(lnum, row)
call setline(lnum, row)
endif
endfor endfor
" Restore user textwidth let &tw = s:textwidth
let &textwidth = textwidth
endfunction endfunction
function! vimwiki#tbl#create(...) abort function! vimwiki#tbl#create(...)
if a:0 > 1 if a:0 > 1
let cols = a:1 let cols = a:1
let rows = a:2 let rows = a:2
@@ -757,100 +586,118 @@ function! vimwiki#tbl#create(...) abort
endfunction endfunction
function! vimwiki#tbl#align_or_cmd(cmd, ...) abort function! vimwiki#tbl#align_or_cmd(cmd)
if s:is_table(getline('.')) if s:is_table(getline('.'))
call call('vimwiki#tbl#format', [line('.')] + a:000) call vimwiki#tbl#format(line('.'))
else else
exe 'normal! '.a:cmd exe 'normal! '.a:cmd
endif endif
endfunction endfunction
function! vimwiki#tbl#move_column_left() abort function! vimwiki#tbl#reset_tw(lnum)
" TODO: move_column_left and move_column_right are good candidates to be refactored. if !(&filetype ==? 'vimwiki')
" Clause in return
let line = getline('.') endif
let line = getline(a:lnum)
if !s:is_table(line) if !s:is_table(line)
return return
endif endif
let s:textwidth = &tw
let &tw = 0
endfunction
" TODO: move_column_left and move_column_right are good candidates to be refactored.
function! vimwiki#tbl#move_column_left()
"echomsg "DEBUG move_column_left: "
let line = getline('.')
if !s:is_table(line)
return
endif
let cur_col = s:cur_column() let cur_col = s:cur_column()
if cur_col == -1 if cur_col == -1
return return
endif endif
if cur_col <= 0
return if cur_col > 0
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
call cursor(line('.'), 1)
let sep = '\('.s:rxSep().'\).\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
endif 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 endfunction
function! vimwiki#tbl#move_column_right() abort function! vimwiki#tbl#move_column_right()
" Clause in
let line = getline('.') let line = getline('.')
if !s:is_table(line) if !s:is_table(line)
return return
endif endif
let cur_col = s:cur_column() let cur_col = s:cur_column()
if cur_col == -1 if cur_col == -1
return return
endif endif
if cur_col >= s:col_count(line('.'))-1
return if cur_col < s:col_count(line('.'))-1
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
call cursor(line('.'), 1)
let sep = '\('.s:rxSep().'\).\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
endif 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 endfunction
function! vimwiki#tbl#get_rows(lnum) abort function! vimwiki#tbl#get_rows(lnum)
return s:get_rows(a:lnum) return s:get_rows(a:lnum)
endfunction endfunction
function! vimwiki#tbl#is_table(line) abort function! vimwiki#tbl#is_table(line)
return s:is_table(a:line) return s:is_table(a:line)
endfunction endfunction
function! vimwiki#tbl#is_separator(line) abort function! vimwiki#tbl#is_separator(line)
return s:is_separator(a:line) return s:is_separator(a:line)
endfunction endfunction
function! vimwiki#tbl#cell_splitter() abort function! vimwiki#tbl#cell_splitter()
return s:cell_splitter() return s:cell_splitter()
endfunction endfunction
function! vimwiki#tbl#sep_splitter() abort function! vimwiki#tbl#sep_splitter()
return s:sep_splitter() return s:sep_splitter()
endfunction endfunction
+26 -435
View File
@@ -3,127 +3,7 @@
" Description: Utility functions " Description: Utility functions
" Home: https://github.com/vimwiki/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
function! vimwiki#u#echo(msg, ...) abort function! vimwiki#u#trim(string, ...)
" 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, optionally replace its content
" :param: Text to replace selection
" Copied 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 = '' let chars = ''
if a:0 > 0 if a:0 > 0
let chars = a:1 let chars = a:1
@@ -134,352 +14,63 @@ function! vimwiki#u#trim(string, ...) abort
endfunction endfunction
function! vimwiki#u#cursor(lnum, cnum) abort " Builtin cursor doesn't work right with unicode characters.
" Builtin cursor doesn't work right with unicode characters. function! vimwiki#u#cursor(lnum, cnum)
exe a:lnum exe a:lnum
exe 'normal! 0'.a:cnum.'|' exe 'normal! 0'.a:cnum.'|'
endfunction endfunction
function! vimwiki#u#os_name() abort function! vimwiki#u#is_windows()
" Returns: OS name, human readable return has("win32") || has("win64") || has("win95") || has("win16")
if vimwiki#u#is_windows()
return 'Windows'
elseif vimwiki#u#is_macos()
return 'Mac'
else
return 'Linux'
endif
endfunction endfunction
function! vimwiki#u#is_windows() abort function! vimwiki#u#is_macos()
" Check if OS is windows if has("mac") || has("macunix") || has("gui_mac")
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 return 1
endif endif
" that still doesn't mean we are not on Mac OS " that still doesn't mean we are not on Mac OS
let os = substitute(system('uname'), '\n', '', '') let os = substitute(system('uname'), '\n', '', '')
return os ==? 'Darwin' || os ==? 'Mac' return os == 'Darwin' || os == 'Mac'
endfunction endfunction
function! vimwiki#u#count_first_sym(line) abort function! vimwiki#u#count_first_sym(line)
let first_sym = matchstr(a:line, '\S') let first_sym = matchstr(a:line, '\S')
return len(matchstr(a:line, first_sym.'\+')) return len(matchstr(a:line, first_sym.'\+'))
endfunction endfunction
function! vimwiki#u#escape(string) abort function! vimwiki#u#escape(string)
" Escape string for literal magic regex match
return escape(a:string, '~.*[]\^$') return escape(a:string, '~.*[]\^$')
endfunction endfunction
function! vimwiki#u#reload_regexes() abort " Load concrete Wiki syntax: sets regexes and templates for headers and links
" Load concrete Wiki syntax: sets regexes and templates for headers and links function vimwiki#u#reload_regexes()
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim' execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
endfunction endfunction
function! vimwiki#u#reload_regexes_custom() abort " Load syntax-specific functionality
" Load syntax-specific functionality function vimwiki#u#reload_regexes_custom()
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim' execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
endfunction endfunction
function! vimwiki#u#sw() abort " Backward compatible version of the built-in function shiftwidth()
" Backward compatible version of the built-in function shiftwidth() if exists('*shiftwidth')
if exists('*shiftwidth') func vimwiki#u#sw()
return shiftwidth() return shiftwidth()
else endfunc
return &shiftwidth else
endif func vimwiki#u#sw()
endfunc return &sw
endfunc
endif
function! vimwiki#u#map_key(mode, key, plug, ...) abort
" a:mode single character indicating the mode as defined by :h maparg function vimwiki#u#error(message)
" a:key the key sequence to map echom 'Vimwiki Error: ' . a:message
" 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 retrieve, 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\|$\)\@=']]
" Note: For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.
" See: https://github.github.com/gfm/#left-flanking-delimiter-run
let res = []
let punctuation = vimwiki#u#get_punctuation_string()
" Iterate on (left delimiter, right delimiter pair)
for a_delimiter in a:lst
let r_left_del = a_delimiter[0]
let r_right_del = a_delimiter[1]
" Regex Start:
" Left-Flanking is not followed by space (or need of line)
let r_left_prefix = '\%(^\|[[:space:]]\@<=\)'
let r_left_prefix = '\\\@<!'
" -- not followed by Unicode whitespace,
let r_left_suffix = '\%([^[:space:]]\@=\)'
" Left Case1: not followed by punctuation
let r_left_suffix1 = '\%(\%([^[:space:]' . punctuation . ']\)\@=\)'
" -- Can escape the leftflank
let r_left_prefix1 = '\%(^\|\\\@<!\)'
" Left Case2: followed by punctuation so must be preceded by Unicode whitespace or start of line or a punctuation character.
let r_left_suffix2 = '\%([' . punctuation . ']\@=\)'
let r_left_prefix2 = '\%(\%(^\|[[:space:]' . punctuation . ']\)\@<=\)'
" Left Concatenate
let r_start = '\%(' . r_left_prefix1 . r_left_del . r_left_suffix1
let r_start .= '\|' . r_left_prefix2 . r_left_del . r_left_suffix2 . '\)'
" Regex End:
" not preceded by Unicode whitespace
let r_right_prefix = '\(^\|[^[:space:]]\@<=\)'
" Right Case1: not preceded by a punctuation character (or start of line)
let r_right_prefix1 = '\%(\%(^\|[^[:space:]' . punctuation . ']\)\@<=\)'
let r_right_suffix1 = ''
" Right Case2: preceded by a punctuation character and followed by Unicode whitespace or end of line or a punctuation character
let r_right_prefix2 = '\%([' . punctuation . ']\@<=\)'
let r_right_suffix2 = '\%(\%($\|[[:space:]' . punctuation . ']\)\@<=\)'
" Right Concatenate
let r_end = '\%(' . r_right_prefix1 . r_right_del . r_right_suffix1
let r_end .= '\|' . r_right_prefix2 . r_right_del . r_right_suffix2 . '\)'
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
" \ 'skip="\\' . a:tag_pre . '" ' .
let cmd = 'syn region ' . a:syntax_group . ' matchgroup=VimwikiDelimiter ' .
\ opt_is_contained .
\ '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 highlighted 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
" But leave
" -- See https://github.github.com/gfm/#example-364
syn match VimwikiError "\w\@<=_\w\@="
endfunction endfunction
+360 -1168
View File
File diff suppressed because it is too large Load Diff
-254
View File
@@ -1,254 +0,0 @@
# 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 misaligned (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
misaligned line, and press `5p`. Now we have a slightly bigger misaligned
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 misaligned
table in an area where misaligned 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: -->
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

-10
View File
@@ -1,10 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 15 KiB

-898
View File
@@ -1,898 +0,0 @@
= 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
}}}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

-98
View File
@@ -1,98 +0,0 @@
<?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>

Before

Width:  |  Height:  |  Size: 18 KiB

-598
View File
@@ -1,598 +0,0 @@
*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
+510 -1779
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 KiB

+395 -472
View File
File diff suppressed because it is too large Load Diff
+136 -243
View File
@@ -4,23 +4,16 @@
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki " GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
" Clause: load only once if exists("g:loaded_vimwiki") || &cp
if exists('g:loaded_vimwiki') || &compatible
finish finish
endif endif
let g:loaded_vimwiki = 1 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:old_cpo = &cpo
let s:plugin_dir = expand('<sfile>:p:h:h') set cpo&vim
" Save peace in the galaxy
let s:old_cpo = &cpoptions
set cpoptions&vim
" Save autowriteall variable state
if exists('g:vimwiki_autowriteall') if exists('g:vimwiki_autowriteall')
let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
else else
@@ -28,8 +21,8 @@ else
endif endif
" Autocommand called when the cursor leaves the buffer " this is called when the cursor leaves the buffer
function! s:setup_buffer_leave() abort function! s:setup_buffer_leave()
" don't do anything if it's not managed by Vimwiki (that is, when it's not in " 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) " a registered wiki and not a temporary wiki)
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1 if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
@@ -44,10 +37,11 @@ function! s:setup_buffer_leave() abort
endfunction endfunction
" Create a new temporary wiki for the current buffer " create a new temporary wiki for the current buffer
function! s:create_temporary_wiki() abort function! s:create_temporary_wiki()
let path = expand('%:p:h') let current_file = vimwiki#path#current_file()
let ext = '.'.expand('%:e') let path = vimwiki#path#directory_of_file(current_file)
let ext = '.'.vimwiki#path#extension(current_file)
let syntax_mapping = vimwiki#vars#get_global('ext2syntax') let syntax_mapping = vimwiki#vars#get_global('ext2syntax')
if has_key(syntax_mapping, ext) if has_key(syntax_mapping, ext)
@@ -69,10 +63,10 @@ function! s:create_temporary_wiki() abort
endfunction endfunction
" Autocommand called when Vim opens a new buffer with a known wiki " This function is called when Vim opens a new buffer with a known wiki
" extension. Both when the buffer has never been opened in this session and " extension. Both when the buffer has never been opened in this session and
" when it has. " when it has.
function! s:setup_new_wiki_buffer() abort function! s:setup_new_wiki_buffer()
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr') let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
if wiki_nr == -1 " it's not in a known wiki directory if wiki_nr == -1 " it's not in a known wiki directory
if vimwiki#vars#get_global('global_ext') if vimwiki#vars#get_global('global_ext')
@@ -84,66 +78,55 @@ function! s:setup_new_wiki_buffer() abort
endif endif
if vimwiki#vars#get_wikilocal('maxhi') 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_wikifiles', vimwiki#base#get_wikilinks(wiki_nr, 1))
call vimwiki#vars#set_bufferlocal('existing_wikidirs', call vimwiki#vars#set_bufferlocal('existing_wikidirs',
\ vimwiki#base#get_wiki_directories(wiki_nr)) \ vimwiki#base#get_wiki_directories(wiki_nr))
endif endif
" this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are " this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are
" sourced " sourced
call vimwiki#u#ft_set() setfiletype vimwiki
endfunction endfunction
" Autocommand called when the cursor enters the buffer " this is called when the cursor enters the buffer
function! s:setup_buffer_enter() abort function! s:setup_buffer_enter()
" don't do anything if it's not managed by Vimwiki (that is, when it's not in " 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) " a registered wiki and not a temporary wiki)
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1 if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
return return
endif endif
if &filetype != 'vimwiki'
setfiletype vimwiki
endif
call s:set_global_options() 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() call s:set_windowlocal_options()
endfunction endfunction
" Help syntax reloading function! s:setup_cleared_syntax()
function! s:setup_cleared_syntax() abort
" highlight groups that get cleared " highlight groups that get cleared
" on colorscheme change because they are not linked to Vim-predefined groups " on colorscheme change because they are not linked to Vim-predefined groups
hi def VimwikiBold term=bold cterm=bold gui=bold hi def VimwikiBold term=bold cterm=bold gui=bold
hi def VimwikiItalic term=italic cterm=italic gui=italic hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
hi def VimwikiUnderline term=underline cterm=underline gui=underline hi def VimwikiUnderline gui=underline
if vimwiki#vars#get_global('hl_headers') == 1 if vimwiki#vars#get_global('hl_headers') == 1
for i in range(1,6) for i in range(1,6)
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg=' execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
\ . vimwiki#vars#get_global('hcolor_guifg_'.&background)[i-1] \ . vimwiki#vars#get_global('hcolor_guifg_'.&bg)[i-1]
\ .' gui=bold ctermfg='.vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[i-1] \ .' gui=bold ctermfg='.vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[i-1]
\ .' term=bold cterm=bold' \ .' term=bold cterm=bold'
endfor endfor
endif endif
endfunction endfunction
" Return: list of extension known vy vimwiki function! s:vimwiki_get_known_extensions()
function! s:vimwiki_get_known_extensions() abort
" Getting all extensions that different wikis could have " Getting all extensions that different wikis could have
let extensions = {} let extensions = {}
for idx in range(vimwiki#vars#number_of_wikis()) for idx in range(vimwiki#vars#number_of_wikis())
@@ -161,7 +144,7 @@ endfunction
" Set settings which are global for Vim, but should only be executed for " 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 " Vimwiki buffers. So they must be set when the cursor enters a Vimwiki buffer
" and reset when the cursor leaves the buffer. " and reset when the cursor leaves the buffer.
function! s:set_global_options() abort function! s:set_global_options()
let s:vimwiki_autowriteall_saved = &autowriteall let s:vimwiki_autowriteall_saved = &autowriteall
let &autowriteall = vimwiki#vars#get_global('autowriteall') let &autowriteall = vimwiki#vars#get_global('autowriteall')
@@ -174,7 +157,7 @@ endfunction
" Set settings which are local to a window. In a new tab they would be reset to " 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 " Vim defaults. So we enforce our settings here when the cursor enters a
" Vimwiki buffer. " Vimwiki buffer.
function! s:set_windowlocal_options() abort function! s:set_windowlocal_options()
if !&diff " if Vim is currently in diff mode, don't interfere with its folding if !&diff " if Vim is currently in diff mode, don't interfere with its folding
let foldmethod = vimwiki#vars#get_global('folding') let foldmethod = vimwiki#vars#get_global('folding')
if foldmethod =~? '^expr.*' if foldmethod =~? '^expr.*'
@@ -196,116 +179,53 @@ function! s:set_windowlocal_options() abort
endif endif
endif endif
if exists('+conceallevel') if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
let &l:conceallevel = vimwiki#vars#get_global('conceallevel') let &conceallevel = vimwiki#vars#get_global('conceallevel')
endif endif
if vimwiki#vars#get_global('auto_chdir') if vimwiki#vars#get_global('auto_chdir')
exe 'lcd' vimwiki#vars#get_wikilocal('path') exe 'lcd' vimwiki#path#to_string(vimwiki#vars#get_wikilocal('path'))
endif endif
endfunction 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
" Initialization of Vimwiki starts here. " cause autoload/vimwiki/base.vim to be loaded
" Make sure everything below does not cause autoload/vimwiki/base.vim
" to be loaded
call vimwiki#vars#init() call vimwiki#vars#init()
" Define callback functions which the user can redefine " Define callback functions which the user can redefine
if !exists('*VimwikiLinkHandler') if !exists("*VimwikiLinkHandler")
function VimwikiLinkHandler(url) function VimwikiLinkHandler(url)
return 0 return 0
endfunction endfunction
endif endif
if !exists('*VimwikiLinkConverter') if !exists("*VimwikiLinkConverter")
function VimwikiLinkConverter(url, source, target) function VimwikiLinkConverter(url, source, target)
" Return the empty string when unable to process link " Return the empty string when unable to process link
return '' return ''
endfunction endfunction
endif endif
if !exists('*VimwikiWikiIncludeHandler') if !exists("*VimwikiWikiIncludeHandler")
function! VimwikiWikiIncludeHandler(value) function! VimwikiWikiIncludeHandler(value)
return '' return ''
endfunction endfunction
endif 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 " Define autocommands for all known wiki extensions
let s:known_extensions = s:vimwiki_get_known_extensions() let s:known_extensions = s:vimwiki_get_known_extensions()
if index(s:known_extensions, '.wiki') > -1 if index(s:known_extensions, '.wiki') > -1
augroup filetypedetect augroup filetypedetect
" Clear FlexWiki's stuff " clear FlexWiki's stuff
au! * *.wiki au! * *.wiki
augroup end augroup end
endif endif
@@ -313,147 +233,122 @@ endif
augroup vimwiki augroup vimwiki
autocmd! autocmd!
autocmd ColorScheme * call s:setup_cleared_syntax() autocmd ColorScheme * call s:setup_cleared_syntax()
for s:ext in s:known_extensions
" ['.md', '.mdown'] => *.md,*.mdown exe 'autocmd BufNewFile,BufRead *'.s:ext.' call s:setup_new_wiki_buffer()'
let pat = join(map(s:known_extensions, '"*" . v:val'), ',') exe 'autocmd BufEnter *'.s:ext.' call s:setup_buffer_enter()'
exe 'autocmd BufNewFile,BufRead '.pat.' call s:setup_new_wiki_buffer()' exe 'autocmd BufLeave *'.s:ext.' call s:setup_buffer_leave()'
exe 'autocmd BufEnter '.pat.' call s:setup_buffer_enter()' " Format tables when exit from insert mode. Do not use textwidth to
exe 'autocmd BufLeave '.pat.' call s:setup_buffer_leave()' " autowrap tables.
exe 'autocmd BufWinEnter '.pat.' call s:setup_buffer_win_enter()' if vimwiki#vars#get_global('table_auto_fmt')
if exists('##DiffUpdated') exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))'
exe 'autocmd DiffUpdated '.pat.' call s:setup_buffer_win_enter()' exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))'
endif endif
" automatically generate a level 1 header for new files if vimwiki#vars#get_global('folding') =~? ':quick$'
exe 'autocmd BufNewFile '.pat.' call s:create_h1(expand("%:p"))' " from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
" Format tables when exit from insert mode. Do not use textwidth to " Don't screw up folds when inserting text that might affect them, until
" autowrap tables. " leaving insert mode. Foldmethod is local to the window. Protect against
if vimwiki#vars#get_global('table_auto_fmt') " screwing up folding when switching between windows.
exe 'autocmd InsertLeave '.pat.' call vimwiki#tbl#format(line("."), 2)' exe 'autocmd InsertEnter *'.s:ext.' if !exists("w:last_fdm") | let w:last_fdm=&foldmethod'.
endif \ ' | setlocal foldmethod=manual | endif'
if vimwiki#vars#get_global('folding') =~? ':quick$' exe 'autocmd InsertLeave,WinLeave *'.s:ext.' if exists("w:last_fdm") |'.
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text \ 'let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif'
" Don't screw up folds when inserting text that might affect them, until endif
" leaving insert mode. Foldmethod is local to the window. Protect against endfor
" 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 augroup END
" Declare global commands
command! VimwikiUISelect call vimwiki#base#ui_select() command! VimwikiUISelect call vimwiki#base#ui_select()
" why not using <count> instead of v:count1?
" See https://github.com/vimwiki-backup/vimwiki/issues/324
command! -count=1 VimwikiIndex
\ call vimwiki#base#goto_index(v:count1)
command! -count=1 VimwikiTabIndex
\ call vimwiki#base#goto_index(v:count1, 1)
" these commands take a count e.g. :VimwikiIndex 2 command! -count=1 VimwikiDiaryIndex
" the default behavior is to open the index, diary etc. \ call vimwiki#diary#goto_diary_index(v:count1)
" for the CURRENT wiki if no count is given command! -count=1 VimwikiMakeDiaryNote
command! -count=0 VimwikiIndex \ call vimwiki#diary#make_note(v:count)
\ call vimwiki#base#goto_index(<count>) command! -count=1 VimwikiTabMakeDiaryNote
\ call vimwiki#diary#make_note(v:count, 1)
command! -count=0 VimwikiTabIndex command! -count=1 VimwikiMakeYesterdayDiaryNote
\ call vimwiki#base#goto_index(<count>, 1) \ call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime() - 60*60*24))
command! -count=0 VimwikiDiaryIndex command! -count=1 VimwikiMakeTomorrowDiaryNote
\ call vimwiki#diary#goto_diary_index(<count>) \ call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime() + 60*60*24))
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 command! VimwikiDiaryGenerateLinks
\ call vimwiki#diary#generate_diary_section() \ 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 let s:map_prefix = vimwiki#vars#get_global('map_prefix')
" <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>
if !hasmapto('<Plug>VimwikiIndex')
" Set default global key mappings exe 'nmap <silent><unique> '.s:map_prefix.'w <Plug>VimwikiIndex'
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 endif
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
if !hasmapto('<Plug>VimwikiTabIndex')
exe 'nmap <silent><unique> '.s:map_prefix.'t <Plug>VimwikiTabIndex'
endif
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
if !hasmapto('<Plug>VimwikiUISelect')
exe 'nmap <silent><unique> '.s:map_prefix.'s <Plug>VimwikiUISelect'
endif
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
if !hasmapto('<Plug>VimwikiDiaryIndex')
exe 'nmap <silent><unique> '.s:map_prefix.'i <Plug>VimwikiDiaryIndex'
endif
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
if !hasmapto('<Plug>VimwikiDiaryGenerateLinks')
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>i <Plug>VimwikiDiaryGenerateLinks'
endif
nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR>
if !hasmapto('<Plug>VimwikiMakeDiaryNote')
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>w <Plug>VimwikiMakeDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>t <Plug>VimwikiTabMakeDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
\ :VimwikiTabMakeDiaryNote<CR>
if !hasmapto('<Plug>VimwikiMakeYesterdayDiaryNote')
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>y <Plug>VimwikiMakeYesterdayDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeYesterdayDiaryNote
\ :VimwikiMakeYesterdayDiaryNote<CR>
if !hasmapto('<Plug>VimwikiMakeTomorrowDiaryNote')
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>m <Plug>VimwikiMakeTomorrowDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeTomorrowDiaryNote
\ :VimwikiMakeTomorrowDiaryNote<CR>
" Build global wiki menu (GUI)
function! s:build_menu(topmenu) abort
let wnamelist = [] function! s:build_menu(topmenu)
for idx in range(vimwiki#vars#number_of_wikis()) for idx in range(vimwiki#vars#number_of_wikis())
let wname = vimwiki#vars#get_wikilocal('name', idx) let norm_path = vimwiki#path#to_string(vimwiki#vars#get_wikilocal('path', idx))
if wname ==? '' let norm_path = escape(norm_path, '\ .')
" fall back to the path if wiki isn't named execute 'menu '.a:topmenu.'.Open\ index.'.norm_path.
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>' \ ' :call vimwiki#base#goto_index('.(idx+1).')<CR>'
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.wname. execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path.
\ ' :call vimwiki#diary#make_note('.(idx+1).')<CR>' \ ' :call vimwiki#diary#make_note('.(idx+1).')<CR>'
endfor endfor
endfunction endfunction
function! s:build_table_menu(topmenu)
" Build global table menu (GUI)
function! s:build_table_menu(topmenu) abort
exe 'menu '.a:topmenu.'.-Sep- :' exe 'menu '.a:topmenu.'.-Sep- :'
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable ' exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq' exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq'
@@ -464,7 +359,6 @@ function! s:build_table_menu(topmenu) abort
endfunction endfunction
" Build Menus now
if !empty(vimwiki#vars#get_global('menu')) if !empty(vimwiki#vars#get_global('menu'))
call s:build_menu(vimwiki#vars#get_global('menu')) call s:build_menu(vimwiki#vars#get_global('menu'))
call s:build_table_menu(vimwiki#vars#get_global('menu')) call s:build_table_menu(vimwiki#vars#get_global('menu'))
@@ -478,5 +372,4 @@ if vimwiki#vars#get_global('use_calendar')
endif endif
" Restore peace in the galaxy let &cpo = s:old_cpo
let &cpoptions = s:old_cpo
+162 -215
View File
@@ -6,31 +6,19 @@
" Quit if syntax file is already loaded " Quit if syntax file is already loaded
if v:version < 600 if v:version < 600
syntax clear syntax clear
elseif exists('b:current_syntax') elseif exists("b:current_syntax")
finish finish
endif endif
let s:current_syntax = vimwiki#vars#get_wikilocal('syntax') 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) call vimwiki#vars#populate_syntax_vars(s:current_syntax)
let syntax_dic = g:vimwiki_syntaxlocal_vars[s:current_syntax]
" Declare nesting capabilities
" -- to be embedded 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 " LINKS: highlighting is complicated due to "nonexistent" links feature
function! s:add_target_syntax_ON(target, type) abort function! s:add_target_syntax_ON(target, type)
let prefix0 = 'syntax match '.a:type.' `' let prefix0 = 'syntax match '.a:type.' `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match '.a:type.'T `' let prefix1 = 'syntax match '.a:type.'T `'
@@ -40,7 +28,7 @@ function! s:add_target_syntax_ON(target, type) abort
endfunction endfunction
function! s:add_target_syntax_OFF(target) abort function! s:add_target_syntax_OFF(target)
let prefix0 = 'syntax match VimwikiNoExistsLink `' let prefix0 = 'syntax match VimwikiNoExistsLink `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
let prefix1 = 'syntax match VimwikiNoExistsLinkT `' let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
@@ -50,7 +38,7 @@ function! s:add_target_syntax_OFF(target) abort
endfunction endfunction
function! s:highlight_existing_links() abort function! s:highlight_existing_links()
" Wikilink " Wikilink
" Conditional highlighting that depends on the existence of a wiki file or " Conditional highlighting that depends on the existence of a wiki file or
" directory is only available for *schemeless* wiki links " directory is only available for *schemeless* wiki links
@@ -63,33 +51,33 @@ function! s:highlight_existing_links() abort
" match [[URL]] " match [[URL]]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '') \ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
call s:add_target_syntax_ON(target, 'VimwikiLink') call s:add_target_syntax_ON(target, 'VimwikiLink')
" match [[URL|DESCRIPTION]] " match [[URL|DESCRIPTION]]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '') \ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
call s:add_target_syntax_ON(target, 'VimwikiLink') call s:add_target_syntax_ON(target, 'VimwikiLink')
" match {{URL}} " match {{URL}}
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '', '') \ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
call s:add_target_syntax_ON(target, 'VimwikiLink') call s:add_target_syntax_ON(target, 'VimwikiLink')
" match {{URL|...}} " match {{URL|...}}
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '', '') \ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
call s:add_target_syntax_ON(target, 'VimwikiLink') call s:add_target_syntax_ON(target, 'VimwikiLink')
" match [[DIRURL]] " match [[DIRURL]]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '') \ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
call s:add_target_syntax_ON(target, 'VimwikiLink') call s:add_target_syntax_ON(target, 'VimwikiLink')
" match [[DIRURL|DESCRIPTION]] " match [[DIRURL|DESCRIPTION]]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '') \ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
call s:add_target_syntax_ON(target, 'VimwikiLink') call s:add_target_syntax_ON(target, 'VimwikiLink')
endfunction endfunction
@@ -111,83 +99,91 @@ else
endif endif
" Weblink: [DESCRIPTION](FILE) " Weblink
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink') call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink')
" WikiLink: " WikiLink
" All remaining schemes are highlighted automatically " All remaining schemes are highlighted automatically
let s:rxSchemes = '\%('. let s:rxSchemes = '\%('.
\ vimwiki#vars#get_global('schemes_local') . '\|'. \ vimwiki#vars#get_global('schemes') . '\|'.
\ vimwiki#vars#get_global('schemes_web'). \ vimwiki#vars#get_global('web_schemes1').
\ '\):' \ '\):'
" a) match [[nonwiki-scheme-URL]] " a) match [[nonwiki-scheme-URL]]
let s:target = vimwiki#base#apply_template( let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'), \ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '') \ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink') call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" b) match [[nonwiki-scheme-URL|DESCRIPTION]] " b) match [[nonwiki-scheme-URL|DESCRIPTION]]
let s:target = vimwiki#base#apply_template( let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'), \ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '') \ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink') call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" a) match {{nonwiki-scheme-URL}} " a) match {{nonwiki-scheme-URL}}
let s:target = vimwiki#base#apply_template( let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'), \ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '') \ vimwiki#vars#get_global('rxWikiInclArgs'), '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink') call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" b) match {{nonwiki-scheme-URL}[{...}]} " b) match {{nonwiki-scheme-URL}[{...}]}
let s:target = vimwiki#base#apply_template( let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')), \ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'), \ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '') \ vimwiki#vars#get_global('rxWikiInclArgs'), '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink') call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" Header Level: 1..6
" Header levels, 1-6
for s:i in range(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 execute 'syntax match VimwikiHeader'.s:i
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax) \ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax).
\ . '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,' \ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ . 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,VimwikiList,VimwikiListTodo,@Spell' \ 'VimwikiLink,@Spell'
execute 'syntax region VimwikiH'.s:i.'Folding start=/' 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.'_Start', s:current_syntax).'/ end=/'.
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax) \ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax).
\ . '/me=s-1' \ '/me=s-1 transparent fold'
\ . ' transparent fold'
endfor endfor
" SetExt Header:
" TODO mutualise SetExt Regexp " possibly concealed chars
let setex_header1_re = '^\s\{0,3}[^>].*\n\s\{0,3}==\+$' let s:conceal = exists("+conceallevel") ? ' conceal' : ''
let setex_header2_re = '^\s\{0,3}[^>].*\n\s\{0,3}--\+$'
execute 'syntax match VimwikiHeader1' execute 'syn match VimwikiEqInChar contained /'.
\ . ' /'. setex_header1_re . '/ ' \ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'. execute 'syn match VimwikiBoldChar contained /'.
\ 'VimwikiLink,@Spell' \ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal
execute 'syntax match VimwikiHeader2' execute 'syn match VimwikiItalicChar contained /'.
\ . ' /'. setex_header2_re . '/ ' . \ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'. execute 'syn match VimwikiBoldItalicChar contained /'.
\ 'VimwikiLink,@Spell' \ vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'.s:conceal
execute 'syn match VimwikiItalicBoldChar contained /'.
\ vimwiki#vars#get_syntaxlocal('char_italicbold').'/'.s:conceal
execute 'syn match VimwikiCodeChar contained /'.
\ vimwiki#vars#get_syntaxlocal('char_code').'/'.s:conceal
execute 'syn match VimwikiDelTextChar contained /'.
\ vimwiki#vars#get_syntaxlocal('char_deltext').'/'.s:conceal
execute 'syn match VimwikiSuperScript contained /'.
\ vimwiki#vars#get_syntaxlocal('char_superscript').'/'.s:conceal
execute 'syn match VimwikiSubScript contained /'.
\ vimwiki#vars#get_syntaxlocal('char_subscript').'/'.s:conceal
let s:options = ' contained transparent contains=NONE' 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 " 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 " VimwikiLinkRest group is left undefined if link shortening is not desired
if exists('+conceallevel') && vimwiki#vars#get_global('url_maxsave') > 0 if exists("+conceallevel") && vimwiki#vars#get_global('url_maxsave') > 0
let s:options .= s:conceal
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze' execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
\.'\%([/#?]\w\|\S\{'.vimwiki#vars#get_global('url_maxsave').'}\)`'.' cchar=~'.s:options \.'\%([/#?]\w\|\S\{'.vimwiki#vars#get_global('url_maxsave').'}\)`'.' cchar=~'.s:options
endif endif
@@ -210,14 +206,34 @@ execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix1
" non concealed chars " non concealed chars
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'. execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.
\ vimwiki#vars#get_syntaxlocal('header_symbol').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('header_symbol'). \ vimwiki#vars#get_syntaxlocal('rxH').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH').
\ '\+\s*$\)/' \ '\+\s*$\)/'
execute 'syn match VimwikiEqInCharT contained /'
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_wikilocal('rx_todo') .'/' \ .vimwiki#vars#get_syntaxlocal('char_eqin').'/'
execute 'syn match VimwikiBoldCharT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_bold').'/'
execute 'syn match VimwikiItalicCharT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_italic').'/'
execute 'syn match VimwikiBoldItalicCharT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'
execute 'syn match VimwikiItalicBoldCharT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_italicbold').'/'
execute 'syn match VimwikiCodeCharT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_code').'/'
execute 'syn match VimwikiDelTextCharT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_deltext').'/'
execute 'syn match VimwikiSuperScriptT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_superscript').'/'
execute 'syn match VimwikiSubScriptT contained /'
\ .vimwiki#vars#get_syntaxlocal('char_subscript').'/'
" Table: execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_global('rxTodo') .'/'
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
" Tables
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ transparent contains=VimwikiCellSeparator, \ transparent contains=VimwikiCellSeparator,
\ VimwikiLinkT, \ VimwikiLinkT,
\ VimwikiNoExistsLinkT, \ VimwikiNoExistsLinkT,
@@ -231,44 +247,85 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ VimwikiSubScriptT, \ VimwikiSubScriptT,
\ VimwikiCodeT, \ VimwikiCodeT,
\ VimwikiEqInT, \ VimwikiEqInT,
\ VimwikiEmoji,
\ @Spell \ @Spell
syntax match VimwikiCellSeparator
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
" List: " Lists
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/' execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'/'
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/' execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/' execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
" Task List Done:
if vimwiki#vars#get_global('hl_cb_checked') == 1 if vimwiki#vars#get_global('hl_cb_checked') == 1
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB') execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1] \ . '\s*\[['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
\ . vimwiki#vars#get_global('listsym_rejected') \ . vimwiki#vars#get_global('listsym_rejected')
\ . ']\]\s\(.*\)$/ ' \ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
elseif vimwiki#vars#get_global('hl_cb_checked') == 2 elseif vimwiki#vars#get_global('hl_cb_checked') == 2
execute 'syntax match VimwikiCheckBoxDone /' execute 'syntax match VimwikiCheckBoxDone /'
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren') \ . vimwiki#vars#get_syntaxlocal('rxListItemAndChildren')
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell' \ .'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
endif endif
" Horizontal Rule: <hr> execute 'syntax match VimwikiEqIn /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
\ '/ contains=VimwikiEqInChar'
execute 'syntax match VimwikiEqInT /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
\ '/ contained contains=VimwikiEqInCharT'
execute 'syntax match VimwikiBold /'.vimwiki#vars#get_syntaxlocal('rxBold').
\ '/ contains=VimwikiBoldChar,@Spell'
execute 'syntax match VimwikiBoldT /'.vimwiki#vars#get_syntaxlocal('rxBold').
\ '/ contained contains=VimwikiBoldCharT,@Spell'
execute 'syntax match VimwikiItalic /'.vimwiki#vars#get_syntaxlocal('rxItalic').
\ '/ contains=VimwikiItalicChar,@Spell'
execute 'syntax match VimwikiItalicT /'.vimwiki#vars#get_syntaxlocal('rxItalic').
\ '/ contained contains=VimwikiItalicCharT,@Spell'
execute 'syntax match VimwikiBoldItalic /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
\ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
execute 'syntax match VimwikiBoldItalicT /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
\ '/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell'
execute 'syntax match VimwikiItalicBold /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
\ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
execute 'syntax match VimwikiItalicBoldT /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
\ '/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell'
execute 'syntax match VimwikiDelText /'.vimwiki#vars#get_syntaxlocal('rxDelText').
\ '/ contains=VimwikiDelTextChar,@Spell'
execute 'syntax match VimwikiDelTextT /'.vimwiki#vars#get_syntaxlocal('rxDelText').
\ '/ contained contains=VimwikiDelTextChar,@Spell'
execute 'syntax match VimwikiSuperScript /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
\ '/ contains=VimwikiSuperScriptChar,@Spell'
execute 'syntax match VimwikiSuperScriptT /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
\ '/ contained contains=VimwikiSuperScriptCharT,@Spell'
execute 'syntax match VimwikiSubScript /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
\ '/ contains=VimwikiSubScriptChar,@Spell'
execute 'syntax match VimwikiSubScriptT /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
\ '/ contained contains=VimwikiSubScriptCharT,@Spell'
execute 'syntax match VimwikiCode /'.vimwiki#vars#get_syntaxlocal('rxCode').
\ '/ contains=VimwikiCodeChar'
execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode').
\ '/ contained contains=VimwikiCodeCharT'
" <hr> horizontal rule
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/' execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
" Preformated Text: `like that` execute 'syntax region VimwikiPre start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : '' \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'
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'). execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell' \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@Spell'
" Placeholder: " placeholders
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/ syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
syntax match VimwikiPlaceholder syntax match VimwikiPlaceholder
\ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite \ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
@@ -279,81 +336,27 @@ syntax match VimwikiPlaceholder
syntax match VimwikiPlaceholderParam /.*/ contained syntax match VimwikiPlaceholderParam /.*/ contained
" Html Tag: <u> " html tags
if vimwiki#vars#get_global('valid_html_tags') !=? '' if vimwiki#vars#get_global('valid_html_tags') != ''
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|') 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*/\?>#' exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
" Html Typeface: <b>bold text</b> execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('rxComment').
let html_typeface = { \ '/ contains=@Spell,VimwikiTodo'
\ '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 endif
" Html Color: <span style="color:#FF0000";>Red paragraph</span> " tags
" -- See: h color_dic execute 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
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 highlight 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: " header groups highlighting
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 if vimwiki#vars#get_global('hl_headers') == 0
" Strangely in default colorscheme Title group is not set to bold for cterm... " Strangely in default colorscheme Title group is not set to bold for cterm...
if !exists('g:colors_name') if !exists("g:colors_name")
hi Title cterm=bold hi Title cterm=bold
endif endif
for s:i in range(1,6) for s:i in range(1,6)
@@ -362,63 +365,36 @@ if vimwiki#vars#get_global('hl_headers') == 0
else else
for s:i in range(1,6) for s:i in range(1,6)
execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg=' 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_guifg_'.&bg)[s:i-1].' gui=bold ctermfg='
\ .vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[s:i-1].' term=bold cterm=bold' \ .vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[s:i-1].' term=bold cterm=bold'
endfor endfor
endif 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 VimwikiMarkers Normal
hi def link VimwikiError Normal
hi def link VimwikiEqIn Number hi def link VimwikiEqIn Number
hi def link VimwikiEqInT VimwikiEqIn hi def link VimwikiEqInT VimwikiEqIn
" Typeface 1
hi def VimwikiBold term=bold cterm=bold gui=bold hi def VimwikiBold term=bold cterm=bold gui=bold
hi def link VimwikiBoldT VimwikiBold hi def link VimwikiBoldT VimwikiBold
hi def VimwikiItalic term=italic cterm=italic gui=italic hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def link VimwikiItalicT VimwikiItalic hi def link VimwikiItalicT VimwikiItalic
hi def VimwikiUnderline term=underline cterm=underline gui=underline hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
" 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 VimwikiItalicBold VimwikiBoldItalic
hi def link VimwikiBoldItalicT VimwikiBoldItalic hi def link VimwikiBoldItalicT VimwikiBoldItalic
hi def link VimwikiItalicBoldT VimwikiBoldItalic hi def link VimwikiItalicBoldT VimwikiBoldItalic
hi def VimwikiBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline hi def VimwikiUnderline gui=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 VimwikiCode PreProc
hi def link VimwikiCodeT VimwikiCode hi def link VimwikiCodeT VimwikiCode
hi def link VimwikiPre PreProc hi def link VimwikiPre PreProc
hi def link VimwikiPreT VimwikiPre hi def link VimwikiPreT VimwikiPre
hi def link VimwikiPreDelim VimwikiPre
hi def link VimwikiMath Number hi def link VimwikiMath Number
hi def link VimwikiMathT VimwikiMath hi def link VimwikiMathT VimwikiMath
@@ -435,14 +411,7 @@ hi def link VimwikiCheckBoxDone Comment
hi def link VimwikiHR Identifier hi def link VimwikiHR Identifier
hi def link VimwikiTag Keyword hi def link VimwikiTag Keyword
hi def link VimwikiDelText Constant
" 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 VimwikiDelTextT VimwikiDelText
hi def link VimwikiSuperScript Number hi def link VimwikiSuperScript Number
@@ -453,7 +422,6 @@ hi def link VimwikiSubScriptT VimwikiSubScript
hi def link VimwikiTodo Todo hi def link VimwikiTodo Todo
hi def link VimwikiComment Comment hi def link VimwikiComment Comment
hi def link VimwikiMultilineComment Comment
hi def link VimwikiPlaceholder SpecialKey hi def link VimwikiPlaceholder SpecialKey
hi def link VimwikiPlaceholderParam String hi def link VimwikiPlaceholderParam String
@@ -471,7 +439,6 @@ hi def link VimwikiSubScriptChar VimwikiMarkers
hi def link VimwikiCodeChar VimwikiMarkers hi def link VimwikiCodeChar VimwikiMarkers
hi def link VimwikiHeaderChar VimwikiMarkers hi def link VimwikiHeaderChar VimwikiMarkers
" TODO remove unused due to region refactoring
hi def link VimwikiEqInCharT VimwikiMarkers hi def link VimwikiEqInCharT VimwikiMarkers
hi def link VimwikiBoldCharT VimwikiMarkers hi def link VimwikiBoldCharT VimwikiMarkers
hi def link VimwikiItalicCharT VimwikiMarkers hi def link VimwikiItalicCharT VimwikiMarkers
@@ -491,13 +458,13 @@ call vimwiki#u#reload_regexes_custom()
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki" " FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
let b:current_syntax='vimwiki' let b:current_syntax="vimwiki"
" Include: Code: EMBEDDED syntax setup -> base.vim " EMBEDDED syntax setup
let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes') let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes') if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), 'keep') let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep")
endif endif
if !empty(s:nested) if !empty(s:nested)
for [s:hl_syntax, s:vim_syntax] in items(s:nested) for [s:hl_syntax, s:vim_syntax] in items(s:nested)
@@ -508,33 +475,13 @@ if !empty(s:nested)
endfor endfor
endif 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 " LaTeX
call vimwiki#base#nested_syntax('tex', call vimwiki#base#nested_syntax('tex',
\ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'. \ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'.
\ '\%([[:blank:][:punct:]].*\)\?', \ '\%([[:blank:][:punct:]].*\)\?',
\ vimwiki#vars#get_syntaxlocal('rxMathEnd'), 'VimwikiMath') \ 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 syntax spell toplevel
+110
View File
@@ -0,0 +1,110 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki syntax file
" Description: Defines default syntax
" Home: https://github.com/vimwiki/vimwiki/
" s:default_syntax is kind of a reference to the dict in
" g:vimwiki_syntax_variables['default']. It is used here simply as an
" abbreviation for the latter.
let s:default_syntax = g:vimwiki_syntax_variables['default']
" text: $ equation_inline $
let s:default_syntax.rxEqIn = '\$[^$`]\+\$'
let s:default_syntax.char_eqin = '\$'
" text: *strong*
" let s:default_syntax.rxBold = '\*[^*]\+\*'
let s:default_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\*'.
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
\'\*'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:default_syntax.char_bold = '*'
" text: _emphasis_
" let s:default_syntax.rxItalic = '_[^_]\+_'
let s:default_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_'.
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
\'_'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:default_syntax.char_italic = '_'
" text: *_bold italic_* or _*italic bold*_
let s:default_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\*_'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'_\*'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:default_syntax.char_bolditalic = '\*_'
let s:default_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_\*'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\*_'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:default_syntax.char_italicbold = '_\*'
" text: `code`
let s:default_syntax.rxCode = '`[^`]\+`'
let s:default_syntax.char_code = '`'
" text: ~~deleted text~~
let s:default_syntax.rxDelText = '\~\~[^~`]\+\~\~'
let s:default_syntax.char_deltext = '\~\~'
" text: ^superscript^
let s:default_syntax.rxSuperScript = '\^[^^`]\+\^'
let s:default_syntax.char_superscript = '^'
" text: ,,subscript,,
let s:default_syntax.rxSubScript = ',,[^,`]\+,,'
let s:default_syntax.char_subscript = ',,'
" generic headers
let s:default_syntax.rxH = '='
let s:default_syntax.symH = 1
" <hr>, horizontal rule
let s:default_syntax.rxHR = '^-----*$'
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
let s:default_syntax.rxTableSep = '|'
" Lists
let s:default_syntax.bullet_types = ['-', '*', '#']
" 1 means the bullets can be repeatet to indicate the level, like * ** ***
" 0 means the bullets stand on their own and the level is indicated by the indentation
let s:default_syntax.recurring_bullets = 0
let s:default_syntax.number_types = ['1)', '1.', 'i)', 'I)', 'a)', 'A)']
"this should contain at least one element
"it is used for i_<C-L><C-J> among other things
let s:default_syntax.list_markers = ['-', '1.', '*', 'I)', 'a)']
let s:default_syntax.rxListDefine = '::\(\s\|$\)'
" Preformatted text
let s:default_syntax.rxPreStart = '{{{'
let s:default_syntax.rxPreEnd = '}}}'
" Math block
let s:default_syntax.rxMathStart = '{{\$'
let s:default_syntax.rxMathEnd = '}}\$'
let s:default_syntax.rxComment = '^\s*%%.*$'
let s:default_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:''[:space:]]\+:\)\+\%(\s\|$\)\@='
let s:default_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
let s:default_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
let s:default_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*'.
\ '[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
let s:default_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
\ '\%([[:punct:]]\|\s\|$\)\@='
let s:default_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
let s:default_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
let s:default_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
+104
View File
@@ -0,0 +1,104 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki syntax file
" Description: Defines markdown syntax
" Home: https://github.com/vimwiki/vimwiki/
" see the comments in vimwiki_default.vim for some info about this file
let s:markdown_syntax = g:vimwiki_syntax_variables['markdown']
" text: $ equation_inline $
let s:markdown_syntax.rxEqIn = '\$[^$`]\+\$'
let s:markdown_syntax.char_eqin = '\$'
" text: *strong*
" let s:markdown_syntax.rxBold = '\*[^*]\+\*'
let s:markdown_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\*'.
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
\'\*'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_bold = '*'
" text: _emphasis_
" let s:markdown_syntax.rxItalic = '_[^_]\+_'
let s:markdown_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_'.
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
\'_'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_italic = '_'
" text: *_bold italic_* or _*italic bold*_
let s:markdown_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\*_'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'_\*'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_bolditalic = '\*_'
let s:markdown_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_\*'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\*_'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_italicbold = '_\*'
" text: `code`
let s:markdown_syntax.rxCode = '`[^`]\+`'
let s:markdown_syntax.char_code = '`'
" text: ~~deleted text~~
let s:markdown_syntax.rxDelText = '\~\~[^~`]\+\~\~'
let s:markdown_syntax.char_deltext = '\~\~'
" text: ^superscript^
let s:markdown_syntax.rxSuperScript = '\^[^^`]\+\^'
let s:markdown_syntax.char_superscript = '^'
" text: ,,subscript,,
let s:markdown_syntax.rxSubScript = ',,[^,`]\+,,'
let s:markdown_syntax.char_subscript = ',,'
" generic headers
let s:markdown_syntax.rxH = '#'
let s:markdown_syntax.symH = 0
" <hr>, horizontal rule
let s:markdown_syntax.rxHR = '^-----*$'
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
let s:markdown_syntax.rxTableSep = '|'
" Lists
let s:markdown_syntax.bullet_types = ['-', '*', '+']
let s:markdown_syntax.recurring_bullets = 0
let s:markdown_syntax.number_types = ['1.']
let s:markdown_syntax.list_markers = ['-', '*', '+', '1.']
let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)'
" Preformatted text
let s:markdown_syntax.rxPreStart = '```'
let s:markdown_syntax.rxPreEnd = '```'
" Math block
let s:markdown_syntax.rxMathStart = '\$\$'
let s:markdown_syntax.rxMathEnd = '\$\$'
let s:markdown_syntax.rxComment = '^\s*%%.*$\|<!--[^>]*-->'
let s:markdown_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
let s:markdown_syntax.header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
let s:markdown_syntax.header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$'
let s:markdown_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs'.
\ '\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
\ '\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
let s:markdown_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
let s:markdown_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
+33 -35
View File
@@ -1,10 +1,10 @@
" 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
function! s:add_target_syntax_ON(target, type)
let prefix0 = 'syntax match '.a:type.' `' let prefix0 = 'syntax match '.a:type.' `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match '.a:type.'T `' let prefix1 = 'syntax match '.a:type.'T `'
@@ -14,7 +14,7 @@ function! s:add_target_syntax_ON(target, type) abort
endfunction endfunction
function! s:add_target_syntax_OFF(target, type) abort function! s:add_target_syntax_OFF(target, type)
let prefix0 = 'syntax match VimwikiNoExistsLink `' let prefix0 = 'syntax match VimwikiNoExistsLink `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match VimwikiNoExistsLinkT `' let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
@@ -24,18 +24,18 @@ function! s:add_target_syntax_OFF(target, type) abort
endfunction endfunction
function! s:wrap_wikilink1_rx(target) abort function! s:wrap_wikilink1_rx(target)
return vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidPrefix') . a:target. return vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidPrefix') . a:target.
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidSuffix') \ vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidSuffix')
endfunction endfunction
function! s:existing_mkd_refs() abort function! s:existing_mkd_refs()
return keys(vimwiki#markdown_base#scan_reflinks()) return keys(vimwiki#markdown_base#scan_reflinks())
endfunction endfunction
function! s:highlight_existing_links() abort function! s:highlight_existing_links()
" Wikilink1 " Wikilink1
" Conditional highlighting that depends on the existence of a wiki file or " Conditional highlighting that depends on the existence of a wiki file or
" directory is only available for *schemeless* wiki links " directory is only available for *schemeless* wiki links
@@ -52,34 +52,34 @@ function! s:highlight_existing_links() abort
" match [URL][] " match [URL][]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DESCRIPTION][URL] " match [DESCRIPTION][URL]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DIRURL][] " match [DIRURL][]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DESCRIPTION][DIRURL] " match [DESCRIPTION][DIRURL]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [MKDREF][] " match [MKDREF][]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
" match [DESCRIPTION][MKDREF] " match [DESCRIPTION][MKDREF]
let target = vimwiki#base#apply_template( let target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
endfunction endfunction
@@ -99,32 +99,41 @@ endif
" Weblink " Weblink
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink1'), 'VimwikiWeblink1') 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 " WikiLink
" All remaining schemes are highlighted automatically " All remaining schemes are highlighted automatically
let s:rxSchemes = '\%('. let s:rxSchemes = '\%('.
\ vimwiki#vars#get_global('schemes_local') . '\|'. \ vimwiki#vars#get_global('schemes') . '\|'.
\ vimwiki#vars#get_global('schemes_web'). \ vimwiki#vars#get_global('web_schemes1').
\ '\):' \ '\):'
" a) match [nonwiki-scheme-URL] " a) match [nonwiki-scheme-URL]
let s:target = vimwiki#base#apply_template( let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'), \ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
" b) match [DESCRIPTION][nonwiki-scheme-URL] " b) match [DESCRIPTION][nonwiki-scheme-URL]
let s:target = vimwiki#base#apply_template( let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')), \ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'), \ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '') \ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
" Header levels, 1-6
for s:i in range(1,6)
execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i).
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
endfor
" concealed chars " concealed chars
if exists('+conceallevel') if exists("+conceallevel")
syntax conceal on syntax conceal on
endif endif
@@ -148,21 +157,15 @@ execute 'syn match VimwikiWeblink1Char "'.
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options \ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
execute 'syn match VimwikiWeblink1Char "'. execute 'syn match VimwikiWeblink1Char "'.
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options \ 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') if exists("+conceallevel")
syntax conceal off syntax conceal off
endif endif
" Tables " Tables
syntax match VimwikiTableRow /^\s*|.\+|\s*$/ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ transparent contains=VimwikiCellSeparator, \ transparent contains=VimwikiCellSeparator,
\ VimwikiLinkT, \ VimwikiLinkT,
\ VimwikiWeblink1T, \ VimwikiWeblink1T,
@@ -180,14 +183,9 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ VimwikiEqInT, \ VimwikiEqInT,
\ @Spell \ @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 " syntax group highlighting
hi def link VimwikiImage VimwikiLink
hi def link VimwikiImageT VimwikiLink
hi def link VimwikiWeblink1 VimwikiLink hi def link VimwikiWeblink1 VimwikiLink
hi def link VimwikiWeblink1T VimwikiLink hi def link VimwikiWeblink1T VimwikiLink
+85
View File
@@ -0,0 +1,85 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki syntax file
" Description: Defines mediaWiki syntax
" Home: https://github.com/vimwiki/vimwiki/
" see the comments in vimwiki_default.vim for some info about this file
let s:media_syntax = g:vimwiki_syntax_variables['media']
" text: $ equation_inline $
let s:media_syntax.rxEqIn = '\$[^$`]\+\$'
let s:media_syntax.char_eqin = '\$'
" text: '''strong'''
let s:media_syntax.rxBold = "'''[^']\\+'''"
let s:media_syntax.char_bold = "'''"
" text: ''emphasis''
let s:media_syntax.rxItalic = "''[^']\\+''"
let s:media_syntax.char_italic = "''"
" text: '''''strong italic'''''
let s:media_syntax.rxBoldItalic = "'''''[^']\\+'''''"
let s:media_syntax.rxItalicBold = s:media_syntax.rxBoldItalic
let s:media_syntax.char_bolditalic = "'''''"
let s:media_syntax.char_italicbold = s:media_syntax.char_bolditalic
" text: `code`
let s:media_syntax.rxCode = '`[^`]\+`'
let s:media_syntax.char_code = '`'
" text: ~~deleted text~~
let s:media_syntax.rxDelText = '\~\~[^~]\+\~\~'
let s:media_syntax.char_deltext = '\~\~'
" text: ^superscript^
let s:media_syntax.rxSuperScript = '\^[^^]\+\^'
let s:media_syntax.char_superscript = '^'
" text: ,,subscript,,
let s:media_syntax.rxSubScript = ',,[^,]\+,,'
let s:media_syntax.char_subscript = ',,'
" generic headers
let s:media_syntax.rxH = '='
let s:media_syntax.symH = 1
" <hr>, horizontal rule
let s:media_syntax.rxHR = '^-----*$'
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
let s:media_syntax.rxTableSep = '|'
" Lists
let s:media_syntax.bullet_types = ['*', '#']
let s:media_syntax.recurring_bullets = 1
let s:media_syntax.number_types = []
let s:media_syntax.list_markers = ['*', '#']
let s:media_syntax.rxListDefine = '^\%(;\|:\)\s'
" Preformatted text
let s:media_syntax.rxPreStart = '<pre>'
let s:media_syntax.rxPreEnd = '<\/pre>'
" Math block
let s:media_syntax.rxMathStart = '{{\$'
let s:media_syntax.rxMathEnd = '}}\$'
let s:media_syntax.rxComment = '^\s*%%.*$'
let s:media_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
let s:media_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
let s:media_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
let s:media_syntax.bold_search = "'''\\zs[^']\\+\\ze'''"
let s:media_syntax.bold_match = '''''''__Text__'''''''
" ^- this strange looking thing is equivalent to "'''__Text__'''" but since we later
" want to call escape() on this string, we must keep it in single quotes
let s:media_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
let s:media_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
let s:media_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
-85
View File
@@ -1,85 +0,0 @@
# 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
-42
View File
@@ -1,42 +0,0 @@
# 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()
-32
View File
@@ -1,32 +0,0 @@
# 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
-91
View File
@@ -1,91 +0,0 @@
# 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:
-83
View File
@@ -1,83 +0,0 @@
# 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=
-28
View File
@@ -1,28 +0,0 @@
# 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>
" See #950 appending to every file: https://github.com/vimwiki/vimwiki/issues/950
:AssertEqual 'pyfile.py.md', 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=:
-1
View File
@@ -1 +0,0 @@
anything in filenew: empirically it does not count anything in filenew: empirically it does not count anything in filenew: empirically it does not count anything in filenew: empirically it does not count anything in filenew: empirically it does not count
-59
View File
@@ -1,59 +0,0 @@
# 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
-170
View File
@@ -1,170 +0,0 @@
# 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:
-300
View File
@@ -1,300 +0,0 @@
# 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
-10
View File
@@ -1,10 +0,0 @@
# 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>')
-110
View File
@@ -1,110 +0,0 @@
# 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
-177
View File
@@ -1,177 +0,0 @@
# 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]
-51
View File
@@ -1,51 +0,0 @@
# 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
-440
View File
@@ -1,440 +0,0 @@
# 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')
Expect('No change'):
[link1](#i-v-p-741528)
[link2](#i-v-p-741528-2)
# I [V p](h) (7.415.28)
# I [V p](h) 741.528
Do (Enter link):
gg\<Cr>
A__HERE1__\<Esc>
ggj\<Cr>
A__HERE2__\<Esc>
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
Expect(Some suffix added after headings):
[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')
Execute (Set filename wiki_test.md):
file wiki_test.md
Do (Navigate with <Tab>):
A more Contents\<Esc>
\<Tab>
\<Enter>
A more Test1\<Esc>
\<Tab>
\<Tab>
\<Enter>
A more Test2\<Esc>
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
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>
# Debugging
:redir @a\<Cr>
:nmap <Bs>\<Cr>
:redir END\<Cr>
# :fixdel\<Cr>
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
# :AssertEqual 'toto', @a\<Cr>
# Cursor at Test2/filenew
A not yet\<Esc>\<Esc>
# Debug
:Log 'Debugging 1, cursor position list'\<Cr>
:Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
# :VimwikiGoBackLink\<Cr>
# :call vimwiki#base#go_back_link()\<Cr>
\<Bs>
:Log 'Debugging 2, cursor position list'\<Cr>
:Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
# 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
###################################
###################################
###################################
###################################
# Commented out as butsetvar of the var prev_links is removing the list info at change of file for old Vim
#Do (Navigate with <Tab> comeback with <Bs> from filenew):
# \<Tab>
# A first shot\<Esc>
# 0\<Tab>
## Cursor at Contents/test1
# \<Cr>
# \<Tab>
# \<Tab>
# A first shot\<Esc>
# 0\<Tab>
## Cursor at Test1/test2
# \<Cr>
# G
## Cursor at Test2/filenew
# A first shot\<Esc>
# 0\<Tab>
## Cursor at Test2/filenew
# \<Cr>
## Cursor in filenew (a new file)
# A anything in filenew: empirically it does not count\<Esc>
## Debug back
# :Log 'Debugging back 1, cursor position list'\<Cr>
# :Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
# :Log expand('%:p')\<Cr>
# :Log expand('/tmp/vader_wiki/testplugin/wiki_test.md')\<Cr>
# :Log filereadable('/tmp/vader_wiki/testplugin/wiki_test.md')\<Cr>
# \<Bs>
# :Log 'Debugging back 2, cursor position list'\<Cr>
# :Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
# :Log expand('%')\<Cr>
## 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
\<Cr>
\<Tab>
\<Tab>
# Cursor at Test1/test2
\<Cr>
\<Tab>
# Cursor at Test2/test1
\<Cr>
\<Tab>
\<Tab>
# Cursor at Test1/test2
\<Cr>
A first test2\<Esc>
\<Tab>
# Cursor at Test2/test1
\<Cr>
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 <Cr> 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>
\<Cr>
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
-475
View File
@@ -1,475 +0,0 @@
# 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 (Press filename):
:call SetSyntax('default')\<CR>
\<CR>\<CR>
:AssertEqual 'filename.wiki', expand('%:t')\<CR>
:call DeleteFile('%')\<CR>
Do (Press filename.dot):
j
\<CR>\<CR>
:AssertEqual 'filename.dot.wiki', 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 (Follow link witout markdown):
\<Cr>\<Cr>
" See issue #950 always adding the extension
:AssertEqual 'part1.part2.part3.md', expand('%:t')\<Cr>
Do (Follow link with .md extension):
j\<Cr>\<Cr>
:AssertEqual 'part1.part2.part3.md', expand('%:t')\<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
-262
View File
@@ -1,262 +0,0 @@
# 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=:
-300
View File
@@ -1,300 +0,0 @@
# 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>
# TODO this does break for old Vim for the buffer local prev_links list is deleted => Cannot change file
# :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=#
-122
View File
@@ -1,122 +0,0 @@
# 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()
-122
View File
@@ -1,122 +0,0 @@
# 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()
-413
View File
@@ -1,413 +0,0 @@
# 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=#
-196
View File
@@ -1,196 +0,0 @@
# 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
-112
View File
@@ -1,112 +0,0 @@
# 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:
-45
View File
@@ -1,45 +0,0 @@
# 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:
-379
View File
@@ -1,379 +0,0 @@
# 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:
-249
View File
@@ -1,249 +0,0 @@
# 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
-191
View File
@@ -1,191 +0,0 @@
# 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:
-87
View File
@@ -1,87 +0,0 @@
# 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:
-654
View File
@@ -1,654 +0,0 @@
# 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
File diff suppressed because it is too large Load Diff
-3
View File
@@ -1,3 +0,0 @@
set runtimepath+=/tmp/vader_wiki/home/vimtest/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,/tmp/vader_wiki/home/vimtest/vim/after
execute 'set rtp+='.join(filter(split(expand('/tmp/vader_wiki/home/vimtest/plugins/*')), 'isdirectory(v:val)'), ',')
set runtimepath+=/tmp/vader_wiki/testplugin
-3
View File
@@ -1,3 +0,0 @@
# Buzz Bozz
Cras nisl dolor, mattis condimentum neque ac, cursus tristique est. Sed vel imperdiet ipsum. Curabitur non dictum tortor. Donec massa justo, cursus at suscipit ornare, tempus a tellus. Praesent at orci mi. Praesent sed odio in leo pulvinar vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed eu leo dui. Fusce vitae laoreet massa. Donec ac tempor lectus. Curabitur eget ligula vel purus efficitur congue. Fusce ut pellentesque magna, eget facilisis nunc.
-59
View File
@@ -1,59 +0,0 @@
# Test Wiki
This test wiki exists to test various features of VimWiki.
VimWiki Developers: Feel free to *add* to this wiki for additional test features.
Foo bar
foo bar
biz baz
foo\bar
baz{13} <--- this is for testing a literal "baz{13}"
buzzzzz <--- this is for testing regex /buz{5}/
# Links
1. [[buzz_bozz|l_Buzz Bozz]]
2. [l_Buzz_Bozz](buzz_bozz)
3. [l_Flashy](#Typefaces#Flashy)
4. [l_Test Wiki](#Test Wiki)
# Typefaces
## Generic
~~strikeout text~~
`code (no syntax) text`
super^script^
sub,,script,,
## Markdown
**bold text** or __bold text__
*italic text* or _italic text_
***bold_italic text*** or ___italic_bold text___
## Flashy
TODO, DONE, STARTED, FIXME, FIXED, XXX.
# More
## Lorem ipsum dolor ==
Sit amet, consectetur adipiscing elit. Etiam sed efficitur lectus, sit amet consectetur purus. Vestibulum pulvinar, magna et fermentum aliquet, diam libero blandit ex, quis iaculis dui metus sit amet nulla. Mauris auctor massa magna, eu aliquam neque consequat a. Duis lorem nunc, tempus eu dignissim a, euismod sit amet ex. Duis nec condimentum libero. Nulla iaculis fringilla ante, in posuere lorem maximus vel. Nam pulvinar quis diam non ultrices. Vivamus maximus ipsum a placerat rutrum. Nam et consectetur erat, sodales hendrerit ligula.
# Etiam dapibus iaculis
Sed tincidunt vestibulum nunc, in dapibus eros dictum in. Nullam ut dolor nisi.
* blandit nulla mi
* at gravida magna
* maximus eu
### Morbi id sodales sem
Nulla id malesuada velit. Mauris ac nisl orci. Donec maximus ex in sapien fringilla mollis. Praesent eu felis bibendum, auctor justo eget, bibendum purus. Nullam egestas, diam et eleifend tempus, ipsum libero auctor mi, quis rutrum neque metus ac tortor. Vestibulum porttitor tempus vulputate.
## Praesent tempor turpis est
Nunc scelerisque placerat auctor. Donec vel iaculis risus, non commodo nisl. Duis pretium nisi nibh, ac faucibus metus condimentum nec. Aliquam eu euismod lorem. Aenean sit amet tellus sed massa luctus dignissim. Nam tempor sapien quis felis hendrerit fermentum. Nunc vitae vehicula enim.
@@ -1,7 +0,0 @@
[index](index)
[/index](/index)
[///tmp/some_page](///tmp/some_page)
[//~/testmarkdown/index](//~/testmarkdown/index)
[diary:2020-07-22](diary:2020-07-22)
[link_syntax/nested](link_syntax/nested)
[./link_syntax/nested](./link_syntax/nested)
@@ -1,6 +0,0 @@
[nested](nested)
[/index](/index)
[///tmp/some_page](///tmp/some_page)
[//~/testmarkdown/index](//~/testmarkdown/index)
[diary:2020-07-22](diary:2020-07-22)
[../link_syntax](../link_syntax)
@@ -1,3 +0,0 @@
= Buzz Bozz =
Cras nisl dolor, mattis condimentum neque ac, cursus tristique est. Sed vel imperdiet ipsum. Curabitur non dictum tortor. Donec massa justo, cursus at suscipit ornare, tempus a tellus. Praesent at orci mi. Praesent sed odio in leo pulvinar vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed eu leo dui. Fusce vitae laoreet massa. Donec ac tempor lectus. Curabitur eget ligula vel purus efficitur congue. Fusce ut pellentesque magna, eget facilisis nunc.
-30
View File
@@ -1,30 +0,0 @@
= Space Path Wiki =
This test wiki exists to test various features of VimWiki.
VimWiki Developers: Feel free to *add* to this wiki for additional test features.
Foo bar foo bar biz baz.
[[buzz_bozz|Buzz Bozz]]
== Lorem ipsum dolor ==
Sit amet, consectetur adipiscing elit. Etiam sed efficitur lectus, sit amet consectetur purus. Vestibulum pulvinar, magna et fermentum aliquet, diam libero blandit ex, quis iaculis dui metus sit amet nulla. Mauris auctor massa magna, eu aliquam neque consequat a. Duis lorem nunc, tempus eu dignissim a, euismod sit amet ex. Duis nec condimentum libero. Nulla iaculis fringilla ante, in posuere lorem maximus vel. Nam pulvinar quis diam non ultrices. Vivamus maximus ipsum a placerat rutrum. Nam et consectetur erat, sodales hendrerit ligula.
== Etiam dapibus iaculis ==
Sed tincidunt vestibulum nunc, in dapibus eros dictum in. Nullam ut dolor nisi.
* blandit nulla mi
* at gravida magna
* maximus eu
=== Morbi id sodales sem ===
Nulla id malesuada velit. Mauris ac nisl orci. Donec maximus ex in sapien fringilla mollis. Praesent eu felis bibendum, auctor justo eget, bibendum purus. Nullam egestas, diam et eleifend tempus, ipsum libero auctor mi, quis rutrum neque metus ac tortor. Vestibulum porttitor tempus vulputate.
== Praesent tempor turpis est ==
Nunc scelerisque placerat auctor. Donec vel iaculis risus, non commodo nisl. Duis pretium nisi nibh, ac faucibus metus condimentum nec. Aliquam eu euismod lorem. Aenean sit amet tellus sed massa luctus dignissim. Nam tempor sapien quis felis hendrerit fermentum. Nunc vitae vehicula enim.
-3
View File
@@ -1,3 +0,0 @@
= Buzz Bozz =
Cras nisl dolor, mattis condimentum neque ac, cursus tristique est. Sed vel imperdiet ipsum. Curabitur non dictum tortor. Donec massa justo, cursus at suscipit ornare, tempus a tellus. Praesent at orci mi. Praesent sed odio in leo pulvinar vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed eu leo dui. Fusce vitae laoreet massa. Donec ac tempor lectus. Curabitur eget ligula vel purus efficitur congue. Fusce ut pellentesque magna, eget facilisis nunc.
@@ -1 +0,0 @@
example diary entry for day 1.
@@ -1,3 +0,0 @@
= Day 2 =
another diary entry
@@ -1,5 +0,0 @@
%nohtml
== day 3 ==
and yet *another* diary entry.
@@ -1,17 +0,0 @@
= day 4 =
== subsection 1 ==
here is some code:
{{{
#!/bin/sh
echo "hello world"
}}}
== subsection 2 ==
an important list:
* point 1
* point 2
-35
View File
@@ -1,35 +0,0 @@
= Test Wiki =
This test wiki exists to test various features of VimWiki.
VimWiki Developers: Feel free to *add* to this wiki for additional test features.
Foo bar
foo bar
biz baz
foo\bar
baz{13} <--- this is for testing a literal "baz{13}"
buzzzzz <--- this is for testing regex /buz{5}/
[[buzz_bozz|Buzz Bozz]]
== Lorem ipsum dolor ==
Sit amet, consectetur adipiscing elit. Etiam sed efficitur lectus, sit amet consectetur purus. Vestibulum pulvinar, magna et fermentum aliquet, diam libero blandit ex, quis iaculis dui metus sit amet nulla. Mauris auctor massa magna, eu aliquam neque consequat a. Duis lorem nunc, tempus eu dignissim a, euismod sit amet ex. Duis nec condimentum libero. Nulla iaculis fringilla ante, in posuere lorem maximus vel. Nam pulvinar quis diam non ultrices. Vivamus maximus ipsum a placerat rutrum. Nam et consectetur erat, sodales hendrerit ligula.
== Etiam dapibus iaculis ==
Sed tincidunt vestibulum nunc, in dapibus eros dictum in. Nullam ut dolor nisi.
* blandit nulla mi
* at gravida magna
* maximus eu
=== Morbi id sodales sem ===
Nulla id malesuada velit. Mauris ac nisl orci. Donec maximus ex in sapien fringilla mollis. Praesent eu felis bibendum, auctor justo eget, bibendum purus. Nullam egestas, diam et eleifend tempus, ipsum libero auctor mi, quis rutrum neque metus ac tortor. Vestibulum porttitor tempus vulputate.
== Praesent tempor turpis est ==
Nunc scelerisque placerat auctor. Donec vel iaculis risus, non commodo nisl. Duis pretium nisi nibh, ac faucibus metus condimentum nec. Aliquam eu euismod lorem. Aenean sit amet tellus sed massa luctus dignissim. Nam tempor sapien quis felis hendrerit fermentum. Nunc vitae vehicula enim.
-7
View File
@@ -1,7 +0,0 @@
[[index]]
[[/index]]
[[///tmp/some_page]]
[[//~/testwiki/index]]
[[diary:2020-07-22]]
[[link_syntax/nested]]
[[./link_syntax/nested]]
@@ -1,6 +0,0 @@
[[nested]]
[[/index]]
[[///tmp/some_page]]
[[//~/testwiki/index]]
[[diary:2020-07-22]]
[[../link_syntax]]
@@ -1,7 +0,0 @@
<html>
<body>
<div class="content">
<p><small>Last updated on %date%</small></p>
</div>
</body>
</html>
-6
View File
@@ -1,6 +0,0 @@
files.extend-exclude = ["test", "autoload/vimwiki/emoji.vim", "doc/vimwiki-emoji.txt"]
[default.extend-words]
# For the fo-table
fo = "fo"
Gude = "Gude"
-385
View File
@@ -1,385 +0,0 @@
#!/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)
red='\033[0;31m'
green='\033[0;32m'
nc='\033[0m'
# 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 without with local Vim
bash run_tests.sh -v -t vader -n local -f link_creation.vader issue_markdown.vader
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
}
print_versions() {
# Print the names of all vim/nvim versions
# Get all possible version <- Dockerfile
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
exit 0
}
run_vader() {
# 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
# Remove quotes
i=${i#\'}
i=${i%\'}
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 \
| 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 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
}
run_vint() {
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
}
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" = *'[ DO] (X)'* ]] || \
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
echo -e "$red$REPLY$nc"
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
}
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="$(print_versions)"
# 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)
print_versions
;;
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)
run_vader ; err=$?
echo "Main Vader: returned $err"
o_error=$(( err | o_error ))
;;
vint)
run_vint ; err=$?
echo "Main Vint: returned $err"
o_error=$(( err | o_error ))
;;
all)
run_vint ; err=$?
echo "Main Vint: returned $err"
o_error=$(( err | o_error ))
run_vader ; 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
-68
View File
@@ -1,68 +0,0 @@
Execute (Setup search testing wrapper):
function! TestSearch(search_command, test_name)
" Note: after each search, the location list of the current window (0)
" will contain the search results. A non-empty list indicates success.
" Search for a single word (a pattern with no spaces)
if v:version < 704
Log 'Cheating for old vim version, do not want to reverse bug'
return
endif
redir => output
silent execute a:search_command
redir END
Assert !empty(getloclist(0)), a:test_name.": no location list result"
Assert match(output, '\d of \d') > -1, a:test_name.": no result message"
" Tests that VimwikiSearch is quoting the pattern correctly.
" If not, Vim will see anything after the first space in the pattern
" as a file name and attempt to open it.
Assert match(output, 'Cannot open file') == -1, "'open file': unquoted pattern?"
return output
endfunction
Execute (Search test wiki):
" Open test wiki
edit test/resources/testwiki/index.wiki
" Make sure we opened the test wiki successfully by checking the
" title (first line) and filetype.
AssertEqual "= Test Wiki =", getline(1)
AssertEqual "vimwiki", &filetype
call TestSearch('VimwikiSearch foo', 'pattern with no spaces')
call TestSearch('VimwikiSearch foo bar', 'pattern with spaces')
call TestSearch('VimwikiSearch foo\bar', 'pattern with ''\''')
call TestSearch('VimwikiSearch baz{13}', 'pattern with literal {}')
call TestSearch('VimwikiSearch /\vbuz{5}/', 'proper regex')
call TestSearch('VWS foo bar', 'use VWS abbreviation')
Execute (Search space path wiki):
" Open wiki with spaces in path to test fname escaping
edit test/resources/testwiki\ space/index.wiki
" Make sure we opened the space path wiki successfully
AssertEqual "= Space Path Wiki =", getline(1)
call TestSearch('VimwikiSearch foo', 'simple search in space path wiki')
Execute (Search failure message):
" Important note: No search tests will succeed after this.
" The failed search will cause a Vim error to be thrown and
" any search with lvimgrep within Vader will result in an
" empty location list and empty messages queue. It is
" difficult to tell if the search itself is failing or if it
" is just an inability to view the results.
" Open test wiki again
edit test/resources/testwiki/index.wiki
" Now test a negative search and make sure we are returning
" the expected VimWiki error.
redir => output
silent VimwikiSearch not_exist
redir END
if v:version > 703
Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"
endif
-816
View File
@@ -1,816 +0,0 @@
# Syntax and Highlight
# 0 Escape {{{1
#################
Given vimwiki (Markdown typeface with escape sequence #1044: _ __ * ** {{{2):
This is 14 | 1
__bold from begining__ 2
\__not bold even from begin \__ 3
and __t \__ is still bold__ Bold 4
and _ita\_ alic continues and end_ Italic 5
*this\* \* is italic also* Italic 6
a ^taa is supperscrit^ Sup 7
,,subaaa subscript end,, Sub 8
a ~~staaill deleted~~ Del 9
$$Eq\$$ uation follows$ Math 10
`code \` not finished inline` Code 11
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax of escape typeface):
AssertEqual '1' , SyntaxAt(1, 14) . 1
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 14) . 2
AssertEqual '3' , SyntaxAt(3, 14) . 3
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
" See: #1303 where an escape start can close the region
AssertEqual '6' , SyntaxAt(6, 14) . 6
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 14) . 7
AssertEqual 'VimwikiSubScript8' , SyntaxAt(8, 14) . 8
AssertEqual 'VimwikiDelText9' , SyntaxAt(9, 14) . 9
AssertEqual 'VimwikiMath10' , SyntaxAt(10, 14) . 10
AssertEqual 'textSnipTEX11' , SyntaxAt(11, 14) . 11
Given vimwiki (Markdown pre with escape sequence #1044: _ __ * ** {{{2):
```
pre
\```
pre
```
Execute (Assert Syntax of escape pre):
AssertEqual 'VimwikiPreDelim1' , SyntaxAt(1, 1) . 1
AssertEqual 'VimwikiPre2' , SyntaxAt(2, 1) . 2
AssertEqual 'VimwikiPre3' , SyntaxAt(3, 1) . 3
AssertEqual 'VimwikiPre4' , SyntaxAt(4, 1) . 4
AssertEqual 'VimwikiPreDelim5' , SyntaxAt(5, 1) . 5
# 1 Typeface {{{1
#################
Given vimwiki (Markdown with punctuation #340 {{{2):
__bold__, not bold
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax (alpha)):
AssertEqual 'VimwikiBold1' , SyntaxAt(1, 5) . 1
AssertEqual '2' , SyntaxAt(1, 16) . 2
Given vimwiki (Markdown bad __this_not_it__ {{{2):
See here 14 |
s2n_error 2
s*n*er_r_ 3
n4rmal_aaaaaaaaaaaaaaaaaaaa_text_ 4
n5t_italiccccccccccccccccccccc_no 5
n6t_italiccccccccccccccccccccccno 6
n7t*italiccccccccccccccccccccc*si 7
n8taitalicccccccccccccccccccccasi 8
__not_italicccccccccc_but_boldd__ 9
_a_asdasda_asdas_asdas_asdasda_a_ 10
_jitaliccccccccccccccccccccccccc_ 11
n12ormalllllllllllllllllllllllll_ 12
_italic if at end of file unfortunately
Note: The decision to start a region is only based on a matching start
pattern. There is no check for a matching end pattern. This does NOT
work: (:h syn-region)
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax (bravo)):
AssertEqual 'VimwikiError2' , SyntaxAt(2, 4) . 2
" See: #1303 where the * is now accepted in the middle of the words
" So no more trick like in _
" syn match VimwikiError "\w\@<=_\w\@=" remove the *
AssertEqual 'VimwikiDelimiter3' , SyntaxAt(3, 4) . 3
AssertEqual '4' , SyntaxAt(4, 14) . 4
AssertEqual '5' , SyntaxAt(5, 14) . 5
AssertEqual '6' , SyntaxAt(6, 14) . 6
AssertEqual 'VimwikiItalic7' , SyntaxAt(7, 14) . 7
AssertEqual '8' , SyntaxAt(8, 14) . 8
AssertEqual 'VimwikiBold9' , SyntaxAt(9, 14) . 9
AssertEqual '10' , SyntaxAt(10, 14) . 10
AssertEqual 'VimwikiItalic11' , SyntaxAt(11, 14) . 11
AssertEqual '12' , SyntaxAt(12, 14) . 12
AssertEqual 'VimwikiItalic13' , SyntaxAt(13, 14) . 13
Given vimwiki (bold and pre {{{2):
__startbold
```
pre
```
__endbold
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax (charlie)):
AssertEqual 'VimwikiPre' , SyntaxAt(3, 1)
# Emphasis stricker {{{2
# See: https://github.github.com/gfm/#emphasis-and-strong-emphasis
Given vimwiki (Emphasis and not):
this __bold__ ok 1
this _italic_ ok 2
t__ no bold __ t 3
t_ no ital _ t 4
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax (delta)):
AssertEqual 'VimwikiBold1' , SyntaxAt(1, 9) . 1
AssertEqual 'VimwikiItalic2' , SyntaxAt(2, 9) . 2
AssertEqual '3' , SyntaxAt(3, 9) . 3
AssertEqual '4' , SyntaxAt(4, 9) . 4
# With vimwiki_hl_cb_checked {{{2
Given vimwiki (task list with code):
Normal syntax
- [X] Lorem __sit__ `sed do eiusmod
tempor` incididunt ut labore et dolore magna aliqua
Normal syntax
Execute (let g:vimwiki_hl_cb_checked = 1):
let g:vimwiki_hl_cb_checked = 1
unlet g:vimwiki_syntaxlocal_vars
call vimwiki#vars#init()
call SetSyntax('markdown')
Execute (Assert Done Syntax 1):
AssertEqual '' , SyntaxAt(1, 7)
AssertEqual 'VimwikiCheckBoxDone', SyntaxAt(2, 7)
AssertEqual 'VimwikiCode' , SyntaxAt(3, 7)
AssertEqual '' , SyntaxAt(4, 7)
Given vimwiki (task list with code):
Normal syntax
- [X] Lorem __sit__ `sed do eiusmod
tempor` incididunt ut labore et dolore magna aliqua
Normal syntax
Execute (let g:vimwiki_hl_cb_checked = 2):
let g:vimwiki_hl_cb_checked = 2
unlet g:vimwiki_syntaxlocal_vars
call vimwiki#vars#init()
call SetSyntax('markdown')
Execute (Assert Done Syntax 2):
AssertEqual '' , SyntaxAt(1, 7)
AssertEqual 'VimwikiCheckBoxDone', SyntaxAt(2, 7)
AssertEqual 'VimwikiCheckBoxDone', SyntaxAt(3, 7)
AssertEqual '' , SyntaxAt(4, 7)
# Extended types {{{2
Given vimwiki (Extended Types mono):
`code `
~~ strike ~~
$ equation $
^superscript ^
,, subscript ,,
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax extended types x 1):
AssertEqual 'VimwikiCode' , SyntaxAt(1, 8)
AssertEqual 'VimwikiDelText' , SyntaxAt(2, 8)
AssertEqual 'textSnipTEX' , SyntaxAt(3, 8)
AssertEqual 'VimwikiSuperScript' , SyntaxAt(4, 8)
AssertEqual 'VimwikiSubScript' , SyntaxAt(5, 8)
Given vimwiki (Extended Types nested in basic):
From __bold `code in bold ` end of bold__ morF
From _it and ~~ strieout in i~~ end of it_ morF
From __bold $ equation $ end bold __
**bold ^superscript ^ end of bold morF**
From normal ,, subscript ,, still normal morF
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax extended types x 2):
AssertEqual 'VimwikiCode' , SyntaxAt(1, 23)
AssertEqual 'VimwikiDelText' , SyntaxAt(2, 23)
AssertEqual 'textSnipTEX' , SyntaxAt(3, 23)
AssertEqual 'VimwikiSuperScript' , SyntaxAt(4, 23)
AssertEqual 'VimwikiSubScript' , SyntaxAt(5, 23)
Given vimwiki (Extended Types nested in extended):
From ^super to`code this ` is crazy but^ morF
From ,,sub to~~ strike ~~why not,, morF
From ~~strike $ equation $ end of strike~~morF
From $eq to ^super ^ Just inline morF$
From ^super t,,sub ,, end super eol ^
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax extended types nested in extended):
AssertEqual 'VimwikiCode' , SyntaxAt(1, 23)
AssertEqual 'VimwikiDelText' , SyntaxAt(2, 23)
AssertEqual 'textSnipTEX' , SyntaxAt(3, 23)
AssertEqual 'textSnipTEX' , SyntaxAt(4, 23)
AssertEqual 'VimwikiSubScript' , SyntaxAt(5, 23)
Given vimwiki (Basic Types nested in extended):
From ^super __bold __ is crazy but^ morF
From ,,sub _italic with en_ aaaaaaa,, morF
From $eq to **boldboldboldbo** aaaaaaaaa $
From ^super *italic aaaaaaa*aaaaaaaaaaaaaaaaaaaaa
From ~~strik __bbbbbbbbbbbbb__ssssssssssssssssss~~
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax basic types nested in extended):
AssertEqual 'VimwikiBold1' , SyntaxAt(1, 23) . 1
AssertEqual 'VimwikiItalic2' , SyntaxAt(2, 23) . 2
AssertEqual 'textSnipTEX3' , SyntaxAt(3, 23) . 3
AssertEqual 'VimwikiItalic4' , SyntaxAt(4, 23) . 4
AssertEqual 'VimwikiBold5' , SyntaxAt(5, 23) . 5
Given vimwiki (Try to nest in code):
From `codeto__no onenest in code__ end`
From `codeto _no onenest in code_ end`
From `codeto ^no onenest in code^ end`
From `codeto ~~no onenest in code~~ end`
From `codeto ___no onenest in code___ end`
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax extended types nested in extended):
AssertEqual 'VimwikiCode' , SyntaxAt(1, 23)
AssertEqual 'VimwikiCode' , SyntaxAt(2, 23)
AssertEqual 'VimwikiCode' , SyntaxAt(3, 23)
AssertEqual 'VimwikiCode' , SyntaxAt(4, 23)
AssertEqual 'VimwikiCode' , SyntaxAt(5, 23)
Given vimwiki (Multiline Typfaces Basic and extended):
__and bold
multiline__
_and it
mutliline_
~~and mutltie
strikeout~~
`
and mutli
path
`
but no $ multi
equation
$
^ but no multi
sup ^
,,
but no multi
sub ,,
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Multiline syantax but not sup and sub):
AssertEqual 'VimwikiBold' , SyntaxAt(2, 1)
AssertEqual 'VimwikiItalic' , SyntaxAt(5, 1)
AssertEqual 'VimwikiDelText' , SyntaxAt(8, 1)
AssertEqual 'VimwikiCode' , SyntaxAt(11, 1)
AssertEqual '' , SyntaxAt(14, 1)
AssertEqual '' , SyntaxAt(17, 1)
AssertEqual '' , SyntaxAt(20, 1)
# HTML types {{{2
# Rememner Bold > Italic > Underline (my convention [tinmarino])
Given vimwiki (Typeface for Italic var_with_underscore):
var_with_underscore
_this is
italic_
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax for typeface 1):
AssertEqual '' , SyntaxAt(1, 1)
AssertEqual 'VimwikiError' , SyntaxAt(1, 4)
AssertEqual '' , SyntaxAt(1, 5)
AssertEqual 'VimwikiItalic' , SyntaxAt(2, 2)
AssertEqual 'VimwikiItalic' , SyntaxAt(3, 2)
Given vimwiki (Typeface for html 1 like italic):
<b> ---- this is bold text 1 ---- </b>
<strong> - this is bold 2 - </strong>
<i> Italic 1 --cacacacacacacaca-- </i>
<em> Italic 2 -cacacacacacacaca- </em>
<u> Underline -cacacacacc acaca- </u>
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax for typeface 1):
AssertEqual 'VimwikiBold' , SyntaxAt(1, 15)
AssertEqual 'VimwikiBold' , SyntaxAt(2, 15)
AssertEqual 'VimwikiItalic' , SyntaxAt(3, 15)
AssertEqual 'VimwikiItalic' , SyntaxAt(4, 15)
AssertEqual 'VimwikiUnderline' , SyntaxAt(5, 15)
Given vimwiki (Typeface for html 2 like italicUnderline):
<b> bold this is bold<i>bold italic ---------</i> text 1 ---- </b>
<strong> - this is bo<u>bold underline ------</u>d 2 - </strong>
<i> Italic 1 --cacaca<b>bold italic----------</b>acacacaca-- </i>
<em> Italic 2 -cacaca<u>italic underline-----</u>cacacaca- </em>
<u> Underline -cacaca<b>bold underline-------</b>asacc acaca- </u>
<u> Underline -cacaca<i>italic underline-----</i>asdacacc acaca- </u>
Execute (Assert Syntax for typeface 2):
AssertEqual 'VimwikiBoldItalic' , GetSyntaxGroup(1, 30)
AssertEqual 'VimwikiBoldUnderline' , GetSyntaxGroup(2, 30)
AssertEqual 'VimwikiBoldItalic' , GetSyntaxGroup(3, 30)
AssertEqual 'VimwikiItalicUnderline', GetSyntaxGroup(4, 30)
AssertEqual 'VimwikiBoldUnderline' , GetSyntaxGroup(5, 30)
AssertEqual 'VimwikiItalicUnderline', GetSyntaxGroup(6, 30)
Given vimwiki (Typeface for html 3 like boldItalicUnderline):
<b><i><u> bold italic underline </u></i></b>
<b><u><i> bold italic underline </i></u></b>
<i><b><u> bold italic underline </u></b></i>
<i><u><b> bold italic underline </b></u></i>
<u><b> <i> bold italic underline </i> </b></u>
<u><i><b> bold italic underline </b></i></u>
Execute (Assert Syntax for typeface 3):
AssertEqual 'VimwikiBoldItalicUnderline1', GetSyntaxGroup(1, 22).1
AssertEqual 'VimwikiBoldItalicUnderline2', GetSyntaxGroup(2, 22).2
AssertEqual 'VimwikiBoldItalicUnderline3', GetSyntaxGroup(3, 22).3
AssertEqual 'VimwikiBoldItalicUnderline4', GetSyntaxGroup(4, 22).4
AssertEqual 'VimwikiBoldItalicUnderline5', GetSyntaxGroup(5, 22).5
AssertEqual 'VimwikiBoldItalicUnderline6', GetSyntaxGroup(6, 22).6
# Keyword uppercase {{{2
Given vimwiki (TODO, XXX):
TODO
DONE
STARTED
FIXME
FIXED
XXX
Execute (Assert Syntax VimwikiTodo):
AssertEqual SyntaxAt(1, 1), 'VimwikiTodo'
AssertEqual SyntaxAt(2, 1), 'VimwikiTodo'
AssertEqual SyntaxAt(3, 1), 'VimwikiTodo'
AssertEqual SyntaxAt(4, 1), 'VimwikiTodo'
AssertEqual SyntaxAt(5, 1), 'VimwikiTodo'
AssertEqual SyntaxAt(6, 1), 'VimwikiTodo'
Given vimwiki (custom TODO words):
NOW
LATER
DONE
TODO
Execute (set custom syntax):
call vimwiki#vars#set_wikilocal('rx_todo', '\C\<\%(NOW\|LATER\|DONE\)\>', vimwiki#vars#get_bufferlocal('wiki_nr'))
call SetSyntax('markdown')
Execute (Assert Syntax VimwikiTodo):
AssertEqual 'VimwikiTodo1', SyntaxAt(1, 1) . 1
AssertEqual 'VimwikiTodo2', SyntaxAt(2, 1) . 2
AssertEqual 'VimwikiTodo3', SyntaxAt(3, 1) . 3
AssertEqual '4' , SyntaxAt(4, 1) . 4
Execute (Restore VimwikiTodo):
call vimwiki#vars#init()
call SetSyntax('markdown')
# Mardown types {{{2
Given vimwiki (Typeface for markdown like italic):
**bold text 1**
__bold text 2__
*italic text 1*
_italic text 2_
***bold italic text 1***
___bold italic text 2___
~~strikeout text~~
`code (no syntax) text`
sp^script^
sb,,script,,
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax for typeface):
AssertEqual 'VimwikiBold' , SyntaxAt(1, 5)
AssertEqual 'VimwikiBold' , SyntaxAt(2, 5)
AssertEqual 'VimwikiItalic' , SyntaxAt(3, 5)
AssertEqual 'VimwikiItalic' , SyntaxAt(4, 5)
AssertEqual 'VimwikiBoldItalic' , SyntaxAt(5, 5)
AssertEqual 'VimwikiBoldItalic' , SyntaxAt(6, 5)
AssertEqual 'VimwikiDelText' , SyntaxAt(7, 5)
AssertEqual 'VimwikiCode' , SyntaxAt(8, 5)
AssertEqual 'VimwikiSuperScript' , SyntaxAt(9, 5)
AssertEqual 'VimwikiSubScript' , SyntaxAt(10, 5)
# 2 Links {{{1
#################
Given vimwiki (Wiki Links):
Plain link: >
[[This is a link]]
With description: >
[[This is a link source|Description of the link]]
Interwiki1: >
[[wiki1:This is a link]]
Interwiki2: >
[[wn.My Name:This is a link]]
Interwiki3: >
[[wn.MyWiki:This is a link source|Description of the link]]
Diary: >
[[diary:2012-03-05]]
Anchor1: >
[[Todo List#Tomorrow|Tasks for tomorrow]]
Anchor2: >
[[#Tomorrow]]
Raw1: >
https://github.com/vimwiki/vimwiki.git
Raw2: >
mailto:habamax@gmail.com
Raw3: >
ftp://vim.org
File1: >
[[file:/home/somebody/a/b/c/music.mp3]]
File2: >
[[file:C:/Users/somebody/d/e/f/music.mp3]]
File3: >
[[file:~/a/b/c/music.mp3]]
File4: >
[[file:../assets/data.csv|Important Data]]
File5: >
[[local:C:/Users/somebody/d/e/f/music.mp3]]
File6: >
[[file:/home/user/documents/|Link to a directory]]
Thumbnail links: >
[[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]]
Execute (Assert Syntax link):
AssertEqual 'VimwikiLink', SyntaxAt(2, 6)
AssertEqual 'VimwikiLink', SyntaxAt(4, 6)
AssertEqual 'VimwikiLink', SyntaxAt(6, 6)
AssertEqual 'VimwikiLink', SyntaxAt(8, 6)
AssertEqual 'VimwikiLink', SyntaxAt(10, 6)
AssertEqual 'VimwikiLink', SyntaxAt(12, 6)
AssertEqual 'VimwikiLink', SyntaxAt(14, 6)
AssertEqual 'VimwikiLink', SyntaxAt(16, 6)
AssertEqual 'VimwikiLink', SyntaxAt(18, 6)
AssertEqual 'VimwikiLink', SyntaxAt(20, 6)
AssertEqual 'VimwikiLink', SyntaxAt(22, 6)
AssertEqual 'VimwikiLink', SyntaxAt(24, 6)
AssertEqual 'VimwikiLink', SyntaxAt(26, 6)
AssertEqual 'VimwikiLink', SyntaxAt(28, 6)
AssertEqual 'VimwikiLink', SyntaxAt(30, 6)
AssertEqual 'VimwikiLink', SyntaxAt(32, 6)
AssertEqual 'VimwikiLink', SyntaxAt(34, 6)
AssertEqual 'VimwikiLink', SyntaxAt(36, 6)
Given vimwiki (Markdown Links):
Inline link: >
[Looks like this](URL)
Image link: >
![Looks like this](URL)
Reference-style links: >
a) [Link Name][Id]
b) [Id][], using the "implicit link name" shortcut
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax link):
AssertEqual 'VimwikiWeblink1' , SyntaxAt(2, 8)
AssertEqual 'VimwikiImage' , SyntaxAt(5, 8)
AssertEqual 'VimwikiWikiLink1' , SyntaxAt(8, 8)
AssertEqual 'VimwikiWikiLink1' , SyntaxAt(9, 8)
# 3 Header {{{1
###############
Given vimwiki (Markdown SetExt Headers):
One
===
two
---
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax Header SetExt):
AssertEqual 'VimwikiHeader1', SyntaxAt(1, 1)
AssertEqual 'VimwikiHeader1', SyntaxAt(2, 1)
AssertEqual 'VimwikiHeader2', SyntaxAt(3, 1)
AssertEqual 'VimwikiHeader2', SyntaxAt(4, 1)
Given vimwiki (Wiki Headers):
= Header level 1 =
== Header level 2 ==
=== Header level 3 ===
==== Header level 4 ====
===== Header level 5 =====
====== Header level 6 ======
Execute (Set syntax default):
call SetSyntax('default')
Execute (Assert Wiki Syntax Header):
AssertEqual 'VimwikiHeader1', SyntaxAt(1, 10)
AssertEqual 'VimwikiHeader2', SyntaxAt(2, 10)
AssertEqual 'VimwikiHeader3', SyntaxAt(3, 10)
AssertEqual 'VimwikiHeader4', SyntaxAt(4, 10)
AssertEqual 'VimwikiHeader5', SyntaxAt(5, 10)
AssertEqual 'VimwikiHeader6', SyntaxAt(6, 10)
Given vimwiki (Markdown Headers):
# Header level 1
## Header level 2
### Header level 3
#### Header level 4
##### Header level 5
###### Header level 6
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Markdown Syntax Header):
Log "Syntax of first heading: " . string(GetSyntaxStack())
Log "Regex of rxListWithoutCb: " . vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
Log "Bullet types: " . string(vimwiki#vars#get_wikilocal('bullet_types'))
AssertEqual 'VimwikiHeader1' , SyntaxAt(1, 10)
AssertEqual 'VimwikiHeader2' , SyntaxAt(2, 10)
AssertEqual 'VimwikiHeader3' , SyntaxAt(3, 10)
AssertEqual 'VimwikiHeader4' , SyntaxAt(4, 10)
AssertEqual 'VimwikiHeader5' , SyntaxAt(5, 10)
AssertEqual 'VimwikiHeader6' , SyntaxAt(6, 10)
# 4 Blockquote {{{1
# Issues: #55
###############
#### 4.1 Blokquotes markdown
Given vimwiki (BlockQuote restarts list numbering #55 {{{3):
1. Item 1
2. Item 2
Block Quote
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Gototo):
Gototo
Expect (Good numbering):
1. Item 1
2. Item 2
Block Quote
3. toto
# 9 Comment {{{1
###############
Given vimwiki (%%):
%% This is a line comment
%% This is also a comment
Execute (Set syntax default):
call SetSyntax('default')
Execute (Assert Syntax VimwikiComment):
AssertEqual 'VimwikiComment' , SyntaxAt(1, 1)
AssertEqual 'VimwikiComment' , SyntaxAt(2, 4)
Given vimwiki (%%+, +%%):
%%+ This
is a
multiline
comment +%%
%%+ This is a comment on one line +%%
%%+ One +%% Not a comment %%+ Two +%% Not a comment
Execute (Set syntax default):
call SetSyntax('default')
Execute (Assert Syntax VimwikiMultilineComment):
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(1, 1)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(1, 8)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(2, 1)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(3, 1)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(4, 1)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(5, 1)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 1)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 11)
AssertEqual '' , SyntaxAt(6, 12)
AssertEqual '' , SyntaxAt(6, 26)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 27)
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 37)
AssertEqual '' , SyntaxAt(6, 38)
AssertEqual '' , SyntaxAt(6, 51)
# 10 Code {{{1
# 10.1 Code Indent (4 spaces) {{{2
#################################
Given vimwiki (Code indent):
this is markdown
this is code
Execute (Assert Syntax normal (i.e. no hi)):
AssertEqual SyntaxAt(1, 5), ''
AssertEqual SyntaxAt(2, 5), ''
# 10.2 Code Inline (1 backtick) {{{2
###################################
Given vimwiki (Code inline):
Well use the `man`
Execute (Assert Syntax Code):
AssertEqual SyntaxAt(1, 16), 'VimwikiCode'
# 10.3 Code Block (3 backtiks) {{{2
##################################
Given vimwiki (Markdown, Text and Vim):
this is markdown
this is TODO
```
this is text
```
```vim
" this is vim
set hlsearch
```
`````vim
" this is vim
set hlsearch
`````
~~~vim
" this is vim
set hlsearch
~~~
~~~~~vim
" this is vim
set hlsearch
~~~~~~~~~~~
Execute (Set syntax markdown):
let g:vimwiki_global_vars['vimwiki_automatic_nested_syntaxes'] = 1
call SetSyntax('markdown')
Execute (Assert ft, normal syntax and VimwikiTodo):
AssertEqual &ft, 'vimwiki'
AssertEqual '', SyntaxAt(1, 1)
AssertEqual 'VimwikiTodo', SyntaxAt(2, 9)
Execute (Assert Code syntax):
AssertEqual 'VimwikiPreDelim', SyntaxAt(4, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(5, 1)
AssertEqual 'vimLineComment' , SyntaxAt(9, 1)
AssertEqual 'vimCommand' , SyntaxAt(10, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(13, 1)
AssertEqual 'vimLineComment' , SyntaxAt(14, 1)
AssertEqual 'vimCommand' , SyntaxAt(15, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(16, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(18, 1)
AssertEqual 'vimLineComment' , SyntaxAt(19, 1)
AssertEqual 'vimCommand' , SyntaxAt(20, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(21, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(23, 1)
AssertEqual 'vimLineComment' , SyntaxAt(24, 1)
AssertEqual 'vimCommand' , SyntaxAt(25, 1)
AssertEqual 'VimwikiPre' , SyntaxAt(26, 1)
# 11 Math {{{1
# 11.1 Math Markdown {{{2
#######################
Given vimwiki (Math markdown):
math inline: $ aaaaaaaaaaaaaa \sum_i a_i^2 = 1 $
math block:
$$
\sum_i a_i^2
=
1
$$
math block env:
$$%align%
\sum_i a_i^2 &= 1 + 1 \\
&= 2.
$$
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert math syntax 1):
AssertEqual 'textSnipTEX', SyntaxAt(1, 18)
let syntax_5 = SyntaxAt(5, 1)
Assert syntax_5 == 'texStatement' || syntax_5 == 'texMathSymbol'
let syntax_12 = SyntaxAt(12, 1)
Assert syntax_12 == 'texStatement' || syntax_5 == 'texMathSymbol'
# 11.2 Math Wiki {{{2
##############################
Given vimwiki (Math wiki):
math inline: $aaaaaaaaaaaaaaaaaaaaaaaaaa \sum_i a_i^2 = 1 $
math block:
{{$
\sum_i a_i^2
=
1
}}$
math block env:
{{$%align%
\sum_i a_i^2 &= 1 + 1 \\
&= 2.
}}$
Execute (Set syntax default):
call SetSyntax('default')
Execute (Assert math syntax 2):
AssertEqual 'textSnipTEX', SyntaxAt(1, 18)
let syntax_5 = SyntaxAt(5, 1)
Assert syntax_5 == 'texStatement' || syntax_5 == 'texMathSymbol'
let syntax_12 = SyntaxAt(12, 1)
Assert syntax_12 == 'texStatement' || syntax_5 == 'texMathSymbol'
# 21 Highlight {{{1
##################
Given vimwiki (One line):
content
# GetHighlightTerm relies on execute(), which isn't available in all 7.4
# versions. Just test this for 8.0 and up to keep things simple:
Execute (Assert highlight typeface 1):
" Typeface 1
call AssertIfVersion(800, ['bold'], GetHighlightTerm('VimwikiBold', 'term'))
call AssertIfVersion(800, ['bold'], GetHighlightTerm('VimwikiBold', 'cterm'))
call AssertIfVersion(800, ['bold'], GetHighlightTerm('VimwikiBold', 'gui'))
call AssertIfVersion(800, ['italic'], GetHighlightTerm('VimwikiItalic', 'cterm'))
call AssertIfVersion(800, ['underline'], GetHighlightTerm('VimwikiUnderline', 'gui'))
Execute (Assert highlight typeface 2):
" Bold > Italic > Underline
call AssertIfVersion(800, sort(['bold', 'italic', '1']), sort(add(GetHighlightTerm('VimwikiBoldItalic', 'gui'), '1')))
call AssertIfVersion(800, sort(['bold', 'italic', '2']), sort(add(GetHighlightTerm('VimwikiBoldItalic', 'term'), '2')))
call AssertIfVersion(800, sort(['bold', 'underline', '3']), sort(add(GetHighlightTerm('VimwikiBoldUnderline', 'cterm'), '3')))
call AssertIfVersion(800, sort(['bold', 'underline', '4']), sort(add(GetHighlightTerm('VimwikiUnderlineBold', 'term'), '4')))
call AssertIfVersion(800, sort(['italic', 'underline', '5']), sort(add(GetHighlightTerm('VimwikiItalicUnderline', 'cterm'), '5')))
Execute (Assert highlight typeface 3):
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '1']), sort(add(GetHighlightTerm('VimwikiBoldItalicUnderline', 'gui'), '1')))
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '2']), sort(add(GetHighlightTerm('VimwikiBoldUnderlineItalic', 'cterm'), '2')))
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '3']), sort(add(GetHighlightTerm('VimwikiItalicBoldUnderline', 'term'), '3')))
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '4']), sort(add(GetHighlightTerm('VimwikiItalicUnderlineBold', 'gui'), '4')))
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '5']), sort(add(GetHighlightTerm('VimwikiUnderlineBoldItalic', 'cterm'), '5')))
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '6']), sort(add(GetHighlightTerm('VimwikiUnderlineItalicBold', 'term'), '6')))
Expect (One line):
content
# vim: foldmethod=marker foldlevel=30 sw=2
-171
View File
@@ -1,171 +0,0 @@
# Github Favor Markdown Typeface
# https://github.github.com/gfm
# 6.4 Emphasis and strong emphasis
# Rule 1 {{{1
# A single * character can open emphasis iff (if and only if) it is part of a left-flanking delimiter run.'
#################
Given vimwiki (Typeface: https://github.github.com/gfm/#example-360):
*foo bar*
Execute (Log rule):
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Italic'
AssertEqual 'VimwikiItalic', SyntaxAt(1, 2)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-361):
a * foo bar*
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'This is not emphasis, because the opening * is followed by whitespace, and hence not part of a left-flanking delimiter'
AssertEqual '', SyntaxAt(1, 5)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-362):
todo TODO
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'TODO'
AssertEqual '', SyntaxAt(1, 5)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-363):
* a *
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Unicode nonbreaking spaces count as whitespace, too'
AssertEqual '', SyntaxAt(1, 3)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-364):
foo*bar*
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Intraword emphasis with * is permitted:'
AssertEqual 'VimwikiItalic', SyntaxAt(1, 5)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-365):
5*6*78
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
# Rule 2 {{{1
# A single _ character can open emphasis iff it is part of a left-flanking delimiter run and either (a) not part of a right-flanking delimiter run or (b) part of a right-flanking delimiter run preceded by punctuation.
#################
Given vimwiki (Typeface: https://github.github.com/gfm/#example-366):
_foo bar_
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Italic'
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-367):
_ foo bar_
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'This is not emphasis, because the opening _ is followed by whitespace'
AssertEqual '', SyntaxAt(1, 3)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-368):
a_"foo"_
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Italic'
AssertEqual '', SyntaxAt(1, 4)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-369):
foo_bar_
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Emphasis with _ is not allowed inside words'
AssertEqual '', SyntaxAt(1, 5)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-370):
* 5_6_78
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
AssertEqual '', SyntaxAt(1, 3)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-371):
CommentLine 'Not emphasis in middle even if unicode alphanumeric before left delimiter'
пристаням_стремятся_
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
AssertEqual '', SyntaxAt(1, 22)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-372):
* aa_"bb"_cc
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'Here _ does not generate emphasis, because the first delimiter run is right-flanking and the second left-flanking'
AssertEqual '', SyntaxAt(1, 5)
Given vimwiki (Typeface: https://github.github.com/gfm/#example-373):
foo-_(bar)_
Execute (Set Markdown):
call SetSyntax('markdown')
Execute (Assert Syntax):
CommentLine 'This is emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation'
AssertEqual 'VimwikiItalic', SyntaxAt(1, 7)
# Rule 3 {{{1
# TODO Test 3
# vim: foldmethod=marker foldlevel=30 sw=2
-88
View File
@@ -1,88 +0,0 @@
# Table autoformating
# Very configurable: read doc/design_notes.md
# Move <Tab> at end of row if next row is badly formated {{{1
# See #1126
##########################
Given vimwiki (Header ok but 1 row bad):
| Service to be Build | Build Tag | Service to Deploy | Deploy Tag | Comments |
|---------------------|-----------|-------------------|------------|----------|
|||Provision/Core/Keycloak|release-3.8.0_RC9|This was done as part of release-3.7.0 hotfix and is not required if you are already on Keycloak 7|
|||Provision/DataPipeline/AnalyticsSpark|release-3.8.0_RC6||
|||OpsAdministration/Core/ESMapping|release-3.8.0_RC9|Choose `userv1,orgv2` for jenkins job parameter `indices_name`|
Do (i<tab> at end of first line):
$i\<Tab>
Expect(Crash (List required)):
# E714: List required <= tbl#goto_next_col, line 9
| Service to be Build | Build Tag | Service to Deploy | Deploy Tag | Comments |
|---------------------|-----------|-------------------|------------|----------|
|||Provision/Core/Keycloak|release-3.8.0_RC9|This was done as part of release-3.7.0 hotfix and is not required if you are already on Keycloak 7|
|||Provision/DataPipeline/AnalyticsSpark|release-3.8.0_RC6||
|||OpsAdministration/Core/ESMapping|release-3.8.0_RC9|Choose `userv1,orgv2` for jenkins job parameter `indices_name`|
# Move <Tab> and <S-Tab> map {{{1
# See #1048
##########################
Given vimwiki (Table Number):
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
Execute (testmap):
imap testmap1 <Plug>VimwikiTableNextCell
imap testmap2 <Plug>VimwikiTablePrevCell
Do (2 x Next):
gga
testmap1
testmap1
\<Del>Z
Expect (One Z in B):
| A | Z | C |
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
Do (4 X Next):
gga
testmap1
testmap1
testmap1
testmap1
\<Del>Z
Expect (One Z in 1):
| A | B | C |
|---|---|---|
| Z | 2 | 3 |
| 4 | 5 | 6 |
Do (4 X Next + 1 X Prev):
gga
testmap1
testmap1
testmap1
testmap1
testmap1
testmap2
\<Del>Z
Expect (One Z in 1):
| A | B | C |
|---|---|---|
| Z | 2 | 3 |
| 4 | 5 | 6 |
Execute (Clean #1048):
iunmap testmap1
iunmap testmap2
# vim: foldmethod=marker foldlevel=30
-240
View File
@@ -1,240 +0,0 @@
# Table autoformating
# Very configurable: read doc/design_notes.md
# Do not consider \| {{{1
##########################
Given vimwiki (Table with \| #281):
| Head1 | Head2 |
| --- | --- |
| l1_1 | l1_2 |
| l2_1 \| with escaped pipe | l2_2 |
Execute (Rename file wiki_test.md for table expand):
file wiki_test.md
call SetSyntax('markdown')
Do (A to trigger insertLeave #281):
A
Expect(Table aligned with \| in cells):
| Head1 | Head2 |
| --- | --- |
| l1_1 | l1_2 |
| l2_1 \| with escaped pipe | l2_2 |
# Do not alter config {{{1
##########################
Given vimwiki (Table Head \#891):
| foo | bar |
Execute (set tw=71):
set tw=71
AssertEqual &tw, 71
Do (A<Cr>):
A\<Cr>\<Esc>
Expect (Table Head \#891):
| foo | bar |
| | |
Execute (Assert tw=71):
AssertEqual &tw, 71
# Autoformat {{{1
#################
Given vimwiki (Unaligned table):
| title1 | title2 |
| - | - |
| a1 | b1 |
| a2 | |
Execute (Rename file wiki_test.md for table expand):
file wiki_test.md
Do (A to trigger insertLeave):
A
Expect (Table autoformat):
| title1 | title2 |
| - | - |
| a1 | b1 |
| a2 | |
Do (gqq to reformats table after making changes.):
gqq
Expect (Table autoformat):
| title1 | title2 |
| - | - |
| a1 | b1 |
| a2 | |
Execute (Option table_reduce_last_col = 1):
let g:vimwiki_global_vars['table_reduce_last_col'] = 1
Do (A to trigger insertLeave):
A
Expect (Last column not expanded):
| title1 | title2 |
| - | - |
| a1 | b1 |
| a2 | |
Execute (Option table_reduce_last_col = 0 [restore]):
let g:vimwiki_global_vars['table_reduce_last_col'] = 0
Execute (Option table_auto_fmt = 0):
let g:vimwiki_global_vars['table_auto_fmt'] = 0
Expect (Same as input):
| title1 | title2 |
| - | - |
| a1 | b1 |
| a2 | |
Execute (Option table_auto_fmt = 1 [restore]):
let g:vimwiki_global_vars['table_auto_fmt'] = 1
# Move and edit cells {{{1
##########################
Do (Use <Tab> in insert mode):
GI
\<Tab>
this_is_16_chars
\<Tab>
this_is_16_chars
\<Esc>
Expect (Table autoformated with more content):
| title1 | title2 |
| - | - |
| a1 | b1 |
| this_is_16_charsa2 | this_is_16_chars |
Do (VimwikiTableMoveColumnRight):
gg:VimwikiTableMoveColumnRight\<CR>
Expect (Column inverted):
| title2 | title1 |
| - | - |
| b1 | a1 |
| | a2 |
Do (CR must insert new row):
GI\<Cr>a3
Expect (Table with new row starting by a3):
| title1 | title2 |
| - | - |
| a1 | b1 |
| a2 | |
| a3 | |
# VimwikiTable Command {{{1
###########################
Given (Nothing):
Execute (VimwikiTable):
VimwikiTable
Expect (Table 5 x 2):
| | | | | |
|---|---|---|---|---|
| | | | | |
Execute (VimwikiTable 8 3):
VimwikiTable 8 3
Expect (Table 8 x 3):
| | | | | | | | |
|---|---|---|---|---|---|---|---|
| | | | | | | | |
| | | | | | | | |
Given vimwiki (Table 5 x (1+3)):
| h1 | h2 | h3 | h4 | h5 |
|-----|-----|-----|-----|-----|
| l11 | l12 | l13 | l14 | l15 |
| l21 | l22 | l23 | l24 | l25 |
| l31 | l32 | l33 | l34 | l35 |
Execute (VimwikiTableMoveColumnRight):
VimwikiTableMoveColumnRight
Expect (Col: 1 -> 2):
| h2 | h1 | h3 | h4 | h5 |
|-----|-----|-----|-----|-----|
| l12 | l11 | l13 | l14 | l15 |
| l22 | l21 | l23 | l24 | l25 |
| l32 | l31 | l33 | l34 | l35 |
Execute (VimwikiTableMoveColumnLeft):
call cursor(5, 16)
VimwikiTableMoveColumnLeft
Expect (Col: 3 -> 2):
| h1 | h3 | h2 | h4 | h5 |
|-----|-----|-----|-----|-----|
| l11 | l13 | l12 | l14 | l15 |
| l21 | l23 | l22 | l24 | l25 |
| l31 | l33 | l32 | l34 | l35 |
# Justify Cell Content {{{1
###########################
Given vimwiki (To be justified from help file [Coffe price]):
| Date | Item | Price |
|------------|:------:|--------:|
| yest |Coffee |$15.00 |
| 2017-02-13 |Tea |$2.10 |
| 2017-03-14 |Cake |$143.12 |
Execute (Rename file wiki_test.md for table expand):
file wiki_test.md
Do (A to trigger insertLeave):
A
Expect (Text justified):
| Date | Item | Price |
|------------|:------:|--------:|
| yest | Coffee | $15.00 |
| 2017-02-13 | Tea | $2.10 |
| 2017-03-14 | Cake | $143.12 |
Given vimwiki (To be left aligned):
| Date | Item |
|:------------|------:|
|yest|Coffee |
| 2017-02-13| Tea|
|2017-03-14 |Cake |
Do (A to trigger insertLeave):
A
Expect (Left justified and :--- -> ----):
| Date | Item |
|------------|-------:|
| yest | Coffee |
| 2017-02-13 | Tea |
| 2017-03-14 | Cake |
# vim: foldmethod=marker foldlevel=30
-305
View File
@@ -1,305 +0,0 @@
# Tag generation and navigation
# Note: The Generate must be in Execute
Execute (Setup):
set sw=4
AssertEqual 4, &sw
######################################################################
Execute (Change delimiter <tag1|tag2> {{{1):
let g:vimwiki_tag_format = {'pre_mark': '<', 'post_mark': '>', 'sep': '|'}
unlet g:vimwiki_syntaxlocal_vars
call vimwiki#vars#init()
edit $HOME/testmarkdown/Test-Tag.md
AssertEqual $HOME . '/testmarkdown/Test-Tag.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Create File Content with <>):
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
I
<tag-bar-1>\<CR>
\<CR>
# A header\<CR>
\<CR>
<tag-bar-2|tag-bar-3>\<CR>
\<CR>
# Another header\<CR>
\<CR>
Words here.
\<Esc>
:write\<CR>
:VimwikiRebuildTags!\<CR>
gg
Execute (Generate tags):
edit $HOME/testmarkdown/Test-Tag.md
AssertEqual 'VimwikiTag', SyntaxAt(1, 1)
VimwikiGenerateTagLinks
set tw=200
Expect (Correctly generated tags section {{{3):
<tag-bar-1>
# A header
<tag-bar-2|tag-bar-3>
# Another header
Words here.
# Generated Tags
## tag-bar-1
- [Test-Tag](Test-Tag)
## tag-bar-2
- [A header](Test-Tag#a-header)
## tag-bar-3
- [A header](Test-Tag#a-header)
Do (Write a quick tag for a quick jump):
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
ggdG
I
[go1](Test-Tag#tag-bar-1)\<Cr>
[go2](#tag-bar-1)\<Cr>
bla\<Cr>
<tag-bar-1>\<Esc>
ggl\<Cr>A __HERE1__\<Esc>
ggjl\<Cr>A __HERE2__\<Esc>
Expect (Good jump {{{3):
[go1](Test-Tag#tag-bar-1)
[go2](#tag-bar-1)
bla
<tag-bar-1> __HERE1__ __HERE2__
Execute (Clean Test-Tag and .vimwiki_tags -2):
let g:vimwiki_tag_format = {}
unlet g:vimwiki_syntaxlocal_vars
call vimwiki#vars#init()
call system("rm $HOME/testmarkdown/Test.md")
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag.md")
call DeleteHiddenBuffers()
######################################################################
Execute (Default tag generation {{{1):
edit $HOME/testmarkdown/Test-Tag.md
AssertEqual $HOME . '/testmarkdown/Test-Tag.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
set tw=200
Do (Single file Part1):
:edit $HOME/testmarkdown/Test-Tag.md\<Cr>
ggdGO
:single-tag:\<Esc>
:write\<Cr>
:VimwikiRebuildTags!\<Cr>
Execute (Generate tags):
edit $HOME/testmarkdown/Test-Tag.md
AssertEqual 'VimwikiTag', SyntaxAt(1, 1)
VimwikiGenerateTagLinks
write
Expect (Single tags toc):
:single-tag:
# Generated Tags
## single-tag
- [Test-Tag](Test-Tag)
Do (Create File Content):
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
ggdGO
:top-tag:\<CR>
\<CR>
# A header\<CR>
\<CR>
:test-tag:\<CR>
\<CR>
# Another header\<CR>
\<CR>
Words here.\<CR>
If tag isn't within 2 lines of header then it has a direct link instead of\<CR>
a link to the header.\<CR>
\<CR>
:second-tag:
\<Esc>
:write\<CR>
:VimwikiRebuildTags\<CR>
Execute (Edit tags file):
edit $HOME/testmarkdown/.vimwiki_tags
AssertEqual $HOME . '/testmarkdown/.vimwiki_tags', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
# Note: tags file uses tabs
Expect (Correctly formatted tags file):
!_TAG_FILE_FORMAT 2
!_TAG_FILE_SORTED 1
!_TAG_OUTPUT_MODE vimwiki-tags
!_TAG_PROGRAM_AUTHOR Vimwiki
!_TAG_PROGRAM_NAME Vimwiki Tags
!_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki
!_TAG_PROGRAM_VERSION 2022.12.02
second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag\tTest-Tag#second-tag
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
Execute (Generate tags):
edit $HOME/testmarkdown/Test-Tag.md
VimwikiGenerateTagLinks
Expect (Correctly generated tags section):
:top-tag:
# A header
:test-tag:
# Another header
Words here.
If tag isn't within 2 lines of header then it has a direct link instead of
a link to the header.
:second-tag:
# Generated Tags
## second-tag
- [second-tag](Test-Tag#second-tag)
## test-tag
- [A header](Test-Tag#a-header)
## top-tag
- [Test-Tag](Test-Tag)
Execute (Clean Test-Tag and .vimwiki_tags -1 ):
call system("rm $HOME/testmarkdown/Test.md")
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag.md")
call DeleteHiddenBuffers()
# vim: sw=2:foldlevel=30:foldmethod=marker:
######################################################################
Execute (Check first tags file):
call system("mkdir -p $HOME/testmarkdown/subdir1/subdir11")
edit $HOME/testmarkdown/Test-Tag-1.md
AssertEqual $HOME . '/testmarkdown/Test-Tag-1.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Build first tags file):
:edit $HOME/testmarkdown/Test-Tag-1.md\<Cr>
ggI
# A Header\<Cr>
:header-tag-1:\<Cr>
\<Cr>
# Another Header\<Cr>
:header-tag-2:\<Cr>
\<Cr>
:standalone-tag-1:
\<Esc>
:write\<Cr>
:VimwikiRebuildTags!\<CR>
Execute (Check second tags file):
edit $HOME/testmarkdown/subdir1/Test-Tag-2.md
AssertEqual $HOME . '/testmarkdown/subdir1/Test-Tag-2.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Build second tags file):
:edit $HOME/testmarkdown/subdir1/Test-Tag-2.md\<Cr>
ggI
# A Header\<Cr>
:header-tag-1:\<Cr>
\<Cr>
# Another Header\<Cr>
:header-tag-2:\<Cr>
\<Cr>
:standalone-tag-1:
\<Esc>
:write\<Cr>
:VimwikiRebuildTags!\<CR>
Execute (Build tag links in third file):
edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md
AssertEqual $HOME . '/testmarkdown/subdir1/subdir11/Test-Tag-Links.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
VimwikiGenerateTagLinks
write
Expect (Tag links relative to current file):
# Generated Tags
## header-tag-1
- [A Header](../../Test-Tag-1#a-header)
- [A Header](../Test-Tag-2#a-header)
## header-tag-2
- [Another Header](../../Test-Tag-1#another-header)
- [Another Header](../Test-Tag-2#another-header)
## standalone-tag-1
- [standalone-tag-1](../../Test-Tag-1#standalone-tag-1)
- [standalone-tag-1](../Test-Tag-2#standalone-tag-1)
Do (Delete some existing links to test updating generated tag links):
:edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md\<Cr>
7G
dd
12G
6dd
:write\<Cr>
:call vimwiki#tags#generate_tags(0)\<Cr>
Expect (Only update generated tag links for tags already existing in the file):
# Generated Tags
## header-tag-1
- [A Header](../../Test-Tag-1#a-header)
- [A Header](../Test-Tag-2#a-header)
## header-tag-2
- [Another Header](../../Test-Tag-1#another-header)
- [Another Header](../Test-Tag-2#another-header)
Execute (Clean relative tag setup):
call system("rm -rf $HOME/testmarkdown/subdir1")
call system("rm $HOME/testmarkdown/Test-Tag-1.md")
-401
View File
@@ -1,401 +0,0 @@
" TODO treat if local (see $HOME in all tests)
" TODO mutualise (to prettify output) mode(1) to check if in -Es or not
" TODO test tabnext in at least one travis job (without -Es)
" Declare tipical Vim preambule
" vint: -ProhibitSetNoCompatible
set nocompatible
filetype plugin indent on
syntax enable
" Usefull var: for one day, making tests on local
let $TPLUGIN = '/testplugin'
let $THOME = $HOME
" Set chrooted virtual runtime path
let rtp = $ROOT . '/rtp.vim'
if filereadable(rtp)
execute 'source ' . rtp
endif
" Load Vader
let vader = $ROOT.'/vader'
exe 'set runtimepath+='.vader
" Wikis configuration
" Declare default syntax
let vimwiki_default = {}
let vimwiki_default.path = $HOME . '/testwiki'
let vimwiki_default.path_html = $HOME . '/html/default'
let vimwiki_default.template_path = $HOME . '/testwiki/templates/'
let vimwiki_default.syntax = 'default'
let vimwiki_default.ext = '.wiki'
let vimwiki_default.name = 'DefaultSyntax'
let vimwiki_default.base_url = 'https://example.com/'
" Declare markdown syntax - https://github.github.com/gfm/
let vimwiki_markdown = {}
let vimwiki_markdown.path = $HOME . '/testmarkdown'
let vimwiki_markdown.path_html = $HOME . '/html/markdown'
let vimwiki_markdown.syntax = 'markdown'
let vimwiki_markdown.ext = '.md'
let vimwiki_markdown.name = 'MarkdownSyntax'
" Declare mediawiki syntax - https://www.mediawiki.org/wiki/Help:Formatting
let vimwiki_mediawiki = {}
let vimwiki_mediawiki.path = $HOME . '/testmediawiki'
let vimwiki_mediawiki.path_html = $HOME . '/html/mediawiki'
let vimwiki_mediawiki.syntax = 'media'
let vimwiki_mediawiki.ext = '.mw'
let vimwiki_mediawiki.name = 'MediaWikiSyntax'
" Declare default syntax with spaces
let vimwiki_default_space = {}
let vimwiki_default_space.path = $HOME . '/testwiki space'
let vimwiki_default_space.path_html = $HOME . '/html/testwiki space'
let vimwiki_default_space.template_path = $HOME . '/testwiki space/templates/'
let vimwiki_default_space.syntax = 'default'
let vimwiki_default_space.ext = '.wiki'
let vimwiki_default_space.name = 'DefaultSyntax'
let vimwiki_default_space.base_url = 'https://example.com/'
" Register the 4 wikis
let g:vimwiki_list = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki, vimwiki_default_space]
let g:vimwiki_list_vimrc = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki, vimwiki_default_space]
" Test VimwikiColorize and ,wc
let g:vimwiki_color_dic = {
\ 'default': ['', '#d79921'],
\ 'red': ['#cc241d', ''],
\ 'bred': ['', '#cc241d'],
\ 'green': ['#98971a', ''],
\ 'bgreen': ['', '#98971a'],
\ 'yellow': ['#d79921', ''],
\ 'byellow': ['', '#d79921'],
\ 'blue': ['#458588', ''],
\ 'bblue': ['', '#458588'],
\ 'purple': ['#b16286', ''],
\ 'bpurple': ['', '#b16286'],
\ 'orange': ['#d65d0e', ''],
\ 'borange': ['', '#d65d0e'],
\ 'gray': ['#a89984', ''],
\ 'bgray': ['', '#a89984']}
" Set basic settings
" Avoid more prompt
set nomore
set backspace=indent,eol,start
set wildmode=longest:full,full
set wildmenu
set wildignorecase
set splitbelow
set splitright
set timeoutlen=600
set ignorecase
set smartcase
set hidden
set laststatus=2
set hlsearch
" Map
" Map ctrl-p/n for history completion instead of up/down arrows
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
" Map jj to go back to command mode
inoremap jj <esc>
" Use <C-L> to clear the highlighting of :set hlsearch and also preserve the
" default behavior of redrawing the screen
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
" Define functions
function! CommentLine(msg)
" Log current line and argument message
" Called: in GFM copying like: https://github.github.com/gfm/#example-360 in syntax_markdown_gfm_typeface.vader
Log 'Content: `' . getline('.') . '`'
Log 'Comment: ' . a:msg
endfunction
command! -nargs=1 CommentLine call CommentLine(<args>)
function! SetSyntax(vw_syn)
" Change the syntax using a temporary wiki
" Change extension and wiki_nr
let index=0
if a:vw_syn ==# 'default'
let ext = 'wiki'
let index=0
elseif a:vw_syn ==# 'markdown'
let ext = 'md'
let index=1
elseif a:vw_syn ==# 'media'
let ext = 'mw'
let index=2
else
Log 'ERROR: Invalid syntax "' . a:vw_syn . '" in SetSyntax()'
Log 'NOTE: function only accepts "media" for setting mediawiki syntax'
return
endif
" Change temporary wiki
let path = expand('%:p:h')
let new_temp_wiki_settings = {
\ 'path': path,
\ 'ext': ext,
\ 'syntax': a:vw_syn,
\ 'bullet_types': g:vimwiki_wikilocal_vars[index]['bullet_types'],
\ }
" Remove any temporary wikis each time this function is called.
" This is necessary to ensure syntax is properly set when running multiple tests
" NOTE: this assumes there are 3 defined wikis in the vimrc. The last wiki
" contains default settings for temporary wikis (so there are always
" num wikis in vimrc + 1)
let num_wikis = len(g:vimwiki_wikilocal_vars)
while num_wikis > 4
call remove(g:vimwiki_wikilocal_vars, num_wikis - 1)
let num_wikis = num_wikis - 1
endwhile
" Add the new wiki
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
call vimwiki#vars#set_bufferlocal('wiki_nr', 3)
" Verify syntax was set correctly
Assert vimwiki#vars#get_wikilocal('syntax') ==# a:vw_syn,
\ 'ERROR: Vimwiki syntax not set correctly: '
\ . 'Want: ' . a:vw_syn . ' '
\ . 'Have: ' . vimwiki#vars#get_wikilocal('syntax')
endfunction
function! UnloadVimwiki()
" Clear mappings so plugin can be reloaded
" this is needed if running manually multiple times
nmapclear
" UNlet what can be
" -- Note: getcompletion not present on vim7.3
for i in ['g:vimwiki_commentstring',
\ 'b:did_ftplugin',
\ 'g:loaded_vimwiki',
\ 'g:vimwiki_global_vars',
\ 'g:vimwiki_wikilocal_vars',
\ 'g:vimwiki_syntaxlocal_vars',
\ 'g:vimwiki_list',
\ ]
if exists(i)
exe 'unlet ' . i
endif
endfor
" Unlet ftplugin:
" -- Vader often staty in same buffer: [Vader-workbench]
if exists('b:did_ftplugin')
unlet b:did_ftplugin
endif
endfunction
function! LoadVimwiki()
" Source plugin
runtime! plugin/vimwiki.vim
endfunction
function! ReloadVimwiki()
" Reload plugin to change settings
call UnloadVimwiki()
" Reset list
let g:vimwiki_list = g:vimwiki_list_vimrc
call LoadVimwiki()
endfunction
function! ReloadVars()
" vars#init will not reload syntax varaible if not set
unlet g:vimwiki_syntaxlocal_vars
call vimwiki#vars#init()
endfunction
function! CopyResources()
" Copy wiki test resources so that vimtest user can write them
call system('cp -r /testplugin/test/resources/* $HOME/')
" Make diary directory
call system('mkdir $HOME/testwiki/diary')
call system('mkdir $HOME/testmarkdown/diary')
endfunction
function! DeleteHiddenBuffers()
" Delete Hidden buffer, usefull to clean
" See: https://stackoverflow.com/a/8459043/2544873
let tpbl=[]
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
if bufname(buf) =~? 'Vader'
continue
endif
silent execute 'bwipeout!' buf
endfor
endfunction
function! WriteMe()
" Write current file: helper to hide `set bt=`
set buftype=
write! %
endfunction
function! DeleteFile(path)
" Delete a file <- path <string>
let path = expand(a:path)
" Delete file
try
call delete(path)
catch | endtry
" Delete Buffer
try
execute 'bwipeout! ' . path
catch | endtry
endfunction
function! PrintCommand(cmd)
" Print a command output to the buffer
redir => message
silent execute a:cmd
redir END
if empty(message)
Log 'no output'
else
silent put=message
endif
endfunction
function! DestroyVar(var)
" Destroy a variable is exists (unlet)
if ! exists(a:var) | return | endif
execute 'unlet ' . a:var
endfunction
function! AssertTab(nr)
" Assert current tab is desired tab
" Vader is creating 2 tabs
AssertEqual a:nr + 2, tabpagenr()
endfunction
function! ConvertWiki2Html()
" Convert current buffer: wiki -> html
" No side effect (if no bug)
" Save fbuffer number (to come back)
let g:buf_vader = bufnr('%')
" Cut wiki content
let wiki_content = getline(1, '$')
1,$delete
" Paste to a named file
" Edit a new file in wiki_root
edit $HOME/testwiki/test_Convert2Html.wiki
" Ensure it is void
1,$delete
" Write wiki content
call setline(1, wiki_content)
" Dump buffer to disk
call WriteMe()
" Convert
"""""""""
Vimwiki2HTML
" Cut output
edit $HOME/html/default/test_Convert2Html.html
let html_content = getline(1, '$')
1,$delete
" Paste output in [Vader] buffer
execute 'buffer ' . g:buf_vader
call setline(1, html_content)
" Delete files
call DeleteFile('$HOME/html/default/test_Convert2Html.html')
call DeleteFile('$HOME/testwiki/test_Convert2Html.wiki')
endfunction
function! ConvertWiki2Body()
" Get only body
call ConvertWiki2Html()
" Empty b register
let @b = ''
" Copy body
/<body>/+1,/<.body>/-1:g/^/y B
" Delete All lines
1,$d
" Paste body
0put! b
" Remove last line
0d
endfunction
function! GetSyntaxGroup(line, col)
" Get normalized syntax group: usefull for boldItalic Vs italicBold
" -- Here, Vader's SyntaxAt is not enough
" From: https://stackoverflow.com/questions/9464844
let l:s = synID(a:line, a:col, 1)
return synIDattr(synIDtrans(l:s), 'name')
endfun
function! GetSyntaxStack()
" Debug helper
if !exists('*synstack')
return
endif
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
function! AssertIfVersion(version, one, two)
" Run Assert only if vim version is high enough
if v:version < a:version | return | endif
AssertEqual a:one, a:two
endfunction
function! GetHighlightTerm(group, term)
" Get output of `hi group`
"
" From: https://vi.stackexchange.com/a/12294/5026
" Return list ['bold','underline']
"
" Warning: must only be called if has("patch-7.4-2008")
" Or rather: If execute() exists - it's not available for all 7.4
" versions.
" https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
" Clause: Dot not work if not able
if v:version < 800 && has('patch-7.4-2008') != 1 | return [] | endif
" Store output of group to variable
let out = execute('hi ' . a:group)
" If links to, call parent
let parent = matchstr(out, 'links to *\zs[^ \t\n\r]*')
if parent !=# ''
" Return list_of_parent, parent
return GetHighlightTerm(parent, a:term)
endif
" Return the unique term we are looking for
let stg = matchstr(out, a:term . '=\zs[^[:space:]]*')
return split(stg, ',')
endfunction
" Copy Wiki's Resources
call CopyResources()
" vim: ft=vim:sw=2
-16
View File
@@ -1,16 +0,0 @@
# Contents more Contents
- [Test1](#Test1)
- [Test2](#Test2)
# Test1
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
# Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
-10
View File
@@ -1,10 +0,0 @@
# Succeding test just to test the script when everything goes fine
Given (Text v0.01):
Text
Do (press escape):
\<Esc>
Expect (Text):
Text