301 Commits

Author SHA1 Message Date
Brennen Bearnes cf05d533a4 WIP: update tested versions of vim
Adjusting the list per discussion here:

https://github.com/vimwiki/vimwiki/issues/1445

    nvim 0.10.2
    vim 7.4.2367
    vim 8.2.5172
    vim 9.0.2190
    vim 9.1.0786

Currently nvim 0.10.2 fails to build, so not testing that.  Seems like
vim-testbed is fairly out-of-date.  I filed this re: project status:

https://github.com/Vimjas/vim-testbed/issues/91

I'm not entirely sure what's up with the commented-out partial (?) sets of
tests for a-k*, l*, m* for different versions. Just conserving resources
by partially testing older versions?
2024-11-30 22:19:49 -07:00
Matthieu Talbot 72792615e7 Update vimwiki.txt
Fix parameter that was renamed in some example.
2024-10-13 22:07:48 -06:00
Brennen Bearnes 5cca07970c test/tag.vader: update hardcoded version to 2024.01.24
This should fix part of #1445.
2024-10-13 21:46:44 -06:00
Tinmarino 705ad1e0dd Fix #1412: Markdown Link creation when cursor is on word 2024.01.24 (or 2024-06-15) 2024-06-23 12:11:20 -04:00
Tinmarino 7ad424ea42 Conf: Add syntax variable open_link_add_ext to be able to open link with another extension (#1271)
Configure the feature adding extension .md to files at link opening.
The new feature (2023) was implemented by Brennen and fixing many other tickets but also openend #1271. So let's just add a configuration variable!
https://github.com/vimwiki/vimwiki/commit/d7ec12645a0460a7d200279c52915e6e080e9869
2024-06-19 13:07:55 -04:00
SukkaW 69318e74c8 docs: no longer recommends polyfill.io 2024-03-16 14:23:28 -03:00
Brennen Bearnes fde35bb87e v2024.01.24: Tweak README.md, update version number and changelog. 2024-01-24 20:14:13 -07:00
qadzek 2d17e6147b docs: describe undocumented key mappings 2024-01-24 19:31:47 -07:00
Brennen Bearnes d0e6d5e517 v2024.01.22: update version number and changelog
Includes some recent authors on the contributor list, and an attempt at
getting the changelog up to date.
2024-01-22 21:04:26 -07:00
Charles Schimmelpfennig 0bb1b4945b Support angle bracket escaped markdown urls (#1211)
* add angle brackets to regex definition

* revert unecessary change to markdown link suffix

* Update vimwiki.txt

---------

Co-authored-by: Charles Schimmelpfennig <charles.schimmelpfennig@corteva.com>
Co-authored-by: NobleRat <tinmarino@gmail.com>
2023-10-31 13:45:18 -03:00
Tinmarino a479154770 Fix previous commit tests 2023-10-31 13:01:15 -03:00
Tinmarino 90b23b466f Fix: Folding code blocks using markdown syntax folds the entire rest of the file (#1323) 2023-10-31 12:40:39 -03:00
Tinmarino 68664e5d72 prettify small 2023-10-31 12:11:31 -03:00
Bence Ferdinandy 5d86b625f5 Fix: count ignored when looking up diary frequency
When calling VimwikiMakeYesterdayDiary (or Tomorrow) the wiki_nr is
looked up by vimwiki#diary#diary_date_link without access to the passed
count, which would result in the creation of the file in the correct
place, but with the diary_frequency of another wiki. Modify
vimwiki#diary#diary_date_link to take a possible third argument as the
wiki_nr+1 and modify the commands to pass <count> as the third argument.

Fixes: #1365
2023-10-16 10:12:32 -03:00
Justin McIntyre 65575fb103 Update README.md
Fixed documentation error
2023-10-16 10:08:24 -03:00
Aarón Fas f0fe154ede Fix wrong example snippet for listsysms option. 2023-07-31 08:27:35 -04:00
Tinmarino 09804c2a5f Fix: Jump to nested anchor bugged with markdown (issue #1356) 2023-07-10 12:47:03 -04:00
Jiaming Chen acc92fb648 Make auto_tags preserve existing tag section structure 2023-07-10 11:26:40 -04:00
Tinmarino 65b9f0e68b CI: add test for tag in codeblock should not be parsed (issue #1034) 2023-06-26 19:30:39 -04:00
Tinmarino c79f15a90b CI: Fix previous test for (issue #1279) 2023-06-23 12:28:52 -04:00
Tinmarino 26adc84dc3 Configure default syntax bloquote marker to include :: (issue #1279) 2023-06-23 12:11:40 -04:00
Tinmarino 942da42b96 CI: add test for unicode rxTableSep (issue #1297) 2023-06-22 19:33:54 -04:00
Julian Prein c5b7f7e76f Fix: Handle multibyte chars properly in get_cells (#1298) (fixes #1297)
Previously vimwiki#tbl#get_cells() would act on `line` as a normal
string (i.e. using `[idx]` and strpart()). This breaks when the column
separator (s:s_rep() or rxTableSep) is a multibyte character like the
vertical box drawing character │. In that case the separator is never
found and only one empty cell is returned. This also affects
vimwiki#tbl#format() which in turn clears the whole table each time the
insert mode is left.

Fix this issue by initially splitting the line into a list of the
characters. Getting the elements with `[idx]` now returns each character
instead of a byte. In addition len() is used in place of strlen() as
well as slicing together with join() instead of strpart().

Fixes: #1297 ("Table formatting breaks on multibyte separator")
2023-06-22 19:10:54 -04:00
Tinmarino bc3bc208d7 CI: Add test for colored convertion wiki syntax (issue #1311) 2023-06-22 18:57:16 -04:00
Tinmarino 40c2bbdcf3 Fix: HTML convertion for code is stripping newlines (issue #1311)
Initially titled: Can't enable syntax highlighting for codes in HTML files when converting wiki to HTML
2023-06-22 18:36:18 -04:00
Tinmarino e0a04e11b8 CI: Add test for highlight dates (issue #309, pr #1315) 2023-06-22 12:45:03 -04:00
Alex Claman 322d22bef8 Add basic GTD-style token highlighting (#1315)
* Add basic GTD-style token highlighting

* Update vimwiki.txt

* Revert "Update vimwiki.txt" This reverts commit bd7c9cfe68.
2023-06-22 12:43:03 -04:00
nolleh7707 5d0c9d3173 docs: add description for disable extension support, to avoid accidently working as wiki for normal docs 2023-06-22 11:35:04 -04:00
Joe Planisky f3b50e5f17 add jplanisky to contributors 2023-06-22 11:17:58 -04:00
Joe Planisky 85c47d1f97 add mixed (concatenated & discrete) tags to #1326 tests 2023-06-22 11:17:58 -04:00
Joe Planisky 89315912b1 fix duplicate tag issue #1326 2023-06-22 11:17:58 -04:00
Joe Planisky a1ca439719 fix cleanup in duplicate tags test 2023-06-22 11:17:58 -04:00
Joe Planisky 22fd036804 Add new Vader test for issue 1326 (duplicate tags) 2023-06-22 11:17:58 -04:00
Tinmarino 88620a2be0 Syntax: admit space trailing the yaml delimiters 2023-06-16 11:14:00 -04:00
Tinmarino 0069c5fb4e Improvement: gqq autowrap leading :: definition as &l:comments (#1279) 2023-06-14 14:04:08 -04:00
Tinmarino 738e24134e Fix previous commit refactoring with: get_globlinks_raw and complete_links_raw 2023-06-14 13:12:13 -04:00
Tinmarino 298a409b74 Fix: VimwikiGoto completion with file with space (#1229) 2023-06-14 13:04:26 -04:00
Tinmarino 69a5682d6f Merge pull request #1324 from rddunphy/dev
File name prompt fixes
2023-06-14 12:29:28 -04:00
Tinmarino 0700fa4068 Fix: Italics broken with 7a48268 commit (#1331) 2023-06-14 11:43:54 -04:00
Tinmarino 2cff9776e8 Feature: Recognize message:// URLs on Mac #1332 2023-06-14 11:34:57 -04:00
Tinmarino 65c3d48227 Comment: previous commit typo 2023-06-14 11:34:24 -04:00
Tinmarino cd2fa19f86 Doc: Explain how to clear typeface highlight (#1346) 2023-06-14 10:43:12 -04:00
Tinmarino d63948d873 Util: add vimwiki#vars#set_syntaxlocal function for consistency 2023-06-14 10:43:12 -04:00
Luke Atkinson cd9cfd299e Fix vimwiki#diary#calendar_sign when g:vimwiki_list is not set
If a user is happy with the default vimwiki location, they may not set
the g:vimwiki_list global variable. In this case, the
len(g:vimwiki_list) vimwiki#diary#calendar_sign function throws an
error every time it is called. This function is called for every day
displayed in the calendar which is very noisy. Checking if the variable
exists before doing the length check prevents the error and the rest of
the function works fine if the variable is not set.
2023-05-12 22:05:10 -04:00
Tinmarino 7a48268d24 Fix commit 72d0220, breaking syntax for bold due to bad punctuation preceded right flank (issue #1325) 2023-04-19 15:13:50 -04:00
Brennen Bearnes 71edcf6802 update g:vimwiki_version for latest release
I missed this before tagging; this will be v2023.04.04_1.
2023-04-04 20:28:34 -06:00
Brennen Bearnes be45bd65f5 Doc: Note changes for 2023.04.04 2023-04-04 20:13:34 -06:00
R. David Dunphy ba02c38346 Use fnameescape() instead of escape() in edit_file() 2023-04-02 01:32:03 +01:00
R. David Dunphy 864f066405 Don't escape filenames for goto() 2023-04-02 01:08:36 +01:00
R. David Dunphy 8f651834fd Cancel goto() if input was empty 2023-04-02 00:57:52 +01:00
Brennen Bearnes 11350f572b is_diary_file(): use filereadable() to check a single file
Intended to address #1267 - "get_diary_files() takes very long to
execute on Windows - this leads to very slow link-creation using the
Enter key".

In theory, this should be a performance improvement for link creation on
systems with very slow filesystem access (this came up under Windows, but
ought to be a general optimization).  It does nothing for generating the
entire list of diary files, which by nature has to get the whole list
anyway.

  - Uses a filereadable() call against a path instead of checking the
    results of get_diary_files() for most calls.

  - Introduces is_among_diary_files() for the case where you want to
    check against a get_diary_files() list.

  - is_diary_file() will pass through to is_among_diary_files() if it gets
    invoked with a second parameter, to retain backwards compatibility on
    the off chance anyone has scripted against this behavior.  I'm not sure
    this is necessary, but trying to be cautious with the implicit API
    here.

  - Includes a test/api_base_is_diary_file.vader

My original version of this change assumed that input would be in the
form of "2023-01-01", instead of a fully-qualifed filename.  As it is,
it expects a full path to the file, in keeping with the list returned by
vimwiki#diary#get_diary_files().

Bug: #1267
2023-03-30 17:08:58 -06:00
Tinmarino dec6a9ecab CI: Lint run_test: reorder function in top>down 2023-03-22 01:22:25 -03:00
Tinmarino 57107c7c56 CI: Lint run_test: all in function 2023-03-22 01:17:20 -03:00
Tinmarino 72d02207b0 Syntax: Fasten highlighting, from 200ms to 20ms for first screen update
Problem:

The loading of a .md file was slow due to multiple nested lookback.
It is advised in vim help to prefer \zs, see :h /\@<
Anyway, it is useless to nest them.

089.080  000.085  000.085: sourcing /home/mtourneb/.vim/after/syntax/vimwiki.vim
089.264  005.184: opening buffers
089.322  000.058: BufEnter autocommands
089.323  000.001: editing files in windows
089.414  000.091: VimEnter autocommands
089.415  000.001: before starting main loop
303.698  214.283: first screen update
303.700  000.002: --- VIM STARTED ---

Solution:

Remove the function s:expand_delimiter in vars.vim.
It was doing a duplicate job with vimwiki#u#hi_expand_regex
And ... well avoid lookback as much as possible

091.784  000.087  000.087: sourcing /home/mtourneb/.vim/after/syntax/vimwiki.vim
091.991  006.034: opening buffers
092.050  000.059: BufEnter autocommands
092.052  000.002: editing files in windows
092.172  000.120: VimEnter autocommands
092.173  000.001: before starting main loop
112.574  020.401: first screen update
112.578  000.004: --- VIM STARTED ---
2023-03-18 01:50:53 -03:00
Tinmarino f4bd841a4c Tags: improve VimwikiSearchTags which was not using user configuration (issue #1316) (v2) 2023-03-17 22:05:47 -03:00
Tinmarino 5eb5c9c71f Fix: ugly debug echom at start #1317 2023-03-17 19:17:41 -03:00
Tinmarino 8640988c5c Markdown typeface: match closer to GFM specification, also add tests 2023-03-17 16:08:27 -03:00
Tinmarino f5399ffdfa Improve typeface specification closer to GFM and test 2023-03-17 13:44:05 -03:00
Tinmarino a7aa5eb1ea Doc: replace http by https 2023-03-17 04:51:14 -03:00
Tinmarino 1d35ff035d Fix: Bug: VimwikiGoto without argument creates empty page (issue #1229) 2023-03-17 03:59:05 -03:00
Tinmarino c9af9c7807 Doc: add changelog for issue #1261 2023-03-17 03:49:56 -03:00
Tinmarino 8374bcfccf Feature: Support for <mark> in Markdown (issue #1261) 2023-03-17 03:46:56 -03:00
Tinmarino cde5dbc92a Feature: permit blockquote automatic continuation (issue #1274) (fixed) 2023-03-17 02:27:08 -03:00
Tinmarino 6993610585 Doc: add #1316 to changelog 2023-03-17 00:07:27 -03:00
Tinmarino 29ac6ee589 Doc: Rename most recent release? #1314 2023-03-17 00:06:42 -03:00
Tinmarino 035b2f15c7 Permit tags in heading #1316 2023-03-17 00:05:48 -03:00
Tinmarino eab70aedaa CI: Add basic syntax test 2023-03-17 00:05:48 -03:00
Tinmarino 91fe25ad5f Fix bad header highlighting with nvim (issue #1291) 2023-03-15 13:09:25 -03:00
Tinmarino 5db16850da Fix VimwikiAddHeaderLevel map (like 3=), borken by previous 5e564bb10d, (Issue #1270) 2023-03-15 02:06:57 -03:00
Tinmarino 87c44caef9 Doc: Add some changelog, release v2022.03.15 2023-03-15 01:03:39 -03:00
Tinmarino 7f1357472d Yaml metadata, fix regex (#1287) 2023-03-15 00:54:49 -03:00
Tinmarino 2f1f497f88 CI: Fix former test to match the new equation syntax #150 2023-03-13 20:03:38 -03:00
Tinmarino f55e700828 Fix Math inline border cases (Issue #150) 2023-03-13 19:43:43 -03:00
Tinmarino 8bf4d6363c Syntax: Add highlithing for YAML metadata block (#1287) 2023-03-13 16:52:57 -03:00
Tinmarino 34ceee8aaa Fix VimwikiTabDropLink mistakely removed in previous commit (tk Nudin) 2023-03-12 01:48:31 -03:00
Tinmarino cd5ef6c4c7 CI small change: add name to workflow to avoid the full path to display 2023-03-12 01:18:26 -03:00
Tinmarino 6d4208157d CI: Add Typos check and fix some typo 2023-03-12 01:15:28 -03:00
Tinmarino 48ce5b811d Cechk: add workfloa-diaptch trigger 2023-03-11 21:44:13 -03:00
Tinmarino acff8a5b1d Check: Change .travis CI to GitHub Actions CI (GHA) 2023-03-10 13:55:18 -03:00
Tinmarino 59402cdf8b Highlight markdown typeface more compliant with Github Flavoured Markdown 2023-03-10 13:54:40 -03:00
Brennen Bearnes fea8bee382 housekeeping: remove non-working / deprecated mirror.yml 2022-12-04 21:25:52 -07:00
Brennen Bearnes 6d87df76cb housekeeping: update issue template for new workflow, add branch mirroring 2022-12-04 19:38:42 -07:00
Brennen Bearnes 0629b39815 switch to calver; add g:vimwiki_version; tidy version hardcoding
Setting a global for g:vimwiki_version doesn't seem too egregious, and
lets us reference it cleanly elsewhere.

Removes version header from vimwiki.txt and hardcoding in tagfile
generation.

There's still one instance of that left in test/tag.vader that we should
clean up eventually.
2022-12-02 14:46:35 -07:00
Brennen Bearnes 221377f4fa version to 2.6.0; rewrite docs for rolling release
This:

  - Changes version number everywhere I could find it.
  - Reworks get_version() to dispense with stable / dev division.
  - Rewrites CONTRIBUTING.md to describe a new release workflow.

The development/release workflow stuff could use some thought.  It's
clunky at best.  There's sort of an inherent tension between semver-style
version numbers and the rolling release thing - maybe we should just use
commit hash or something date-based?

Still, it's a start.
2022-11-29 22:57:10 -07:00
Brennen Bearnes 487eb21385 Merge branch 'master' into release/2.6.0 2022-11-28 19:52:14 -07:00
xgpt 584f073a28 minor documentation improvement
Adds sentence to allow for keyword searches for "orphaned" to hit on this function to find missing links. "Orphaned" or "Orphan" is used to describe such files in similar PKM software used in the PKM community.
2022-08-23 16:48:01 -06:00
Brennen Bearnes c21c939b06 resolve_link(): check ext against version with dot (fixes #1256)
It turns out that the target extension here in `ext` has a dot prepended.

Under manual testing, this seems to fix the issue where a wiki with
`markdown_link_ext` set and using `.md` (for example) in links will wind up
taking people to pages with a repeated extension, like `foo.md.md`.

I feel like the repeated use of:

    vimwiki#vars#get_wikilocal('ext', link_infos.index)

here should probably be replaced with a named variable like `target_ext`,
but I wanted to touch the minimum lines of code possible for this fix.
2022-08-15 13:00:11 -06:00
Brennen Bearnes fc2e9f0dba vimwiki.txt: include jsn and Vimwiki2HTMLBrowse fix
For https://github.com/vimwiki/vimwiki/pull/1240
2022-07-18 20:52:08 -06:00
dmitry kim bd65f7dd7c make vimwiki#html#Wiki2HTML respect 'html_filename_parameterization'
Fixes `:Vimwiki2HTMLBrowse` when vimwiki_markdown is in use.
2022-07-18 20:50:00 -06:00
Brennen Bearnes d7ec12645a append extension to links containing "." (fixes #950) (#1236)
If a link contains `.`, then this:

  fnamemodify(link_text, ':e')

will return the last .-separated part of the name as extension, and nothing
else will get appended.  Instead, we check if the extension is empty _or_
doesn't match the extension for the target wiki, in which case we append
the correct one.

This seems like it works, and might not break anything else, given the
branch of the function that it's in.

Co-authored-by: Brennen Bearnes <code@p1k3.com>
2022-07-18 18:08:18 -06:00
Brennen Bearnes 7cfc3eee22 diary: use :drop for :VimwikiMakeDiaryNote
I find this is one of the more common reasons I wind up with way too many
copies of the same file open.

This adds 2 new magic numbers to vimwiki#diary#make_note()'s second
parameter: 4 for `tab drop` and 5 for `drop`.  It also checks to make sure
:drop exists in the current build.
2022-07-18 18:07:02 -06:00
Brennen Bearnes 8e4202847f follow_link: reuse existing tabs with tab drop (closes #238)
Replaces :e in `vimwiki#base#follow_link()` with :drop, making this the
default behavior for pressing <CR> on a link.  Checks for the existence
of :drop first, since this isn't available in some builds.

Adds a new :VimwikiTabDropLink and makes this a default for the keybindings
formerly occupied by :VimwikiTabnewLink; leaving :VimwikiTabnewLink
available for backwards compatibility and anyone who still wants the old
behavior.

Doesn't touch the split window reuse functionality, or the
:VimwikiGoBackLink behavior, although I can see an argument for adding
:drop to the latter.

I've wanted this for a while and happened to notice @davidlmontgomery's
patch from 2016 in #238.  Code has moved around a little since, but I
think this is correct.
2022-07-18 18:07:02 -06:00
Brennen Bearnes 3ac8e1ae14 fixed s:get_links so that it finds both link styles when using markdown syntax 2022-07-18 17:44:04 -06:00
Felix Wolfsteller 2a8775c21d update link to tagbar
fixes #1250
2022-07-15 10:17:37 -06:00
Philipp Oberdiek 61c513d8d0 Add vader test for updating generated tag links 2022-04-09 20:14:04 -04:00
Philipp Oberdiek 4a0901a811 Search for already present tag links
If the tag link section should only be updated, search for an already
existing section and use the present tags for updating the links.
2022-04-09 20:14:04 -04:00
Philipp Oberdiek 7ab9983ddd Make collect_headers a global plugin function
This way it can be used in `tags.vim` to retrieve the headers of the
generated tag link section.
2022-04-09 20:14:04 -04:00
Philipp Oberdiek a905ee71e0 Update tag link captions in tag vader tests 2022-04-09 20:14:04 -04:00
Philipp Oberdiek 0690d8ad51 Add description key to tag link entries 2022-04-09 20:14:04 -04:00
Brennen Bearnes 63af6e72dd README.md: point to libera.chat channel (#1167) (#1194)
Co-authored-by: KaiserBarbarossa <kaiser.barbarossa@yandex.com>
Co-authored-by: Brennen Bearnes <code@p1k3.com>
2022-03-10 03:04:13 +01:00
Tinmarino 4d7a4da2e8 Doc fix helptags all (#1181) 2021-12-19 00:49:16 -03:00
Philipp Oberdiek c19e63b1e9 Make tag links relative to current file #794 (#1162)
Also add a vader test case and update the changelog as well as the list
of contributors.

Co-authored-by: Tinmarino <tinmarino@gmail.com>
2021-12-18 12:11:01 -03:00
Jean-Luc Bastarache ee31d45553 Feature: Add wiki page to buffer list using badd (#1185)
Co-authored-by: Tinmarino <tinmarino@gmail.com>
2021-12-18 12:08:54 -03:00
Tinmarino ecce184493 VimwikiTOC: update-listing in buffer more lazy (after #1155) 2021-12-18 11:53:59 -03:00
Tobias Mersmann 1bea2ce40a fix(update_listing_in_buffer): don't update listing if there are no changes
Before updating a listing, check if the update differs from the existing state.
Only then update the buffer, otherwise return early.

Initial reasoning: If `let g:vimwiki_auto_toc = 1` is set, saving a buffer would always update
the `contents`-section, even if there were no updates in this section. This lead to undesired
undo-behavior.

NOTE: this fix was only tested for the toc-listing.
2021-12-18 11:43:31 -03:00
ysftaha 2141fde8b8 Addresses issue #621 (#1181)
* issue#621: html highlighter

* docs for issue#621

* removing windows support for issue#621

Co-authored-by: Tinmarino <tinmarino@gmail.com>
2021-12-18 11:40:17 -03:00
Thomas Leyh 064a8f7ade Fix wildcard expansion in find_autoload_file
When using vim's native mechanism for `packages`, wildcards (*) are used
in the `runtimepath` since package folders can have arbitrary names.
They were not expanded, thus a path to e.g. `default.tpl` could not be
resolved when calling Vimwiki2HTML.

Resolves vimwiki/vimwiki#1193
2021-12-18 11:31:38 -03:00
Tulio Brunoro 95dd2e0d2c Revert breaking changes to customwiki2html.sh file
There is an extra space when calling the `basename` command, which causes the following error:
```
Vimwiki: 'basename: extra operand ‘md’
Try ''basename --help'' for more information.
```
2021-12-11 20:32:27 -07:00
Tomas Janousek 5148f5f601 Fix: Typo VimwikiUmderline → VimwikiUnderline in nested_typeface
(No idea how this typo actually manifests, just stumbled upon this by
chance.)
2021-12-11 20:26:44 -07:00
thecliguy a3a3fbf95f Replaced references to Freenode IRC with Libera 2021-09-20 11:16:56 -06:00
Lily Foster f28fe1ae43 Fix: Links opening in qutebrowser multiple times #763 2021-09-01 01:08:37 -06:00
Brennen Bearnes 8b53bd4c73 README.md: point to libera.chat channel (#1167)
README.md: point to libera.chat channel

Per discussion in #1131.

README-cn.md still needs updated.  This removes mention of the Telegram
group, but I'm guessing that can be re-bridged to the correct IRC / Matrix channel.

Co-authored-by: KaiserBarbarossa <kaiser.barbarossa@yandex.com>
Co-authored-by: Brennen Bearnes <code@p1k3.com>
2021-09-01 00:58:16 -06:00
petrisch 174eca3f06 Typo
Sorry for not beeing able to read.
2021-09-01 00:56:42 -06:00
paperbenni 22dcb36618 remove echo usage from VimwikiPasteLink 2021-07-29 13:53:27 -06:00
paperbenni 7d937615c1 Feature: VimwikiPasteLink to get absolute wiki link to the current file 2021-07-29 13:53:27 -06:00
Stephan T 1aa417fbd8 Fix typo 2021-07-28 10:33:05 -04:00
Tinmarino 212a66fcd6 Fix: forbid \$ for equation region start or stop #150 2021-06-11 12:06:43 -04:00
Tinmarino 369130edd7 Feature: Add thunderlink to schemes_web #435 2021-06-11 11:24:18 -04:00
Tinmarino c4e78fe310 Fix: Calendar integration if no vinwikilist #290 2021-06-11 10:57:56 -04:00
Tinmarino 45c89ebca4 Feature: Table cells permiting escaped separator (i.e. \|) #281 2021-06-11 10:50:53 -04:00
Tinmarino d43fdd14d2 Test: Demo: Renaming link text in markdown #1138 2021-06-11 09:22:52 -04:00
Tinmarino a182f7db8f Test: Fix bad space removed 2021-06-10 17:28:46 -04:00
Tinmarino 70682fc52f Pretty: Delete trailing space 2021-06-10 17:23:20 -04:00
Tinmarino 7eb6fed581 Pretty: Delete trailing space 2021-06-10 17:17:57 -04:00
Tinmarino 4cc6edf3eb Fix RenameFile with relative to root (prefix with /) #617 2021-06-10 17:15:29 -04:00
Tinmarino 9706f5eee8 Rename rename_link -> rename_file (corresponding to the exported RenameFile) 2021-06-10 16:13:40 -04:00
Tinmarino b4f7c7ba3d Fix: deprecate has been moved from base to u 2021-06-10 16:07:27 -04:00
Tinmarino 114ead874c Test: Fix: for Vim <= 7.3 the linkify function 2021-06-09 13:13:05 -04:00
Tinmarino 1fbe1bc6a8 Feature: Syntax: Provide vimwiki language escape sequences -> \token #1044 2021-06-09 12:42:51 -04:00
Tinmarino 62baafe259 Test: link creation with dot #924 2021-06-09 09:45:25 -04:00
Tinmarino 0181009dba Feature: vimwiki#base#linkify() with markdown syntax setting #994 2021-06-09 09:26:52 -04:00
Tinmarino 573e3d1952 Test comment last 2021-06-08 17:44:38 -04:00
Hugo Hörnquist eedc26bfe6 Fix self-link for TOC links.
Previously TOC links contained a closing </a>-tag, but lacked the
accompanying start tag, leading to invalid HTML. This fixes that, along
with placing class="justcenter" on the correct tag once again.
2021-06-08 17:44:07 -04:00
Tinmarino 760cab232d Test for links_space_char #1132 2021-06-08 17:14:43 -04:00
Vinny Furia 725709ba80 Update changelog
Add correct PR number
2021-06-08 15:43:26 -04:00
Vinny Furia 8a73cd8668 Updated changelog and added to contributing
Missing PR number
2021-06-08 15:43:26 -04:00
Vinny Furia 7cea1cfb3c Do not substitute spaces in LinkDescription 2021-06-08 15:43:26 -04:00
Steven Stallion 8fef79bcbd VimwikiGoto: Support wiki pages with spaces (#1128) 2021-05-20 14:50:10 -05:00
Tinmarino 1f77b7e6f6 Table: Fix exception if i<Tab> at end of line if next line is bad (Issue #1126) 2021-05-17 10:36:12 -04:00
Reiner Herrmann 84e9422c7c Add matrix as known URI scheme
It has meanwhile been accepted into the HTML standard:
 https://github.com/whatwg/html/pull/6320
2021-05-13 10:29:05 -06:00
Stefan Schuhbäck f6c419fb87 Add wikilocal option showing description in generated links 2021-05-06 20:36:42 -04:00
Matthew Toohey 4c7ab73c51 Added vertical svg logo in doc (#1111)
Co-authored-by: mtoohey31 <mtoohey31@users.noreply.github.com>
Co-authored-by: Tinmarino <tinmarino@gmail.com>
2021-04-06 22:13:24 -04:00
Brennen Bearnes f396e8a494 Fix resolution of leading-slash links, add link tests (#1108)
Hopefully this solves #1084, "Page links with leading slash lead to a
file in working directory, not a page at the root of the wiki", introduced
in 850aace.

It also adds a set of tests for different kinds of wiki links:

  - api_base_resolve_link.vader
  - link_syntax_markdown.vader
  - link_syntax_vimwiki.vader

Includes some fixes for locally-failing tests, removes a test from
test/map.vader and comments out test/config_vars.vader entirely for the
moment.

Code by : Brennen Bearnes <code@p1k3.com>
2021-04-06 22:09:37 -04:00
Brennen Bearnes 618893be00 Vimwiki2HTML: remove string concat from variable substitution (#1110)
Problem: I noticed that running :Vimwiki2HTML for a file with a `"` in
the `%title` line would error out.  For example, a title like:

    %title this will die: "

Causes:

    Error detected while processing function vimwiki#html#Wiki2HTML[1]..<SNR>177_convert_file[15]..<SNR>177_convert_file_to_lines
_template:
    line    8:
    E116: Invalid arguments for function substitute(v:val, "%title%", "this will die: "", "g")

Solution: It seems like the string concatenation here was unnecessary.
At least on my vim 8.1, the evaluated code seems to have access to the
correct variables.

I'm sure there are bigger problems with the HTML generation here, but this
allows my ~2000 pages with titles to render without throwing errors.

Also adds a brief test and removes some unnecessary DeleteFile() calls
from html_convert_default.vader.

Co-authored-by: Brennen Bearnes <code@p1k3.com>
2021-04-05 22:07:38 -05:00
Fergus Collins db85dc54c9 Doc: Fix trailing closing brace and comma typo when describing the defaults of g:vimwiki_ext2syntax (#1106)
* Fix trailing closing brace and comma typo

* add `C-Fergus` to contributors

* add pull request to changelog

* update pull request number to `#1106`
2021-03-15 15:19:43 -03:00
Levi Rizki Saputra 61a6ce6686 Fix Renaming and HTML Exporting Issue (#1057)
On Windows.

Commits squashed from first to be committed to most recent:
* fix subdir not correct when path using `\`

* fix slice by variable value not supported in vim 7.3

* remove last '\' from path in CustomWiki2HTML

* fix CSS path in CustomWiki2HTML wrong

* remove unused confirm CustomWiki2HTML

* use ==# rather than == in shellescape html.vim

* remove "FIXME this can terminate in the middle of a path component! from
base#subdir

* update doc/vimwiki.txt

* update contributor to doc/vimwiki.txt

* add comment in html#shellescape
2021-02-05 08:58:02 -03:00
Rane Brown d34abf9fa5 Update variable name used to open markdown image links 2021-02-01 14:55:11 -07:00
Niklas Söderlund a9d157fa0f Restore <C-@> list item toggle on Unix systems
A changed aimed to allow user configuration files to be able to override
all default mappings for the VimwikiToggleListItem plug did so by
removing the optional forth argument to vimwiki#u#map_key(). This
argument if set to 1 allows the same plug to be mapped to multiple keys
in the same mode. If not present only the first mapping takes effect and
all later attempts to map the plug in the same mode result in a no-op.
Thus allowing any user configuration to set it first and then 'skipping'
the defaults.

The change however did not account for that the default on Unix systems
was to map both <C-Space> _and_ <C-@> to VimwikiToggleListItem so the
change breaks this behavior, described in issue #1061.

Fix this by restoring the forth argument to vimwiki#u#map_key() to allow
multiple mappings to the same plug/mode but wrap it in a block to first
check if the user have overridden it or not. This goes back to how his
was handled before vimwiki#u#map_key() was added in [1].

1. 4106cb7bc7 ("New option g:vimwiki_key_mappings to enable/disable key mappings.")

Fixes: 48baa1f4cd ("Allow VimwikiToggleListItem mapping to be replaced (#1047)")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-01-15 13:48:13 -03:00
Niklas Söderlund 8f92aaffe4 Default to wiki number 0 if diary is called outside a wiki buffer
If a diary page is opened from outside a wiki buffer the diary frequency
and start of week options are not respected as the wiki number is not
yet set for the local buffer.

Fix this by defaulting the wiki number to 0, which is what is done in
vimwiki#diary#make_note() for the diary_rel_path option that suffers
from the same problem.

Example on how to trigger the problem:

    let g:vimwiki_list = [{'path': '~/.vimwiki', 'diary_frequency': 'weekly', 'diary_start_week_day': 'monday'}]

    $ vim -c VimwikiMakeDiaryNote

Fixes: a3be479d5a ("Add a diary frequency option (#884)")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-01-12 20:15:30 -03:00
Tinmarino 0a9488f3f1 Feature VimwikiColorize maps in visual and normal mode #990
Colorize working for visual selection
Add map (,wc), test and doc
2021-01-10 19:03:37 -03:00
Tinmarino e91711eb79 Test: Fix error in previous typeface hi 2021-01-10 13:16:34 -03:00
Tinmarino 850aace465 Conf: #1060 Get configurable schemes_web
Permit opening file with name "ssh: name with spaces.md"
2021-01-10 13:00:54 -03:00
Tinmarino e7124290a2 Fix: Typeface font highlight VimwikiBoldItalicUnderline was not bold
Fix 2: s:setup_cleared_syntax() was reconfiguring badly
Test: for hi VimwikiBold -> cterm=bold
2021-01-10 12:27:35 -03:00
Tinmarino 788a961052 Test: Add option to configure date string format #1073 2021-01-07 22:15:35 -03:00
Tinmarino 5996fdf26a Test: #1048 <Plug>VimwikiTableNextCell 2021-01-06 14:36:06 -03:00
Tinmarino 29fa4b028b Doc: Indent Docstring inside function 2021-01-06 14:36:06 -03:00
yhu266 ffc4e41208 move changelog entry to the end 2020-12-29 11:38:24 -03:00
yhu266 036a7d24f9 Add option to configure date string format 2020-12-29 11:38:24 -03:00
Tinmarino 8c7937c765 Fix: #1074 Key not present in Dictionary: lists_return in g:vimwiki_key_mappings
Bug from previous PR #1066
2020-12-29 11:29:09 -03:00
yuuy bb4f5f85e8 feat(vimwiki_key_mappings):add a flag lists_return 2020-12-28 19:45:30 -03:00
yuuy 84928f7ace feat(vimwiki_key_mappings):add a flag lists_return 2020-12-28 19:45:30 -03:00
Tinmarino dbe332a095 Fix: Jenkins: Dockerfile install py3-pip 2020-12-28 19:27:49 -03:00
Chip Senkbeil e4fc0ca0e5 Revise with table column alignment based on work done for vimwiki-server 2020-12-22 20:25:56 -03:00
Chip Senkbeil 237f67db4e Revise based on comments 2020-12-22 20:25:56 -03:00
Chip Senkbeil 4f0df71d84 Rename component to element 2020-12-22 20:25:56 -03:00
Chip Senkbeil 1b2f34f5e0 Fix bad whitespace characters link 2020-12-22 20:25:56 -03:00
Chip Senkbeil 9753bcbcde Add TODO about preformatted text metadata list separators 2020-12-22 20:25:56 -03:00
Chip Senkbeil c3eff1dd0e Update header and definition list specs to support inline components 2020-12-22 20:25:56 -03:00
Chip Senkbeil 333b44a238 Correct statement about link with wikiN: needing N to be 1 (should be 0..N-1) 2020-12-22 20:25:56 -03:00
Chip Senkbeil 2c10045004 Add vimwiki language specification 0.1.0 2020-12-22 20:25:56 -03:00
Levi Rizki Saputra 8d4cb7f11d Revert "Fix Renaming issue in Windows and ext with two dot (#1051)" (#1056)
This reverts commit e922f7302f.
2020-11-20 11:05:51 -03:00
Levi Rizki Saputra e922f7302f Fix Renaming issue in Windows and ext with two dot (#1051)
* fix subdir not correct when path using `\`

* fix slice by variable value not supported in vim 7.3
2020-11-20 09:08:51 -03:00
Amit Beka 96713548cc configure expression for Todo words (#1053)
Enable the user to conveniently set the regular expression used for the
`VimwikiTodo` syntax group, instead of the defaults which might be
more suitable to code.

This setting is now also local per wiki.

Signed-off-by: Amit Beka <--->

Co-authored-by: Amit Beka <--->
2020-11-20 09:02:55 -03:00
Amit Beka 609fc5f509 Map: Enable changing insert mode table mappings (#1048)
Mapping `<Tab>` and `<S-Tab>` at insert mode sometimes collide with
other plugins which utilize these for completions (e.g. coc example
mapping).

Since for many users the case for completion is more frequent than table
editing, this patch enables changing these mappings using the options
`<Plug>VimwikiTableNextCell` and `<Plug>VimwikiTablePrevCell`.

This patch makes it easier of those using multiple plugins and have no
desire or knowledge in debugging the collision.
It complements #1030 by providing a more direct and documented method
for setting custom keymappings.

Signed-off-by: Amit Beka <--->

Co-authored-by: Amit Beka <--->
2020-11-19 09:55:19 -03:00
Amit Beka 523986df4b enable strikethrough for Neovim (#1054)
Neovim has a different method of marking applied patches, using neovim
versions, since patches from Vim are not merged by chronological order.

Signed-off-by: Amit Beka <--->

Co-authored-by: Amit Beka <--->
2020-11-15 09:21:41 -03:00
Rajesh Sharma 48baa1f4cd Allow VimwikiToggleListItem mapping to be replaced (#1047)
* Allow VimwikiToggleListItem mapping to be replaced

Currently VimwikiToggleListItem mapping cannot be removed but only new mapping
to it can be added. This commit will allow to add custom binding to this
function and release default mapping of <C-space> and <C-@>, which was how it
was before https://github.com/vimwiki/vimwiki/pull/686

* Update changelog + contributor list

* endi -> endif

Co-authored-by: Tinmarino <tinmarino@gmail.com>
2020-11-12 22:22:25 -03:00
Tomas Janousek dc2b16a587 Fix vint warning introduced by #1039 2020-10-24 19:43:01 -03:00
Tomas Janousek c34b37e195 Doc: Fix inconsistent naming of some option help tags 2020-10-24 19:43:01 -03:00
Tomas Janousek 2a31984369 Feature: Optionally disable todo propagation to parents/children (Issue #954)
taskwiki integrates vimwiki with taskwarrior, and in doing so changes
the semantics of checkboxes a bit:

    * [ ] Install Taskwiki   |   pending task
    * [X] Install Taskwiki   |   completed task
    * [D] Install Taskwiki   |   deleted task
    * [S] Install Taskwiki   |   started task
    * [W] Install Taskwiki   |   waiting task

It's still desirable for vimwiki to automatically insert `* [ ]` on
`i_<CR>`, `o` and `O` and to syntax highlight all these five as
checkboxes, so I have this in my .vimrc:

    let g:vimwiki_listsym_rejected = 'D'
    let g:vimwiki_listsyms = ' WSX'

but it results in undesirable behaviour with task hierarchies: when I
add a new subtask (using `i_<CR>`, `o` or `O`)
or mark a subtask done, the parent's checkbox is updated to reflect its
overall completion, to one of ` `, `W`, `S` or `X`, depending on
subtasks completion. This makes little sense in taskwiki. One usually
doesn't want to touch the "parent" task in taskwarrior until the
"subtasks" are done. Setting

    let g:vimwiki_listsym_rejected = 'W'
    let g:vimwiki_listsyms = ' SX'

results in slightly less illogical behaviour, but it still assumes that
(1) all subtasks are visible (not necessarily true in taskwiki) and
(2) that it's a parent/subtask relationship, not a dependency
relationship (not true in taskwarrior, questionable in taskwiki).

This commit adds an option to disable this behaviour.
2020-10-24 19:43:01 -03:00
Tomas Janousek f794f1e284 Fix some typos in vars.vim 2020-10-24 19:43:01 -03:00
Daniel Moura a040c42264 fix: not throwing error when loading for some languages
Some languages uses comma instead of dot for decimal separator.
When loading vimwiki the following error was occuring
E806: using Float as a String
This is probably a bug in vim, as a workaround when using float can be
str2float.
Similar issue in another project
https://github.com/nathanaelkane/vim-indent-guides/issues/10
2020-10-22 12:19:03 -03:00
mtourneb e2a6b825de Doc: Update changelog (@davidsierradz) 2020-10-19 23:47:10 -03:00
David Sierra DiazGranados 527ca1b7a1 Allow overwriting insert mode maps (#1030)
According to `:h hasmapto()` if we don't pass the mode as an argument
then only normal, visual and operator-pending modes are checked.

Lets pass the mode explicitly to allow overwriting insert mode mappings.
2020-10-19 23:30:28 -03:00
Michael F. Schönitzer ea4a5e3bb2 Update README.md 2020-10-19 22:57:10 -03:00
Marek Šuppa a6878015e6 docs: Fix typo (#1017)
* Change `commando` -> `command`

Signed-off-by: mr.Shu <mr@shu.io>
2020-09-22 20:17:18 +02:00
mtourneb 78216de25e Fix bug: g:vimwiki_syntaxlocal_vars not initialized (Issue #1013) 2020-09-08 10:27:17 -03:00
Benney Au 842f842100 886 fix generate links on windows (#1011)
* 886 fix generate links on windows

* update docs

* 886
2020-09-06 04:45:48 -03:00
mtourneb 990b25ce37 Fix: Folding by 'syntax' does nothing with Markdown syntax (Issue #1009) 2020-09-05 16:19:21 -04:00
Ryan Winograd 1ea97303fd Fix: HTML Conversion: List with wrapped lines (#1008)
Track how many leading spaces a list item has in order to determine whether we should start a blockquote.

Note the extra close tag in the added test: this is a pre-existing issue
already present on `dev`.
2020-09-05 11:45:50 -04:00
mtourneb a7f34cd8cf Feature: Add command VimwikiColorize (Issue #990)
Only colorize the current line to start
2020-09-03 23:43:56 -04:00
Edward Bassett dbbadc8035 [Issue #999] Fix duplicate help tags (#1000)
Doc: Fix: Changed one occurrence of "vimwiki-global-options" back(?) to "vimwiki-syntax-options".

Problem: Duplicate tag
Solution: Delete one

Co-authored-by: Edward Bassett <edward.bassett@ualberta.net>
2020-09-01 20:13:12 -04:00
Tinmarino dc63a5dacc Fix: Html convertion: Blockquote: multiline and in number list (Issue #55)
- Issue 5 indented multiline

Transoform blockquotes by precode
```
<blockquote>
Block quote line 1
Block quote line 2
</blockquote>
```
->

```
<pre><code>line 1
line 2
</code></pre>
```

- Issue 2: BlockQuote restarts list numbering

Allow indent precode in list
2020-08-24 01:14:18 -04:00
Tinmarino 8e5274b1a2 Test: Batchify all && Lint run_test.sh
All tests in the same batch, in other words, no independant test
2020-08-23 03:42:02 -04:00
Tinmarino 817641e551 Fix: Indentation broken within lists (Issue #991)
Side effect, formatoption+=c in order to also keep the joining behavior
with lists
2020-08-23 01:59:12 -04:00
Tinmarino d1b3fe34c9 Fix: Vimwiki2HTMLBrowse broken when using a custom converter (Issue #992) 2020-08-22 12:40:54 -04:00
Tinmarino a51052cbe6 Feature: VimwikiVar to list, get and set variables
Refaction:
- Add g:vimwiki_syntax_list to set syntaxlocal variables
- Delete: syntax/vimwiki_markdown.vim and friends
- Change: vimwiki_syntax_variables -> vimwiki_syntaxlocal_vars for consistency
- Include: some doc in design notes
2020-08-17 23:51:48 -04:00
kraem ee2d67751e Fix typo in help file 2020-08-17 09:21:05 -04:00
Tinmarino 5c64ced22d Feature: Utility function: linkify to extract link title from url (PR #982 from @jeromg) 2020-08-14 01:30:04 -04:00
Tinmarino d93858509d Prettyfy: Plugin: Comment and one antipattern 2020-08-13 01:59:47 -04:00
Tinmarino 0b85dd1a7b Feature: Syntax typeface delimiters can end at punctuation 2020-08-13 01:59:21 -04:00
Tinmarino 22d9d012ba Fix: Broken TOC links format when using default syntax (Issue #981)
- Not normalising for default
- SetExt header missed a `^` in the regex so mateched the trailing ===
of === head3 ===
2020-08-12 23:59:45 -04:00
Tinmarino 212cd8e09b Doc: rename DesignNotes.md -> design_notes.md 2020-08-12 11:17:00 -04:00
Tinmarino 4431caf7ff Fix: Vars.vim error in parsing: key not present (Issue #980) 2020-08-12 10:35:40 -04:00
Tinmarino 11337f5b34 Test: remove vader_setup and vader_teardon 2020-08-12 09:12:17 -04:00
Tinmarino 39407014c8 Syntax: Stricter typeface and fix preCode (alias inline) nested in bold
Fix: Syntax bug precode nested in bold apperead bold

Problem:
1. `that_ HERE _was` italic
2. `__that ``HERE`` was__  bold => PreCode should not receive typeface
region changes

Solution:
1. Stricter regex (and add \* to VimwikiError)
2. Add VikiError and WikiPre to nestables syntaxes
2020-08-12 01:37:27 -04:00
Tinmarino a241d458ab Syntax: Emoji faster conceal with keyword 2020-08-12 01:20:55 -04:00
Tinmarino a1f1b9c290 Syntax: Stricter italic match: match '_that_' not 'a_ that _a'
See: https://github.github.com/gfm/#emphasis-and-strong-emphasis

`A single * character can open emphasis iff (if and only if) it is part of a left-flanking delimiter run.`

Tim Pope default is too permissive (leads to too much emphasis openener): `\S\@<=_\|_\S\@=` -> `_\S\@=`
2020-08-09 16:29:39 -04:00
Tinmarino 21c5a7f796 Feature: Better joining bullet and task lists (set comments) 2020-08-09 16:14:31 -04:00
Tinmarino 7144df6b96 Test: Refactor: Normalize names and behavior 2020-08-09 16:13:53 -04:00
Tinmarino 4b041a606a Refactor: Mutualize messaging (echo) 2020-08-09 16:06:35 -04:00
Tinmarino 188ead55db Config: Permit tag configuration for syntax, search and match (Issue #922 #928)
Affects: (via user configurated regexp)

- VimwikiGenerateTagLinks
- follow_link
- completion
- Syntax Highlighting
2020-08-08 04:06:20 -04:00
Tinmarino dede5a1eea Change: VimwikiCheckLinks work on current wiki or on given range
Problem: VimwikiCheckLinks can be slow
Solution: Work only on current wiki or accept a range
2020-08-08 04:01:31 -04:00
Tinmarino 659ca62b29 Fix: Accessing other filetypes within vimwiki (Issue #979)
Note: Viwiki no longer rules them all
2020-08-07 13:26:14 -04:00
Tinmarino 4aa3ca5c16 Fix: VimwikiGenerateLinks crash with single quote in filename (Issue #886 #881) 2020-08-07 12:27:05 -04:00
Tinmarino dd239c58fb Comment: tipo (for faster grep) 2020-08-07 12:27:05 -04:00
Tinmarino f18bf3dafb Fix: Html convertion regex Bold and Italic (Issue #977)
Problem: I copied rxBold from markdown (mea culpa)
Solution: Use the one that was defined in default
2020-08-07 12:27:05 -04:00
Tinmarino 348b014957 Fix: Typeface should not be nested in single equation (#977)
Solution: make thos a tex nested region and let tex decide the syntax
2020-08-07 12:27:04 -04:00
Tinmarino aa628f8a12 Feature: Emoji support conceal and complete 2020-08-07 02:39:53 -04:00
Tinmarino 0693e41132 Fix: VimwikiTOC removes next non-empty line (Issue #910) 2020-08-06 17:04:58 -04:00
Tinmarino 8a50d022b1 Fix: follow_link (suffix) and VimwikiGenerateTagLinks (__FileExtension__) (Issue #914)
Problem:
- follow_link failed with header with number at the end
- VimwikiGenerateTagLinks did not replace the __FileExtension__

Solution:
- follow_link try first 1 time with suffix number n and then n times without
- VimwikiGenerateTagLinks replace the __FileExtension__
2020-08-06 11:21:48 -04:00
Tinmarino 69ead3bf3c Fix: VimwikiTOC is broken against headers with link (Issue #182)
Problem: VimwikiTOC and follow_link do not support header (anchor) with
link in their body

Solution:
- VimwikiTOC (easy): Create function base.vim s:clean_header_text that
converts [DESC](URL) -> DESC
- follow_link (hard):
-- [[URL]]: was already working due to punctuation removal.
-- [DESC](URL): Search for a potential `]([^)]*)` after every character
2020-08-05 22:26:05 -04:00
Tinmarino e4186adc3d Fix: iMap <Cr> Interfere in completion (alias popup-menu, pum) (Issue: #813)
Problem: When pum opened, the mapping of <CR> is triggered but user
want the default behaviour: to choose a completion item

Solution: Conditional mapping:
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : ':<Esc>:VimwikiReturn 1 5<Cr>'
                         The previous mapping  -----------------^
2020-08-05 12:13:13 -04:00
Tinmarino 8cc99c00c2 Fix VimwikiRenameLink ruins window layout (Issue #592) 2020-08-05 10:22:32 -04:00
Jerome Gay b1de908f0e Fix: is_diary_file to support whitespaces (Issue #970) 2020-08-04 19:15:30 -04:00
Tinmarino 708fde781a Fix: tilde ~ not supported in g:vimwiki_listsym_rejected (Issue #962)
Just escape the tild in match
2020-08-04 18:57:02 -04:00
Tinmarino 825870ec1b Fix: Highlight borken with done item rided by code (Issue #971) 2020-08-04 17:44:37 -04:00
Tinmarino fc056cfeca Feature: Markdown: Support SetExt Heading (Issue #209)
Like these
==========

See: https://spec.commonmark.org/0.29/#setext-headings

Note: work for follow_link and VimwikiTOC
2020-08-04 01:17:34 -04:00
Tinmarino 40f02293bf Prettify Syntax: Reduce var name && Move from vars.vim to syntax.vim 2020-08-03 22:21:02 -04:00
Tinmarino 94a78859d7 Refactor: Syntax as region (code, eq, sub, sup, strike) => Fix (Issue #709)
More syntax pattern are defined as regions => Faster, enable nesting
2020-08-03 18:45:46 -04:00
Tinmarino fb178f8e3c Fix: Typeface: var_with_undersore triggered syntax italic 2020-08-03 01:00:14 -04:00
Tinmarino 22bb7d9570 Doc: Update Changelog 2020-08-03 00:42:13 -04:00
Tinmarino 428c60a45e Feature: Markdown link: VimwikiTOC supports multiple heading with same name (Issue: #968, 666, #664)
Anchor can be suffixed with -1 -2 according to the heading number (in
file) user want to reach.
Implemented with a dictionary for caching anchor names (without sufix)
2020-08-02 23:28:18 -04:00
Tinmarino a27940a394 Feature: Markdown anchor normalize and unormalize (Issue #664)
Add normalize anchor and unnormalize to get markdown anchor github
compliant. For respectively follow_link and VimwikiTOC

TODO: Treat the potential -12 suffix in anchor-links: ex:
[got to second link](same-link-2)
2020-08-02 22:05:37 -04:00
Tinmarino 1b16720b7b Refactor: Syntax highlighting typeface: match -> region: (Issues #847, #640)
- Less code, Easyer to maintain, to add a markup language
- Faster to load, and to highlight
- Support multiline tags: #847
- Support nested tags
- Support intraword tags: this<b>bold</b>type #640
2020-08-02 03:57:22 -04:00
Tinmarino 5408d74b35 Syntax: Html support nested, concealable tag and faster
Use of syntax region => clearer, faster
2020-08-01 22:40:06 -04:00
Chip Senkbeil 6dff2c60a5 Add multiline comment support via %%+ and +%% 2020-08-01 18:18:11 -04:00
Chip Senkbeil 321e518fdb Replace VimwikiListChangeLevel references in doc with VimwikiListChangeLvl 2020-07-31 07:54:16 -04:00
Aditya Harit 7f8c4b5669 Fix: wrong html link conversion in windows (PR #945) 2020-07-30 19:31:55 -04:00
Tinmarino 97e02897f4 Refactor: Vars: Make vimwiki_list_ignore_newline wiki local (Issue #894)
Also: vimwiki_text_ignore_newline
2020-07-30 18:48:15 -04:00
Tinmarino 787e95b910 Refactor: Vars: Make vimwiki_toc_header wiki local
Also: vimwiki_toc_header_level, vimwiki_toc_link_format
2020-07-30 18:48:15 -04:00
Tinmarino 5651e744a6 Test: Fix vader_setup dep from 946 2020-07-30 18:47:23 -04:00
BirgerNi 0a5a33af19 Feature: Add option g:vimwiki_commentstring to disable vimwiki commentstring (PR #946 from @BirgerNi ) 2020-07-30 18:04:43 -04:00
Tinmarino 66a294d76f Test: Fix not understood frooze
Found by dichotomy, related to :file commmand and filename cannto be
writen. bug in run_test.sh but not in custom Vader
2020-07-30 01:10:36 -04:00
Tinmarino 355c1f76b0 Feature: Follow links: Allow hyphens and case-insensitive (PR #840 from @bratekarate)
Brief: Permits:

```
[Link to heading](#heading-example)
```

Issue: Feature Request: Support GFM anchor links inside wiki files #831
Original PR: Allow hyphens instead of spaces and search case-insensitive in jump_to_anchor function #840
Author: @bratekarate (implementation) @tinmarino (test)

Related: #666
2020-07-30 00:45:28 -04:00
Tinmarino 2332dc1514 Refactor: Test & Doc: Remove test/vader_include and move DesignNotes to doc
- vader_include is declareing functions -> faster to load (parse) once in
vimrc
- DesignNotes is doc so goes to doc
2020-07-29 23:29:03 -04:00
Tinmarino 96232c0340 Test for html table convertion with header (Issue #941) 2020-07-29 21:18:36 -04:00
Gaurang Kher f107557463 #940: Render header inside thead element if table has header (#941) 2020-07-29 15:36:33 -04:00
Ryan Winograd 7a4ad2ed95 Fix :VimwikiNextTask
Use the correct function for accessing 'rxListItemWithoutCB'.
`ac4d0a1d46` refactored access to vars and it appears this is one place
where `get_syntaxlocal` should have been renamed to `get_wikilocal` but
was accidentally skipped.
2020-07-29 15:26:33 -04:00
Tinmarino 369a64cdc8 Feature: VimwikiRenameFile 1/ to other dir 2/ take argument (completable) (Issue #926) 2020-07-29 01:18:40 -04:00
Tinmarino e785c6f5b4 Test: travis run vint in an other job => faster 2020-07-29 00:36:44 -04:00
Tinmarino b124c9b1d8 Test: VimwikiDiaryGenerateLinks with wiki syntax (Issue: #921) 2020-07-27 14:48:05 -04:00
Tinmarino af08e34000 Fix: update_listing_in_buffer is clearing the buffer (Issue #921)
Problem:
        VimwikiGenerateTags and VimwikiDiaryGenerateLinks end up with empty wiki files
        when foldlevel=0 and g:vimwiki_folding='expr'

Solution:
        Set an initial foldlevel to 100 in update_listing in diary

Optionaly: Comment a little the big messy, geeky hack !
2020-07-27 01:35:49 -04:00
Tinmarino d9d14cc3f7 Feature: Config: Normalize link so that user can choose [[]] or []() (Issue #892)
Main change:
        Create function: normalize_syntax_settings(syntax)

Problem:
        Some user prefer [[]] links more than []().
        As vimwiki know both of them, they should be able to choose
        without regex mastery and with tests

Solution:
        let g:vimwiki_syntax_variables.markdown.Link1 = vimwiki#vars#get_global('WikiLinkTemplate1')
2020-07-26 23:46:35 -04:00
Tinmarino 4672deb44e Config: make vimwiki_markdown_link_ext wikilocal 2020-07-26 23:46:18 -04:00
Tinmarino d5964f0c84 Feature: blockquote (> ) better joining (J) and hard wrapping (Issue #915)
Wrap: autoadd a new `> ` on new create lines with `setlocal comments+=n:>`
Join: autoremove the inter `> ` with  `setlocal formatoptions+=j`
2020-07-26 19:01:04 -04:00
Tinmarino 536184c59b Test: Travis run job in parallel
And re-add nvim to the Dockerfile
2020-07-26 16:50:23 -04:00
Tinmarino 8e2eab2e55 Test: #473 Convert Html Linux [[local:C:/Users/somebody/d/e/f/music.mp3]] 2020-07-26 00:51:05 -04:00
Tinmarino 0a9b11fb0f Test: Add local testing (no docker need), working on windows
Problem: User do not want to install docker to test
        and docker is not set for windows already
Solution: Get the script to make the tests locally with current os and
        vim

Log of workflow (6h):
=====================

Test: cloning only last 10 Vader commits locally [tinwin]
Test: run_bash fix local copies and prettify/robustify [tinwin]
Test: Lint tests and fix err treatment in run_bash [Tinmarino]
Test; Windows: Restore the bug that I appended on Linux OLD-PATH env deps [Tinmarino]
Test: bash script first success on Windows (only the script not the tests) [tinwin]
Test: Dirty Backup [tinwin]
2020-07-26 00:00:23 -04:00
Tinmarino c9ba53e204 Refractor: Path Add utility unixify #478
Basically unixify all before workingm then transofom in function os os

Util: Add function sort_len that a list of string according to the lenght of its content
Fix: VimwikiRenameLink doesn't update links in diary #90
Test: VimwikiRenameLink with nested directories
Prettify comments in autoload/path + remove antipattern
Define osxify function helper to solve windows Vs Unix : see #478
Path: remove useless temporary fix convertion before calling relpath (redundant) : see #478
Test: Fix typo
Path corrected (Thanks to test)
2020-07-25 03:51:02 -04:00
Tinmarino 81c67f97e4 Test: 1/Fix some interdependencies 2/replace -o -> -f
1/ Fix interdependencies: any test can run alone
2/ Replace command line -o by -f
3/ As usual makesome formating, don't hate me if merge conflicting ..
2020-07-25 02:05:59 -04:00
Tinmarino ac38bb2f09 Refactor: normalize_link_v, creating u#get_selection (Fix #382)
* Less hacky selection handling: nomal command hack -> vimscript code
* Some prettifying, antipattern removal
2020-07-24 17:59:54 -04:00
Tinmarino edf562fab0 Test: VimwikiTableMoveColumnLeft and some friends
Test: VimwikiTableMoveColumnLeft (Note:cannot test <M-Left> map : not triggered)
Test: issue #949 <Enter> create link bug with Chinese characters
Test: VimwikiGoto with ,wn
Test: Table left align
Prettify: modeline of contributing
2020-07-24 00:16:09 -04:00
Tinmarino 446776e00b Fix: Table imap <Tab> (error from new tipo on configurable mapping) 2020-07-24 00:16:02 -04:00
Tinmarino f21245a843 Fix: html conversion error from markdown (#951)
From last html conversion refactoring
2020-07-24 00:14:28 -04:00
Reiner Herrmann ca84701c83 Add Vader tests for RSS feed generation 2020-07-22 10:06:30 -04:00
Reiner Herrmann e3501dcdd0 Generate RSS feed for diary entries 2020-07-22 10:06:30 -04:00
Reiner Herrmann 0543b46ffd Refactor HTML conversion into separate function 2020-07-22 10:06:30 -04:00
Rafael Castillo e006da5aa0 Add test for arrow blockquotes 2020-07-22 00:41:36 -04:00
Rafael Castillo 36e5455723 Fix blockquotes not stripping arrows 2020-07-22 00:41:36 -04:00
Rafael Castillo be86b54914 Fix typo 2020-07-22 00:41:36 -04:00
Rafael Castillo 12327c6f90 Adds email style quotes to signal blockquotes 2020-07-22 00:41:36 -04:00
Rajdeep e3e841f335 Feature: Add handling of absolute path to vimwiki #811 from @justrajdeep
- update vimwiki link handling so that if using env variables it is resolved
- add [[//absolute_path]] to handle absolute path
- updated doc to reflect the changes
2020-07-22 00:25:58 -04:00
Tinmarino 8cf2789840 Prettify 2020-07-21 19:37:05 -04:00
Tinmarino 068a26acec Fix link extension removed 2020-07-21 19:36:14 -04:00
Tinmarino 667929d3f9 Prettify tbl.vim 2020-07-21 15:15:56 -04:00
Tinmarino dfc5344d0c Fix: #891 Table Pressing <Enter> autosets tw<-0
Issue: Pressing <Enter> in insert mode in table breaks line wrapping #891
2020-07-21 15:13:58 -04:00
Tinmarino 19bfe93ef3 Test: Table should not change tw 2020-07-21 15:10:27 -04:00
Tinmarino 1072f2a14e Lint, diary from last PR: ==? and '' 2020-07-21 13:24:42 -04:00
Jérémy Caldas a3be479d5a Add a diary frequency option (#884)
* Add diary_frequency parameter to wikis

* Create diary entries according to the frequency

* Update date validation

* Use timestamps, extract abstract yesterday and today as day-long periods

* Revert old changes

* Remove debug log

* Start the week any day

* Add monthly and yearly options

* Cleanup
2020-07-21 13:21:43 -04:00
Tinmarino 45b7515b88 Fix: VimwikiGenerateDiary with unreplaced __FileExtention__ 2020-07-21 13:12:18 -04:00
Tinmarino 75a9232fd5 Fix: #913: VimwikiGoto completion aafter <CR> [in input() prompt]
Issue #913:
        :VimwikiGoto tab completion only works when written in-line, not when called from \wn #913
        PR #785 adds completion to :VimwikiGoto, however it works only when you try to type the filename after the command, e.g.
2020-07-21 10:20:06 -04:00
Tinmarino 2f20c617d6 Update Contributing.md
WIth github interace, enfasis on the non regression tests
2020-07-21 09:06:44 -04:00
Yigit Sever ed3f1ad215 Allow weblinks to end with '<'
Fixes #908
2020-07-21 00:16:16 -04:00
Clinton Ryan 975a29ebf0 Update spelling mistake 2020-07-21 00:14:16 -04:00
Edward Bassett da9ef92948 Doc: Fix for duplicate helptags: bullet_types 2020-06-16 23:21:41 -04:00
Tinmarino e1826702b7 Fix: Link substitution of __FileExtension__ #914 2020-06-16 17:47:40 -04:00
Tinmarino 865b402c06 Travis: Fix vint error propagation 2020-06-16 14:48:15 -04:00
Tinmarino 43951e5851 Clean & Fix: cycle_bullets bug not defined key in dic: #911 2020-06-16 13:46:56 -04:00
Michael F. Schönitzer a9f21c6d4a Functions to remove all todo items that are done (#906)
Add function VimwikiRemoveDone that will delete lines with todo list items marked as done. Works on ranges as well as without range on the current list.

Co-authored-by: Tinmarino <tinmarino@gmail.com>
2020-06-08 14:31:35 +02:00
Robert Günzler 61093f4f2a Feature: Add option to automatically cycle bullet chars (#907)
When the syntax local config `cycle_bullets` is set (currently only
markdown has it by default) the indent functions will cycle through the
characters defined in `bullet_types` based on the level of indentation.

Signed-off-by: Robert Günzler <r@gnzler.io>
2020-06-07 19:03:10 -04:00
Tinmarino 1617d4b654 Test: add issue non-regession and todo list 2020-06-04 17:29:47 -04:00
Tinmarino 5e564bb10d Comment: code and robustify 2020-06-04 17:29:26 -04:00
Milkey Mouse c70e1dea54 Darken logo text (#902)
The logo was unreadably light on my display. WCAG accessibility
guidelines suggest an even lighter color, but this preserves the "look"
of the logo without making it too dark.
2020-06-04 18:35:05 +02:00
Michael F. Schönitzer ac4d0a1d46 Allow to configure bullet points & status indicators per wiki (#889)
* Allow the bullet point characters of lists to be configures by the wiki option `bullet_types`. This allows to use other/additional characters for the bullets of lists – including unicode-chars like '→' or '•'. The default values depends on the chooses syntax.
* Allow to configure `vimwiki-listsyms` and `vimwiki-listsym_rejected` on per wiki basis.
* Fix a test for mediawiki syntax
2020-06-04 18:33:12 +02:00
Michael F. Schönitzer afc868929d Bugfix: file extension for markdown is syntax wide (#895)
populate_extra_markdown_vars() contained uses of the file-extension via vimwiki#vars#get_wikilocal. Since the first is syntax-wide and the second is wikilocal and no wiki is specified or open at the moment of the call, the file extension of the first markdown wiki will be used for all markdown wikis. Further problems will occur when adding new wikilocal options, that depend on the syntax.

This commit is working towards separating wiki and syntax, which is needed for several feature requests.
2020-06-02 01:33:06 +02:00
Tinmarino d8e7e40fcd Update vimwiki.txt
REmove the star at flex
2020-06-01 11:24:15 -04:00
PtitCaius df8bfcba23 Add changelog 2020-06-01 11:24:15 -04:00
PtitCaius 762bb7f124 Revert version change 2020-06-01 11:24:15 -04:00
Marius Lopez 1448dc3a7b Fix conceallevel set globally 2020-06-01 11:24:15 -04:00
Michael F. Schönitzer 5b17cfc076 Bump version number – release 2.5 2020-06-01 11:24:15 -04:00
Tinmarino 285f1628c2 Test: Fix: exit status (was always 0) 2020-05-30 18:08:23 -04:00
111 changed files with 17371 additions and 3862 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
Prior to submitting a new issue make sure to complete these steps:
- [ ] Checkout the `dev` branch and confirm the issue is present there as well.
The `dev` branch contains fixes that may not have been merged to `master` yet.
- [ ] Post the syntax you are using (default/mediawiki/markdown) **and** your vimwiki settings from your `.vimrc`
- [ ] 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`.
+119
View File
@@ -0,0 +1,119 @@
---
# Copied from previous .travis.yml by tinmarino the 2023-03-09
# Commented out to avoid verbosity on github commit status
name: CI
# yamllint disable-line rule:truthy
on: [push, pull_request, workflow_dispatch]
jobs:
Typos:
# Copied 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
Yamllint:
# Copied from: https://github.com/junegunn/fzf/blob/master/
# -- .github/workflows/typos.yml
name: Yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: .github/workflows/test-vader-action.yml
Vint:
# Copied 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.4.2367",
"-n vim_8.2.5172",
"-n vim_9.0.2190",
"-n vim_9.1.0786",
# 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",
# This build isn't currently working with vim-testbed:
# "-n nvim_0.10.2",
# 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 }}
+24 -1
View File
@@ -1,4 +1,9 @@
# 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:
@@ -20,8 +25,26 @@ before_install:
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
- bash run_tests.sh
- 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:
+54 -58
View File
@@ -1,72 +1,68 @@
# Contributing to Vimwiki
# Contributing to VimWiki
# Filing a bug
Before filing a bug or starting to write a patch, check the latest development version from
https://github.com/vimwiki/vimwiki/tree/dev to see if your problem is already fixed.
Before filing a bug or starting to write a patch, check the latest development
version from https://github.com/vimwiki/vimwiki/tree/dev to see if your problem
is already fixed.
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/ .
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/
# Git branching model
As of v2022.12.02, VimWiki has adopted a rolling release model, along with
[calendar versioning][calver]. A release should be
[prepared][#preparing-a-release] for every change or set of changes which merge
to `dev`.
[calver]: https://calver.org/
There are two permanent branches:
1. `dev`: This is the default branch, and where changes are released. Tasks
which are done in one or only a few commits go here directly. Always
keep this branch in a working state. If the task you work on requires
multiple commits, make sure intermediate commits don't make VimWiki
unusable.
2. `master`: This is a legacy branch, retained to avoid breaking existing
checkouts of the plugin. It should be kept in sync with `dev`.
Large changes which require multiple commits may be authored in feature
branches, and merged into `dev` when the work is done.
# Creating a pull request
If you want to provide a pull request on GitHub, 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.
Make sure to update `doc/vimwiki.txt` with the following information:
Version bureaucracy:
1. Update the changelog to include information on the new feature the PR introduces or the bug it
is fixing.
1. Pick a new version number according to the current date:
`YYYY.MM.DD` (if releasing a second version for the
current date, append a `_MICRO` version such as `_1`, `_2`, etc.
- Examples: `2022.12.22`, `2022.12.22_1`
2. Update the version number at the top of `plugin/vimwiki.vim`
3. Update the `!_TAG_PROGRAM_VERSION` expected in `test/tag.vader`
(this is a bit silly, will have to figure out how to get rid of it)
Update `doc/vimwiki.txt` with the following information:
1. Update the changelog to include, at the top of it, information on the new
feature the PR introduces or the bug it is fixing as well as the PR number
and related issue number if possible.
2. Add a help section to describe any new features or options.
3. If you are a first time contributor add your name to the list of contributors.
3. If you are a first time contributor add your name to the list of
contributors.
**Testing:** Vimwiki uses [vader](https://github.com/junegunn/vader.vim) for unit tests and
[vint](https://github.com/Kuniwak/vint) for linting. Any new PRs must add new tests and pass all
linter checks. See the [test README](test/README.md) for more info.
# Preparing a release
- In addition to the included tests, there are more example wikis that can be used for testing
[here](https://github.com/vimwiki/testwikis).
This section is primarily for maintainers.
# More info and advice for (aspiring) core developers
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.
- Before implementing a non-trivial feature, think twice what it means for the user. We should
always try to keep backward compatibility. If you are not sure, discuss it on GitHub.
- Also, when thinking about adding a new feature, it should be something which fits into the
overall design of Vimwiki and which a significant portion of the users may like. Keep in mind
that everybody has their own way to use Vimwiki.
- Keep the coding style consistent.
- Test your changes. Keep in mind that Vim has a ton of options and the users tons of different
setups. Take a little time to think about under which circumstances your changes could break.
## Git branching model
- There are two branches with eternal lifetime:
1. `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).
2. `master`: This branch is for released states only. Whenever a reasonable set of changes has
piled up in the `dev` branch, a [release is done](#preparing-a-release). After a release,
`dev` has been merged into `master` and `master` got exactly one additional commit in which
the version number in `plugin/vimwiki.vim` is updated. Apart from these commits and the
merge commit from `dev`, nothing happens on `master`. Never should `master` merge into
`dev`. When the users ask, we should recommend this branch for them to use.
- Larger changes which require multiple commits are done in feature branches. They are based on
`dev` and merge into `dev` when the work is done.
## Preparing a release
1. `git checkout dev`
2. Update the changelog in the doc, nicely grouped, with a new version number and release date.
3. Update the list of contributors.
4. Update the version number at the top of the doc file.
5. If necessary, update the Readme and the home page.
6. `git checkout master && git merge dev`
7. Update the version number at the top of plugin/vimwiki.vim.
8. Set a tag with the version number in Git: `git tag vX.Y`
9. `git push --tags`
10. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag, convert the changelog
from the doc to markdown and post it there. Make plans to build an automatic converter and
immediately forget this plan.
11. Tell the world.
<!-- vim:tw=99 -->
[semver]: https://semver.org/
+19 -15
View File
@@ -1,23 +1,27 @@
FROM testbed/vim:17
FROM testbed/vim:latest
# add packages
RUN apk --no-cache add bash=~5.0
RUN apk --no-cache add git=~2.22
RUN apk --no-cache add python3=~3.7
# 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==0.3.21
# Get vint for linting
RUN pip3 install vim-vint
# get vader for unit tests
# Get vader for unit tests
RUN git clone -n https://github.com/junegunn/vader.vim /vader
WORKDIR /vader
RUN git checkout de8a976f1eae2c2b680604205c3e8b5c8882493c
# build vim and neovim versions we want to test
# TODO uncomment nvim tag
# Build vim and neovim versions we want to test
WORKDIR /
RUN install_vim -tag v7.3.429 -name vim_7.3.429 -build \
-tag v7.4.1099 -name vim_7.4.1099 -build \
-tag v7.4.1546 -name vim_7.4.1546 -build \
-tag v8.0.0027 -name vim_8.0.0027 -build \
-tag v8.1.0519 -name vim_8.1.0519 -build \
RUN install_vim -tag v7.4.2367 -name vim_7.4.2367 -build
RUN install_vim -tag v8.2.5172 -name vim_8.2.5172 -build
RUN install_vim -tag v9.0.2190 -name v9.0.2190 -build
RUN install_vim -tag v9.1.0786 -name v9.1.0786 -build
# TODO: This one doesn't build - vim-testbed seems way out of date:
# TODO: tag neovim:v0.10.2, name nvim_0.10.2
# (Format as install_vim instances above.)
+54 -15
View File
@@ -2,7 +2,7 @@
[中文](README-cn.md)
- [Intro](#intro)
- [Intro](#introduction)
- [Screenshots](#screenshots)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
@@ -28,7 +28,6 @@ VimWiki is a personal wiki for Vim -- a number of linked text files that have
their own syntax highlighting. See the [VimWiki Wiki](https://vimwiki.github.io/vimwikiwiki/)
for an example website built with VimWiki!
For the latest features and fixes checkout the [dev branch](https://github.com/vimwiki/vimwiki/tree/dev).
If you are interested in contributing see [this section](#helping-vimwiki).
With VimWiki, you can:
@@ -40,8 +39,8 @@ With VimWiki, you can:
- 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.
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:
@@ -77,8 +76,10 @@ The result should look something like:
## Installation
VimWiki has been tested on **Vim >= 7.3**. It will likely work on older
versions but will not be officially supported.
VimWiki has been tested on **Vim >= 7.3**. It may work on older versions but
will not be officially supported. It is known to work on NeoVim, although
it is likely to have
[NeoVim-specific bugs](https://github.com/vimwiki/vimwiki/labels/neovim).
### Prerequisites
@@ -143,7 +144,7 @@ vim +PluginInstall +qall
#### Manual Install
Download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip)
Download the [zip archive](https://github.com/vimwiki/vimwiki/archive/dev.zip)
and extract it in `~/.vim/bundle/`
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was
@@ -185,6 +186,16 @@ _italic_ -- italic text
For other syntax elements, see `:h vimwiki-syntax`
### Todo lists
```text
- [.] Partially completed item with sub-tasks
- [X] Completed sub-task
- [ ] Incomplete sub-task
- [ ] Other incomplete sub-task
- [ ] Incomplete item
```
## Key bindings
### Normal mode
@@ -222,11 +233,13 @@ more bindings.
## Changing Wiki Syntax
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown
(markdown), and MediaWiki (media).
(markdown), and MediaWiki (media). Of these, the native VimWiki syntax is
best supported, followed by Markdown. No promises are made for MediaWiki.
**NOTE:** Only the default syntax ships with a built-in HTML converter. For
Markdown or MediaWiki see `:h vimwiki-option-custom_wiki2html`. Some examples
and 3rd party tools are available [here](https://vimwiki.github.io/vimwikiwiki/Related%20Tools.html#Related%20Tools-External%20Tools).
and 3rd party tools are available
[here](https://vimwiki.github.io/vimwikiwiki/Related%20Tools.html#Related%20Tools-External%20Tools).
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
following option in your `.vimrc`:
@@ -234,26 +247,52 @@ following option in your `.vimrc`:
```vim
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
\ 'syntax': 'markdown', 'ext': 'md'}]
```
This option will treat all markdown files in your system as part of vimwiki
(check `set filetype?`). Add
```vim
let g:vimwiki_global_ext = 0
```
to your `.vimrc` to restrict Vimwiki's operation to only those paths listed in
`g:vimwiki_list`. Other markdown files wouldn't be treated as wiki pages.
See [g:vimwiki_global_ext](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L2631).
if you want to turn off support for other extension(for example, disabling
accidently creating new wiki and link for normal markdown files), set the
following option in your `.vimrc` before packadd vimwiki:
```vim
let g:vimwiki_ext2syntax = {}
```
See [g:vimiki_ext2syntax](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L2652)
## Getting help
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
method for raising bug reports or feature requests.
Additional resources include the IRC channel [#vimwiki](https://webchat.freenode.net/?channels=#vimwiki) on Freenode
([webchat](https://webchat.freenode.net/?channels=#vimwiki), also synced to Matrix/Riot: `#freenode_#vimwiki:matrix.org` and [Telegram](https://t.me/joinchat/JqBaKBfWs04qNVrp5oWcMg))
or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
Additional resources:
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on
irc.libera.chat is the "official" discussion and support channel
- [Connect via webchat](https://web.libera.chat/?channels=#vimwiki)
- [@vimwiki@wikis.world](https://wikis.world/@vimwiki) on the Fediverse
## Helping VimWiki
VimWiki has a lot of users but only very few recurring developers or people
helping the community. Your help is therefore appreciated. Everyone can help!
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how you can help.
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how
you can help.
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md).
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md)
and [design_notes.md](doc/design_notes.md)
----
+1093 -335
View File
File diff suppressed because it is too large Load Diff
+10 -11
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This script converts markdown into html, to be used with vimwiki's
@@ -13,23 +13,23 @@
#
# http://www.pell.portland.or.us/~orc/Code/discount/
#
# To verify your installation, check that the commands markdown and mkd2text,
# To verify your installation, check that the commands markdown and mkd2html,
# are on your path.
#
# Also verify that this file is executable.
#
# Then, in your .vimrc file, set:
#
# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
# g:vimwiki_custom_wiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
#
# On your next restart, Vimwiki will run this script instead of using the
# internal wiki2html converter.
#
MARKDOWN=markdown
MKD2HTML=mkd2html
# shellcheck disable=SC2034 # FORCE appears unused
FORCE="$1"
SYNTAX="$2"
EXTENSION="$3"
@@ -37,14 +37,16 @@ OUTPUTDIR="$4"
INPUT="$5"
CSSFILE="$6"
FORCEFLAG=
[ $FORCE -eq 0 ] || { FORCEFLAG="-f"; };
[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; };
[[ "$SYNTAX" == "markdown" ]] || { echo "Error: Unsupported syntax"; exit 2; };
OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
OUTPUT="$OUTPUTDIR/$(basename "$INPUT" ."$EXTENSION").html"
# # Method 1:
# FORCEFLAG=
# (( "$FORCE" == 0 )) || { FORCEFLAG="-f"; };
# MARKDOWN=markdown
#
# # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile]
#
# URLBASE=http://example.com
@@ -57,6 +59,3 @@ OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
$MKD2HTML -css "$CSSFILE" "$INPUT"
OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html
mv -f "$OUTPUTTMP" "$OUTPUT"
+1
View File
@@ -2,6 +2,7 @@
<html>
<head>
<link rel="Stylesheet" type="text/css" href="%root_path%%css%">
<link rel="alternate" type="application/rss+xml" title="RSS" href="%root_path%%rss%">
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
<meta name="viewport" content="width=device-width, initial-scale=1">
+128 -22
View File
@@ -4,6 +4,7 @@
" Home: https://github.com/vimwiki/vimwiki/
" Clause: load only once
if exists('g:loaded_vimwiki_diary_auto') || &compatible
finish
endif
@@ -11,6 +12,7 @@ let g:loaded_vimwiki_diary_auto = 1
function! s:prefix_zero(num) abort
" Add zero prefix to a number
if a:num < 10
return '0'.a:num
endif
@@ -19,12 +21,14 @@ endfunction
function! s:diary_path(...) abort
" Return: diary directory path <String>
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
return vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)
endfunction
function! s:diary_index(...) abort
" Return: diary index file path <String>
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).
\ vimwiki#vars#get_wikilocal('ext', idx)
@@ -32,15 +36,78 @@ endfunction
function! vimwiki#diary#diary_date_link(...) abort
if a:0
return strftime('%Y-%m-%d', a:1)
" Return: <String> date
if a:0 > 2
" user supply wiki number as 1 indexed, not 0 indexed
let wiki_nr = a:3 - 1
else
return strftime('%Y-%m-%d')
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
endif
if wiki_nr < 0 " this happens when called outside a wiki buffer
let wiki_nr = 0
endif
if wiki_nr >= vimwiki#vars#number_of_wikis()
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!')
return
endif
if a:0
let l:timestamp = a:1
else
let l:timestamp = localtime()
endif
let l:delta_periods = 0
if a:0 > 1
let l:delta_periods = a:2
endif
let l:day_s = 60*60*24
let l:weekday_number = {
\ 'monday': 1, 'tuesday': 2,
\ 'wednesday': 3, 'thursday': 4,
\ 'friday': 5, 'saturday': 6,
\ 'sunday': 0}
let l:frequency = vimwiki#vars#get_wikilocal('diary_frequency', wiki_nr)
if l:frequency ==? 'weekly'
let l:start_week_day = vimwiki#vars#get_wikilocal('diary_start_week_day', wiki_nr)
let l:weekday_num = str2nr(strftime('%w', l:timestamp))
let l:days_to_end_of_week = (7-l:weekday_number[l:start_week_day]+weekday_num) % 7
let l:computed_timestamp = l:timestamp
\ + 7*l:day_s*l:delta_periods
\ - l:day_s*l:days_to_end_of_week
elseif l:frequency ==? 'monthly'
let l:day_of_month = str2nr(strftime('%d', l:timestamp))
let l:beginning_of_month = l:timestamp - (l:day_of_month - 1)*l:day_s
let l:middle_of_month = l:beginning_of_month + 15*l:day_s
let l:middle_of_computed_month = l:middle_of_month + float2nr(30.5*l:day_s*l:delta_periods)
let l:day_of_computed_month = str2nr(strftime('%d', l:middle_of_computed_month)) - 1
let l:computed_timestamp = l:middle_of_computed_month - l:day_of_computed_month*l:day_s
elseif l:frequency ==? 'yearly'
let l:day_of_year = str2nr(strftime('%j', l:timestamp))
let l:beginning_of_year = l:timestamp - (l:day_of_year - 1)*l:day_s
let l:middle_of_year = l:beginning_of_year + float2nr(365.25/2*l:day_s)
let l:middle_of_computed_year = l:middle_of_year + float2nr(365.25*l:day_s*l:delta_periods)
let l:day_of_computed_year = str2nr(strftime('%j', l:middle_of_computed_year)) - 1
let l:computed_timestamp = l:middle_of_computed_year - l:day_of_computed_year*l:day_s
else "daily
let l:computed_timestamp = localtime() + l:delta_periods*l:day_s
endif
return strftime('%Y-%m-%d', l:computed_timestamp)
endfunction
function! s:get_position_links(link) abort
" Return: <int:index, list:links>
let idx = -1
let links = []
if a:link =~# '^\d\{4}-\d\d-\d\d'
@@ -57,9 +124,11 @@ endfunction
function! s:get_month_name(month) abort
" Convert month: number -> name
return vimwiki#vars#get_global('diary_months')[str2nr(a:month)]
endfunction
function! s:get_first_header(fl) abort
" Get the first header in the file within the first s:vimwiki_max_scan_for_caption lines.
let header_rx = vimwiki#vars#get_syntaxlocal('rxHeader')
@@ -72,9 +141,10 @@ function! s:get_first_header(fl) abort
return ''
endfunction
function! s:get_all_headers(fl, maxlevel) abort
" Get a list of all headers in a file up to a given level.
" Returns a list whose elements are pairs [level, title]
" 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')
@@ -103,8 +173,9 @@ function! s:count_headers_level_less_equal(headers, maxlevel) abort
return l:count
endfunction
function! s:get_min_header_level(headers) abort
" The minimum level of any header in a list of [level, title] pairs.
" Get the minimum level of any header in a list of [level, title] pairs.
if len(a:headers) == 0
return 0
endif
@@ -117,11 +188,13 @@ endfunction
function! s:read_captions(files) abort
" Read all caption in 1. <List>files
" Return: <Dic>: key -> caption
let result = {}
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level')
for fl in a:files
" remove paths and extensions
" Remove paths and extensions
let fl_captions = {}
" Default; no captions from the file.
@@ -158,6 +231,7 @@ endfunction
function! vimwiki#diary#get_diary_files() abort
" Return: <list> diary file names
let rx = '^\d\{4}-\d\d-\d\d'
let s_files = glob(vimwiki#vars#get_wikilocal('path').
\ vimwiki#vars#get_wikilocal('diary_rel_path').'*'.vimwiki#vars#get_wikilocal('ext'))
@@ -172,6 +246,7 @@ endfunction
function! s:group_links(links) abort
" Return: <dic> nested -> links
let result = {}
let p_year = 0
let p_month = 0
@@ -194,6 +269,7 @@ endfunction
function! s:sort(lst) abort
" Sort list
if vimwiki#vars#get_wikilocal('diary_sort') ==? 'desc'
return reverse(sort(a:lst))
else
@@ -201,10 +277,15 @@ function! s:sort(lst) abort
endif
endfunction
" The given wiki number a:wnum is 1 for the first wiki, 2 for the second and so on. This is in
" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki
" is used.
function! vimwiki#diary#diary_sort(lst) abort
return s:sort(a:lst)
endfunction
function! vimwiki#diary#make_note(wnum, ...) abort
" Create note
" The given wiki number a:wnum is 1 for the first wiki, 2 for the second and so on. This is in
" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki
" is used.
if a:wnum == 0
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
if wiki_nr < 0 " this happens when e.g. VimwikiMakeDiaryNote was called outside a wiki buffer
@@ -215,21 +296,31 @@ function! vimwiki#diary#make_note(wnum, ...) abort
endif
if wiki_nr >= vimwiki#vars#number_of_wikis()
echomsg 'Vimwiki Error: Wiki '.wiki_nr.' is not registered in g:vimwiki_list!'
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!')
return
endif
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
let cmd = 'edit'
let cmd = ':edit'
if a:0
if a:1 == 1
let cmd = 'tabedit'
let cmd = ':tabedit'
elseif a:1 == 2
let cmd = 'split'
let cmd = ':split'
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
if a:0>1
@@ -241,8 +332,9 @@ function! vimwiki#diary#make_note(wnum, ...) abort
call vimwiki#base#open_link(cmd, link, s:diary_index(wiki_nr))
endfunction
function! vimwiki#diary#goto_diary_index(wnum) abort
function! vimwiki#diary#goto_diary_index(wnum) abort
" Jump to diary index of 1. <Int> wikinumber
" if wnum = 0 the current wiki is used
if a:wnum == 0
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
@@ -254,7 +346,7 @@ function! vimwiki#diary#goto_diary_index(wnum) abort
endif
if a:wnum > vimwiki#vars#number_of_wikis()
echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
call vimwiki#u#error('Wiki '.a:wnum.' is not registered in g:vimwiki_list!')
return
endif
@@ -268,6 +360,7 @@ endfunction
function! vimwiki#diary#goto_next_day() abort
" Jump to next day
let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r'))
@@ -289,6 +382,7 @@ endfunction
function! vimwiki#diary#goto_prev_day() abort
" Jump to previous day
let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r'))
@@ -310,7 +404,7 @@ endfunction
function! vimwiki#diary#generate_diary_section() abort
" Create diary index content
let GeneratorDiary = copy(l:)
function! GeneratorDiary.f() abort
let lines = []
@@ -358,8 +452,11 @@ function! vimwiki#diary#generate_diary_section() abort
let bullet = vimwiki#lst#default_symbol().' '
let entry = substitute(top_link_tpl, '__LinkUrl__', fl, '')
let entry = substitute(entry, '__LinkDescription__', topcap, '')
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
let extension = vimwiki#vars#get_wikilocal('ext', wiki_nr)
let entry = substitute(entry, '__FileExtension__', extension, 'g')
" If single H1 then that will be used as the description for the link to the file
" if multple H1 then the filename will be used as the description for the link to the
" 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)
@@ -399,13 +496,13 @@ function! vimwiki#diary#generate_diary_section() abort
\ 1,
\ 1)
else
echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
call vimwiki#u#error('You can generate diary links only in a diary index page!')
endif
endfunction
" Callback function for Calendar.vim
function! vimwiki#diary#calendar_action(day, month, year, week, dir) abort
" Callback function for Calendar.vim
let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month)
@@ -428,9 +525,18 @@ endfunction
function! vimwiki#diary#calendar_sign(day, month, year) abort
" Callback function for Calendar.vim
" Clause: no wiki no sign #290
if exists('g:vimwiki_list') && len(g:vimwiki_list) <= 0
return
endif
let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month)
let sfile = vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path').
\ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
let sfile = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
\ . a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
return filereadable(expand(sfile))
endfunction
function! vimwiki#diary#diary_file_captions() abort
return s:read_captions(vimwiki#diary#get_diary_files())
endfunction
File diff suppressed because it is too large Load Diff
+562 -199
View File
File diff suppressed because it is too large Load Diff
+296 -127
View File
@@ -1,9 +1,18 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Everything concerning lists and checkboxes
" Title: Vimwiki list functions
"
" Description:
" Everything concerning lists and checkboxes
"
" Also helpers for blockquotes as this file has intelligence and map (issue #1274)
" i <Cr>
" n o
" n O
" Which also got exploited for blocquotes
"
" Home: https://github.com/vimwiki/vimwiki/
if exists('g:loaded_vimwiki_list_auto') || &compatible
finish
endif
@@ -134,54 +143,105 @@ function! vimwiki#lst#get_list_margin() abort
endfunction
"Returns: the column where the text of a line starts (possible list item
"markers and checkboxes are skipped)
function! s:text_begin(lnum) abort
return s:string_length(matchstr(getline(a:lnum), vimwiki#vars#get_syntaxlocal('rxListItem')))
" Returns: the column where the text of a line starts (possible list item
" markers and checkboxes are skipped)
return s:string_length(matchstr(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem')))
endfunction
"Returns: 2 if there is a marker and text
" 1 for a marker and no text
" 0 for no marker at all (empty line or only text)
function! s:line_has_marker(lnum) abort
if getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxListItem').'\s*$'
" Returns: 2 if there is a marker and text
" 1 for a marker and no text
" 0 for no marker at all (empty line or only text)
" Concatenate regex list and blockquote item
let rx_list_or_blockquote =
\ '\%('
\ . vimwiki#vars#get_wikilocal('rxListItem')
\ . '\|'
\ . vimwiki#vars#get_wikilocal('rxBlockquoteItem')
\ . '\)'
" Search for marker
if getline(a:lnum) =~# rx_list_or_blockquote . '\s*$'
" Found without text
return 1
elseif getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxListItem').'\s*\S'
elseif getline(a:lnum) =~# rx_list_or_blockquote . '\s*\S'
" Found with text
return 2
else
" Not found
return 0
endif
endfunction
function! s:remove_including_children(item) abort
" Remove a list item and it's children (recursive)
let num_removed_lines = 1
let child = s:get_first_child(a:item)
while child.type != 0
let num_removed_lines += s:remove_including_children(child)
let child = s:get_first_child(a:item)
endwhile
exec a:item.lnum.'delete _'
return num_removed_lines
endfunction
function! s:is_done(item) abort
return a:item.type != 0 && a:item.cb !=# '' && s:get_rate(a:item) == 100
endfunction
" ---------------------------------------------------------
" get properties of a list item
" ---------------------------------------------------------
"Returns: the mainly used data structure in this file
"An item represents a single list item and is a dictionary with the keys
"lnum - the line number of the list item
"type - 1 for bulleted item, 2 for numbered item, 0 for a regular line
"mrkr - the concrete marker, e.g. '**' or 'b)'
"cb - the char in the checkbox or '' if there is no checkbox
function! s:get_item(lnum) abort
" Return: the mainly used data structure in this file
" An item represents a single list item and is a dictionary with the keys
" lnum - the line number of the list item
" type - the type of marker at current line
" - 0 for a regular line (default)
" - 1 for bulleted item
" - 2 for numbered item
" - 3 a blockquote item (see #1274 to add line-continuation trick to blockquotes)
" mrkr - the concrete marker, e.g. '**' or 'b)' (default '')
" cb - the char in the checkbox or '' if there is no checkbox
" Init default
let item = {'lnum': a:lnum}
let item.type = 0
let item.mrkr = ''
let item.cb = ''
" Clause: Check lnum argument is in buffer line range
if a:lnum == 0 || a:lnum > line('$')
let item.type = 0
return item
endif
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_syntaxlocal('rxListItem'))
" Clause: Search for blockquotes (#1274) and return it if found
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxBlockquoteItem'))
if len(matches) >= 1 && matches[1] !=? ''
let item.type = 3
let item.mrkr = matches[1]
return item
endif
" List: Search for list on current line if no blockquotes
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem'))
" Clause: If not on a list line => do not work
if matches == [] ||
\ (matches[1] ==? '' && matches[2] ==? '') ||
\ (matches[1] !=? '' && matches[2] !=? '')
let item.type = 0
return item
endif
" Fill item
" The checkbox inner is the last match
let item.cb = matches[3]
if matches[1] !=? ''
let item.type = 1
let item.mrkr = matches[1]
@@ -190,18 +250,20 @@ function! s:get_item(lnum) abort
let item.mrkr = matches[2]
endif
" See you on an other stack
return item
endfunction
function! s:empty_item() abort
" Craft: empty item
return {'type': 0}
endfunction
"Returns: level of the line
"0 is the 'highest' level
function! s:get_level(lnum) abort
" Returns: level of the line
" 0 is the 'highest' level
if getline(a:lnum) =~# '^\s*$'
return 0
endif
@@ -209,7 +271,7 @@ function! s:get_level(lnum) abort
let level = indent(a:lnum)
else
let level = s:string_length(matchstr(getline(a:lnum),
\ vimwiki#vars#get_syntaxlocal('rx_bullet_chars')))-1
\ vimwiki#vars#get_wikilocal('rx_bullet_chars')))-1
if level < 0
let level = (indent(a:lnum) == 0) ? 0 : 9999
endif
@@ -218,10 +280,10 @@ function! s:get_level(lnum) abort
endfunction
"Returns: 1, a, i, A, I or ''
"If in doubt if alphanumeric character or romanian
"numeral, peek in the previous line
function! s:guess_kind_of_numbered_item(item) abort
" Returns: 1, a, i, A, I or ''
" If in doubt if alphanumeric character or romanian
" numeral, peek in the previous line
if a:item.type != 2 | return '' | endif
let number_chars = a:item.mrkr[:-2]
let divisor = a:item.mrkr[-1:]
@@ -299,10 +361,10 @@ function! s:regexp_of_marker(item) abort
endfunction
" Returns: Whether or not the checkbox of a list item is [X] or [-]
function! s:is_closed(item) abort
" Returns: Whether or not the checkbox of a list item is [X] or [-]
let state = a:item.cb
return state ==# vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
return state ==# vimwiki#vars#get_wikilocal('listsyms_list')[-1]
\ || state ==# vimwiki#vars#get_global('listsym_rejected')
endfunction
@@ -310,9 +372,9 @@ endfunction
" functions for navigating between items
" ---------------------------------------------------------
"Returns: the list item after a:item or an empty item
"If a:ignore_kind is 1, the markers can differ
function! s:get_next_list_item(item, ignore_kind) abort
" Returns: the list item after a:item or an empty item
" If a:ignore_kind is 1, the markers can differ
let org_lvl = s:get_level(a:item.lnum)
if !a:ignore_kind
let org_regex = s:regexp_of_marker(a:item)
@@ -334,9 +396,9 @@ function! s:get_next_list_item(item, ignore_kind) abort
endfunction
"Returns: the list item before a:item or an empty item
"If a:ignore_kind is 1, the markers can differ
function! s:get_prev_list_item(item, ignore_kind) abort
" Returns: the list item before a:item or an empty item
" If a:ignore_kind is 1, the markers can differ
let org_lvl = s:get_level(a:item.lnum)
if !a:ignore_kind
let org_regex = s:regexp_of_marker(a:item)
@@ -409,11 +471,11 @@ function! s:get_last_item_in_list(item, ignore_kind) abort
endfunction
"Returns: lnum+1 in most cases, but skips blank lines and preformatted text,
"0 in case of nonvalid line.
"If there is no second argument, 0 is returned at a header, otherwise the
"header is skipped
function! s:get_next_line(lnum, ...) abort
" Returns: lnum+1 in most cases, but skips blank lines and preformatted text,
" 0 in case of nonvalid line.
" If there is no second argument, 0 is returned at a header, otherwise the
" header is skipped
if getline(a:lnum) =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
let cur_ln = a:lnum + 1
while cur_ln <= line('$') && getline(cur_ln) !~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
@@ -439,9 +501,9 @@ function! s:get_next_line(lnum, ...) abort
endfunction
"Returns: lnum-1 in most cases, but skips blank lines and preformatted text
"0 in case of nonvalid line and a header, because a header ends every list
function! s:get_prev_line(lnum) abort
" Returns: lnum-1 in most cases, but skips blank lines and preformatted text
" 0 in case of nonvalid line and a header, because a header ends every list
let cur_ln = a:lnum - 1
if getline(cur_ln) =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
@@ -482,10 +544,10 @@ function! s:get_first_child(item) abort
endfunction
"Returns: the next sibling of a:child, given the parent item
"Used for iterating over children
"Note: child items do not necessarily have the same indent, i.e. level
function! s:get_next_child_item(parent, child) abort
" Returns: the next sibling of a:child, given the parent item
" Used for iterating over children
" Note: child items do not necessarily have the same indent, i.e. level
if a:parent.type == 0 | return s:empty_item() | endif
let parent_lvl = s:get_level(a:parent.lnum)
let cur_ln = s:get_last_line_of_item_incl_children(a:child)
@@ -531,8 +593,8 @@ function! s:get_parent(item) abort
endfunction
"Returns: the item above or the item below or an empty item
function! s:get_a_neighbor_item(item) abort
" Returns: the item above or the item below or an empty item
let prev_item = s:get_prev_list_item(a:item, 1)
if prev_item.type != 0
return prev_item
@@ -558,9 +620,9 @@ function! s:get_a_neighbor_item_in_column(lnum, column) abort
endfunction
"Returns: the item if there is one in a:lnum
"else the multiline item a:lnum belongs to
function! s:get_corresponding_item(lnum) abort
" Returns: the item if there is one in a:lnum
" else the multiline item a:lnum belongs to
let item = s:get_item(a:lnum)
if item.type != 0
return item
@@ -582,8 +644,8 @@ function! s:get_corresponding_item(lnum) abort
endfunction
"Returns: the last line of a (possibly multiline) item, including all children
function! s:get_last_line_of_item_incl_children(item) abort
" Returns: the last line of a (possibly multiline) item, including all children
let cur_ln = a:item.lnum
let org_lvl = s:get_level(a:item.lnum)
while 1
@@ -596,9 +658,9 @@ function! s:get_last_line_of_item_incl_children(item) abort
endfunction
"Returns: the last line of a (possibly multiline) item
"Note: there can be other list items between the first and last line
function! s:get_last_line_of_item(item) abort
" Returns: the last line of a (possibly multiline) item
" Note: there can be other list items between the first and last line
if a:item.type == 0 | return 0 | endif
let org_lvl = s:get_level(a:item.lnum)
let last_corresponding_line = a:item.lnum
@@ -625,9 +687,9 @@ endfunction
" renumber list items
" ---------------------------------------------------------
"Renumbers the current list from a:item on downwards
"Returns: the last item that was adjusted
function! s:adjust_numbered_list_below(item, recursive) abort
" Renumbers the current list from a:item on downwards
" Returns: the last item that was adjusted
if !(a:item.type == 2 || (a:item.type == 1 && a:recursive))
return a:item
endif
@@ -677,11 +739,11 @@ function! s:adjust_items_recursively(parent) abort
endfunction
"Renumbers the list a:item is in.
"If a:ignore_kind == 0, only the items which have the same kind of marker as
"a:item are considered, otherwise all items.
"Returns: the last item that was adjusted
function! s:adjust_numbered_list(item, ignore_kind, recursive) abort
" Renumbers the list a:item is in.
" If a:ignore_kind == 0, only the items which have the same kind of marker as
" a:item are considered, otherwise all items.
" Returns: the last item that was adjusted
if !(a:item.type == 2 || (a:item.type == 1 && (a:ignore_kind || a:recursive)))
return s:empty_item()
end
@@ -706,9 +768,9 @@ function! s:adjust_numbered_list(item, ignore_kind, recursive) abort
endfunction
"Renumbers the list the cursor is in
"also update its parents checkbox state
function! vimwiki#lst#adjust_numbered_list() abort
" Renumbers the list the cursor is in
" also update its parents checkbox state
let cur_item = s:get_corresponding_item(line('.'))
if cur_item.type == 0 | return | endif
call s:adjust_numbered_list(cur_item, 1, 0)
@@ -716,9 +778,9 @@ function! vimwiki#lst#adjust_numbered_list() abort
endfunction
"Renumbers all lists of the buffer
"of course, this might take some seconds
function! vimwiki#lst#adjust_whole_buffer() abort
" Renumbers all lists of the buffer
" of course, this might take some seconds
let cur_ln = 1
while 1
let cur_item = s:get_item(cur_ln)
@@ -737,8 +799,8 @@ endfunction
" checkbox stuff
" ---------------------------------------------------------
"Returns: the rate of checkboxed list item in percent
function! s:get_rate(item) abort
" Returns: the rate of checkboxed list item in percent
if a:item.type == 0 || a:item.cb ==? ''
return -1
endif
@@ -746,14 +808,14 @@ function! s:get_rate(item) abort
if state == vimwiki#vars#get_global('listsym_rejected')
return -1
endif
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
return index(vimwiki#vars#get_syntaxlocal('listsyms_list'), state) * 100/(n-1)
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
return index(vimwiki#vars#get_wikilocal('listsyms_list'), state) * 100/(n-1)
endfunction
"Set state of the list item to [ ] or [o] or whatever
"Returns: 1 if the state changed, 0 otherwise
function! s:set_state(item, new_rate) abort
" Set state of the list item to [ ] or [o] or whatever
" Returns: 1 if the state changed, 0 otherwise
let new_state = s:rate_to_state(a:new_rate)
let old_state = s:rate_to_state(s:get_rate(a:item))
if new_state !=# old_state
@@ -765,16 +827,20 @@ function! s:set_state(item, new_rate) abort
endfunction
" Sets the state of the list item to [ ] or [o] or whatever. Updates the states of its child items.
" If the new state should be [X] or [-], the state of the current list item is changed to this
" state, but if a child item already has [X] or [-] it is left alone.
function! s:set_state_plus_children(item, new_rate, ...) abort
" Sets the state of the list item to [ ] or [o] or whatever. Updates the states of its child items.
" If the new state should be [X] or [-], the state of the current list item is changed to this
" state, but if a child item already has [X] or [-] it is left alone.
let retain_state_if_closed = a:0 > 0 && a:1 > 0
if !(retain_state_if_closed && (a:new_rate == 100 || a:new_rate == -1) && s:is_closed(a:item))
call s:set_state(a:item, a:new_rate)
endif
if vimwiki#vars#get_wikilocal('listsyms_propagate') == 0
return
endif
let all_children_are_done = 1
let all_children_are_rejected = 1
@@ -786,7 +852,7 @@ function! s:set_state_plus_children(item, new_rate, ...) abort
if child_item.cb != vimwiki#vars#get_global('listsym_rejected')
let all_children_are_rejected = 0
endif
if child_item.cb != vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
if child_item.cb != vimwiki#vars#get_wikilocal('listsyms_list')[-1]
let all_children_are_done = 0
endif
if !all_children_are_done && !all_children_are_rejected
@@ -820,9 +886,9 @@ function! s:set_state_plus_children(item, new_rate, ...) abort
endfunction
"Returns: the appropriate symbol for a given percent rate
function! s:rate_to_state(rate) abort
let listsyms_list = vimwiki#vars#get_syntaxlocal('listsyms_list')
" Returns: the appropriate symbol for a given percent rate
let listsyms_list = vimwiki#vars#get_wikilocal('listsyms_list')
let state = ''
let n = len(listsyms_list)
if a:rate == 100
@@ -839,10 +905,9 @@ function! s:rate_to_state(rate) abort
endfunction
"updates the symbol of a checkboxed item according to the symbols of its
"children
function! s:update_state(item) abort
if a:item.type == 0 || a:item.cb ==? ''
" Updates the symbol of a checkboxed item according to the symbols of its children
if a:item.type == 0 || a:item.cb ==? '' || vimwiki#vars#get_wikilocal('listsyms_propagate') == 0
return
endif
@@ -894,9 +959,9 @@ function! s:set_state_recursively(item, new_rate) abort
endfunction
"Creates checkbox in a list item.
"Returns: 1 if successful
function! s:create_cb(item, start_rate) abort
" Creates checkbox in a list item.
" Returns: 1 if successful
if a:item.type == 0 || a:item.cb !=? ''
return 0
endif
@@ -921,8 +986,8 @@ function! s:remove_cb(item) abort
endfunction
" Change state of the checkboxes in the lines of the given range
function! s:change_cb(from_line, to_line, new_rate) abort
" Change state of the checkboxes in the lines of the given range
let from_item = s:get_corresponding_item(a:from_line)
if from_item.type == 0
return
@@ -944,13 +1009,12 @@ function! s:change_cb(from_line, to_line, new_rate) abort
for parent_item in parent_items_of_lines
call s:update_state(parent_item)
endfor
endfunction
" Toggles checkbox between two states in the lines of the given range, creates checkboxes (with
" a:start_rate as state) if there aren't any.
function! s:toggle_create_cb(from_line, to_line, state1, state2, start_rate) abort
" Toggles checkbox between two states in the lines of the given range, creates checkboxes (with
" a:start_rate as state) if there aren't any.
let from_item = s:get_corresponding_item(a:from_line)
if from_item.type == 0
return
@@ -985,13 +1049,12 @@ function! s:toggle_create_cb(from_line, to_line, state1, state2, start_rate) abo
call s:change_cb(a:from_line, a:to_line, new_rate)
endif
endfunction
"Decrement checkbox between [ ] and [X]
"in the lines of the given range
function! vimwiki#lst#decrement_cb(from_line, to_line) abort
" Decrement checkbox between [ ] and [X]
" in the lines of the given range
let from_item = s:get_corresponding_item(a:from_line)
if from_item.type == 0
return
@@ -999,17 +1062,16 @@ function! vimwiki#lst#decrement_cb(from_line, to_line) abort
"if from_line has CB, decrement it and set all siblings to the same new state
let rate_first_line = s:get_rate(from_item)
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
let new_rate = max([rate_first_line - 100/(n-1)-1, 0])
call s:change_cb(a:from_line, a:to_line, new_rate)
endfunction
"Increment checkbox between [ ] and [X]
"in the lines of the given range
function! vimwiki#lst#increment_cb(from_line, to_line) abort
" Increment checkbox between [ ] and [X]
" in the lines of the given range
let from_item = s:get_corresponding_item(a:from_line)
if from_item.type == 0
return
@@ -1017,24 +1079,23 @@ function! vimwiki#lst#increment_cb(from_line, to_line) abort
"if from_line has CB, increment it and set all siblings to the same new state
let rate_first_line = s:get_rate(from_item)
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
let n = len(vimwiki#vars#get_wikilocal('listsyms_list'))
let new_rate = min([rate_first_line + 100/(n-1)+1, 100])
call s:change_cb(a:from_line, a:to_line, new_rate)
endfunction
"Toggles checkbox between [ ] and [X] or creates one
"in the lines of the given range
function! vimwiki#lst#toggle_cb(from_line, to_line) abort
" Toggles checkbox between [ ] and [X] or creates one
" in the lines of the given range
return s:toggle_create_cb(a:from_line, a:to_line, 100, 0, 0)
endfunction
"Toggles checkbox between [ ] and [-] or creates one
"in the lines of the given range
function! vimwiki#lst#toggle_rejected_cb(from_line, to_line) abort
" Toggles checkbox between [ ] and [-] or creates one
" in the lines of the given range
return s:toggle_create_cb(a:from_line, a:to_line, -1, 0, -1)
endfunction
@@ -1085,6 +1146,105 @@ function! vimwiki#lst#remove_cb_in_list() abort
endfunction
function! s:remove_done_in_list(item, recursive) abort
" Iterate over given todo list and remove all task that are done
" If recursive is true, child items will be checked too
" Clause non-null item type
if a:item.type == 0
return
endif
" Recurse self on list item
let first_item = s:get_first_item_in_list(a:item, 0)
let total_lines_removed = 0
let cur_item = first_item
while 1
let next_item = s:get_next_list_item(cur_item, 0)
if s:is_done(cur_item)
let lines_removed = s:remove_including_children(cur_item)
elseif a:recursive
let lines_removed = s:remove_done_in_list(s:get_first_child(cur_item), a:recursive)
else
let lines_removed = 0
endif
let total_lines_removed += lines_removed
if next_item.type == 0
break
else
let next_item.lnum -= lines_removed
let cur_item = next_item
endif
endwhile
" Update state of parent item (percentage of done)
call s:update_state(s:get_parent(first_item))
return total_lines_removed
endfunction
function! vimwiki#lst#remove_done_in_current_list(recursive) abort
" Iterate over the list that the cursor is positioned in
" and remove all lines of task that are done.
" If recursive is true, child items will be checked too
let item = s:get_corresponding_item(line('.'))
call s:remove_done_in_list(item, a:recursive)
endfunction
function! vimwiki#lst#remove_done_in_range(first_line, last_line) abort
" Remove selected lines if they contain a task that is done
let first_item = s:get_corresponding_item(a:first_line)
let last_item = s:get_corresponding_item(a:last_line)
" Clause non-null first and last type item
if first_item.type == 0 || last_item.type == 0
return
endif
" For each line, delete done tasks
let parent_items_of_lines = []
let cur_ln = first_item.lnum
let end_ln = last_item.lnum
while cur_ln > 0 && cur_ln <= end_ln
let cur_item = s:get_item(cur_ln)
if s:is_done(cur_item)
let cur_parent_item = s:get_parent(cur_item)
if index(parent_items_of_lines, cur_parent_item) == -1
call insert(parent_items_of_lines, cur_parent_item)
endif
exe cur_ln.'delete _'
let cur_ln -= 1
let end_ln -= 1
endif
let cur_ln = s:get_next_line(cur_ln)
endwhile
" Update all parent state (percentage of done)
for parent_item in parent_items_of_lines
call s:update_state(parent_item)
endfor
endfunction
function! vimwiki#lst#remove_done(recursive, range, first_line, last_line) abort
" wrapper function to distinguish between function used with a range or not
" vim 8.0.1089 and newer and corresponding neovim versions allow to use <range> to distinguish if
" the function has been called with a range. For older versions we use remove_done_in_range if
" first and last line are identical, which means there was either no range or the range was within
" one line.
if a:range ==# '<range>'
let range = a:first_line != a:last_line
else
let range = a:range > 0
endif
if range
call vimwiki#lst#remove_done_in_range(a:first_line, a:last_line)
else
call vimwiki#lst#remove_done_in_current_list(a:recursive)
endif
endfunction
" ---------------------------------------------------------
" change the level of list items
@@ -1100,14 +1260,13 @@ function! s:set_indent(lnum, new_indent) abort
endfunction
function! s:decrease_level(item) abort
function! s:decrease_level(item, by) abort
let removed_indent = 0
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
\ s:first_char(a:item.mrkr)) > -1
if s:string_length(a:item.mrkr) >= 2
call s:substitute_string_in_line(a:item.lnum, s:first_char(a:item.mrkr), '')
let removed_indent = -1
endif
else
let old_indent = indent(a:item.lnum)
@@ -1116,21 +1275,19 @@ function! s:decrease_level(item) abort
else
let new_indent = old_indent - vimwiki#u#sw()
endif
call s:set_indent(a:item.lnum, new_indent)
let removed_indent = new_indent - old_indent
call s:set_indent(a:item.lnum, a:by * new_indent)
endif
return removed_indent
call s:indent_cycle_bullets(a:item, -a:by)
endfunction
function! s:increase_level(item) abort
function! s:increase_level(item, by) abort
let additional_indent = 0
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && a:item.type == 1 &&
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
\ s:first_char(a:item.mrkr)) > -1
call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:item.mrkr .
\ s:first_char(a:item.mrkr))
let additional_indent = 1
else
let old_indent = indent(a:item.lnum)
if &shiftround
@@ -1138,33 +1295,45 @@ function! s:increase_level(item) abort
else
let new_indent = old_indent + vimwiki#u#sw()
endif
call s:set_indent(a:item.lnum, new_indent)
let additional_indent = new_indent - old_indent
call s:set_indent(a:item.lnum, a:by * new_indent)
endif
return additional_indent
call s:indent_cycle_bullets(a:item, a:by)
endfunction
function! s:indent_cycle_bullets(item, indent_by) abort
" Cycle through the bullet list markers set in
" `bullet_types` based on the indentation level
" TODO there is potential to merge this with the change_marker* funcs further
" up if we can make them operate on arbitrary lists of characters
" Clause: Check if should work
if !vimwiki#vars#get_syntaxlocal('cycle_bullets') || a:item.type != 1
return
endif
let bullets = vimwiki#vars#get_syntaxlocal('bullet_types')
let i = index(bullets, s:first_char(a:item.mrkr)) + a:indent_by
" Calculate the index in a way that wraps around the end of the list
" ... making it behave like a ring buffer
let new_mrkr = bullets[((i % len(bullets) + len(bullets)) % len(bullets))]
call vimwiki#lst#change_marker(a:item.lnum, a:item.lnum, new_mrkr, 'n')
endfunction
"adds a:indent_by to the current indent
"a:indent_by can be negative
function! s:indent_line_by(lnum, indent_by) abort
" Add a:indent_by to the current indent
"a:indent_by can be negative
let item = s:get_item(a:lnum)
if vimwiki#vars#get_syntaxlocal('recurring_bullets') && item.type == 1 &&
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
\ s:first_char(item.mrkr)) > -1
if a:indent_by > 0
call s:substitute_string_in_line(a:lnum, item.mrkr, item.mrkr . s:first_char(item.mrkr))
elseif a:indent_by < 0
call s:substitute_string_in_line(a:lnum, s:first_char(item.mrkr), '')
endif
else
call s:set_indent(a:lnum, indent(a:lnum) + a:indent_by)
if a:indent_by > 0
call s:increase_level(item, a:indent_by)
elseif a:indent_by < 0
" double negate indent_by here
call s:decrease_level(item, -a:indent_by)
endif
endfunction
"changes lvl of lines in selection
function! s:change_level(from_line, to_line, direction, plus_children) abort
" Change lvl of lines in selection
let from_item = s:get_corresponding_item(a:from_line)
if from_item.type == 0
if a:direction ==# 'increase' && a:from_line == a:to_line && empty(getline(a:from_line))
@@ -1208,8 +1377,8 @@ function! s:change_level(from_line, to_line, direction, plus_children) abort
let first_line_level = s:get_level(from_item.lnum)
let more_than_one_level_concerned = 0
let first_line_indented_by = (a:direction ==# 'increase') ?
\ s:increase_level(from_item) : s:decrease_level(from_item)
let first_line_indented_by = (a:direction ==# 'increase') ? 1 : -1
call s:indent_line_by(from_item.lnum, first_line_indented_by)
let cur_ln = s:get_next_line(from_item.lnum)
while cur_ln > 0 && cur_ln <= to_line
@@ -1248,8 +1417,8 @@ function! vimwiki#lst#change_level(from_line, to_line, direction, plus_children)
endfunction
"indent line a:lnum to be the continuation of a:prev_item
function! s:indent_multiline(prev_item, lnum) abort
" Indent line a:lnum to be the continuation of a:prev_item
if a:prev_item.type != 0
call s:set_indent(a:lnum, s:text_begin(a:prev_item.lnum))
endif
@@ -1260,8 +1429,8 @@ endfunction
" change markers of list items
" ---------------------------------------------------------
"Returns: the position of a marker in g:vimwiki_list_markers
function! s:get_idx_list_markers(item) abort
" Returns: the position of a marker in g:vimwiki_list_markers
if a:item.type == 1
let m = s:first_char(a:item.mrkr)
else
@@ -1271,8 +1440,8 @@ function! s:get_idx_list_markers(item) abort
endfunction
"changes the marker of the given item to the next in g:vimwiki_list_markers
function! s:get_next_mrkr(item) abort
" Changes the marker of the given item to the next in g:vimwiki_list_markers
let markers = vimwiki#vars#get_syntaxlocal('list_markers')
if a:item.type == 0
let new_mrkr = markers[0]
@@ -1284,8 +1453,8 @@ function! s:get_next_mrkr(item) abort
endfunction
"changes the marker of the given item to the previous in g:vimwiki_list_markers
function! s:get_prev_mrkr(item) abort
" Changes the marker of the given item to the previous in g:vimwiki_list_markers
let markers = vimwiki#vars#get_syntaxlocal('list_markers')
if a:item.type == 0
return markers[-1]
@@ -1325,7 +1494,7 @@ function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode) abort
endif
"handle markers like ***
if index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'), s:first_char(new_mrkr)) > -1
if index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'), s:first_char(new_mrkr)) > -1
"use *** if the item above has *** too
let item_above = s:get_prev_list_item(cur_item, 1)
if item_above.type == 1 && s:first_char(item_above.mrkr) ==# s:first_char(new_mrkr)
@@ -1382,8 +1551,8 @@ function! vimwiki#lst#change_marker_in_list(new_mrkr) abort
endfunction
"sets kind of the item depending on neighbor items and the parent item
function! s:adjust_mrkr(item) abort
" Sets kind of the item depending on neighbor items and the parent item
if a:item.type == 0 || vimwiki#vars#get_syntaxlocal('recurring_bullets')
return
endif
@@ -1396,7 +1565,7 @@ function! s:adjust_mrkr(item) abort
"if possible, set e.g. *** if parent has ** as marker
if neighbor_item.type == 0 && a:item.type == 1 &&
\ index(vimwiki#vars#get_syntaxlocal('multiple_bullet_chars'),
\ index(vimwiki#vars#get_wikilocal('multiple_bullet_chars'),
\ s:first_char(a:item.mrkr)) > -1
let parent_item = s:get_parent(a:item)
if parent_item.type == 1 && s:first_char(parent_item.mrkr) ==# s:first_char(a:item.mrkr)
@@ -1634,12 +1803,11 @@ function! vimwiki#lst#kbd_cr(normal, just_mrkr) abort
else
startinsert
endif
endfunction
"creates a list item in the current line or removes it
function! vimwiki#lst#toggle_list_item() abort
" Creates a list item in the current line or removes it
let cur_col_from_eol = col('$') - col("'^")
let cur_item = s:get_item(line('.'))
@@ -1711,3 +1879,4 @@ function! vimwiki#lst#fold_level(lnum) abort
return '='
endfunction
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+7 -53
View File
@@ -34,9 +34,8 @@ function! vimwiki#markdown_base#scan_reflinks() abort
endfunction
" try markdown reference links
function! vimwiki#markdown_base#open_reflink(link) abort
" echom "vimwiki#markdown_base#open_reflink"
" try markdown reference links
let link = a:link
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
if has_key(mkd_refs, link)
@@ -101,62 +100,17 @@ function! s:normalize_link_syntax_n() abort
let sub = vimwiki#base#normalize_link_in_diary(lnk)
else
let sub = vimwiki#base#normalize_link_helper(lnk,
\ vimwiki#vars#get_global('rxWord'), '',
\ vimwiki#vars#get_syntaxlocal('Weblink1Template'))
\ vimwiki#vars#get_global('rxWord'),
\ vimwiki#vars#get_global('rxWord'),
\ vimwiki#vars#get_syntaxlocal('Link1'))
endif
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
return
endif
endfunction
function! s:normalize_link_syntax_v() abort
let lnum = line('.')
let sel_save = &selection
let &selection = 'old'
let rv = @"
let rt = getregtype('"')
let done = 0
try
norm! gvy
let visual_selection = @"
if vimwiki#base#is_diary_file(expand('%:p'))
let link = vimwiki#base#normalize_link_in_diary(visual_selection)
else
let link = s:safesubstitute(vimwiki#vars#get_syntaxlocal('Weblink1Template'),
\ '__LinkUrl__', visual_selection, '')
endif
" replace spaces with new character if option is set
let link = substitute(link, '\s', vimwiki#vars#get_wikilocal('links_space_char'), 'g')
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
function! vimwiki#markdown_base#normalize_link() abort
" TODO mutualize with base
call s:normalize_link_syntax_n()
endfunction
function! vimwiki#markdown_base#normalize_link(is_visual_mode) abort
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
+99 -58
View File
@@ -4,12 +4,38 @@
" Home: https://github.com/vimwiki/vimwiki/
function! s:unixify(path) abort
" Unixify Path:
return substitute(a:path, '\', '/', 'g')
endfunction
function! s:windowsify(path) abort
" Windowsify Path:
return substitute(a:path, '/', '\', 'g')
endfunction
" Define: os specific path 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, '[/\\]\+$', '', '')
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()
function! vimwiki#path#is_equal(p1, p2) abort
return a:p1 ==? a:p2
@@ -20,8 +46,9 @@ else
endfunction
endif
" collapse sections like /a/b/../c to /a/c and /a/b/./c to /a/b/c
function! vimwiki#path#normalize(path) abort
" Collapse Sections: like /a/b/../c to /a/c and /a/b/./c to /a/b/c
let path = a:path
while 1
let intermediateResult = substitute(path, '/[^/]\+/\.\.', '', '')
@@ -36,34 +63,34 @@ endfunction
function! vimwiki#path#path_norm(path) abort
" /-slashes
if a:path !~# '^scp:'
let path = substitute(a:path, '\', '/', 'g')
" treat multiple consecutive slashes as one path separator
let path = substitute(path, '/\+', '/', 'g')
" ensure that we are not fooled by a symbolic link
return resolve(path)
else
return a:path
endif
" Normalize Path: \ -> / && /// -> / && resolve(symlinks)
" return if scp
if a:path =~# '^scp:' | return a:path | endif
" convert backslash to slash
let path = substitute(a:path, '\', '/', 'g')
" treat multiple consecutive slashes as one path separator
let path = substitute(path, '/\+', '/', 'g')
" ensure that we are not fooled by a symbolic link
return resolve(path)
endfunction
function! vimwiki#path#is_link_to_dir(link) abort
" Check if link is to a directory.
" Check: if link is to a directory
" It should be ended with \ or /.
return a:link =~# '\m[/\\]$'
endfunction
function! vimwiki#path#abs_path_of_link(link) abort
" Get: absolute path <- path relative to current file
return vimwiki#path#normalize(expand('%:p:h').'/'.a:link)
endfunction
" return longest common path prefix of 2 given paths.
" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
function! vimwiki#path#path_common_pfx(path1, path2) abort
" Returns: longest common path prefix of 2 given paths.
" Ex: '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
let p1 = split(a:path1, '[/\\]', 1)
let p2 = split(a:path2, '[/\\]', 1)
@@ -81,6 +108,7 @@ endfunction
function! vimwiki#path#wikify_path(path) abort
" Convert: path -> full resolved slashed path
let result = resolve(fnamemodify(a:path, ':p'))
if vimwiki#u#is_windows()
let result = substitute(result, '\\', '/', 'g')
@@ -91,67 +119,60 @@ endfunction
function! vimwiki#path#current_wiki_file() abort
" Return: Current file path relative
return vimwiki#path#wikify_path(expand('%:p'))
endfunction
" Returns: the relative path from a:dir to a:file
function! vimwiki#path#relpath(dir, file) abort
" Return: the relative path from a:dir to a:file
" Check if dir here ('.') -> return file
if empty(a:dir) || a:dir =~# '^\.[/\\]\?$'
return a:file
endif
let result = []
if vimwiki#u#is_windows()
" TODO temporary fix see #478
" not sure why paths get converted back to using forward slash
" when passed to the function in the form C:\path\to\file
let dir = substitute(a:dir, '/', '\', 'g')
let file = substitute(a:file, '/', '\', 'g')
let dir = split(dir, '\')
let file = split(file, '\')
else
let dir = split(a:dir, '/')
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])
call remove(dir, 0)
call remove(file, 0)
endwhile
" Return './' if nothing left
if empty(dir) && empty(file)
if vimwiki#u#is_windows()
" TODO temporary fix see #478
return '.\'
else
return './'
endif
return s:osxify('./')
endif
" Build path segment
let segments = []
for segment in dir
let result += ['..']
let segments += ['..']
endfor
for segment in file
let result += [segment]
let segments += [segment]
endfor
if vimwiki#u#is_windows()
" TODO temporary fix see #478
let result_path = join(result, '\')
if a:file =~? '\m\\$'
let result_path .= '\'
endif
else
let result_path = join(result, '/')
if a:file =~? '\m/$'
let result_path .= '/'
endif
" Join segments
let result_path = join(segments, '/')
if a:file =~# '\m/$'
let result_path .= '/'
endif
return result_path
endfunction
" If the optional argument provided and nonzero,
" it will ask before creating a directory
" Returns: 1 iff directory exists or successfully created
function! vimwiki#path#mkdir(path, ...) abort
" Mkdir:
" if the optional argument provided and nonzero,
" it will ask before creating a directory
" returns: 1 iff directory exists or successfully created
let path = expand(a:path)
if path =~# '^scp:'
@@ -182,19 +203,40 @@ endfunction
function! vimwiki#path#is_absolute(path) abort
" Check: if path is absolute
let res=0
" Match 'C:' or '/' or '~'
if vimwiki#u#is_windows()
return a:path =~? '\m^\a:'
let res += a:path =~? '\m^\a:'
else
return a:path =~# '\m^/\|\~/'
let res += a:path =~# '\m^/\|\~/'
endif
" Do not prepend root_path to scp files
" See: https://vim.fandom.com/wiki/Editing_remote_files_via_scp_in_vim
let res += a:path =~# '\m^scp:'
return res
endfunction
function! s:get_wikifile_link(wikifile) abort
return vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), a:wikifile).
\ fnamemodify(a:wikifile, ':t:r')
endfunction
function! vimwiki#path#PasteLink(wikifile) abort
call append(line('.'), '[[/'.s:get_wikifile_link(a:wikifile).']]')
endfunction
" 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()
" Combine: a directory and a file into one path, doesn't generate duplicate
" path separator in case the directory is also having an ending / or \. This
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
" valid path.
function! vimwiki#path#join_path(directory, file) abort
let directory = vimwiki#path#chomp_slash(a:directory)
let file = substitute(a:file, '\m^[\\/]\+', '', '')
@@ -207,4 +249,3 @@ else
return directory . '/' . file
endfunction
endif
+154 -89
View File
@@ -1,18 +1,16 @@
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
let s:TAGS_METADATA_FILE_NAME = '.vimwiki_tags'
" Description: Tag manipulation functions
" Home: https://github.com/vimwiki/vimwiki/
"
" Tags metadata in-memory format:
" metadata := { 'pagename': [entries, ...] }
" entry := { 'tagname':..., 'lineno':..., 'link':... }
" Tags metadata in-file format:
"
" Is based on CTags format (see |tags-file-format|).
" Is based on CTags format (see |tags-file-format|) and
" https://ctags.sourceforge.net/FORMAT
"
" {tagaddress} is set to lineno. We'll let vim search by exact line number; we
" can afford that, we assume metadata file is always updated before use.
@@ -22,12 +20,14 @@ let s:TAGS_METADATA_FILE_NAME = '.vimwiki_tags'
" of missing parameters -- "pagename" and "link".
let s:TAGS_METADATA_FILE_NAME = '.vimwiki_tags'
" Update tags metadata.
" a:full_rebuild == 1: re-scan entire wiki
" a:full_rebuild == 0: only re-scan current page
" a:all_files == '': only if the file is newer than .tags
function! vimwiki#tags#update_tags(full_rebuild, all_files) abort
" Update tags metadata.
" Param: a:full_rebuild == 1: re-scan entire wiki
" Param: a:full_rebuild == 0: only re-scan current page
" a:all_files == '': only if the file is newer than .tags
let all_files = a:all_files !=? ''
if !a:full_rebuild
" Updating for one page (current)
@@ -63,21 +63,23 @@ endfunction
function! s:safesubstitute(text, search, replace, mode) abort
" Substitute regexp but do not interpret replace
" TODO mutualize with same function in base
let escaped = escape(a:replace, '\&')
return substitute(a:text, a:search, escaped, a:mode)
endfunction
" Scans the list of text lines (argument) and produces tags metadata as a list of tag entries.
function! s:scan_tags(lines, page_name) abort
let entries = []
" Scan the list of text lines (argument) and produces tags metadata as a list of tag entries.
" Code wireframe to scan for headers -- borrowed from
" vimwiki#base#get_anchors(), with minor modifications.
let entries = []
" Get syntax wide regex
let rxheader = vimwiki#vars#get_syntaxlocal('header_search')
let rxtag = vimwiki#vars#get_syntaxlocal('tag_search')
let tag_search_rx = vimwiki#vars#get_syntaxlocal('tag_search')
let tag_format = vimwiki#vars#get_syntaxlocal('tag_format')
let anchor_level = ['', '', '', '', '', '', '']
let current_complete_anchor = ''
@@ -97,7 +99,8 @@ function! s:scan_tags(lines, page_name) abort
let h_match = matchlist(line, rxheader)
if !empty(h_match) " got a header
let header_line_nr = line_nr
let header = vimwiki#u#trim(h_match[2])
let header = vimwiki#base#normalize_anchor(h_match[2])
let current_header_description = vimwiki#u#trim(h_match[2])
let level = len(h_match[1])
let anchor_level[level-1] = header
for l in range(level, 6)
@@ -114,19 +117,20 @@ function! s:scan_tags(lines, page_name) abort
endfor
let current_complete_anchor .= header
endif
continue " tags are not allowed in headers
" See: issue #1316 to allow tags in header
" continue " tags are not allowed in headers
endif
" Scan line for tags. There can be many of them.
let str = line
while 1
let tag_group = matchstr(str, rxtag)
if tag_group ==? ''
break
endif
let tagend = matchend(str, rxtag)
let str = str[(tagend):]
for tag in split(tag_group, ':')
" Get all matches
let tag_groups = []
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
if tag_groups == []
continue
endif
for tag_group in tag_groups
for tag in split(tag_group, tag_format.sep)
" Create metadata entry
let entry = {}
let entry.tagname = tag
@@ -134,31 +138,34 @@ function! s:scan_tags(lines, page_name) abort
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
" Tag appeared at the top of the file
let entry.link = a:page_name
let entry.description = entry.link
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
" Tag appeared right below a header
let entry.link = a:page_name . '#' . current_complete_anchor
let entry.description = current_header_description
else
" Tag stands on its own
let entry.link = a:page_name . '#' . tag
let entry.description = entry.link
endif
call add(entries, entry)
endfor
endwhile
endfor
endfor " loop over lines
return entries
endfunction
" Returns tags metadata file path
function! vimwiki#tags#metadata_file_path() abort
" Return: tags metadata file path
return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'),
\ s:TAGS_METADATA_FILE_NAME), ':p')
endfunction
" Loads tags metadata from file, returns a dictionary
function! s:load_tags_metadata() abort
" Load tags metadata from file, returns a dictionary
let metadata_path = vimwiki#tags#metadata_file_path()
if !filereadable(metadata_path)
return {}
@@ -190,7 +197,7 @@ function! s:load_tags_metadata() abort
let vw_data = substitute(vw_data, '\\t', "\t", 'g')
let vw_data = substitute(vw_data, '\\\\', "\\", 'g')
let vw_fields = split(vw_data, "\t")
if len(vw_fields) != 2
if len(vw_fields) != 3
throw 'VimwikiTags5: Metadata file corrupted'
endif
let pagename = vw_fields[0]
@@ -198,6 +205,7 @@ function! s:load_tags_metadata() abort
let entry.tagname = std_fields[0]
let entry.lineno = std_fields[2]
let entry.link = vw_fields[1]
let entry.description = vw_fields[2]
if has_key(metadata, pagename)
call add(metadata[pagename], entry)
else
@@ -208,9 +216,9 @@ function! s:load_tags_metadata() abort
endfunction
" Removes all entries for given page from metadata in-place. Returns updated
" metadata (just in case).
function! s:remove_page_from_tags(metadata, page_name) abort
" Remove all entries for given page from metadata in-place. Returns updated
" metadata (just in case).
if has_key(a:metadata, a:page_name)
call remove(a:metadata, a:page_name)
return a:metadata
@@ -220,24 +228,24 @@ function! s:remove_page_from_tags(metadata, page_name) abort
endfunction
" Merges metadata of one file into a:metadata
function! s:merge_tags(metadata, pagename, file_metadata) abort
" Merge metadata of one file into a:metadata
let metadata = a:metadata
let metadata[a:pagename] = a:file_metadata
return metadata
endfunction
" Compares two actual lines from tags file. Return value is in strcmp style.
" See help on sort() -- that's what this function is going to be used for.
" See also s:write_tags_metadata below -- that's where we compose these tags
" file lines.
"
" This function is needed for tags sorting, since plain sort() compares line
" numbers as strings, not integers, and so, for example, tag at line 14
" preceeds the same tag on the same page at line 9. (Because string "14" is
" alphabetically 'less than' string "9".)
function! s:tags_entry_cmp(i1, i2) abort
" Compare two actual lines from tags file. Return value is in strcmp style.
" See help on sort() -- that's what this function is going to be used for.
" See also s:write_tags_metadata below -- that's where we compose these tags
" file lines.
"
" This function is needed for tags sorting, since plain sort() compares line
" numbers as strings, not integers, and so, for example, tag at line 14
" precedes the same tags on the same page at line 9. (Because string "14" is
" alphabetically 'less than' string "9".)
let items = []
for orig_item in [a:i1, a:i2]
let fields = split(orig_item, "\t")
@@ -260,13 +268,13 @@ function! s:tags_entry_cmp(i1, i2) abort
endfunction
" Saves metadata object into a file. Throws exceptions in case of problems.
function! s:write_tags_metadata(metadata) abort
" Save metadata object into a file. Throws exceptions in case of problems.
let metadata_path = vimwiki#tags#metadata_file_path()
let tags = []
for pagename in keys(a:metadata)
for entry in a:metadata[pagename]
let entry_data = pagename . "\t" . entry.link
let entry_data = pagename . "\t" . entry.link . "\t" . entry.description
let entry_data = substitute(entry_data, "\\", '\\\\', 'g')
let entry_data = substitute(entry_data, "\t", '\\t', 'g')
let entry_data = substitute(entry_data, "\r", '\\r', 'g')
@@ -282,7 +290,7 @@ function! s:write_tags_metadata(metadata) abort
endfor
call sort(tags, 's:tags_entry_cmp')
let tag_comments = [
\ "!_TAG_PROGRAM_VERSION\t2.5",
\ "!_TAG_PROGRAM_VERSION\t" . g:vimwiki_version,
\ "!_TAG_PROGRAM_URL\thttps://github.com/vimwiki/vimwiki",
\ "!_TAG_PROGRAM_NAME\tVimwiki Tags",
\ "!_TAG_PROGRAM_AUTHOR\tVimwiki",
@@ -297,8 +305,8 @@ function! s:write_tags_metadata(metadata) abort
endfunction
" Returns list of unique tags found in the .tags file
function! vimwiki#tags#get_tags() abort
" Return: list of unique tags found in the .tags file
let metadata = s:load_tags_metadata()
let tags = {}
for entries in values(metadata)
@@ -310,12 +318,38 @@ function! vimwiki#tags#get_tags() abort
endfunction
" Similar to vimwiki#base#generate_links. In the current buffer, appends
" tags and references to all their instances. If no arguments (tags) are
" specified, outputs all tags.
function! vimwiki#tags#generate_tags(create, ...) abort
let specific_tags = a:000
" Generate tags in current buffer
" Similar to vimwiki#base#generate_links. In the current buffer, appends
" tags and references to all their instances. If no arguments (tags) are
" specified, outputs all tags.
let header_level = vimwiki#vars#get_global('tags_header_level')
let tags_header_text = vimwiki#vars#get_global('tags_header')
" If tag headers should only be updated, search for already present tag headers
if !a:create
let headers = vimwiki#base#collect_headers()
let specific_tags = []
let inside_tag_headers = 0
for header in headers
" If we ran out of the headers containing the tags, stop
if inside_tag_headers && header[1] <= header_level
break
endif
" All headers in the tag headers section correspond to tag names. Collect all of them in a list.
if inside_tag_headers
call add(specific_tags, header[2])
endif
" If we found the start of the tag headers section, remember that the following headers are now inside of it
if header[1] == header_level && header[2] ==# tags_header_text
let inside_tag_headers = 1
endif
endfor
else
let specific_tags = a:000
endif
" use a dictionary function for closure like capability
" copy all local variables into dict (add a: if arguments are needed)
@@ -326,57 +360,70 @@ function! vimwiki#tags#generate_tags(create, ...) abort
" make a dictionary { tag_name: [tag_links, ...] }
let tags_entries = {}
for tagname in self.specific_tags
let tags_entries[tagname] = []
endfor
for entries in values(metadata)
for entry in entries
if has_key(tags_entries, entry.tagname)
call add(tags_entries[entry.tagname], entry.link)
call add(tags_entries[entry.tagname], [entry.link, entry.description])
else
let tags_entries[entry.tagname] = [entry.link]
if need_all_tags
let tags_entries[entry.tagname] = [[entry.link, entry.description]]
endif
endif
endfor
unlet entry " needed for older vims with sticky type checking since name is reused
endfor
let tagnames = need_all_tags ? sort(keys(tags_entries)) : self.specific_tags
let lines = []
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
for tagname in sort(keys(tags_entries))
if need_all_tags || index(self.specific_tags, tagname) != -1
if len(lines) > 0
let current_dir = vimwiki#base#current_subdir()
for tagname in tagnames
if len(lines) > 0
call add(lines, '')
endif
let tag_tpl = printf('rxH%d_Template', self.header_level + 1)
call add(lines, s:safesubstitute(vimwiki#vars#get_syntaxlocal(tag_tpl), '__Header__', tagname, ''))
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
call add(lines, '')
endif
let tag_tpl = printf('rxH%d_Template', self.header_level + 1)
call add(lines, s:safesubstitute(vimwiki#vars#get_syntaxlocal(tag_tpl), '__Header__', tagname, ''))
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
call add(lines, '')
endfor
endif
for taglink in sort(tags_entries[tagname])
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('Weblink1Template')
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', taglink, '')
let entry = s:safesubstitute(entry, '__LinkDescription__', taglink, '')
else
let link_caption = split(link_infos.anchor, '#', 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, '')
endif
call add(lines, bullet . entry)
else
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
call add(lines, bullet . substitute(link_tpl, '__LinkUrl__', taglink, ''))
endif
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
endfor
return lines
@@ -384,11 +431,11 @@ function! vimwiki#tags#generate_tags(create, ...) abort
let tag_match = printf('rxH%d', header_level + 1)
let links_rx = '^\%('.vimwiki#vars#get_syntaxlocal(tag_match).'\)\|'.
\ '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
\ '\%(^\s*$\)\|^\s*\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(
\ GeneratorTags,
\ vimwiki#vars#get_global('tags_header'),
\ tags_header_text,
\ links_rx,
\ line('$')+1,
\ header_level,
@@ -397,9 +444,27 @@ endfunction
function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
" Complete tags
" We can safely ignore args if we use -custom=complete option, Vim engine
" will do the job of filtering.
let taglist = vimwiki#tags#get_tags()
return join(taglist, "\n")
endfunction
function! vimwiki#tags#search_tags(tag_pattern) abort
" See #1316 and rxTags in vars.vim
let tf = vimwiki#vars#get_syntaxlocal('tag_format')
" Craft regex
let rx_this_tag = '/'
let rx_this_tag .= tf.pre . '\@<=' . tf.pre_mark
let rx_this_tag .= '\%(' . tf.in . tf.sep . '\)*'
let rx_this_tag .= a:tag_pattern
let rx_this_tag .= '\%(' . tf.sep . tf.in . '\)*'
let rx_this_tag .= tf.post_mark . tf.post . '\@='
let rx_this_tag .= '/'
" Search in current wiki folder
return vimwiki#base#search(rx_this_tag)
endfunction
+104 -108
View File
@@ -8,20 +8,25 @@
" Home: https://github.com/vimwiki/vimwiki/
" Clause: Load only once
if exists('g:loaded_vimwiki_tbl_auto') || &compatible
finish
endif
let g:loaded_vimwiki_tbl_auto = 1
let s:textwidth = &textwidth
function! s:rxSep() abort
function! s:s_sep() abort
" Return string column separator
return vimwiki#vars#get_syntaxlocal('rxTableSep')
endfunction
function! s:r_sep() abort
" Return regex column separator
" Not prefixed with \
let res = '\(^\|[^\\]\)\@<='
let res .= vimwiki#vars#get_syntaxlocal('rxTableSep')
return res
endfunction
function! s:wide_len(str) abort
" vim73 has new function that gives correct string width.
@@ -47,41 +52,43 @@ endfunction
function! s:cell_splitter() abort
return '\s*'.s:rxSep().'\s*'
return '\s*'.s:r_sep().'\s*'
endfunction
function! s:sep_splitter() abort
return '-'.s:rxSep().'-'
return '-'.s:r_sep().'-'
endfunction
function! s:is_table(line) abort
" Check if param:line is in a table
return s:is_separator(a:line) ||
\ (a:line !~# s:rxSep().s:rxSep() && a:line =~# '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
\ (a:line !~# s:r_sep().s:r_sep() && a:line =~# '^\s*'.s:r_sep().'.\+'.s:r_sep().'\s*$')
endfunction
function! s:is_separator(line) abort
return a:line =~# '^\s*'.s:rxSep().'\(:\=--\+:\='.s:rxSep().'\)\+\s*$'
" Check if param:line is a separator (ex: | --- | --- |)
return a:line =~# '^\s*'.s:r_sep().'\(:\=--\+:\='.s:r_sep().'\)\+\s*$'
endfunction
function! s:is_separator_tail(line) abort
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:r_sep().'-\+\)\+'.s:r_sep().'\s*$'
endfunction
function! s:is_last_column(lnum, cnum) abort
let line = strpart(getline(a:lnum), a:cnum - 1)
return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
return line =~# s:r_sep().'\s*$' && line !~# s:r_sep().'.*'.s:r_sep().'\s*$'
endfunction
function! s:is_first_column(lnum, cnum) abort
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
return line =~# '^\s*$' ||
\ (line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
\ (line =~# '^\s*'.s:r_sep() && line !~# '^\s*'.s:r_sep().'.*'.s:r_sep())
endfunction
@@ -112,8 +119,9 @@ endfunction
function! s:create_empty_row(cols) abort
let row = s:rxSep()
let cell = ' '.s:rxSep()
" Create an empty row of a:cols columns
let row = s:s_sep()
let cell = ' '.s:s_sep()
for c in range(a:cols)
let row .= cell
@@ -124,8 +132,9 @@ endfunction
function! s:create_row_sep(cols) abort
let row = s:rxSep()
let cell = '---'.s:rxSep()
" Create an empty separator row of a:cols columns
let row = s:s_sep()
let cell = '---'.s:s_sep()
for c in range(a:cols)
let row .= cell
@@ -140,7 +149,9 @@ function! vimwiki#tbl#get_cells(line, ...) abort
let state = 'NONE'
let cell_start = 0
let quote_start = 0
let len = strlen(a:line) - 1
" Split byte string into list of character to properly handle multibyte chars
let chars = split(a:line, '\zs')
let len = len(chars) - 1
" 'Simple' FSM
while state !=# 'CELL'
@@ -148,10 +159,9 @@ function! vimwiki#tbl#get_cells(line, ...) abort
let state = 'CELL'
endif
for idx in range(quote_start, len)
" The only way I know Vim can do Unicode...
let ch = a:line[idx]
let ch = chars[idx]
if state ==# 'NONE'
if ch ==# '|'
if ch ==# s:s_sep() && (idx < 1 || chars[idx-1] !=# '\')
let cell_start = idx + 1
let state = 'CELL'
endif
@@ -159,8 +169,8 @@ function! vimwiki#tbl#get_cells(line, ...) abort
if ch ==# '[' || ch ==# '{'
let state = 'BEFORE_QUOTE_START'
let quote_start = idx
elseif ch ==# '|'
let cell = strpart(a:line, cell_start, idx - cell_start)
elseif ch ==# s:s_sep() && (idx < 1 || chars[idx-1] !=# '\')
let cell = join(chars[cell_start : idx-1], '')
if a:0 && a:1
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
else
@@ -225,12 +235,12 @@ endfunction
function! s:get_rows(lnum, ...) abort
if !s:is_table(getline(a:lnum))
return
endif
let rows = []
if !s:is_table(getline(a:lnum))
return rows
endif
let lnum = a:lnum - 1
let depth = a:0 > 0 ? a:1 : 0
let ldepth = 0
@@ -358,7 +368,7 @@ function! s:get_aligned_rows(lnum, col1, col2, depth) abort
let check_all = 1
if a:depth > 0
let rows = s:get_rows(a:lnum, a:depth)
let startlnum = rows[0][0]
let startlnum = len(rows) > 0 ? rows[0][0] : 0
let lrows = len(rows)
if lrows == a:depth + 1
let line = rows[-1][1]
@@ -389,7 +399,7 @@ function! s:get_aligned_rows(lnum, col1, col2, depth) abort
if check_all
" all the table must be re-formatted
let rows = s:get_rows(a:lnum)
let startlnum = rows[0][0]
let startlnum = len(rows) > 0 ? rows[0][0] : 0
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row))
@@ -417,8 +427,8 @@ function! s:get_aligned_rows(lnum, col1, col2, depth) abort
endfunction
" Number of the current column. Starts from 0.
function! s:cur_column() abort
" Number of the current column. Starts from 0.
let line = getline('.')
if !s:is_table(line)
return -1
@@ -426,10 +436,10 @@ function! s:cur_column() abort
" TODO: do we need conditional: if s:is_separator(line)
let curs_pos = col('.')
let mpos = match(line, s:rxSep(), 0)
let mpos = match(line, s:r_sep(), 0)
let col = -1
while mpos < curs_pos && mpos != -1
let mpos = match(line, s:rxSep(), mpos+1)
let mpos = match(line, s:r_sep(), mpos+1)
if mpos != -1
let col += 1
endif
@@ -457,7 +467,7 @@ endfunction
function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort
let new_line = s:rxSep()
let new_line = s:s_sep()
for idx in range(len(a:cells))
if idx == a:col1
let idx = a:col2
@@ -465,12 +475,12 @@ function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort
let idx = a:col1
endif
let value = a:cells[idx]
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:rxSep()
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:s_sep()
endfor
let idx = len(a:cells)
while idx < len(a:max_lens)
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:rxSep()
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:s_sep()
let idx += 1
endwhile
return new_line
@@ -495,14 +505,14 @@ endfunction
function! s:fmt_sep(max_lens, aligns, col1, col2) abort
let new_line = s:rxSep()
let new_line = s:s_sep()
for idx in range(len(a:max_lens))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:rxSep()
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:s_sep()
endfor
return new_line
endfunction
@@ -513,10 +523,10 @@ function! s:kbd_create_new_row(cols, goto_first) abort
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'), 2)\<CR>"
let cmd .= "\<ESC>0"
if a:goto_first
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'c', line('.'))\<CR>"
else
let cmd .= (col('.')-1).'l'
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
endif
let cmd .= 'a'
@@ -526,8 +536,8 @@ endfunction
function! s:kbd_goto_next_row() abort
let cmd = "\<ESC>j"
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a'
return cmd
endfunction
@@ -535,21 +545,21 @@ endfunction
function! s:kbd_goto_prev_row() abort
let cmd = "\<ESC>k"
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a'
return cmd
endfunction
" Used in s:kbd_goto_next_col
function! vimwiki#tbl#goto_next_col() abort
" Used in s:kbd_goto_next_col
let curcol = virtcol('.')
let lnum = line('.')
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = rows[0][0]
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))
@@ -577,14 +587,14 @@ function! s:kbd_goto_next_col(jumpdown) abort
endfunction
" Used in s:kbd_goto_prev_col
function! vimwiki#tbl#goto_prev_col() abort
" Used in s:kbd_goto_prev_col
let curcol = virtcol('.')
let lnum = line('.')
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = rows[0][0]
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))
@@ -615,9 +625,8 @@ function! s:kbd_goto_prev_col(jumpup) abort
let cmd .= '$'
endif
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'b', line('.'))\<CR>"
" let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'b', line('.'))\<CR>"
" let cmd .= "a"
"echomsg "DEBUG kbd_goto_prev_col> ".cmd
return cmd
endfunction
@@ -645,7 +654,7 @@ function! vimwiki#tbl#kbd_tab() abort
let last = s:is_last_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum))
"echomsg "DEBUG kbd_tab> last=".last.", is_sep=".is_sep
"vimwiki#u#debug("DEBUG kbd_tab> last=".last.", is_sep=".is_sep)
if (is_sep || last) && !s:is_table(getline(lnum+1))
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
return s:kbd_create_new_row(cols, 1)
@@ -662,7 +671,7 @@ function! vimwiki#tbl#kbd_shift_tab() abort
let first = s:is_first_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum))
"echomsg "DEBUG kbd_tab> ".first
"vimwiki#u#debug("kbd_tab> ".first)
if (is_sep || first) && !s:is_table(getline(lnum-1))
return ''
endif
@@ -671,6 +680,7 @@ endfunction
function! vimwiki#tbl#format(lnum, ...) abort
" Clause in
if !vimwiki#u#ft_is_vw()
return
endif
@@ -679,6 +689,9 @@ function! vimwiki#tbl#format(lnum, ...) abort
return
endif
" Backup textwidth
let textwidth = &textwidth
let depth = a:0 == 1 ? a:1 : 0
if a:0 == 2
@@ -704,7 +717,8 @@ function! vimwiki#tbl#format(lnum, ...) abort
endif
endfor
let &textwidth = s:textwidth
" Restore user textwidth
let &textwidth = textwidth
endfunction
@@ -753,85 +767,68 @@ function! vimwiki#tbl#align_or_cmd(cmd, ...) abort
endfunction
function! vimwiki#tbl#reset_tw(lnum) abort
if !vimwiki#u#ft_is_vw()
return
endif
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
let s:textwidth = &textwidth
let &textwidth = 0
endfunction
" TODO: move_column_left and move_column_right are good candidates to be refactored.
function! vimwiki#tbl#move_column_left() abort
"echomsg "DEBUG move_column_left: "
" TODO: move_column_left and move_column_right are good candidates to be refactored.
" Clause in
let line = getline('.')
if !s:is_table(line)
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col > 0
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
if cur_col <= 0
return
endif
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
call cursor(line('.'), 1)
let sep = '\('.s:r_sep().'\).\zs'
let mpos = -1
let col = -1
while col < cur_col-1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
else
break
endif
endwhile
endfunction
function! vimwiki#tbl#move_column_right() abort
" Clause in
let line = getline('.')
if !s:is_table(line)
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col < s:col_count(line('.'))-1
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
if cur_col >= s:col_count(line('.'))-1
return
endif
" Format table && Put cursor on first col
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
call cursor(line('.'), 1)
" Change add one to all col
let sep = '\('.s:r_sep().'\).\zs'
let mpos = -1
let col = -1
while col < cur_col+1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
else
break
endif
endwhile
endfunction
@@ -858,4 +855,3 @@ endfunction
function! vimwiki#tbl#sep_splitter() abort
return s:sep_splitter()
endfunction
+375 -36
View File
@@ -3,16 +3,127 @@
" Description: Utility functions
" Home: https://github.com/vimwiki/vimwiki/
function! vimwiki#u#echo(msg, ...) abort
" Echo: msg
" :param: (1) <string> highlighting group
" :param: (2) <string> echo suffix (ex: 'n', 'm')
" :param: (3) <string> message prefix, default Vimwiki
let hl_group = a:0 > 0 ? a:1 : ''
let echo_suffix = a:0 > 1 ? a:2 : ''
let msg_prefix = a:0 > 2 ? a:3 : 'Vimwiki: '
" Start highlighting
if hl_group !=# ''
exe 'echohl ' . hl_group
endif
" Escape
let msg = substitute(a:msg, "'", "''", 'g')
" Print
exe 'echo'.echo_suffix . " '" . msg_prefix . msg . "'"
" Stop highlighting
if hl_group !=# ''
echohl None
endif
endfunction
function! vimwiki#u#debug(msg) abort
" Debug: msg
" let b:vimwiki_debug to trigger
if !exists('b:vimwiki_debug') || b:vimwiki_debug == 0
return
endif
echomsg 'DEBUG: ' . a:msg
endfunction
function! vimwiki#u#warn(msg) abort
" Warn: msg
call vimwiki#u#echo('Warning: ' . a:msg, 'WarningMsg', '')
endfunction
function! vimwiki#u#error(msg) abort
" Error: msg
call vimwiki#u#echo('Error: ' . a:msg, 'Error', 'msg')
endfunction
function! vimwiki#u#deprecate(old, new) abort
" Warn: deprecated feature: old -> new
call vimwiki#u#warn('Deprecated: ' . a:old . ' is deprecated and '
\ . 'will be removed in future versions. Use ' . a:new . ' instead.')
endfunction
function! vimwiki#u#get_selection(...) abort
" Get visual selection text content, 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
" Execute: string v:count times
function! vimwiki#u#count_exe(cmd) abort
for i in range( max([1, v:count]) )
exe a:cmd
endfor
" Execute: string v:count times
" Called: prefixable mapping
for i in range( max([1, v:count]) )
exe a:cmd
endfor
endfunction
function! vimwiki#u#sort_len(list) abort
function! s:len_compare(s1, s2) abort
let i1 = len(a:s1)
let i2 = len(a:s2)
return i1 == i2 ? 0 : i1 > i2 ? 1 : -1
endfunction
return sort(a:list, 's:len_compare')
endfunction
function! vimwiki#u#trim(string, ...) abort
" Trim spaces: leading and trailing
" :param: string in
" :param: (1) <string> optional list of character to trim
let chars = ''
if a:0 > 0
let chars = a:1
@@ -23,15 +134,15 @@ function! vimwiki#u#trim(string, ...) abort
endfunction
" Builtin cursor doesn't work right with unicode characters.
function! vimwiki#u#cursor(lnum, cnum) abort
" Builtin cursor doesn't work right with unicode characters.
exe a:lnum
exe 'normal! 0'.a:cnum.'|'
endfunction
" Returns: OS name, human readable
function! vimwiki#u#os_name() abort
" Returns: OS name, human readable
if vimwiki#u#is_windows()
return 'Windows'
elseif vimwiki#u#is_macos()
@@ -43,11 +154,13 @@ endfunction
function! vimwiki#u#is_windows() abort
" Check if OS is windows
return has('win32') || has('win64') || has('win95') || has('win16')
endfunction
function! vimwiki#u#is_macos() abort
" Check if OS is mac
if has('mac') || has('macunix') || has('gui_mac')
return 1
endif
@@ -64,44 +177,43 @@ endfunction
function! vimwiki#u#escape(string) abort
" Escape string for literal magic regex match
return escape(a:string, '~.*[]\^$')
endfunction
" Load concrete Wiki syntax: sets regexes and templates for headers and links
function! vimwiki#u#reload_regexes() abort
" Load concrete Wiki syntax: sets regexes and templates for headers and links
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
endfunction
" Load syntax-specific functionality
function! vimwiki#u#reload_regexes_custom() abort
" Load syntax-specific functionality
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
endfunction
" Backward compatible version of the built-in function shiftwidth()
if exists('*shiftwidth')
function! vimwiki#u#sw() abort
function! vimwiki#u#sw() abort
" Backward compatible version of the built-in function shiftwidth()
if exists('*shiftwidth')
return shiftwidth()
endfunc
else
function! vimwiki#u#sw() abort
else
return &shiftwidth
endfunc
endif
endif
endfunc
" a:mode single character indicating the mode as defined by :h maparg
" a:key the key sequence to map
" a:plug the plug command the key sequence should be mapped to
" a:1 optional argument with the following functionality:
" if a:1==1 then the hasmapto(<Plug>) check is skipped.
" this can be used to map different keys to the same <Plug> definition
" if a:1==2 then the mapping is not <buffer> specific i.e. it is global
function! vimwiki#u#map_key(mode, key, plug, ...) abort
" a:mode single character indicating the mode as defined by :h maparg
" a:key the key sequence to map
" a:plug the plug command the key sequence should be mapped to
" a:1 optional argument with the following functionality:
" if a:1==1 then the hasmapto(<Plug>) check is skipped.
" this can be used to map different keys to the same <Plug> definition
" if a:1==2 then the mapping is not <buffer> specific i.e. it is global
if a:0 && a:1 == 2
" global mappings
if !hasmapto(a:plug) && maparg(a:key, a:mode) ==# ''
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
@@ -109,18 +221,18 @@ function! vimwiki#u#map_key(mode, key, plug, ...) abort
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
else
" vimwiki buffer mappings
if !hasmapto(a:plug)
if !hasmapto(a:plug, a:mode)
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
endif
endif
endfunction
" 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
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 !=? '')
@@ -130,10 +242,10 @@ function! vimwiki#u#is_codeblock(lnum) abort
endif
endfunction
" Sets the filetype to vimwiki
" If g:vimwiki_filetypes variable is set
" the filetype will be vimwiki.<ft1>.<ft2> etc.
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
@@ -142,11 +254,11 @@ function! vimwiki#u#ft_set() abort
let &filetype = ftype
endfunction
" 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
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'
@@ -155,3 +267,230 @@ function! vimwiki#u#ft_is_vw() abort
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
" res = '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
" But I removed the * as it is treated as a special case
return '!"#$%&''()+,-./:;<=>?@\[\\\]^`{}|~'
endfunction
function! vimwiki#u#hi_expand_regex(lst) abort
" Helper: Expand regex from reduced typeface delimiters
" :param: list<list<delimiters>> with reduced regex
" 1: Left delimiter (regex)
" 2: Right delimiter (regex)
" 3: Possible characters to ignore (regex: default '$^' => never match)
" 4: Can multiply delimiter (boolean: default 0 => do not repeat)
" 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]
let r_repeat_del = len(a_delimiter) >= 3 ? a_delimiter[2] : '$^'
let b_can_mult = len(a_delimiter) >= 4 ? a_delimiter[3] : 0
" Craft the repeatable middle
let r_mult = b_can_mult ? '\+' : ''
let r_left_repeat = '\%(\%(' . r_left_del . '\)' . r_mult . '\)'
let r_right_repeat = '\%(\%(' . r_right_del . '\)' . r_mult . '\)'
let r_unescaped_repeat = '\%(\\\|\\\@<!' . r_repeat_del . '\)'
" Regex Start:
" Left-Flanking is not followed by space (or need of line)
" Left Case1: not followed by punctuation, start with blacklist
" -- Can escape the leftflank
let r_left_prefix1 = '\%(^\|' . r_unescaped_repeat . '\@<!\)'
let r_left_suffix1 = '\%(\%([[:space:]\n' . punctuation . ']\|' . r_unescaped_repeat . '\)\@!\)'
" Left Case2: followed by punctuation so must be preceded by whitelisted Unicode whitespace or start of line or a punctuation character.
let r_left_prefix2 = '\%(\%(^\|[[:space:]\n' . punctuation . ']\)\@<=\)'
let r_left_suffix2 = '\%([' . punctuation . ']\@=\)'
" Left Concatenate
let r_start = '\%(' . r_left_prefix1 . '\zs' . r_left_repeat . '\ze' . r_left_suffix1
let r_start .= '\|' . r_left_prefix2 . '\zs' . r_left_repeat . '\ze' . 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:]\n' . punctuation . ']\|' . r_unescaped_repeat . '\)\@<!\)'
let r_right_suffix1 = '\%($\|' . r_unescaped_repeat . '\@!\)'
" 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:]\n' . punctuation . ']\)\@=\)'
" Right Concatenate
let r_end = '\%(' . r_right_prefix1 . r_right_repeat . r_right_suffix1
let r_end .= '\|' . r_right_prefix2 . r_right_repeat . 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_pre <string>: opening tag example '<b>'
" :param: tag_post <string>: closing tag 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
" 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
" 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
" 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
+1102 -343
View File
File diff suppressed because it is too large Load Diff
+90 -7
View File
@@ -1,12 +1,13 @@
# Design Notes
This file is meant to document design decisions and algorithms inside vimwiki
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
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
@@ -52,7 +53,7 @@ random edit.
The lowest row gets aligned when leaving the Insert mode. Let's copy _Data1_
(using `viwy` or another keystroke) and paste it (using `p`) in the second data
row of the first column. Now the table looks mis-aligned (as we did not enter
row of the first column. Now the table looks misaligned (as we did not enter
the Insert mode).
```
@@ -107,7 +108,7 @@ 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 formating algorithm
### The newer table formatting algorithm
The newer algorithm was introduced to struggle against performance issues when
formatting large tables.
@@ -122,7 +123,7 @@ Let's take the table from the previous example in an intermediate state.
```
Then move the cursor to the first data row, copy it with `yy`, go down to the
mis-aligned line, and press `5p`. Now we have a slightly bigger mis-aligned
misaligned line, and press `5p`. Now we have a slightly bigger misaligned
table.
```
@@ -177,10 +178,92 @@ row by row from the top to the bottom, dynamic formatting should be both fast
(watching only three rows in a table, re-formatting only when the shrunk
current row gets longer than any of the two rows above) and eager (a table
should look formatted on every press on _Tab_ and _Enter_). However, the newer
algorithm differs from the older algorithm when starting editing a mis-aligned
table in an area where mis-aligned rows do not get into the viewport: in this
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
" 1/ Redraw: Typeface: -> u.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
call vimwiki#u#hi_typeface(s:typeface_dic)
" 2/ Clear typeface highlighting (see #1346)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Create a dic with no highlight but yes with all keys
" -- So that they are effectivemly overwritten
let typeface_dic = {'bold': [], 'italic': [], 'underline': [], 'bold_italic': [], 'code': [], 'del': [], 'sup': [], 'sub': [], 'eq': []}
" Just for consistency, this is an internal variable
echo vimwiki#vars#set_syntaxlocal('typeface', typeface_dic)
" Here is a Vim aware syntax highlighting big command
verbose call vimwiki#u#hi_typeface(typeface_dic)
```
<!-- vim: set tw=80: -->
+7 -7
View File
@@ -1,10 +1,10 @@
<svg width="200" height="43" viewBox="0 0 372 80" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M45.592 20.804C48.4347 22.4987 49.856 24.3027 49.856 26.216C49.856 27.3093 49.3093 28.8127 48.216 30.726L31.242 59.836C30.6953 60.7653 29.8207 61.6127 28.618 62.378C27.4153 63.0887 26.2127 63.444 25.01 63.444C23.862 63.444 22.7413 63.1707 21.648 62.624C20.6093 62.0227 19.8713 61.4213 19.434 60.82L18.696 59.918L1.64 30.726C0.546667 28.922 0 27.446 0 26.298C0 24.33 1.42133 22.4987 4.264 20.804C6.34133 19.6013 7.98133 19 9.184 19C10.3867 19 11.316 19.3827 11.972 20.148C12.6827 20.8587 13.4207 21.952 14.186 23.428L24.928 44.092L35.67 23.428C36.2713 22.3893 36.7087 21.6513 36.982 21.214C37.31 20.722 37.802 20.2573 38.458 19.82C39.114 19.328 39.9887 19.082 41.082 19.082C42.1753 19.082 43.6787 19.656 45.592 20.804Z" fill="black"/>
<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="black"/>
<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="black"/>
<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="#E5E5E5"/>
<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="#E5E5E5"/>
<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="#E5E5E5"/>
<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="#E5E5E5"/>
<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

After

Width:  |  Height:  |  Size: 15 KiB

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

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

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

After

Width:  |  Height:  |  Size: 18 KiB

+598
View File
@@ -0,0 +1,598 @@
*vimwiki-emoji.txt* A Reference table of markdown emoji
==============================================================================
CONTENTS *vimwiki-emoji*
1. People |vimwiki-emoji-people|
1.1. Face |vimwiki-emoji-face|
1.2. Job |vimwiki-emoji-job|
1.3. Familly |vimwiki-emoji-familly|
2. Activity |vimwiki-emoji-activity|
3. Places |vimwiki-emoji-places|
4. Nature |vimwiki-emoji-nature|
5. Objects |vimwiki-emoji-objects|
6. Foods |vimwiki-emoji-foods|
7. Symbols |vimwiki-emoji-symbols|
8. Flags |vimwiki-emoji-flags|
==============================================================================
1. People *vimwiki-emoji-people*
------------------------------------------------------------------------------
1.1 Face *vimwiki-emoji-face*
| 😀 | grinning | 😃 | smiley | 😄 | smile
| 😁 | grin | 😆 | laughing | 😅 | sweat_smile
| 😂 | joy | 🤣 | rofl | ☺️ | relaxed
| 😊 | blush | 😇 | innocent | 🙂 | slightly_smiling_face
| 🙃 | upside_down_face | 😉 | wink | 😌 | relieved
| 😍 | heart_eyes | 😘 | kissing_heart | 😗 | kissing
| 😙 | kissing_smiling_eyes | 😚 | kissing_closed_eyes | 😋 | yum
| 😜 | stuck_out_tongue_winking_eye | 😝 | stuck_out_tongue_closed_eyes| 😛 | stuck_out_tongue
| 🤑 | money_mouth_face | 🤗 | hugs | 🤓 | nerd_face
| 😎 | sunglasses | 🤡 | clown_face | 🤠 | cowboy_hat_face
| 😏 | smirk | 😒 | unamused | 😞 | disappointed
| 😔 | pensive | 😟 | worried | 😕 | confused
| 🙁 | slightly_frowning_face | ☹️ | frowning_face | 😣 | persevere
| 😖 | confounded | 😫 | tired_face | 😩 | weary
| 😤 | triumph | 😠 | angry | 😡 | rage
| 😶 | no_mouth | 😐 | neutral_face | 😑 | expressionless
| 😯 | hushed | 😦 | frowning | 😧 | anguished
| 😮 | open_mouth | 😲 | astonished | 😵 | dizzy_face
| 😳 | flushed | 😱 | scream | 😨 | fearful
| 😰 | cold_sweat | 😢 | cry | 😥 | disappointed_relieved
| 🤤 | drooling_face | 😭 | sob | 😓 | sweat
| 😪 | sleepy | 😴 | sleeping | 🙄 | roll_eyes
| 🤔 | thinking | 🤥 | lying_face | 😬 | grimacing
| 🤐 | zipper_mouth_face | 🤢 | nauseated_face | 🤧 | sneezing_face
| 😷 | mask | 🤒 | face_with_thermometer | 🤕 | face_with_head_bandage
| 😈 | smiling_imp | 👿 | imp | 👹 | japanese_ogre
| 👺 | japanese_goblin | 💩 | hankey | 👻 | ghost
| 💀 | skull | ☠️ | skull_and_crossbones| 👽 | alien
| 👾 | space_invader | 🤖 | robot | 🎃 | jack_o_lantern
| 😺 | smiley_cat | 😸 | smile_cat | 😹 | joy_cat
| 😻 | heart_eyes_cat | 😼 | smirk_cat | 😽 | kissing_cat
| 🙀 | scream_cat | 😿 | crying_cat_face | 😾 | pouting_cat
| 👐 | open_hands | 🙌 | raised_hands | 👏 | clap
| 🙏 | pray | 🤝 | handshake | 👍 | +1
| 👎 | -1 | 👊 | fist_oncoming | ✊ | fist_raised
| 🤛 | fist_left | 🤜 | fist_right | 🤞 | crossed_fingers
| ✌️ | v | 🤘 | metal | 👌 | ok_hand
| 👈 | point_left | 👉 | point_right | 👆 | point_up_2
| 👇 | point_down | ☝️ | point_up | ✋ | hand
| 🤚 | raised_back_of_hand | 🖐 | raised_hand_with_fingers_splayed | 🖖 | vulcan_salute
| 👋 | wave | 🤙 | call_me_hand | 💪 | muscle
| 🖕 | middle_finger | ✍️ | writing_hand | 🤳 | selfie
| 💅 | nail_care | 💍 | ring | 💄 | lipstick
| 💋 | kiss | 👄 | lips | 👅 | tongue
| 👂 | ear | 👃 | nose | 👣 | footprints
| 👁 | eye | 👀 | eyes | 🗣 | speaking_head
------------------------------------------------------------------------------
1.2 Job *vimwiki-emoji-job*
| 👤 | bust_in_silhouette | 👥 | busts_in_silhouette | 👶 | baby
| 👦 | boy | 👧 | girl | 👨 | man
| 👩 | woman | 👱‍♀️ | blonde_woman| 👱 | blonde_man
| 👴 | older_man | 👵 | older_woman | 👲 | man_with_gua_pi_mao
| 👳‍♀️ | woman_with_turban | 👳 | man_with_turban
| 👮‍♀️ | policewoman | 👮 | policeman
| 👷‍♀️ | construction_worker_woman| 👷 | construction_worker_man
| 💂‍♀️ | guardswoman | 💂 | guardsman
| 🕵️‍♀️ | female_detective | 🕵️ | male_detective
| 👩‍⚕️ | woman_health_worker | 👨‍⚕️ | man_health_worker
| 👩‍🌾 | woman_farmer | 👨‍🌾 | man_farmer
| 👩‍🍳 | woman_cook | 👨‍🍳 | man_cook
| 👩‍🎓 | woman_student | 👨‍🎓 | man_student
| 👩‍🎤 | woman_singer | 👨‍🎤 | man_singer
| 👩‍🏫 | woman_teacher | 👨‍🏫 | man_teacher
| 👩‍🏭 | woman_factory_worker | 👨‍🏭 | man_factory_worker
| 👩‍💻 | woman_technologist | 👨‍💻 | man_technologist
| 👩‍💼 | woman_office_worker | 👨‍💼 | man_office_worker
| 👩‍🔧 | woman_mechanic | 👨‍🔧 | man_mechanic
| 👩‍🔬 | woman_scientist | 👨‍🔬 | man_scientist
| 👩‍🎨 | woman_artist | 👨‍🎨 | man_artist
| 👩‍🚒 | woman_firefighter | 👨‍🚒 | man_firefighter
| 👩‍✈️ | woman_pilot | 👨‍✈️ | man_pilot
| 👩‍🚀 | woman_astronaut | 👨‍🚀 | man_astronaut
| 👩‍⚖️ | woman_judge | 👨‍⚖️ | man_judge
| 🤶 | mrs_claus | 🎅 | santa
| 👸 | princess | 🤴 | prince
| 👰 | bride_with_veil | 🤵 | man_in_tuxedo
| 👼 | angel | 🤰 | pregnant_woman
| 🙇‍♀️ | bowing_woman | 🙇 | bowing_man
| 💁 | tipping_hand_woman | 💁‍♂️ | tipping_hand_man
| 🙅 | no_good_woman | 🙅‍♂️ | no_good_man
| 🙆 | ok_woman | 🙆‍♂️ | ok_man
| 🙋 | raising_hand_woman | 🙋‍♂️ | raising_hand_man
| 🤦‍♀️ | woman_facepalming | 🤦‍♂️ | man_facepalming
| 🤷‍♀️ | woman_shrugging | 🤷‍♂️ | man_shrugging
| 🙎 | pouting_woman | 🙎‍♂️ | pouting_man
| 🙍 | frowning_woman | 🙍‍♂️ | frowning_man
| 💇 | haircut_woman | 💇‍♂️ | haircut_man
| 💆 | massage_woman | 💆‍♂️ | massage_man
| 🕴 | business_suit_levitating | 💃 | dancer
| 🕺 | man_dancing | 👯 | dancing_women
| 👯‍♂️ | dancing_men | 🚶‍♀️ | walking_woman
| 🚶 | walking_man | 🏃‍♀️ | running_woman
| 🏃 | running_man | 👚 | womans_clothes
| 👕 | shirt | 👖 | jeans
| 👔 | necktie | 👗 | dress | 👙 | bikini
| 👘 | kimono | 👠 | high_heel | 👡 | sandal
| 👢 | boot | 👞 | mans_shoe | 👟 | athletic_shoe
| 👒 | womans_hat | 🎩 | tophat | 🎓 | mortar_board
| 👑 | crown | ⛑ | rescue_worker_helmet| 🎒 | school_satchel
| 👝 | pouch | 👛 | purse | 👜 | handbag
| 💼 | briefcase | 👓 | eyeglasses | 🕶 | dark_sunglasses
| 🌂 | closed_umbrella | ☂️ | open_umbrella
------------------------------------------------------------------------------
1.3 Familly *vimwiki-emoji-familly*
| 👫 | couple
| 👭 | two_women_holding_hands
| 👬 | two_men_holding_hands
| 💑 | couple_with_heart_woman_man
| 👩‍❤️‍👩 | couple_with_heart_woman_woman
| 👨‍❤️‍👨 | couple_with_heart_man_man
| 💏 | couplekiss_man_woman
| 👩‍❤️‍💋‍👩 | couplekiss_woman_woman
| 👨‍❤️‍💋‍👨 | couplekiss_man_man
| 👪 | family_man_woman_boy
| 👨‍👩‍👧 | family_man_woman_girl
| 👨‍👩‍👧‍👦 | family_man_woman_girl_boy
| 👨‍👩‍👦‍👦 | family_man_woman_boy_boy
| 👨‍👩‍👧‍👧 | family_man_woman_girl_girl
| 👩‍👩‍👦 | family_woman_woman_boy
| 👩‍👩‍👧 | family_woman_woman_girl
| 👩‍👩‍👧‍👦 | family_woman_woman_girl_boy
| 👩‍👩‍👦‍👦 | family_woman_woman_boy_boy
| 👩‍👩‍👧‍👧 | family_woman_woman_girl_girl
| 👨‍👨‍👦 | family_man_man_boy
| 👨‍👨‍👧 | family_man_man_girl
| 👨‍👨‍👧‍👦 | family_man_man_girl_boy
| 👨‍👨‍👦‍👦 | family_man_man_boy_boy
| 👨‍👨‍👧‍👧 | family_man_man_girl_girl
| 👩‍👦 | family_woman_boy
| 👩‍👧 | family_woman_girl
| 👩‍👧‍👦 | family_woman_girl_boy
| 👩‍👦‍👦 | family_woman_boy_boy
| 👩‍👧‍👧 | family_woman_girl_girl
| 👨‍👦 | family_man_boy
| 👨‍👧 | family_man_girl
| 👨‍👧‍👦 | family_man_girl_boy
| 👨‍👦‍👦 | family_man_boy_boy
| 👨‍👧‍👧 | family_man_girl_girl
==============================================================================
2. Activity *vimwiki-emoji-activity*
| 👴 | older_man | 👵 | older_woman | 👲 | man_with_gua_pi_mao
| ⚽️ | soccer | 🏀 | basketball | 🏈 | football
| ⚾️ | baseball | 🎾 | tennis | 🏐 | volleyball
| 🏉 | rugby_football | 🎱 | 8ball | 🏓 | ping_pong
| 🏸 | badminton | 🥅 | goal_net | 🏒 | ice_hockey
| 🏑 | field_hockey | 🏏 | cricket | ⛳️ | golf
| 🏹 | bow_and_arrow | 🎣 | fishing_pole_and_fish | 🥊 | boxing_glove
| 🥋 | martial_arts_uniform | ⛸ | ice_skate | 🎿 | ski
| ⛷ | skier | 🏂 | snowboarder
| 🏋️‍♀️ | weight_lifting_woman | 🏋️ | weight_lifting_man
| 🤺 | person_fencing | 🤼‍♀️ | women_wrestling
| 🤼‍♂️ | men_wrestling | 🤸‍♀️ | woman_cartwheeling
| 🤸‍♂️ | man_cartwheeling | ⛹️‍♀️ | basketball_woman
| ⛹️ | basketball_man | 🤾‍♀️ | woman_playing_handball
| 🤾‍♂️ | man_playing_handball | 🏌️‍♀️ | golfing_woman
| 🏌️ | golfing_man | 🏄‍♀️ | surfing_woman
| 🏄 | surfing_man | 🏊‍♀️ | swimming_woman
| 🏊 | swimming_man | 🤽‍♀️ | woman_playing_water_polo
| 🤽‍♂️ | man_playing_water_polo | 🚣‍♀️ | rowing_woman
| 🚣 | rowing_man | 🏇 | horse_racing
| 🚴‍♀️ | biking_woman | 🚴 | biking_man
| 🚵‍♀️ | mountain_biking_woman | 🚵 | mountain_biking_man
| 🎽 | running_shirt_with_sash | 🏅 | medal_sports
| 🎖 | medal_military | 🥇 | 1st_place_medal | 🥈 | 2nd_place_medal
| 🥉 | 3rd_place_medal | 🏆 | trophy | 🏵 | rosette
| 🎗 | reminder_ribbon | 🎫 | ticket | 🎟 | tickets
| 🎪 | circus_tent | 🤹‍♀️ | woman_juggling | 🤹‍♂️ | man_juggling
| 🎭 | performing_arts | 🎨 | art | 🎬 | clapper
| 🎤 | microphone | 🎧 | headphones | 🎼 | musical_score
| 🎹 | musical_keyboard | 🥁 | drum | 🎷 | saxophone
| 🎺 | trumpet | 🎸 | guitar | 🎻 | violin
| 🎲 | game_die | 🎯 | dart | 🎳 | bowling
| 🎮 | video_game | 🎰 | slot_machine
==============================================================================
3. Places *vimwiki-emoji-places*
| 🚗 | car | 🚕 | taxi | 🚙 | blue_car
| 🚌 | bus | 🚎 | trolleybus | 🏎 | racing_car
| 🚓 | police_car | 🚑 | ambulance | 🚒 | fire_engine
| 🚐 | minibus | 🚚 | truck | 🚛 | articulated_lorry
| 🚜 | tractor | 🛴 | kick_scooter | 🚲 | bike
| 🛵 | motor_scooter | 🏍 | motorcycle | 🚨 | rotating_light
| 🚔 | oncoming_police_car | 🚍 | oncoming_bus | 🚘 | oncoming_automobile
| 🚖 | oncoming_taxi | 🚡 | aerial_tramway | 🚠 | mountain_cableway
| 🚟 | suspension_railway | 🚃 | railway_car | 🚋 | train
| 🚞 | mountain_railway | 🚝 | monorail | 🚄 | bullettrain_side
| 🚅 | bullettrain_front | 🚈 | light_rail | 🚂 | steam_locomotive
| 🚆 | train2 | 🚇 | metro | 🚊 | tram
| 🚉 | station | 🚁 | helicopter | 🛩 | small_airplane
| ✈️ | airplane | 🛫 | flight_departure | 🛬 | flight_arrival
| 🚀 | rocket | 🛰 | artificial_satellite| 💺 | seat
| 🛶 | canoe | ⛵️ | boat | 🛥 | motor_boat
| 🚤 | speedboat | 🛳 | passenger_ship | ⛴ | ferry
| 🚢 | ship | ⚓️ | anchor | 🚧 | construction
| ⛽️ | fuelpump | 🚏 | busstop | 🚦 | vertical_traffic_light
| 🚥 | traffic_light | 🗺 | world_map | 🗿 | moyai
| 🗽 | statue_of_liberty | ⛲️ | fountain | 🗼 | tokyo_tower
| 🏰 | european_castle | 🏯 | japanese_castle | 🏟 | stadium
| 🎡 | ferris_wheel | 🎢 | roller_coaster | 🎠 | carousel_horse
| ⛱ | parasol_on_ground | 🏖 | beach_umbrella | 🏝 | desert_island
| ⛰ | mountain | 🏔 | mountain_snow | 🗻 | mount_fuji
| 🌋 | volcano | 🏜 | desert | 🏕 | camping
| ⛺️ | tent | 🛤 | railway_track | 🛣 | motorway
| 🏗 | building_construction| 🏭 | factory | 🏠 | house
| 🏡 | house_with_garden | 🏘 | houses | 🏚 | derelict_house
| 🏢 | office | 🏬 | department_store | 🏣 | post_office
| 🏤 | european_post_office | 🏥 | hospital | 🏦 | bank
| 🏨 | hotel | 🏪 | convenience_store | 🏫 | school
| 🏩 | love_hotel | 💒 | wedding | 🏛 | classical_building
| ⛪️ | church | 🕌 | mosque | 🕍 | synagogue
| 🕋 | kaaba | ⛩ | shinto_shrine | 🗾 | japan
| 🎑 | rice_scene | 🏞 | national_park | 🌅 | sunrise
| 🌄 | sunrise_over_mountain| 🌠 | stars | 🎇 | sparkler
| 🎆 | fireworks | 🌇 | city_sunrise | 🌆 | city_sunset
| 🏙 | cityscape | 🌃 | night_with_stars | 🌌 | milky_way
| 🌉 | bridge_at_night | 🌁 | foggy
==============================================================================
4. Nature *vimwiki-emoji-nature*
| 🐶 | dog | 🐱 | cat | 🐭 | mouse
| 🐹 | hamster | 🐰 | rabbit | 🦊 | fox_face
| 🐻 | bear | 🐼 | panda_face | 🐨 | koala
| 🐯 | tiger | 🦁 | lion | 🐮 | cow
| 🐷 | pig | 🐽 | pig_nose | 🐸 | frog
| 🐵 | monkey_face | 🙈 | see_no_evil | 🙉 | hear_no_evil
| 🙊 | speak_no_evil | 🐒 | monkey | 🐔 | chicken
| 🐧 | penguin | 🐦 | bird | 🐤 | baby_chick
| 🐣 | hatching_chick | 🐥 | hatched_chick | 🦆 | duck
| 🦅 | eagle | 🦉 | owl | 🦇 | bat
| 🐺 | wolf | 🐗 | boar | 🐴 | horse
| 🦄 | unicorn | 🐝 | bee | 🐛 | bug
| 🦋 | butterfly | 🐌 | snail | 🐚 | shell
| 🐞 | beetle | 🐜 | ant | 🕷 | spider
| 🕸 | spider_web | 🐢 | turtle | 🐍 | snake
| 🦎 | lizard | 🦂 | scorpion | 🦀 | crab
| 🦑 | squid | 🐙 | octopus | 🦐 | shrimp
| 🐠 | tropical_fish | 🐟 | fish | 🐡 | blowfish
| 🐬 | dolphin | 🦈 | shark | 🐳 | whale
| 🐋 | whale2 | 🐊 | crocodile | 🐆 | leopard
| 🐅 | tiger2 | 🐃 | water_buffalo | 🐂 | ox
| 🐄 | cow2 | 🦌 | deer | 🐪 | dromedary_camel
| 🐫 | camel | 🐘 | elephant | 🦏 | rhinoceros
| 🦍 | gorilla | 🐎 | racehorse | 🐖 | pig2
| 🐐 | goat | 🐏 | ram | 🐑 | sheep
| 🐕 | dog2 | 🐩 | poodle | 🐈 | cat2
| 🐓 | rooster | 🦃 | turkey | 🕊 | dove
| 🐇 | rabbit2 | 🐁 | mouse2 | 🐀 | rat
| 🐿 | chipmunk | 🐾 | feet | 🐉 | dragon
| 🐲 | dragon_face | 🌵 | cactus | 🎄 | christmas_tree
| 🌲 | evergreen_tree | 🌳 | deciduous_tree | 🌴 | palm_tree
| 🌱 | seedling | 🌿 | herb | ☘️ | shamrock
| 🍀 | four_leaf_clover | 🎍 | bamboo | 🎋 | tanabata_tree
| 🍃 | leaves | 🍂 | fallen_leaf | 🍁 | maple_leaf
| 🍄 | mushroom | 🌾 | ear_of_rice | 💐 | bouquet
| 🌷 | tulip | 🌹 | rose | 🥀 | wilted_flower
| 🌻 | sunflower | 🌼 | blossom | 🌸 | cherry_blossom
| 🌺 | hibiscus | 🌎 | earth_americas | 🌍 | earth_africa
| 🌏 | earth_asia | 🌕 | full_moon | 🌖 | waning_gibbous_moon
| 🌗 | last_quarter_moon | 🌘 | waning_crescent_moon| 🌑 | new_moon
| 🌒 | waxing_crescent_moon | 🌓 | first_quarter_moon | 🌔 | moon
| 🌚 | new_moon_with_face | 🌝 | full_moon_with_face | 🌞 | sun_with_face
| 🌛 | first_quarter_moon_with_face | 🌜 | last_quarter_moon_with_face
| 🌙 | crescent_moon | 💫 | dizzy | ⭐️ | star
| 🌟 | star2 | ✨ | sparkles | ⚡️ | zap
| 🔥 | fire | 💥 | boom | ☄️ | comet
| ☀️ | sunny | 🌤 | sun_behind_small_cloud
| ⛅️ | partly_sunny | 🌥 | sun_behind_large_cloud
| 🌦 | sun_behind_rain_cloud | 🌈 | rainbow
| ☁️ | cloud | 🌧 | cloud_with_rain
| ⛈ | cloud_with_lightning_and_rain | 🌩 | cloud_with_lightning
| 🌨 | cloud_with_snow | ☃️ | snowman_with_snow | ⛄️ | snowman
| ❄️ | snowflake | 🌬 | wind_face | 💨 | dash
| 🌪 | tornado | 🌫 | fog | 🌊 | ocean
| 💧 | droplet | 💦 | sweat_drops | ☔️ | umbrella
==============================================================================
5. Objects *vimwiki-emoji-objects*
| ⌚️ | watch | 📱 | iphone | 📲 | calling
| 💻 | computer | ⌨️ | keyboard | 🖥 | desktop_computer
| 🖨 | printer | 🖱 | computer_mouse | 🖲 | trackball
| 🕹 | joystick | 🗜 | clamp | 💽 | minidisc
| 💾 | floppy_disk | 💿 | cd | 📀 | dvd
| 📼 | vhs | 📷 | camera | 📸 | camera_flash
| 📹 | video_camera | 🎥 | movie_camera | 📽 | film_projector
| 🎞 | film_strip | 📞 | telephone_receiver | ☎️ | phone
| 📟 | pager | 📠 | fax | 📺 | tv
| 📻 | radio | 🎙 | studio_microphone | 🎚 | level_slider
| 🎛 | control_knobs | ⏱ | stopwatch | ⏲ | timer_clock
| ⏰ | alarm_clock | 🕰 | mantelpiece_clock | ⌛️ | hourglass
| ⏳ | hourglass_flowing_sand | 📡 | satellite
| 🔋 | battery | 🔌 | electric_plug | 💡 | bulb
| 🔦 | flashlight | 🕯 | candle | 🗑 | wastebasket
| 🛢 | oil_drum | 💸 | money_with_wings | 💵 | dollar
| 💴 | yen | 💶 | euro | 💷 | pound
| 💰 | moneybag | 💳 | credit_card | 💎 | gem
| ⚖️ | balance_scale | 🔧 | wrench | 🔨 | hammer
| ⚒ | hammer_and_pick | 🛠 | hammer_and_wrench | ⛏ | pick
| 🔩 | nut_and_bolt | ⚙️ | gear | ⛓ | chains
| 🔫 | gun | 💣 | bomb | 🔪 | hocho
| 🗡 | dagger | ⚔️ | crossed_swords | 🛡 | shield
| 🚬 | smoking | ⚰️ | coffin | ⚱️ | funeral_urn
| 🏺 | amphora | 🔮 | crystal_ball | 📿 | prayer_beads
| 💈 | barber | ⚗️ | alembic | 🔭 | telescope
| 🔬 | microscope | 🕳 | hole | 💊 | pill
| 💉 | syringe | 🌡 | thermometer | 🚽 | toilet
| 🚰 | potable_water | 🚿 | shower | 🛁 | bathtub
| 🛀 | bath | 🛎 | bellhop_bell | 🔑 | key
| 🗝 | old_key | 🚪 | door | 🛋 | couch_and_lamp
| 🛏 | bed | 🛌 | sleeping_bed | 🖼 | framed_picture
| 🛍 | shopping | 🛒 | shopping_cart | 🎁 | gift
| 🎈 | balloon | 🎏 | flags | 🎀 | ribbon
| 🎊 | confetti_ball | 🎉 | tada | 🎎 | dolls
| 🏮 | izakaya_lantern | 🎐 | wind_chime | ✉️ | email
| 📩 | envelope_with_arrow | 📨 | incoming_envelope | 📧 | e-mail
| 💌 | love_letter | 📥 | inbox_tray | 📤 | outbox_tray
| 📦 | package | 🏷 | label | 📪 | mailbox_closed
| 📫 | mailbox | 📬 | mailbox_with_mail | 📭 | mailbox_with_no_mail
| 📮 | postbox | 📯 | postal_horn | 📜 | scroll
| 📃 | page_with_curl | 📄 | page_facing_up | 📑 | bookmark_tabs
| 📊 | bar_chart | 📈 | chart_with_upwards_trend
| 📉 | chart_with_downwards_trend | 🗒 | spiral_notepad
| 🗓 | spiral_calendar | 📆 | calendar | 📅 | date
| 📇 | card_index | 🗃 | card_file_box | 🗳 | ballot_box
| 🗄 | file_cabinet | 📋 | clipboard | 📁 | file_folder
| 📂 | open_file_folder | 🗂 | card_index_dividers | 🗞 | newspaper_roll
| 📰 | newspaper | 📓 | notebook | 📔 | notebook_with_decorative_cover
| 📒 | ledger | 📕 | closed_book | 📗 | green_book
| 📘 | blue_book | 📙 | orange_book | 📚 | books
| 📖 | book | 🔖 | bookmark | 🔗 | link
| 📎 | paperclip | 🖇 | paperclips | 📐 | triangular_ruler
| 📏 | straight_ruler | 📌 | pushpin | 📍 | round_pushpin
| ✂️ | scissors | 🖊 | pen | 🖋 | fountain_pen
| ✒️ | black_nib | 🖌 | paintbrush | 🖍 | crayon
| 📝 | memo | ✏️ | pencil2 | 🔍 | mag
| 🔎 | mag_right | 🔏 | lock_with_ink_pen | 🔐 | closed_lock_with_key
| 🔒 | lock | 🔓 | unlock
==============================================================================
6. Foods *vimwiki-emoji-foods*
| 🍏 | green_apple | 🍎 | apple | 🍐 | pear
| 🍊 | tangerine | 🍋 | lemon | 🍌 | banana
| 🍉 | watermelon | 🍇 | grapes | 🍓 | strawberry
| 🍈 | melon | 🍒 | cherries | 🍑 | peach
| 🍍 | pineapple | 🥝 | kiwi_fruit | 🥑 | avocado
| 🍅 | tomato | 🍆 | eggplant | 🥒 | cucumber
| 🥕 | carrot | 🌽 | corn | 🌶 | hot_pepper
| 🥔 | potato | 🍠 | sweet_potato | 🌰 | chestnut
| 🥜 | peanuts | 🍯 | honey_pot | 🥐 | croissant
| 🍞 | bread | 🥖 | baguette_bread | 🧀 | cheese
| 🥚 | egg | 🍳 | fried_egg | 🥓 | bacon
| 🥞 | pancakes | 🍤 | fried_shrimp | 🍗 | poultry_leg
| 🍖 | meat_on_bone | 🍕 | pizza | 🌭 | hotdog
| 🍔 | hamburger | 🍟 | fries | 🥙 | stuffed_flatbread
| 🌮 | taco | 🌯 | burrito | 🥗 | green_salad
| 🥘 | shallow_pan_of_food | 🍝 | spaghetti | 🍜 | ramen
| 🍲 | stew | 🍥 | fish_cake | 🍣 | sushi
| 🍱 | bento | 🍛 | curry | 🍚 | rice
| 🍙 | rice_ball | 🍘 | rice_cracker | 🍢 | oden
| 🍡 | dango | 🍧 | shaved_ice | 🍨 | ice_cream
| 🍦 | icecream | 🍰 | cake | 🎂 | birthday
| 🍮 | custard | 🍭 | lollipop | 🍬 | candy
| 🍫 | chocolate_bar | 🍿 | popcorn | 🍩 | doughnut
| 🍪 | cookie | 🥛 | milk_glass | 🍼 | baby_bottle
| ☕️ | coffee | 🍵 | tea | 🍶 | sake
| 🍺 | beer | 🍻 | beers | 🥂 | clinking_glasses
| 🍷 | wine_glass | 🥃 | tumbler_glass | 🍸 | cocktail
| 🍹 | tropical_drink | 🍾 | champagne | 🥄 | spoon
| 🍴 | fork_and_knife | 🍽 | plate_with_cutlery
==============================================================================
7. Symbols *vimwiki-emoji-symbols*
| ❤️ | heart | 💛 | yellow_heart | 💚 | green_heart
| 💙 | blue_heart | 💜 | purple_heart | 🖤 | black_heart
| 💔 | broken_heart | ❣️ | heavy_heart_exclamation
| 💕 | two_hearts | 💞 | revolving_hearts | 💓 | heartbeat
| 💗 | heartpulse | 💖 | sparkling_heart | 💘 | cupid
| 💝 | gift_heart | 💟 | heart_decoration | ☮️ | peace_symbol
| ✝️ | latin_cross | ☪️ | star_and_crescent | 🕉 | om
| ☸️ | wheel_of_dharma | ✡️ | star_of_david | 🔯 | six_pointed_star
| 🕎 | menorah | ☯️ | yin_yang | ☦️ | orthodox_cross
| 🛐 | place_of_worship | ⛎ | ophiuchus | ♈️ | aries
| ♉️ | taurus | ♊️ | gemini | ♋️ | cancer
| ♌️ | leo | ♍️ | virgo | ♎️ | libra
| ♏️ | scorpius | ♐️ | sagittarius | ♑️ | capricorn
| ♒️ | aquarius | ♓️ | pisces | 🆔 | id
| ⚛️ | atom_symbol | 🉑 | accept | ☢️ | radioactive
| ☣️ | biohazard | 📴 | mobile_phone_off | 📳 | vibration_mode
| 🈶 | u6709 | 🈚️ | u7121 | 🈸 | u7533
| 🈺 | u55b6 | 🈷️ | u6708 | ✴️ | eight_pointed_black_star
| 🆚 | vs | 💮 | white_flower | 🉐 | ideograph_advantage
| ㊙️ | secret | ㊗️ | congratulations | 🈴 | u5408
| 🈵 | u6e80 | 🈹 | u5272 | 🈲 | u7981
| 🅰️ | a | 🅱️ | b | 🆎 | ab
| 🆑 | cl | 🅾️ | o2 | 🆘 | sos
| ❌ | x | ⭕️ | o | 🛑 | stop_sign
| ⛔️ | no_entry | 📛 | name_badge | 🚫 | no_entry_sign
| 💯 | 100 | 💢 | anger | ♨️ | hotsprings
| 🚷 | no_pedestrians | 🚯 | do_not_litter | 🚳 | no_bicycles
| 🚱 | non-potable_water | 🔞 | underage | 📵 | no_mobile_phones
| 🚭 | no_smoking | ❗️ | exclamation | ❕ | grey_exclamation
| ❓ | question | ❔ | grey_question | ‼️ | bangbang
| ⁉️ | interrobang | 🔅 | low_brightness | 🔆 | high_brightness
| 〽️ | part_alternation_mark | ⚠️ | warning
| 🚸 | children_crossing | 🔱 | trident | ⚜️ | fleur_de_lis
| 🔰 | beginner | ♻️ | recycle | ✅ | white_check_mark
| 🈯️ | u6307 | 💹 | chart | ❇️ | sparkle
| ✳️ | eight_spoked_asterisk | ❎ | negative_squared_cross_mark
| 🌐 | globe_with_meridians | 💠 | diamond_shape_with_a_dot_inside
| Ⓜ️ | m | 🌀 | cyclone | 💤 | zzz
| 🏧 | atm | 🚾 | wc | ♿️ | wheelchair
| 🅿️ | parking | 🈳 | u7a7a | 🈂️ | sa
| 🛂 | passport_control | 🛃 | customs | 🛄 | baggage_claim
| 🛅 | left_luggage | 🚹 | mens | 🚺 | womens
| 🚼 | baby_symbol | 🚻 | restroom | 🚮 | put_litter_in_its_place
| 🎦 | cinema | 📶 | signal_strength | 🈁 | koko
| 🔣 | symbols | ️ | information_source | 🔤 | abc
| 🔡 | abcd | 🔠 | capital_abcd | 🆖 | ng
| 🆗 | ok | 🆙 | up | 🆒 | cool
| 🆕 | new | 🆓 | free |0️⃣ | zero
| 1️⃣ | one | 2️⃣ | two |3️⃣ | three
| 4️⃣ | four |5️⃣ | five |6️⃣ | six
| 7️⃣ | seven |8️⃣ | eight |9️⃣ | nine
| 🔟 | keycap_ten | 🔢 | 1234 |#️⃣ | hash
| *️⃣ | asterisk | ▶️ | arrow_forward | ⏸ | pause_button
| ⏯ | play_or_pause_button | ⏹ | stop_button
| ⏺ | record_button | ⏭ | next_track_button | ⏮ | previous_track_button
| ⏩ | fast_forward | ⏪ | rewind | ⏫ | arrow_double_up
| ⏬ | arrow_double_down | ◀️ | arrow_backward | 🔼 | arrow_up_small
| 🔽 | arrow_down_small | ➡️ | arrow_right | ⬅️ | arrow_left
| ⬆️ | arrow_up | ⬇️ | arrow_down | ↗️ | arrow_upper_right
| ↘️ | arrow_lower_right | ↙️ | arrow_lower_left | ↖️ | arrow_upper_left
| ↕️ | arrow_up_down | ↔️ | left_right_arrow | ↪️ | arrow_right_hook
| ↩️ | leftwards_arrow_with_hook | ⤴️ | arrow_heading_up
| ⤵️ | arrow_heading_down | 🔀 | twisted_rightwards_arrows
| 🔁 | repeat | 🔂 | repeat_one
| 🔄 | arrows_counterclockwise | 🔃 | arrows_clockwise
| 🎵 | musical_note | 🎶 | notes | | heavy_plus_sign
| | heavy_minus_sign | ➗ | heavy_division_sign | ✖️ | heavy_multiplication_x
| 💲 | heavy_dollar_sign | 💱 | currency_exchange | ™️ | tm
| ©️ | copyright | ®️ | registered | 〰️ | wavy_dash
| ➰ | curly_loop | ➿ | loop | 🔚 | end
| 🔙 | back | 🔛 | on | 🔝 | top
| 🔜 | soon | ✔️ | heavy_check_mark | ☑️ | ballot_box_with_check
| 🔘 | radio_button | ⚪️ | white_circle | ⚫️ | black_circle
| 🔴 | red_circle | 🔵 | large_blue_circle | 🔺 | small_red_triangle
| 🔻 | small_red_triangle_down | 🔸 | small_orange_diamond
| 🔹 | small_blue_diamond | 🔶 | large_orange_diamond| 🔷 | large_blue_diamond
| 🔳 | white_square_button | 🔲 | black_square_button | ▪️ | black_small_square
| ▫️ | white_small_square | ◾️ | black_medium_small_square
| ◽️ | white_medium_small_square | ◼️ | black_medium_square
| ◻️ | white_medium_square | ⬛️ | black_large_square | ⬜️ | white_large_square
| 🔈 | speaker | 🔇 | mute | 🔉 | sound
| 🔊 | loud_sound | 🔔 | bell | 🔕 | no_bell
| 📣 | mega | 📢 | loudspeaker | 👁‍🗨 | eye_speech_bubble
| 💬 | speech_balloon | 💭 | thought_balloon | 🗯 | right_anger_bubble
| ♠️ | spades | ♣️ | clubs | ♥️ | hearts
| ♦️ | diamonds | 🃏 | black_joker | 🎴 | flower_playing_cards
| 🀄️ | mahjong | 🕐 | clock1 | 🕑 | clock2
| 🕒 | clock3 | 🕓 | clock4 | 🕔 | clock5
| 🕕 | clock6 | 🕖 | clock7 | 🕗 | clock8
| 🕘 | clock9 | 🕙 | clock10 | 🕚 | clock11
| 🕛 | clock12 | 🕜 | clock130 | 🕝 | clock230
| 🕞 | clock330 | 🕟 | clock430 | 🕠 | clock530
| 🕡 | clock630 | 🕢 | clock730 | 🕣 | clock830
| 🕤 | clock930 | 🕥 | clock1030 | 🕦 | clock1130
| 🕧 | clock1230
8. Flags *vimwiki-emoji-flags*
==============================================================================
| 🏳️ | white_flag | 🏴 | black_flag | 🏁 | checkered_flag
| 🚩 | triangular_flag_on_post | 🏳️‍🌈 | rainbow_flag
| 🇦🇫 | afghanistan | 🇦🇽 | aland_islands | 🇦🇱 | albania
| 🇩🇿 | algeria | 🇦🇸 | american_samoa | 🇦🇩 | andorra
| 🇦🇴 | angola | 🇦🇮 | anguilla | 🇦🇶 | antarctica
| 🇦🇬 | antigua_barbuda | 🇦🇷 | argentina | 🇦🇲 | armenia
| 🇦🇼 | aruba | 🇦🇺 | australia | 🇦🇹 | austria
| 🇦🇿 | azerbaijan | 🇧🇸 | bahamas | 🇧🇭 | bahrain
| 🇧🇩 | bangladesh | 🇧🇧 | barbados | 🇧🇾 | belarus
| 🇧🇪 | belgium | 🇧🇿 | belize | 🇧🇯 | benin
| 🇧🇲 | bermuda | 🇧🇹 | bhutan | 🇧🇴 | bolivia
| 🇧🇶 | caribbean_netherlands | 🇧🇦 | bosnia_herzegovina
| 🇧🇼 | botswana | 🇧🇷 | brazil | 🇮🇴 | british_indian_ocean_territory
| 🇻🇬 | british_virgin_islands | 🇧🇳 | brunei
| 🇧🇬 | bulgaria | 🇧🇫 | burkina_faso | 🇧🇮 | burundi
| 🇨🇻 | cape_verde | 🇰🇭 | cambodia | 🇨🇲 | cameroon
| 🇨🇦 | canada | 🇮🇨 | canary_islands | 🇰🇾 | cayman_islands
| 🇨🇫 | central_african_republic | 🇹🇩 | chad
| 🇨🇱 | chile | 🇨🇳 | cn | 🇨🇽 | christmas_island
| 🇨🇨 | cocos_islands | 🇨🇴 | colombia | 🇰🇲 | comoros
| 🇨🇬 | congo_brazzaville | 🇨🇩 | congo_kinshasa | 🇨🇰 | cook_islands
| 🇨🇷 | costa_rica | 🇨🇮 | cote_divoire | 🇭🇷 | croatia
| 🇨🇺 | cuba | 🇨🇼 | curacao | 🇨🇾 | cyprus
| 🇨🇿 | czech_republic | 🇩🇰 | denmark | 🇩🇯 | djibouti
| 🇩🇲 | dominica | 🇩🇴 | dominican_republic| 🇪🇨 | ecuador
| 🇪🇬 | egypt | 🇸🇻 | el_salvador | 🇬🇶 | equatorial_guinea
| 🇪🇷 | eritrea | 🇪🇪 | estonia | 🇪🇹 | ethiopia
| 🇪🇺 | eu | 🇫🇰 | falkland_islands | 🇫🇴 | faroe_islands
| 🇫🇯 | fiji | 🇫🇮 | finland | 🇫🇷 | fr
| 🇬🇫 | french_guiana | 🇵🇫 | french_polynesia | 🇹🇫 | french_southern_territories
| 🇬🇦 | gabon | 🇬🇲 | gambia | 🇬🇪 | georgia
| 🇩🇪 | de | 🇬🇭 | ghana | 🇬🇮 | gibraltar
| 🇬🇷 | greece | 🇬🇱 | greenland | 🇬🇩 | grenada
| 🇬🇵 | guadeloupe | 🇬🇺 | guam | 🇬🇹 | guatemala
| 🇬🇬 | guernsey | 🇬🇳 | guinea | 🇬🇼 | guinea_bissau
| 🇬🇾 | guyana | 🇭🇹 | haiti | 🇭🇳 | honduras
| 🇭🇰 | hong_kong | 🇭🇺 | hungary | 🇮🇸 | iceland
| 🇮🇳 | india | 🇮🇩 | indonesia | 🇮🇷 | iran
| 🇮🇶 | iraq | 🇮🇪 | ireland | 🇮🇲 | isle_of_man
| 🇮🇱 | israel | 🇮🇹 | it | 🇯🇲 | jamaica
| 🇯🇵 | jp | 🎌 | crossed_flags | 🇯🇪 | jersey
| 🇯🇴 | jordan | 🇰🇿 | kazakhstan | 🇰🇪 | kenya
| 🇰🇮 | kiribati | 🇽🇰 | kosovo | 🇰🇼 | kuwait
| 🇰🇬 | kyrgyzstan | 🇱🇦 | laos | 🇱🇻 | latvia
| 🇱🇧 | lebanon | 🇱🇸 | lesotho | 🇱🇷 | liberia
| 🇱🇾 | libya | 🇱🇮 | liechtenstein | 🇱🇹 | lithuania
| 🇱🇺 | luxembourg | 🇲🇴 | macau | 🇲🇰 | macedonia
| 🇲🇬 | madagascar | 🇲🇼 | malawi | 🇲🇾 | malaysia
| 🇲🇻 | maldives | 🇲🇱 | mali | 🇲🇹 | malta
| 🇲🇭 | marshall_islands | 🇲🇶 | martinique | 🇲🇷 | mauritania
| 🇲🇺 | mauritius | 🇾🇹 | mayotte | 🇲🇽 | mexico
| 🇫🇲 | micronesia | 🇲🇩 | moldova | 🇲🇨 | monaco
| 🇲🇳 | mongolia | 🇲🇪 | montenegro | 🇲🇸 | montserrat
| 🇲🇦 | morocco | 🇲🇿 | mozambique | 🇲🇲 | myanmar
| 🇳🇦 | namibia | 🇳🇷 | nauru | 🇳🇵 | nepal
| 🇳🇱 | netherlands | 🇳🇨 | new_caledonia | 🇳🇿 | new_zealand
| 🇳🇮 | nicaragua | 🇳🇪 | niger | 🇳🇬 | nigeria
| 🇳🇺 | niue | 🇳🇫 | norfolk_island | 🇲🇵 | northern_mariana_islands
| 🇰🇵 | north_korea | 🇳🇴 | norway | 🇴🇲 | oman
| 🇵🇰 | pakistan | 🇵🇼 | palau | 🇵🇸 | palestinian_territories
| 🇵🇦 | panama | 🇵🇬 | papua_new_guinea | 🇵🇾 | paraguay
| 🇵🇪 | peru | 🇵🇭 | philippines | 🇵🇳 | pitcairn_islands
| 🇵🇱 | poland | 🇵🇹 | portugal | 🇵🇷 | puerto_rico
| 🇶🇦 | qatar | 🇷🇪 | reunion | 🇷🇴 | romania
| 🇷🇺 | ru | 🇷🇼 | rwanda | 🇧🇱 | st_barthelemy
| 🇸🇭 | st_helena | 🇰🇳 | st_kitts_nevis | 🇱🇨 | st_lucia
| 🇵🇲 | st_pierre_miquelon | 🇻🇨 | st_vincent_grenadines
| 🇼🇸 | samoa | 🇸🇲 | san_marino | 🇸🇹 | sao_tome_principe
| 🇸🇦 | saudi_arabia | 🇸🇳 | senegal | 🇷🇸 | serbia
| 🇸🇨 | seychelles | 🇸🇱 | sierra_leone | 🇸🇬 | singapore
| 🇸🇽 | sint_maarten | 🇸🇰 | slovakia | 🇸🇮 | slovenia
| 🇸🇧 | solomon_islands | 🇸🇴 | somalia | 🇿🇦 | south_africa
| 🇬🇸 | south_georgia_south_sandwich_islands| 🇰🇷 | kr
| 🇸🇸 | south_sudan | 🇪🇸 | es | 🇱🇰 | sri_lanka
| 🇸🇩 | sudan | 🇸🇷 | suriname | 🇸🇿 | swaziland
| 🇸🇪 | sweden | 🇨🇭 | switzerland | 🇸🇾 | syria
| 🇹🇼 | taiwan | 🇹🇯 | tajikistan | 🇹🇿 | tanzania
| 🇹🇭 | thailand | 🇹🇱 | timor_leste | 🇹🇬 | togo
| 🇹🇰 | tokelau | 🇹🇴 | tonga | 🇹🇹 | trinidad_tobago
| 🇹🇳 | tunisia | 🇹🇷 | tr | 🇹🇲 | turkmenistan
| 🇹🇨 | turks_caicos_islands| 🇹🇻 | tuvalu | 🇺🇬 | uganda
| 🇺🇦 | ukraine | 🇦🇪 | united_arab_emirate| 🇬🇧 | gb
| 🇺🇸 | us | 🇻🇮 | us_virgin_islands | 🇺🇾 | uruguay
| 🇺🇿 | uzbekistan | 🇻🇺 | vanuatu | 🇻🇦 | vatican_city
| 🇻🇪 | venezuela | 🇻🇳 | vietnam | 🇼🇫 | wallis_futuna
| 🇪🇭 | western_sahara | 🇾🇪 | yemen | 🇿🇲 | zambia
| 🇿🇼 | zimbabwe
+816 -127
View File
File diff suppressed because it is too large Load Diff
+161 -70
View File
@@ -2,15 +2,13 @@
" Vimwiki filetype plugin file
" Home: https://github.com/vimwiki/vimwiki/
" Clause: load only once per buffer
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
setlocal commentstring=%%%s
if vimwiki#vars#get_global('conceallevel') && exists('+conceallevel')
let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
endif
@@ -22,28 +20,40 @@ setlocal isfname-=[,]
exe 'setlocal tags+=' . escape(vimwiki#tags#metadata_file_path(), ' \|"')
" Helper: for omnicompletion
function! Complete_wikifiles(findstart, base) abort
" s:line_context = link | tag | ''
if a:findstart == 1
" Find line context
" Called: first time
let column = col('.')-2
let line = getline('.')[:column]
" Check Link:
" -- WikiLink
let startoflink = match(line, '\[\[\zs[^\\[\]]*$')
if startoflink != -1
let s:line_context = '['
let s:line_context = 'link'
return startoflink
endif
" -- WebLink
if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
let startofinlinelink = match(line, '\[.*\](\zs[^)]*$')
if startofinlinelink != -1
let s:line_context = '['
let s:line_context = 'link'
return startofinlinelink
endif
endif
let startoftag = match(line, ':\zs[^:[:space:]]*$')
" Check Tag:
let tf = vimwiki#vars#get_syntaxlocal('tag_format')
let startoftag = match(line, tf.pre_mark . '\zs' . tf.in . '*$')
if startoftag != -1
let s:line_context = ':'
let s:line_context = 'tag'
return startoftag
endif
" Nothing can do ...
let s:line_context = ''
return -1
else
@@ -52,8 +62,8 @@ function! Complete_wikifiles(findstart, base) abort
" solution, because calling col('.') here returns garbage.
if s:line_context ==? ''
return []
elseif s:line_context ==# ':'
" Tags completion
elseif s:line_context ==# 'tag'
" Look Tags: completion
let tags = vimwiki#tags#get_tags()
if a:base !=? ''
call filter(tags,
@@ -61,8 +71,7 @@ function! Complete_wikifiles(findstart, base) abort
endif
return tags
elseif a:base !~# '#'
" we look for wiki files
" Look Wiki: files
if a:base =~# '\m^wiki\d\+:'
let wikinumber = eval(matchstr(a:base, '\m^wiki\zs\d\+'))
if wikinumber >= vimwiki#vars#number_of_wikis()
@@ -90,7 +99,7 @@ function! Complete_wikifiles(findstart, base) abort
return result
else
" we look for anchors in the given wikifile
" Look Anchor: in the given wikifile
let segments = split(a:base, '#', 1)
let given_wikifile = segments[0] ==? '' ? expand('%:t:r') : segments[0]
@@ -112,51 +121,98 @@ function! Complete_wikifiles(findstart, base) abort
endif
endfunction
" Set Completion:
setlocal omnifunc=Complete_wikifiles
if and(vimwiki#vars#get_global('emoji_enable'), 2) != 0
\ && &completefunc ==# ''
set completefunc=vimwiki#emoji#complete
endif
" settings necessary for the automatic formatting of lists
" Declare Settings: necessary for the automatic formatting of lists
" ------------------------------------------------
setlocal autoindent
setlocal nosmartindent
setlocal nocindent
setlocal comments=""
setlocal formatoptions-=c
" Set Comments: to insert and format 'comments' or cheat
" Used to break blockquote prepending one on each new line (see: #915)
" B like blank character follow
" blockquotes
let comments = 'b:>'
for bullet in vimwiki#vars#get_syntaxlocal('bullet_types')
" task list
for point in vimwiki#vars#get_wikilocal('listsyms_list')
\ + [vimwiki#vars#get_wikilocal('listsym_rejected')]
let comments .= ',fb:' . bullet . ' [' . point . ']'
endfor
" list
let comments .= ',fb:' . bullet
endfor
" Add :: for vimwiki default syntax (#1279)
if 'default' ==# vimwiki#vars#get_wikilocal('syntax')
let comments .= ',b:::'
endif
let &l:comments = comments
" Set Format Options: (:h fo-table)
" Disable autocomment because, vimwiki does it better
setlocal formatoptions-=r
setlocal formatoptions-=o
setlocal formatoptions-=2
" Autowrap with leading comment
setlocal formatoptions+=c
" Do not wrap if line was already long
setlocal formatoptions+=l
" AutoWrap intelligent with lists
setlocal formatoptions+=n
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')
" Used to join 'commented' lines (blockquote, list) (see: #915)
if v:version > 703
setlocal formatoptions+=j
endif
let &formatlistpat = vimwiki#vars#get_syntaxlocal('rxListItem')
" Set commentstring %%%s
let &l:commentstring = vimwiki#vars#get_wikilocal('commentstring')
" ------------------------------------------------
" Folding stuff
" ------------------------------------------------
" Get fold level for a list
function! VimwikiFoldListLevel(lnum) abort
return vimwiki#lst#fold_level(a:lnum)
endfunction
" Get fold level for 1. line number
function! VimwikiFoldLevel(lnum) abort
let line = getline(a:lnum)
" Header/section folding...
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader') && !vimwiki#u#is_codeblock(a:lnum)
return '>'.vimwiki#u#count_first_sym(line)
" Code block folding...
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
return 'a1'
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
return 's1'
else
return '='
endif
" Code block folding...
" -- previously it would always increment when it saw a ```, so we never left the code block. (See #1323)
let prevline = getline(v:lnum - 1)
let nextline = getline(v:lnum + 1)
" -- Start: assumes empty line before
if line =~# vimwiki#vars#get_syntaxlocal('rxPreStart') && prevline =~# '^\s*$'
return 'a1'
" -- End: assumes empty line after
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd') && nextline =~# '^\s*$'
return 's1'
endif
return '='
endfunction
" Constants used by VimwikiFoldText
" Declare Constants: used by VimwikiFoldText
" use \u2026 and \u21b2 (or \u2424) if enc=utf-8 to save screen space
let s:ellipsis = (&encoding ==? 'utf-8') ? "\u2026" : '...'
let s:ell_len = strlen(s:ellipsis)
@@ -164,19 +220,21 @@ let s:newline = (&encoding ==? 'utf-8') ? "\u21b2 " : ' '
let s:tolerance = 5
" unused
" unused: too naive
function! s:shorten_text_simple(text, len) abort
let spare_len = a:len - len(a:text)
return (spare_len>=0) ? [a:text,spare_len] : [a:text[0:a:len].s:ellipsis, -1]
endfunction
" Shorten Text:
" Called: by VimwikiFoldText
" s:shorten_text(text, len) = [string, spare] with "spare" = len-strlen(string)
" for long enough "text", the string's length is within s:tolerance of "len"
" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
" Return: [string, spare]
function! s:shorten_text(text, len) abort
" returns [string, spare]
" strlen() returns lenght in bytes, not in characters, so we'll have to do a
" strlen() returns length in bytes, not in characters, so we'll have to do a
" trick here -- replace all non-spaces with dot, calculate lengths and
" indexes on it, then use original string to break at selected index.
let text_pattern = substitute(a:text, '\m\S', '.', 'g')
@@ -192,6 +250,7 @@ function! s:shorten_text(text, len) abort
endfunction
" Fold: text chapter
function! VimwikiFoldText() abort
let line = getline(v:foldstart)
let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
@@ -223,20 +282,24 @@ endfunction
command! -buffer Vimwiki2HTML
\ if filewritable(expand('%')) | silent noautocmd w | endif
\ <bar>
\ let res = vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')),
\ expand('%'))
\ let res = vimwiki#html#Wiki2HTML(
\ expand(vimwiki#vars#get_wikilocal('path_html')), expand('%'))
\ <bar>
\ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '
\ . expand(vimwiki#vars#get_wikilocal('path_html')) | endif
\ if res != '' | call vimwiki#u#echo('HTML conversion is done, output: '
\ . expand(vimwiki#vars#get_wikilocal('path_html'))) | endif
command! -buffer Vimwiki2HTMLBrowse
\ if filewritable(expand('%')) | silent noautocmd w | endif
\ <bar>
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
\ expand(vimwiki#vars#get_wikilocal('path_html')),
\ expand('%')))
command! -buffer -bang VimwikiAll2HTML
\ call vimwiki#html#WikiAll2HTML(expand(vimwiki#vars#get_wikilocal('path_html')), <bang>0)
command! -buffer VimwikiRss call vimwiki#html#diary_rss()
command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1)
command! -buffer VimwikiNextTask call vimwiki#base#find_next_task()
@@ -244,21 +307,25 @@ command! -buffer VimwikiNextLink call vimwiki#base#find_next_link()
command! -buffer VimwikiPrevLink call vimwiki#base#find_prev_link()
command! -buffer VimwikiDeleteFile call vimwiki#base#delete_link()
command! -buffer VimwikiDeleteLink
\ call vimwiki#base#deprecate("VimwikiDeleteLink", "VimwikiDeleteFile") |
\ call vimwiki#u#deprecate("VimwikiDeleteLink", "VimwikiDeleteFile") |
\ call vimwiki#base#delete_link()
command! -buffer VimwikiRenameFile call vimwiki#base#rename_link()
command! -buffer -nargs=? -complete=customlist,vimwiki#base#complete_file
\ VimwikiRenameFile call vimwiki#base#rename_file(<f-args>)
command! -buffer VimwikiRenameLink
\ call vimwiki#base#deprecate("VimwikiRenameLink", "VimwikiRenameFile") |
\ call vimwiki#base#rename_link()
\ call vimwiki#u#deprecate("VimwikiRenameLink", "VimwikiRenameFile") |
\ call vimwiki#base#rename_file()
command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit', 0, 1)
command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
command! -buffer -nargs=* VimwikiSplitLink call vimwiki#base#follow_link('hsplit', <f-args>)
command! -buffer -nargs=* VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', <f-args>)
command! -buffer VimwikiBaddLink call vimwiki#base#follow_link('badd', 0, 1)
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tab', 0, 1)
command! -buffer VimwikiTabDropLink call vimwiki#base#follow_link('tabdrop', 0, 1)
command! -buffer -nargs=? VimwikiGenerateLinks call vimwiki#base#generate_links(1, <f-args>)
command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
@@ -267,10 +334,10 @@ command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
command! -buffer -nargs=* VimwikiSearch call vimwiki#base#search(<q-args>)
command! -buffer -nargs=* VWS call vimwiki#base#search(<q-args>)
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_escaped
\ VimwikiGoto call vimwiki#base#goto(<f-args>)
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_raw
\ VimwikiGoto call vimwiki#base#goto(<q-args>)
command! -buffer VimwikiCheckLinks call vimwiki#base#check_links()
command! -buffer -range VimwikiCheckLinks call vimwiki#base#check_links(<range>, <line1>, <line2>)
" list commands
command! -buffer -nargs=+ VimwikiReturn call <SID>CR(<f-args>)
@@ -292,6 +359,7 @@ command! -buffer VimwikiRemoveCBInList call vimwiki#lst#remove_cb_in_list()
command! -buffer VimwikiRenumberList call vimwiki#lst#adjust_numbered_list()
command! -buffer VimwikiRenumberAllLists call vimwiki#lst#adjust_whole_buffer()
command! -buffer VimwikiListToggle call vimwiki#lst#toggle_list_item()
command! -buffer -range VimwikiRemoveDone call vimwiki#lst#remove_done(1, "<range>", <line1>, <line2>)
" table commands
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
@@ -307,17 +375,19 @@ command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
" tags commands
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
\ VimwikiSearchTags VimwikiSearch /:<args>:/
\ VimwikiSearchTags call vimwiki#tags#search_tags(<q-args>)
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
\ VimwikiGenerateTagLinks call vimwiki#tags#generate_tags(1, <f-args>)
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
\ VimwikiGenerateTags
\ call vimwiki#base#deprecate("VimwikiGenerateTags", "VimwikiGenerateTagLinks") |
\ call vimwiki#u#deprecate("VimwikiGenerateTags", "VimwikiGenerateTagLinks") |
\ call vimwiki#tags#generate_tags(1, <f-args>)
command! -buffer VimwikiPasteUrl call vimwiki#html#PasteUrl(expand('%:p'))
command! -buffer VimwikiPasteLink call vimwiki#path#PasteLink(expand('%:p'))
command! -buffer VimwikiCatUrl call vimwiki#html#CatUrl(expand('%:p'))
command! -buffer -nargs=* -range -complete=custom,vimwiki#base#complete_colorize
\ VimwikiColorize <line1>,<line2>call vimwiki#base#colorize(<f-args>)
" ------------------------------------------------
" Keybindings
@@ -331,6 +401,7 @@ if str2nr(vimwiki#vars#get_global('key_mappings').mouse)
\ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<lt>2-LeftMouse>")<CR>
nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
nnoremap <silent><buffer> <MiddleMouse> <LeftMouse>:VimwikiBaddLink<CR>
nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
endif
@@ -351,6 +422,8 @@ nnoremap <silent><script><buffer> <Plug>VimwikiSplitLink
\ :VimwikiSplitLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiVSplitLink
\ :VimwikiVSplitLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiBaddLink
\ :VimwikiBaddLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLink
\ :VimwikiNormalizeLink 0<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual
@@ -359,6 +432,8 @@ vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisualCR
\ :<C-U>VimwikiNormalizeLink 1<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiTabnewLink
\ :VimwikiTabnewLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiTabDropLink
\ :VimwikiTabDropLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiGoBackLink
\ :VimwikiGoBackLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiNextLink
@@ -375,28 +450,35 @@ nnoremap <silent><script><buffer> <Plug>VimwikiDiaryNextDay
\ :VimwikiDiaryNextDay<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiDiaryPrevDay
\ :VimwikiDiaryPrevDay<CR>
noremap <script><buffer> <Plug>VimwikiColorizeNormal
\ :call vimwiki#base#colorize(vimwiki#base#get_user_color(), '')<CR>
vnoremap <script><buffer> <Plug>VimwikiColorize
\ :call vimwiki#base#colorize(vimwiki#base#get_user_color(), visualmode())<CR>
" default links key mappings
" Declare Map: default links key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').links)
call vimwiki#u#map_key('n', '<CR>', '<Plug>VimwikiFollowLink')
call vimwiki#u#map_key('n', '<S-CR>', '<Plug>VimwikiSplitLink')
call vimwiki#u#map_key('n', '<C-CR>', '<Plug>VimwikiVSplitLink')
call vimwiki#u#map_key('n', '<M-CR>', '<Plug>VimwikiBaddLink')
call vimwiki#u#map_key('n', '+', '<Plug>VimwikiNormalizeLink')
call vimwiki#u#map_key('v', '+', '<Plug>VimwikiNormalizeLinkVisual')
call vimwiki#u#map_key('v', '<CR>', '<Plug>VimwikiNormalizeLinkVisualCR')
call vimwiki#u#map_key('n', '<D-CR>', '<Plug>VimwikiTabnewLink')
call vimwiki#u#map_key('n', '<C-S-CR>', '<Plug>VimwikiTabnewLink', 1)
call vimwiki#u#map_key('n', '<D-CR>', '<Plug>VimwikiTabDropLink')
call vimwiki#u#map_key('n', '<C-S-CR>', '<Plug>VimwikiTabDropLink', 1)
call vimwiki#u#map_key('n', '<BS>', '<Plug>VimwikiGoBackLink')
call vimwiki#u#map_key('n', '<TAB>', '<Plug>VimwikiNextLink')
call vimwiki#u#map_key('n', '<S-TAB>', '<Plug>VimwikiPrevLink')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'n', '<Plug>VimwikiGoto')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'d', '<Plug>VimwikiDeleteFile')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'r', '<Plug>VimwikiRenameFile')
call vimwiki#u#map_key('n', vimwiki#vars#get_global('map_prefix').'c', '<Plug>VimwikiColorizeNormal')
call vimwiki#u#map_key('v', vimwiki#vars#get_global('map_prefix').'c', '<Plug>VimwikiColorize')
call vimwiki#u#map_key('n', '<C-Down>', '<Plug>VimwikiDiaryNextDay')
call vimwiki#u#map_key('n', '<C-Up>', '<Plug>VimwikiDiaryPrevDay')
endif
" <Plug> lists definitions
" Map: <Plug> lists definitions
nnoremap <silent><script><buffer> <Plug>VimwikiNextTask
\ :VimwikiNextTask<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiToggleListItem
@@ -446,14 +528,16 @@ nnoremap <silent><buffer> <Plug>VimwikiListo
nnoremap <silent><buffer> <Plug>VimwikiListO
\ :<C-U>call vimwiki#u#count_exe('call vimwiki#lst#kbd_O()')<CR>
" default lists key mappings
" Declare Map: default lists key mappings (again)
if str2nr(vimwiki#vars#get_global('key_mappings').lists)
call vimwiki#u#map_key('n', 'gnt', '<Plug>VimwikiNextTask')
call vimwiki#u#map_key('n', '<C-Space>', '<Plug>VimwikiToggleListItem')
call vimwiki#u#map_key('v', '<C-Space>', '<Plug>VimwikiToggleListItem', 1)
if has('unix')
call vimwiki#u#map_key('n', '<C-@>', '<Plug>VimwikiToggleListItem', 1)
call vimwiki#u#map_key('v', '<C-@>', '<Plug>VimwikiToggleListItem', 1)
if !hasmapto('<Plug>VimwikiToggleListItem')
call vimwiki#u#map_key('n', '<C-Space>', '<Plug>VimwikiToggleListItem')
call vimwiki#u#map_key('v', '<C-Space>', '<Plug>VimwikiToggleListItem', 1)
if has('unix')
call vimwiki#u#map_key('n', '<C-@>', '<Plug>VimwikiToggleListItem', 1)
call vimwiki#u#map_key('v', '<C-@>', '<Plug>VimwikiToggleListItem', 1)
endif
endif
call vimwiki#u#map_key('n', 'glx', '<Plug>VimwikiToggleRejectedListItem')
call vimwiki#u#map_key('v', 'glx', '<Plug>VimwikiToggleRejectedListItem', 1)
@@ -480,17 +564,21 @@ if str2nr(vimwiki#vars#get_global('key_mappings').lists)
call vimwiki#u#map_key('n', 'o', '<Plug>VimwikiListo')
call vimwiki#u#map_key('n', 'O', '<Plug>VimwikiListO')
" handle case of existing VimwikiReturn mappings outside the <Plug> definition
if maparg('<CR>', 'i') !~# '.*VimwikiReturn*.'
if has('patch-7.3.489')
" expand iabbrev on enter
inoremap <silent><buffer> <CR> <C-]><Esc>:VimwikiReturn 1 5<CR>
else
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 5<CR>
" Set lists_return to 0, if you don't want <CR> mapped to VimwikiReturn
if str2nr(vimwiki#vars#get_global('key_mappings').lists_return)
" Handle case of existing VimwikiReturn mappings outside the <Plug> definition
" Note: Avoid interfering with popup/completion menu if it's active (#813)
if maparg('<CR>', 'i') !~# '.*VimwikiReturn*.'
if has('patch-7.3.489')
" expand iabbrev on enter
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<C-]><Esc>:VimwikiReturn 1 5<CR>'
else
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 1 5<CR>'
endif
endif
if maparg('<S-CR>', 'i') !~# '.*VimwikiReturn*.'
inoremap <expr><silent><buffer> <S-CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 2 2<CR>'
endif
endif
if maparg('<S-CR>', 'i') !~# '.*VimwikiReturn*.'
inoremap <silent><buffer> <S-CR> <Esc>:VimwikiReturn 2 2<CR>
endif
" change symbol for bulleted lists
@@ -539,9 +627,13 @@ function! s:CR(normal, just_mrkr) abort
endfunction
" insert mode table mappings
inoremap <silent><buffer><expr> <Plug>VimwikiTableNextCell
\ vimwiki#tbl#kbd_tab()
inoremap <silent><buffer><expr> <Plug>VimwikiTablePrevCell
\ vimwiki#tbl#kbd_shift_tab()
if str2nr(vimwiki#vars#get_global('key_mappings').table_mappings)
inoremap <expr><buffer> <Tab> vimwiki#tbl#kbd_tab()
inoremap <expr><buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
call vimwiki#u#map_key('i', '<Tab>', '<Plug>VimwikiTableNextCell')
call vimwiki#u#map_key('i', '<S-Tab>', '<Plug>VimwikiTablePrevCell')
endif
" <Plug> table formatting definitions
@@ -610,7 +702,7 @@ onoremap <silent><buffer> <Plug>VimwikiTextObjListSingle
vnoremap <silent><buffer> <Plug>VimwikiTextObjListSingleV
\ :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
" default text object key mappings
" Declare Map: default text object key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').text_objs)
call vimwiki#u#map_key('o', 'ah', '<Plug>VimwikiTextObjHeader')
call vimwiki#u#map_key('v', 'ah', '<Plug>VimwikiTextObjHeaderV')
@@ -634,7 +726,7 @@ if str2nr(vimwiki#vars#get_global('key_mappings').text_objs)
call vimwiki#u#map_key('v', 'il', '<Plug>VimwikiTextObjListSingleV')
endif
" <Plug> header definitions
" Map: <Plug> header definitions
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel
\ :<C-U>call vimwiki#base#AddHeaderLevel(v:count)<CR>
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel
@@ -650,7 +742,7 @@ nnoremap <silent><buffer> <Plug>VimwikiGoToNextSiblingHeader
nnoremap <silent><buffer> <Plug>VimwikiGoToPrevSiblingHeader
\ :<C-u>call vimwiki#base#goto_sibling(-1)<CR>
" default header key mappings
" Declare Map Header: default header key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').headers)
call vimwiki#u#map_key('n', '=', '<Plug>VimwikiAddHeaderLevel')
call vimwiki#u#map_key('n', '-', '<Plug>VimwikiRemoveHeaderLevel')
@@ -662,7 +754,6 @@ if str2nr(vimwiki#vars#get_global('key_mappings').headers)
call vimwiki#u#map_key('n', '[=', '<Plug>VimwikiGoToPrevSiblingHeader')
endif
if vimwiki#vars#get_wikilocal('auto_export')
" Automatically generate HTML on page write.
augroup vimwiki
+90 -77
View File
@@ -4,21 +4,23 @@
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
" Clause: load only once
if exists('g:loaded_vimwiki') || &compatible
finish
endif
let g:loaded_vimwiki = 1
" Set to version number for release, otherwise -1 for dev-branch
let s:plugin_vers = 2.5
" Set to version number for release:
let g:vimwiki_version = '2024.01.24'
" Get the directory the script is installed in
let s:plugin_dir = expand('<sfile>:p:h:h')
" Save peace in the galaxy
let s:old_cpo = &cpoptions
set cpoptions&vim
" Save autowriteall variable state
if exists('g:vimwiki_autowriteall')
let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
else
@@ -26,7 +28,7 @@ else
endif
" this is called when the cursor leaves the buffer
" Autocommand called when the cursor leaves the buffer
function! s:setup_buffer_leave() abort
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
" a registered wiki and not a temporary wiki)
@@ -42,7 +44,7 @@ function! s:setup_buffer_leave() abort
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
let path = expand('%:p:h')
let ext = '.'.expand('%:e')
@@ -67,7 +69,7 @@ function! s:create_temporary_wiki() abort
endfunction
" This function is called when Vim opens a new buffer with a known wiki
" Autocommand called when Vim opens a new buffer with a known wiki
" extension. Both when the buffer has never been opened in this session and
" when it has.
function! s:setup_new_wiki_buffer() abort
@@ -90,11 +92,10 @@ function! s:setup_new_wiki_buffer() abort
" this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are
" sourced
call vimwiki#u#ft_set()
endfunction
" this is called when the cursor enters the buffer
" Autocommand called when the cursor enters the buffer
function! s:setup_buffer_enter() abort
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
" a registered wiki and not a temporary wiki)
@@ -106,7 +107,7 @@ function! s:setup_buffer_enter() abort
endfunction
" this is called when the buffer enters a window or when running a diff
" 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)
@@ -122,13 +123,14 @@ function! s:setup_buffer_win_enter() abort
endfunction
" Help syntax reloading
function! s:setup_cleared_syntax() abort
" highlight groups that get cleared
" on colorscheme change because they are not linked to Vim-predefined groups
hi def VimwikiBold term=bold cterm=bold gui=bold
hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
hi def VimwikiUnderline gui=underline
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def VimwikiUnderline term=underline cterm=underline gui=underline
if vimwiki#vars#get_global('hl_headers') == 1
for i in range(1,6)
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
@@ -140,6 +142,7 @@ function! s:setup_cleared_syntax() abort
endfunction
" Return: list of extension known vy vimwiki
function! s:vimwiki_get_known_extensions() abort
" Getting all extensions that different wikis could have
let extensions = {}
@@ -193,8 +196,8 @@ function! s:set_windowlocal_options() abort
endif
endif
if vimwiki#vars#get_global('conceallevel') && exists('+conceallevel')
let &conceallevel = vimwiki#vars#get_global('conceallevel')
if exists('+conceallevel')
let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
endif
if vimwiki#vars#get_global('auto_chdir')
@@ -203,30 +206,29 @@ function! s:set_windowlocal_options() abort
endfunction
" Echo vimwiki version
" Called by :VimwikiShowVersion
function! s:get_version() abort
if s:plugin_vers != -1
echo 'Stable version: ' . string(s:plugin_vers)
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
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 'Unknown version'
endif
echo 'Unable to retrieve repository info'
endif
endfunction
" Initialization of Vimwiki starts here. Make sure everything below does not
" cause autoload/vimwiki/base.vim to be loaded
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Initialization of Vimwiki starts here.
" Make sure everything below does not cause autoload/vimwiki/base.vim
" to be loaded
call vimwiki#vars#init()
@@ -251,58 +253,59 @@ if !exists('*VimwikiWikiIncludeHandler')
endif
" write a level 1 header to new wiki files
" Write a level 1 header to new wiki files
" a:fname should be an absolute filepath
function! s:create_h1(fname) abort
if vimwiki#vars#get_global('auto_header')
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
" Clause: Don't do anything for unregistered wikis
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
if idx == -1
return
endif
" don't do anything for unregistered wikis
if idx == -1
return
endif
" Clause: no auto_header
if !vimwiki#vars#get_global('auto_header')
return
endif
" 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
" 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')
" Get tail of filename without extension
let title = expand('%:t:r')
" don't insert header for index page
if title ==# vimwiki#vars#get_wikilocal('index', idx)
return
endif
" 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
" 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
" Insert the header
if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
keepjumps call append(0, '# ' . title)
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
keepjumps call append(1, '')
endfor
else
keepjumps call append(0, '= ' . title . ' =')
endif
endfunction
" Define autocommands for all known wiki extensions
let s:known_extensions = s:vimwiki_get_known_extensions()
if index(s:known_extensions, '.wiki') > -1
augroup filetypedetect
" clear FlexWiki's stuff
" Clear FlexWiki's stuff
au! * *.wiki
augroup end
endif
@@ -326,7 +329,6 @@ augroup vimwiki
" autowrap tables.
if vimwiki#vars#get_global('table_auto_fmt')
exe 'autocmd InsertLeave '.pat.' call vimwiki#tbl#format(line("."), 2)'
exe 'autocmd InsertEnter '.pat.' call vimwiki#tbl#reset_tw(line("."))'
endif
if vimwiki#vars#get_global('folding') =~? ':quick$'
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
@@ -341,6 +343,7 @@ augroup vimwiki
augroup END
" Declare global commands
command! VimwikiUISelect call vimwiki#base#ui_select()
" these commands take a count e.g. :VimwikiIndex 2
@@ -356,25 +359,29 @@ command! -count=0 VimwikiDiaryIndex
\ call vimwiki#diary#goto_diary_index(<count>)
command! -count=0 VimwikiMakeDiaryNote
\ call vimwiki#diary#make_note(<count>)
\ 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() - 60*60*24))
\ vimwiki#diary#diary_date_link(localtime(), -1, <count>))
command! -count=0 VimwikiMakeTomorrowDiaryNote
\ call vimwiki#diary#make_note(<count>, 0,
\ vimwiki#diary#diary_date_link(localtime() + 60*60*24))
\ vimwiki#diary#diary_date_link(localtime(), 1, <count>))
command! VimwikiDiaryGenerateLinks
\ call vimwiki#diary#generate_diary_section()
command! VimwikiShowVersion call s:get_version()
command! -nargs=* -complete=customlist,vimwiki#vars#complete
\ VimwikiVar call vimwiki#vars#cmd(<q-args>)
" Declare global maps
" <Plug> global definitions
nnoremap <silent><script> <Plug>VimwikiIndex
\ :<C-U>call vimwiki#base#goto_index(v:count)<CR>
@@ -387,21 +394,22 @@ nnoremap <silent><script> <Plug>VimwikiDiaryIndex
nnoremap <silent><script> <Plug>VimwikiDiaryGenerateLinks
\ :VimwikiDiaryGenerateLinks<CR>
nnoremap <silent><script> <Plug>VimwikiMakeDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count)<CR>
\ :<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() - 60*60*24))<CR>
\ vimwiki#diary#diary_date_link(localtime(), -1, v:count))<CR>
nnoremap <silent><script> <Plug>VimwikiMakeTomorrowDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime() + 60*60*24))<CR>
\ vimwiki#diary#diary_date_link(localtime(), 1, v:count))<CR>
" get the user defined prefix (default <leader>w)
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
" default global key mappings
" Set default global key mappings
if str2nr(vimwiki#vars#get_global('key_mappings').global)
" Get the user defined prefix (default <leader>w)
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
call vimwiki#u#map_key('n', s:map_prefix . 'w', '<Plug>VimwikiIndex', 2)
call vimwiki#u#map_key('n', s:map_prefix . 't', '<Plug>VimwikiTabIndex', 2)
call vimwiki#u#map_key('n', s:map_prefix . 's', '<Plug>VimwikiUISelect', 2)
@@ -414,6 +422,7 @@ if str2nr(vimwiki#vars#get_global('key_mappings').global)
endif
" Build global wiki menu (GUI)
function! s:build_menu(topmenu) abort
let wnamelist = []
for idx in range(vimwiki#vars#number_of_wikis())
@@ -442,6 +451,8 @@ function! s:build_menu(topmenu) abort
endfor
endfunction
" Build global table menu (GUI)
function! s:build_table_menu(topmenu) abort
exe 'menu '.a:topmenu.'.-Sep- :'
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
@@ -453,6 +464,7 @@ function! s:build_table_menu(topmenu) abort
endfunction
" Build Menus now
if !empty(vimwiki#vars#get_global('menu'))
call s:build_menu(vimwiki#vars#get_global('menu'))
call s:build_table_menu(vimwiki#vars#get_global('menu'))
@@ -466,4 +478,5 @@ if vimwiki#vars#get_global('use_calendar')
endif
" Restore peace in the galaxy
let &cpoptions = s:old_cpo
+235 -152
View File
@@ -13,9 +13,21 @@ endif
let s:current_syntax = vimwiki#vars#get_wikilocal('syntax')
" Get config: possibly concealed chars
let b:vimwiki_syntax_conceal = exists('+conceallevel') ? ' conceal' : ''
let b:vimwiki_syntax_concealends = has('conceal') ? ' concealends' : ''
" Populate all syntax vars
" Include syntax/vimwiki_markdown.vim as "side effect"
call vimwiki#vars#populate_syntax_vars(s:current_syntax)
let syntax_dic = g:vimwiki_syntaxlocal_vars[s:current_syntax]
" Declare nesting capabilities
" -- to be 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
function! s:add_target_syntax_ON(target, type) abort
@@ -51,33 +63,33 @@ function! s:highlight_existing_links() abort
" match [[URL]]
let target = vimwiki#base#apply_template(
\ 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')
" match [[URL|DESCRIPTION]]
let target = vimwiki#base#apply_template(
\ 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')
" match {{URL}}
let target = vimwiki#base#apply_template(
\ 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')
" match {{URL|...}}
let target = vimwiki#base#apply_template(
\ 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')
" match [[DIRURL]]
let target = vimwiki#base#apply_template(
\ 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')
" match [[DIRURL|DESCRIPTION]]
let target = vimwiki#base#apply_template(
\ 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')
endfunction
@@ -99,87 +111,103 @@ else
endif
" Weblink
" Weblink: [DESCRIPTION](FILE)
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink')
" WikiLink
" WikiLink:
" All remaining schemes are highlighted automatically
let s:rxSchemes = '\%('.
\ vimwiki#vars#get_global('schemes') . '\|'.
\ vimwiki#vars#get_global('web_schemes1').
\ vimwiki#vars#get_global('schemes_local') . '\|'.
\ vimwiki#vars#get_global('schemes_web').
\ '\):'
" a) match [[nonwiki-scheme-URL]]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" a) match {{nonwiki-scheme-URL}}
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
\ vimwiki#vars#get_global('rxWikiInclArgs'), '')
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" b) match {{nonwiki-scheme-URL}[{...}]}
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
\ vimwiki#vars#get_global('rxWikiInclArgs'), '')
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
" List:
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
" Header levels, 1-6
" Task List Done:
if vimwiki#vars#get_global('hl_cb_checked') == 1
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
\ . vimwiki#vars#get_global('listsym_rejected')
\ . ']\]\s\(.*\)$/ '
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
execute 'syntax match VimwikiCheckBoxDone /'
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
endif
" GTD-style token highlighting
syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=VimwikiTodo
syntax match TodoDueDate 'due:\d\{2,4\}-\d\{2\}-\d\{2\}' contains=VimwikiTodo
syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=VimwikiTodo
syntax match TodoContext '\(^\|\W\)@[^[:blank:]]\+' contains=VimwikiTodo
" Header Level: 1..6
for s:i in range(1,6)
" WebLink are for markdown but putting them here avoidcode duplication
" -- and syntax folding Issue #1009
execute 'syntax match VimwikiHeader'.s:i
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax).
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
execute 'syntax region VimwikiH'.s:i.'Folding start=/'.
\ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'.
\ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax).
\ '/me=s-1 transparent fold'
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax)
\ . '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'
\ . 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,VimwikiList,VimwikiListTodo,@Spell'
execute 'syntax region VimwikiH'.s:i.'Folding start=/'
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax)
\ . '/me=s-1'
\ . ' transparent fold'
endfor
" possibly concealed chars
let s:conceal = exists('+conceallevel') ? ' conceal' : ''
if vimwiki#vars#get_global('conceal_onechar_markers')
execute 'syn match VimwikiEqInChar contained /'.
\ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal
execute 'syn match VimwikiBoldChar contained /'.
\ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal
execute 'syn match VimwikiItalicChar contained /'.
\ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal
execute 'syn match VimwikiBoldItalicChar contained /'.
\ 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
endif
" SetExt Header:
" TODO mutualise SetExt Regexp
let setex_header1_re = '^\s\{0,3}[^>].*\n\s\{0,3}==\+$'
let setex_header2_re = '^\s\{0,3}[^>].*\n\s\{0,3}--\+$'
execute 'syntax match VimwikiHeader1'
\ . ' /'. setex_header1_re . '/ '
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
execute 'syntax match VimwikiHeader2'
\ . ' /'. setex_header2_re . '/ ' .
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
let s:options = ' contained transparent contains=NONE'
if exists('+conceallevel')
let s:options .= s:conceal
let s:options .= b:vimwiki_syntax_conceal
endif
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
@@ -207,33 +235,13 @@ execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix1
" non concealed chars
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.
\ vimwiki#vars#get_syntaxlocal('rxH').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH').
\ vimwiki#vars#get_syntaxlocal('header_symbol').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('header_symbol').
\ '\+\s*$\)/'
execute 'syn match VimwikiEqInCharT contained /'
\ .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').'/'
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_wikilocal('rx_todo') .'/'
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_global('rxTodo') .'/'
" Tables
" Table:
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ transparent contains=VimwikiCellSeparator,
\ VimwikiLinkT,
@@ -248,86 +256,26 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ VimwikiSubScriptT,
\ VimwikiCodeT,
\ VimwikiEqInT,
\ VimwikiEmoji,
\ @Spell
syntax match VimwikiCellSeparator
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
" Lists
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'/'
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
if vimwiki#vars#get_global('hl_cb_checked') == 1
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
\ . '\s*\[['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
\ . vimwiki#vars#get_global('listsym_rejected')
\ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
execute 'syntax match VimwikiCheckBoxDone /'
\ . vimwiki#vars#get_syntaxlocal('rxListItemAndChildren')
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
endif
execute 'syntax match VimwikiEqIn /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
\ '/ contains=VimwikiEqInChar,@NoSpell'
execute 'syntax match VimwikiEqInT /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
\ '/ contained contains=VimwikiEqInCharT,@NoSpell'
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=VimwikiDelTextCharT,@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,@NoSpell'
execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode').
\ '/ contained contains=VimwikiCodeCharT'
" <hr> horizontal rule
" Horizontal Rule: <hr>
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
" Preformated Text: `like that`
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@NoSpell'.concealpre
" Equation Text: $like that$
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell'
" placeholders
" Placeholder:
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
syntax match VimwikiPlaceholder
\ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
@@ -338,24 +286,85 @@ syntax match VimwikiPlaceholder
syntax match VimwikiPlaceholderParam /.*/ contained
" html tags
" Html Tag: <u>
if vimwiki#vars#get_global('valid_html_tags') !=? ''
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('rxComment').
\ '/ contains=@Spell,VimwikiTodo'
" Html Typeface: <b>bold text</b>
let html_typeface = {
\ 'bold': [['<b>', '</b\_s*>'], ['<strong>', '</strong\_s*>']],
\ 'italic': [['<i>', '</i\_s*>'], ['<em>', '</em\_s*>']],
\ 'underline': [['<u>', '</u\_s*>']],
\ 'code': [['<code>', '</code\_s*>']],
\ 'del': [['<del>', '</del\_s*>']],
\ 'eq': [],
\ 'sup': [['<sup>', '</sup\_s*>']],
\ 'sub': [['<sub>', '</sub\_s*>']],
\ }
" Highlight now
call vimwiki#u#hi_typeface(html_typeface)
endif
" tags
execute 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
" Html Color: <span style="color:#FF0000";>Red paragraph</span>
" -- See: h color_dic
let color_dic = vimwiki#vars#get_wikilocal('color_dic')
let color_tag = vimwiki#vars#get_wikilocal('color_tag_template')
for [color_key, color_value] in items(color_dic)
let [fg, bg] = color_value
let delimiter = color_tag
let delimiter = substitute(delimiter, '__COLORFG__', fg, 'g')
let delimiter = substitute(delimiter, '__COLORBG__', bg, 'g')
" The user input has been already checked
let [pre_region, post_region] = split(delimiter, '__CONTENT__')
let cmd = 'syntax region Vimwiki' . color_key . ' matchgroup=VimwikiDelimiterColor'
\ . ' start=/' . pre_region . '/'
\ . ' end=/' . post_region . '/'
\ . ' ' . b:vimwiki_syntax_concealends
execute cmd
" Build 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
" Html mark tag, feature request in issue #1261
let cmd = 'syntax region VimwikiMarkTag matchgroup=VimwikiDelimiterColor'
\ . ' start=/<mark>/'
\ . ' end=+</mark>+'
\ . ' ' . b:vimwiki_syntax_concealends
execute cmd
" 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
" header groups highlighting
" Tag:
let tag_cmd = 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
let tf = vimwiki#vars#get_wikilocal('tag_format')
if exists('+conceallevel') && tf.conceal != 0
let tag_cmd .= ' conceal'
if tf.cchar !=# ''
let tag_cmd .= ' cchar=' . tf.cchar
endif
endif
execute tag_cmd
" Header Groups: highlighting
if vimwiki#vars#get_global('hl_headers') == 0
" Strangely in default colorscheme Title group is not set to bold for cterm...
if !exists('g:colors_name')
@@ -373,28 +382,56 @@ else
endif
" Typeface: -> u.vim
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
call vimwiki#u#hi_typeface(s:typeface_dic)
" Link highlighting groups
""""""""""""""""""""""""""
hi def link VimwikiMarkers Normal
hi def link VimwikiError Normal
hi def link VimwikiEqIn Number
hi def link VimwikiEqInT VimwikiEqIn
" Typeface 1
hi def VimwikiBold term=bold cterm=bold gui=bold
hi def link VimwikiBoldT VimwikiBold
hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def link VimwikiItalicT VimwikiItalic
hi def VimwikiUnderline term=underline cterm=underline gui=underline
" Typeface 2
" Bold > Italic > Underline
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def link VimwikiItalicBold VimwikiBoldItalic
hi def link VimwikiBoldItalicT VimwikiBoldItalic
hi def link VimwikiItalicBoldT VimwikiBoldItalic
hi def VimwikiUnderline gui=underline
hi def VimwikiBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
hi def link VimwikiUnderlineBold VimwikiBoldUnderline
hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=italic,underline
hi def link VimwikiUnderlineItalic VimwikiItalicUnderline
" Typeface 3
hi def VimwikiBoldItalicUnderline term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
hi def link VimwikiBoldUnderlineItalic VimwikiBoldItalicUnderline
hi def link VimwikiItalicBoldUnderline VimwikiBoldItalicUnderline
hi def link VimwikiItalicUnderlineBold VimwikiBoldItalicUnderline
hi def link VimwikiUnderlineBoldItalic VimwikiBoldItalicUnderline
hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
" Code
hi def link VimwikiCode PreProc
hi def link VimwikiCodeT VimwikiCode
" Mark
hi def VimwikiMarkTag term=bold ctermbg=yellow ctermfg=black guibg=yellow guifg=black
hi def link VimwikiPre PreProc
hi def link VimwikiPreT VimwikiPre
hi def link VimwikiPreDelim VimwikiPre
@@ -414,7 +451,14 @@ hi def link VimwikiCheckBoxDone Comment
hi def link VimwikiHR Identifier
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 VimwikiSuperScript Number
@@ -425,6 +469,7 @@ hi def link VimwikiSubScriptT VimwikiSubScript
hi def link VimwikiTodo Todo
hi def link VimwikiComment Comment
hi def link VimwikiMultilineComment Comment
hi def link VimwikiPlaceholder SpecialKey
hi def link VimwikiPlaceholderParam String
@@ -442,6 +487,7 @@ hi def link VimwikiSubScriptChar VimwikiMarkers
hi def link VimwikiCodeChar VimwikiMarkers
hi def link VimwikiHeaderChar VimwikiMarkers
" TODO remove unused due to region refactoring
hi def link VimwikiEqInCharT VimwikiMarkers
hi def link VimwikiBoldCharT VimwikiMarkers
hi def link VimwikiItalicCharT VimwikiMarkers
@@ -455,6 +501,12 @@ hi def link VimwikiHeaderCharT VimwikiMarkers
hi def link VimwikiLinkCharT VimwikiLinkT
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
" GTD-style token highlighting
hi def link TodoDate PreProc
hi def link TodoDueDate VimWikiBold
hi def link TodoProject Constant
hi def link TodoContext Statement
" Load syntax-specific functionality
call vimwiki#u#reload_regexes_custom()
@@ -464,7 +516,7 @@ call vimwiki#u#reload_regexes_custom()
let b:current_syntax='vimwiki'
" EMBEDDED syntax setup
" Include: Code: EMBEDDED syntax setup -> base.vim
let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), 'keep')
@@ -478,13 +530,44 @@ if !empty(s:nested)
endfor
endif
" Include: Yaml metadata block for pandoc
let a_yaml_delimiter = vimwiki#vars#get_syntaxlocal('yaml_metadata_block')
for [rx_start, rx_end] in a_yaml_delimiter
call vimwiki#base#nested_syntax(
\ 'yaml',
\ rx_start,
\ rx_end,
\ 'VimwikiPre')
endfor
" LaTeX
" LaTex: Load
if !empty(globpath(&runtimepath, 'syntax/tex.vim'))
execute 'syntax include @textGrouptex syntax/tex.vim'
endif
if !empty(globpath(&runtimepath, 'after/syntax/tex.vim'))
execute 'syntax include @textGrouptex after/syntax/tex.vim'
endif
" LaTeX: Block
call vimwiki#base#nested_syntax('tex',
\ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'.
\ '\%([[:blank:][:punct:]].*\)\?',
\ vimwiki#vars#get_syntaxlocal('rxMathEnd'), 'VimwikiMath')
" LaTeX: Inline
for u in syntax_dic.typeface.eq
execute 'syntax region textSniptex matchgroup=texSnip'
\ . ' start="'.u[0].'" end="'.u[1].'"'
\ . ' contains=@texMathZoneGroup'
\ . ' keepend oneline '. b:vimwiki_syntax_concealends
endfor
" Emoji: :dog: (after tags to take precedence, after nested to not be reset)
if and(vimwiki#vars#get_global('emoji_enable'), 1) != 0 && has('conceal')
call vimwiki#emoji#apply_conceal()
exe 'syn iskeyword '.&iskeyword.',-,:'
endif
syntax spell toplevel
-110
View File
@@ -1,110 +0,0 @@
" 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
@@ -1,104 +0,0 @@
" 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** or __strong__
let s:markdown_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\(\*\|_\)\{2\}'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\1\{2\}'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_bold = '\*\*\|__'
" text: _emphasis_ or *emphasis*
let s:markdown_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\(\*\|_\)'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\1'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_italic = '\*\|_'
" text: *_bold italic_* or _*italic bold*_
let s:markdown_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\(\*\)\{3\}'.
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
\'\1\{3\}'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_bolditalic = '\*\*\*'
let s:markdown_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\(_\)\{3\}'.
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
\'\1\{3\}'.
\'\%([[: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 (code blocks)
let s:markdown_syntax.rxPreStart = '\%(`\{3,}\|\~\{3,}\)'
let s:markdown_syntax.rxPreEnd = '\%(`\{3,}\|\~\{3,}\)'
" TODO see syntax/vimwiki_markdown_custom.vim for more info
" let s:markdown_syntax.rxIndentedCodeBlock = '\%(^\n\)\@1<=\%(\%(\s\{4,}\|\t\+\).*\n\)\+'
" 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\|$\)'
+10 -20
View File
@@ -52,34 +52,34 @@ function! s:highlight_existing_links() abort
" match [URL][]
let target = vimwiki#base#apply_template(
\ 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')
" match [DESCRIPTION][URL]
let target = vimwiki#base#apply_template(
\ 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')
" match [DIRURL][]
let target = vimwiki#base#apply_template(
\ 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')
" match [DESCRIPTION][DIRURL]
let target = vimwiki#base#apply_template(
\ 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')
" match [MKDREF][]
let target = vimwiki#base#apply_template(
\ 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')
" match [DESCRIPTION][MKDREF]
let target = vimwiki#base#apply_template(
\ 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')
endfunction
@@ -105,34 +105,24 @@ call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxImage'), 'VimwikiIma
" WikiLink
" All remaining schemes are highlighted automatically
let s:rxSchemes = '\%('.
\ vimwiki#vars#get_global('schemes') . '\|'.
\ vimwiki#vars#get_global('web_schemes1').
\ vimwiki#vars#get_global('schemes_local') . '\|'.
\ vimwiki#vars#get_global('schemes_web').
\ '\):'
" a) match [nonwiki-scheme-URL]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
" b) match [DESCRIPTION][nonwiki-scheme-URL]
let s:target = vimwiki#base#apply_template(
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
" Header levels, 1-6
for s:i in range(1,6)
execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i).
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
endfor
" concealed chars
if exists('+conceallevel')
syntax conceal on
-85
View File
@@ -1,85 +0,0 @@
" 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\|$\)'
+11 -1
View File
@@ -7,6 +7,7 @@ Vimwiki functionality. It is based on the following tools:
- [Vader](https://github.com/junegunn/vader.vim)
- [Vint](https://github.com/Kuniwak/vint)
## Resources
- [Vim patches](http://ftp.vim.org/pub/vim/patches/)
@@ -16,11 +17,13 @@ Vimwiki functionality. It is based on the following tools:
- [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
@@ -43,7 +46,12 @@ 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`.
## Inside the container
## 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 !
@@ -51,6 +59,7 @@ plugin source files. For more information run `./run_tests.sh -h`.
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
@@ -62,6 +71,7 @@ For more information, read the [base docker image](https://github.com/tweekmonst
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
+25
View File
@@ -0,0 +1,25 @@
# Test vimwiki#base#is_diary_file() for various inputs.
Execute (Check known good diary file):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
Assert vimwiki#base#is_diary_file(link_infos.filename)
Execute (Check known good diary file using is_diary_file, with list of all diary files - legacy interface):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
let diary_file_paths = vimwiki#diary#get_diary_files()
Assert vimwiki#base#is_diary_file(link_infos.filename, diary_file_paths)
Execute (Check known good diary file use is_among_diary_files, with list of all diary files):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
let diary_file_paths = vimwiki#diary#get_diary_files()
Assert vimwiki#base#is_among_diary_files(link_infos.filename, diary_file_paths)
Execute (Check for nonexistent diary file):
VimwikiIndex 1
Assert !vimwiki#base#is_diary_file('not-a-diary-file')
Execute (Clean):
call ReloadVimwiki()
+42
View File
@@ -0,0 +1,42 @@
# Test vimwiki#base#resolve_link for various inputs.
Execute (Resolve link for index):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('index')
AssertEqual 'wiki0', link_infos.scheme
AssertEqual $HOME . '/testwiki/index.wiki', link_infos.filename
Execute (Resolve link for /index - absolute path from wiki root):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('/index')
AssertEqual 'wiki0', link_infos.scheme
AssertEqual '', link_infos.anchor
AssertEqual $HOME . '/testwiki/index.wiki', link_infos.filename
Execute (Resolve link for ///tmp/some_page - absolute path to standalone page):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('///tmp/some_page')
AssertEqual '/tmp/some_page.wiki', link_infos.filename
Execute (Resolve link for //~/testwiki/index - page in wiki under homedir):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('//~/testwiki/index')
AssertEqual $HOME . '/testwiki/index.wiki', expand(link_infos.filename)
Execute (Resolve link for diary:2020-01-01 - diary page):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-01-01')
AssertEqual $HOME . '/testwiki/diary/2020-01-01.wiki', link_infos.filename
Execute (Resolve link to link_syntax/nested - page in subdirectory):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('link_syntax/nested')
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', link_infos.filename
Execute (Resolve relative link to ./link_syntax/nested - page in subdirectory):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('link_syntax/nested')
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', link_infos.filename
Execute (Clean):
call ReloadVimwiki()
-103
View File
@@ -1,103 +0,0 @@
Include: vader_includes/vader_setup.vader
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
# 1 VimwikiGenerateLinks
##########################
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)
Do (Save Test.md && Re-GenerateLinks):
:edit $HOME/testmarkdown/Test.md\<CR>
:set bt=\<CR>
:write %\<CR>
:VimwikiGenerateLinks\<CR>
Expect (The links with a header with file Test):
# Generated Links
- [Generated Links](Test)
- [Buzz Bozz](buzz_bozz)
- [Test Wiki](index)
# 2 VimwikiDiaryGenerateLinks
#############################
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
## 2019
### December
- [2019-12-10](2019-12-10)
### July
- [informative title](2019-07-13)
### March
- [2019-03-01](2019-03-01)
Execute (Clean):
Log "End: Clean"
call system("rm $HOME/testmarkdown/diary/2019-12-10.md")
call system("rm $HOME/testmarkdown/diary/2019-07-13.md")
call system("rm $HOME/testmarkdown/diary/2019-03-01.md")
call system("rm $HOME/testmarkdown/diary/diary.md")
Include: vader_includes/vader_teardown.vader
" vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
-96
View File
@@ -1,96 +0,0 @@
Include: vader_includes/vader_setup.vader
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
Execute (Setup):
set sw=4
AssertEqual 4, &sw
Execute (Edit Test-Tag.md):
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):
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
I
: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 2.5
second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#A header
top-tag Test-Tag.md 1;" vimwiki:Test-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):
Log "End: Clean"
call system("rm $HOME/testmarkdown/Test.md")
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag.md")
call DeleteHiddenBuffers()
Include: vader_includes/vader_teardown.vader
-149
View File
@@ -1,149 +0,0 @@
Include: vader_includes/vader_setup.vader
Execute (Reset TOC header to default):
let g:vimwiki_global_vars['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 1#Header 1.1)
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
- [Header 2](#Header 2)
- [Header 2.1.1](#Header 2#Header 2.1.1)
# 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 1#Header 1.1)
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
- [Header 2](#Header 2)
- [Header 2.1.1](#Header 2#Header 2.1.1)
# 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 1#Header 1.1)
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
- [Header 2](#Header 2)
- [Header 2.1.1](#Header 2#Header 2.1.1)
# 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):
let g:vimwiki_global_vars['toc_header'] = "Sommaire"
VimwikiTOC
Expect (Append a Sommaire && Leave Contents alone):
# Sommaire
- [Header 1](#Header 1)
- [Header 1.1](#Header 1#Header 1.1)
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
- [Header 2](#Header 2)
- [Header 2.1.1](#Header 2#Header 2.1.1)
# 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 1#Header 1.1)
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
- [Header 2](#Header 2)
- [Header 2.1.1](#Header 2#Header 2.1.1)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Include: vader_includes/vader_teardown.vader
" vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
+32
View File
@@ -0,0 +1,32 @@
# Test comment string PR #946
# TODO try default
# TODO try editing other buffer
#Execute (default commenstring, ft vimwiki):
# AssertEqual &filetype[0], 't'
# AssertEqual '/*%s*/', &commentstring
Given txt (txt):
txt
After (clean up):
if exists('g:vimwiki_commentstring')
unlet g:vimwiki_commentstring
endif
if exists('b:did_ftplugin')
unlet b:did_ftplugin
endif
Execute (default vimwiki commentstring):
call vimwiki#vars#init()
set ft=vimwiki
AssertEqual '%%%s', &commentstring
Execute (html commentstring):
let g:vimwiki_commentstring='<!-- %s -->'
call vimwiki#vars#init()
set ft=vimwiki
AssertEqual '<!-- %s -->', &commentstring
Expect (void):
txt
+91
View File
@@ -0,0 +1,91 @@
# Test variable management (should be small)
# PR #1132 make other test break ...
#Given vimwiki (abc def ghi jkl #1132):
# abc def ghi jkl
#
#Do (vee<CR>):
# :call SetSyntax('markdown')\<CR>
# :call vimwiki#vars#set_wikilocal('links_space_char', '_')\<CR>
# vee\<CR>
# :call vimwiki#vars#set_wikilocal('links_space_char', ' ')\<CR>
#
#Expect (underscores in link url not in description):
# [abc def](abc_def) ghi jkl
#
# Issue #980
#
# brennen commenting these out 2021-03-29 per @tinmarino:
# https://github.com/vimwiki/vimwiki/pull/1108#issuecomment-806775805
# Given txt (txt):
# txt
#
# Execute (VimWei vars #980):
# " Set
# call UnloadVimwiki()
# let wiki = {}
# let wiki.name = 'ChenWei 🦊VimwikiMd @^%@!*#&^'
# let wiki.path = $HOME . '/testmarkdown'
# let wiki.ext = '.md'
# let wiki.syntax = 'markdown'
# let wiki.nested_syntaxes = {'python': 'python'}
#
# " Make other tests crash
# "let wiki.links_space_char = '_'
# "let wiki.list_margin = 0
# "let wiki.auto_toc = 1
# "let wiki.auto_tags = 1
# "let wiki.auto_generate_tags = 1
#
# let g:vimwiki_list = [wiki]
# let g:vimwiki_ext2syntax = {'.md': 'markdown'}
# let g:vimwiki_global_ext = 1
# let g:vimwiki_autowriteall = 1
# let g:vimwiki_auto_chdir = 1
# let g:vimwiki_folding = 'expr'
# call LoadVimwiki()
#
# " Log
# Log 'Path (Current): ' . getcwd()
# Log 'File: (Buffer)' . @%
# Log 'List (Wiki): ' . string(g:vimwiki_list)
# Log ''
# Log 'Local (Vars):'
# Log g:vimwiki_wikilocal_vars
#
# " Work
# edit $HOME/testmarkdown/index.md
#
# " Assert
# AssertEqual '/home/vimtest/testmarkdown_cwd', getcwd() . '_cwd'
# AssertEqual '0_wiki_nr', vimwiki#vars#get_bufferlocal('wiki_nr') . '_wiki_nr'
# AssertEqual 'markdown_syntax', vimwiki#vars#get_wikilocal('syntax') . '_syntax'
# AssertEqual '0_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
# Log 'Path (Current): ' . getcwd()
# Log 'File (Buffer):' . @%
# bprevious
# Log 'Path (Current): ' . getcwd()
# Log 'File (Buffer):' . @%
# bwipeout index.md
#
# " Clean
# Log 'Clean up'
# cd /testplugin
# unlet g:vimwiki_list
# unlet g:vimwiki_ext2syntax
# unlet g:vimwiki_global_ext
# unlet g:vimwiki_autowriteall
# unlet g:vimwiki_auto_chdir
# unlet g:vimwiki_folding
# unlet wiki
# Log 'Path (Current): ' . getcwd()
# Log 'File (Buffer):' . @%
# call ReloadVimwiki()
# Log g:vimwiki_wikilocal_vars
#
# Expect (txt):
# txt
# vim: sw=2:foldlevel=30:foldmethod=indent:
-59
View File
@@ -1,59 +0,0 @@
Include: vader_includes/vader_setup.vader
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
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>
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>
Include: vader_includes/vader_teardown.vader
@@ -1,9 +1,8 @@
Include: vader_includes/vader_setup.vader
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
# 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):
@@ -11,16 +10,37 @@ Execute (VimwikiGoto buzz_bozz && Assert):
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>
Execute (:VimwikiGoto + Completion):
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())
let s_complete=string(vimwiki#base#get_globlinks_raw())
Assert -1 != stridx(s_complete, 'buzz_bozz')
Execute (Create dir1/dir2/test_goto_file.md):
@@ -35,30 +55,29 @@ Execute (:VimwikiGoto + Completion in directory):
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
" Complete without argment
let s_complete1=string(vimwiki#base#get_globlinks_escaped())
let s_complete1=string(vimwiki#base#get_globlinks_raw())
Assert -1 != stridx(s_complete1, 'test_goto_file')
" Complete with file argument
let s_complete2=string(vimwiki#base#get_globlinks_escaped('test_goto_file'))
let s_complete2=string(vimwiki#base#get_globlinks_raw('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'))
let s_complete3=string(vimwiki#base#get_globlinks_raw('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'))
let s_complete4=string(vimwiki#base#get_globlinks_raw('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 l_complete5=vimwiki#base#get_globlinks_raw('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):
Log "End: Clean"
call DeleteFile("$HOME/testmarkdown/dir1/dir2/test_goto_file.md")
call system("rm $HOME/testmarkdown/dir1")
Include: vader_includes/vader_teardown.vader
# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
+28
View File
@@ -0,0 +1,28 @@
# 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
@@ -0,0 +1 @@
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
@@ -0,0 +1,59 @@
# Fold
Execute (Save state):
Log 'Previous foldmethod: ' . &foldmethod
let save_foldmethod = &foldmethod
Given vimwiki (Markdown Headers):
Some stuff 1
# Header level 1 2
## Header level 2 3
Content 4
### Header level 3 5
# Header level 1 6
Content 7
## Just to end 8: Vader cannot match end-of-file
Execute (Markdown and Fold Syntax):
call SetSyntax('markdown')
set foldmethod=syntax
Execute (Assert Markdown: Fold Syntax):
Log 'Supposing it starts at foldlevel 0'
AssertEqual 'line 1:0', 'line 1:' . foldlevel(1)
AssertEqual 'line 2:0', 'line 2:' . foldlevel(2)
AssertEqual 'line 3:1', 'line 3:' . foldlevel(3)
AssertEqual 'line 4:2', 'line 4:' . foldlevel(4)
AssertEqual 'line 5:2', 'line 5:' . foldlevel(5)
AssertEqual 'line 6:0', 'line 6:' . foldlevel(6)
AssertEqual 'line 7:0', 'line 7:' . foldlevel(7)
Given vimwiki (Wiki Headers):
Some stuff 1
= Header level 1 2 =
== Header level 2 3 ==
Content 4
=== Header level 3 5 ===
= Header level 1 6 =
Content 7
== Just to end 8 ==
Execute (Markdown and Fold Syntax):
call SetSyntax('default')
set foldmethod=syntax
Execute (Assert Markdown: Fold Syntax):
Log 'Supposing it starts at foldlevel 0'
AssertEqual 'line 1:0', 'line 1:' . foldlevel(1)
AssertEqual 'line 2:0', 'line 2:' . foldlevel(2)
AssertEqual 'line 3:1', 'line 3:' . foldlevel(3)
AssertEqual 'line 4:2', 'line 4:' . foldlevel(4)
AssertEqual 'line 5:2', 'line 5:' . foldlevel(5)
AssertEqual 'line 6:0', 'line 6:' . foldlevel(6)
AssertEqual 'line 7:0', 'line 7:' . foldlevel(7)
Execute (Restore state):
let &foldmethod = save_foldmethod
Log 'Next foldmethod: ' . &foldmethod
+170
View File
@@ -0,0 +1,170 @@
# Blockquotes in html convertion #55
# TODO replace remove newline before end of pre tag: \n</pre></code> -> </pre></code>
Given (Issue 2: BlockQuote restarts list numbering {{{3):
# Item 1
# Item 2
Block Quote Text
# Item 3
Execute (2Html):
call ConvertWiki2Body()
1d | $d | $d
Expect (Tested by hand 2):
<ul>
<li>
Item 1
<li>
Item 2
<pre><code>Block Quote Text
</code></pre>
<li>
Item 3
</ul>
Given vimwiki (Issue 1007: List with hard wraps and a blockquote):
- Item 1
wraps to the second line.
This is a blockquote.
And this is back to the list item
- [ ] Item 2
wraps to the second line.
This is a blockquote.
And this is back to the list item
Execute (2Html):
call ConvertWiki2Body() | 1d | $d | $d
Expect (No blockquote):
<ul>
<li>
Item 1
wraps to the second line.
<pre><code>This is a blockquote.
</code></pre>
</code></pre>
And this is back to the list item
<li class="done0">
Item 2
wraps to the second line.
<pre><code>This is a blockquote.
</code></pre>
And this is back to the list item
</ul>
#Given (Issue 3: BlockQuote at multiple list levels {{{3):
# 1. Outer Item 1
# 1. Inner Item 1
#
# > quote 1
#
# 2. Inner Item 2
# 2. Outer Item 2
#
# > quote 2
#
#Execute (2Html):
# call ConvertWiki2Body()
# 1d | $d | $d
#
#Expect (Got with pandoc):
Given (Issue 5: Newlines in blockquotes are not honored {{{3):
Before
line 1
line 2
After
Execute (2Html):
call ConvertWiki2Body()
1d | $d | $d
Expect (Got with pandoc 5):
<p>
Before
</p>
<pre><code>line 1
line 2
</code></pre>
<p>
After
</p>
Given (Void: Basic test {{{1):
Execute (Edit TestHtml Wiki):
edit $HOME/testwiki/TestHtml.wiki
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Markdown with arrow blockquotes):
:edit $HOME/testwiki/TestHtml.wiki\<CR>
ggdGi first paragraph\<CR>\<CR>
> block\<CR>
> quote\<CR>\<CR>
last paragraph\<CR>\<Esc>
:write\<CR>
Execute (Save and Convert to html):
edit $HOME/testwiki/TestHtml.wiki
Vimwiki2HTML
#Given (Void):
#
#
#Do (Get Html body):
# :read $HOME/html/default/TestHtml.html\<CR>
## Goto body
# gg/<body>\<CR>
## Copy in b
# "bdat
## Delete All
# ggdG
## Paste body
# "bP
## Remove last line
# Gdd
## Save (Not necessary)
# :write
#
#
#
#Expect (Plain Html):
## the whole default html file should be here as a base + the modifications
## from "Given"
# <body>
#
# <p>
# first paragraph
# </p>
#
# <blockquote>
# <p>
# block
# quote
# </p>
# </blockquote>
#
# <p>
# last paragraph
# </p>
#
# </body>
#
## vim: sw=2:foldlevel=30:foldmethod=indent:
+300
View File
@@ -0,0 +1,300 @@
# Conversion: Wiki -> Html
#################################################
Given vimwiki (Comments):
This is some text
%% This is a comment
Test%%+INLINE COMMENT+%%1
%%+INLINE COMMENT+%%Test2
Test3%%+INLINE COMMENT+%%
%%+ Multiline
comment
that
is
removed
+%%
Final text
Do (Convert):
:call ConvertWiki2Html()\<Cr>
# Keep only body
ggd/<body>\<Cr>
Expect (Comments Removed):
<body>
<p>
This is some text
Test1
Test2
Test3
</p>
<p>
Final text
</p>
</body>
</html>
#################################################
Given vimwiki (Table no heading {{{1):
| header1 | header2 |
| val1 | val2 |
| val1 | val2 |
| val1 | val2 |
Do (Convert):
:call ConvertWiki2Html()\<Cr>
# Keep only body
ggd/<body>\<Cr>
Expect (Table no heading):
<body>
<table>
<tr>
<td>
header1
</td>
<td>
header2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
</table>
</body>
</html>
Given vimwiki (Table with heading {{{1):
| header1 | header2 | header3 |
|---------|---------|---------|
| val1 | val2 | var3 |
| val4 | val5 | var6 |
Do (Convert):
:call ConvertWiki2Html()\<Cr>
# Keep only body
ggd/<body>\<Cr>
Expect (Table with heading):
<body>
<table>
<thead>
<tr>
<th>
header1
</th>
<th>
header2
</th>
<th>
header3
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
val1
</td>
<td>
val2
</td>
<td>
var3
</td>
</tr>
<tr>
<td>
val4
</td>
<td>
val5
</td>
<td>
var6
</td>
</tr>
</tbody>
</table>
</body>
</html>
#################################################
Execute (Log):
Log '#473: Syntax "local:" doesnt work as expected. #473'
Given vimwiki (Void Md):
Execute (Edit Test473 Wiki):
edit $HOME/testwiki/TestHtml.wiki
Do (Add local link: [[local:$HOME/here|Link]]):
:edit $HOME/testwiki/Test473.wiki\<CR>
i
[[local:
\<C-r>=$HOME\<Cr>
/here|Link]]
\<Esc>
:call WriteMe()\<Cr>
:Vimwiki2HTML\<Cr>
Execute (Save and Convert to html):
edit $HOME/testwiki/Test473.wiki
Vimwiki2HTML
AssertEqual '[[local:'.$HOME.'/here|Link]]', getline(1)
Given (Void Html):
# TODO mutualise
Do (Get Html body):
:read $HOME/html/default/Test473.html\<CR>
# Goto body
gg/<body>\<CR>
# Copy in b
"bdat
# Delete All
ggdG
# Paste body
"bP
# Remove last line
Gdd
# Save (Not necessary)
:write
Expect (Local link):
<body>
<p>
<a href="../../here">Link</a>
</p>
</body>
Execute (Delete):
call DeleteFile(' $HOME/testwiki/Test473.wiki')
#################################################
Given (Void):
Execute (Edit TestHtml Wiki):
edit $HOME/testwiki/TestHtml.wiki
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Markdwon with %plainhtml):
:edit $HOME/testwiki/TestHtml.wiki\<CR>
:normal ggdG\<Cr>
i%plainhtml<div id="test">\<CR>
my paragraph\<CR>
%plainhtml</div>\<CR>\<Esc>
:set bt=\<CR>
:write\<CR>
Execute (Save and Convert to html):
edit $HOME/testwiki/TestHtml.wiki
Vimwiki2HTML
Given (Void):
Do (Get Html body):
:read $HOME/html/default/TestHtml.html\<CR>
# Goto body
gg/<body>\<CR>
# Copy in b
"bdat
# Delete All
ggdG
# Paste body
"bP
# Remove last line
Gdd
# Save (Not necessary)
:write
Expect (Plain Html):
# the whole default html file should be here as a base + the modifications
# from "Given"
<body>
<div id="test">
<p>
my paragraph
</p>
</div>
</body>
Execute (Delete):
call DeleteFile('$HOME/testwiki/TestHtml.wiki')
Given vimwiki (PR: Add option to configure date string format 1073) {{{1):
%template template_1073
content
Do (template_date_format):
# Set conf
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = '%b %d, %Y'\<Cr>
# Convert
:call ConvertWiki2Html()\<Cr>
# Erase oth and date
:%s/[0-9]\+/Z/g\<Cr>
:%s/[A-Z][a-z][a-z]/Z/g\<Cr>
# Restore peace
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = ''\<Cr>
Expect (Date proper format):
<html>
<body>
<div class="content">
<p><small>Zt updated on Z Z, Z</small></p>
</div>
</body>
</html>
# vim: sw=2 foldmethod=marker foldlevel=30
+10
View File
@@ -0,0 +1,10 @@
# Test that %title values carry through when HTML is rendered
Given vimwiki (Title value):
%title this is a title with some quotes in it: ' "
Some content.
Execute(Check for title tag):
call ConvertWiki2Html()
Assert 0 != search('<title>this is a title with some quotes in it: '' "</title>')
+110
View File
@@ -0,0 +1,110 @@
# Feature to generate a diray RSS feed (PR #934)
# TODO bug with 7.3
#Given (Void):
#
#Execute (Generate HTML and RSS feed):
# edit $HOME/testwiki/index.wiki
# Vimwiki2HTML
# VimwikiRss
#
#Given (Void):
#
#Do (Get HTML file):
# :read $HOME/html/default/index.html\<CR>
## Go to line with RSS link
# gg/RSS\<CR>
## Delete everything above
# kdgg
## Delete everything below
# jdG
## Save (Not necessary) => Actually make rest of batch freeze, do you really want
## to quit buffer
## :write
#
#Expect (RSS link in HTML):
# <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
#
#Do (Get RSS feed):
# :read $HOME/html/default/rss.xml\<CR>
## Remove first line
# ggdd
## Replace pubDate with dummy as it's based on file modification time
# :%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
## Save (Not necessary)
## :write
#
#Expect (RSS):
## TODO the next line is deleted with -Es
## <?xml version="1.0" encoding="UTF-8" ?>
# <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
# <channel>
# <title>Diary</title>
# <link>https://example.com/diary/diary.html</link>
# <description>Diary</description>
# <pubDate>...</pubDate>
# <atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
# <item>
# <title>day 4</title>
# <link>https://example.com/diary/2020-07-25.html</link>
# <guid isPermaLink="false">2020-07-25</guid>
# <description><![CDATA[
# <div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
#
# <div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
#
# <p>
# here is some code:
# </p>
#
# <pre>
# #!/bin/sh
# echo "hello world"
# </pre>
#
# <div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
#
# <p>
# an important list:
# </p>
#
# <ul>
# <li>
# point 1
#
# <li>
# point 2
#
# </ul>
# ]]></description>
# <pubDate>...</pubDate>
# </item>
# <item>
# <title>Day 2</title>
# <link>https://example.com/diary/2020-07-23.html</link>
# <guid isPermaLink="false">2020-07-23</guid>
# <description><![CDATA[
# <div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
#
# <p>
# another diary entry
# </p>
# ]]></description>
# <pubDate>...</pubDate>
# </item>
# <item>
# <title>2020-07-22</title>
# <link>https://example.com/diary/2020-07-22.html</link>
# <guid isPermaLink="false">2020-07-22</guid>
# <description><![CDATA[
# <p>
# example diary entry for day 1.
# </p>
# ]]></description>
# <pubDate>...</pubDate>
# </item>
# </channel>
# </rss>
#
#Execute (Clean buffer modification):
# edit! $HOME/testwiki/index.wiki
-461
View File
@@ -1,461 +0,0 @@
Include: vader_setup
# 0 Configure {{{1
##################
Execute (Configure: Set vimwiki list to markdown resource):
Log "Let mapleader = ,"
let mapleader = ','
Log "Declare function DestroyVar"
function! DestroyVar(var)
if ! exists(a:var) | return | endif
execute "unlet " . a:var
endfunction
Log "Declare function AssertTab"
function! AssertTab(nr)
" Vader is creating 2 tabs
AssertEqual a:nr + 2, tabpagenr()
endfunction
Log "Destroy vimrc or previous run heritage"
call DestroyVar('g:vimwiki_list')
call DestroyVar('g:vimwiki_global_vars')
call DestroyVar('g:vimwiki_wikilocal_vars')
Log "Destroy vimrc variable, works better that way"
call DestroyVar('g:vimwiki_default')
call DestroyVar('g:vimwiki_markdown')
call DestroyVar('g:vimwiki_mediawiki')
Log "Declare my vimwiki_list"
let g:vimwiki_list = [{
\ 'path': 'test/resources/testmarkdown',
\ 'syntax': 'markdown',
\ 'ext': '.md'
\ }]
Log "Declare my extension for temporary wiki"
let g:vimwiki_ext2syntax = {'.md': 'markdown'}
Log "Reload vimwiki <- vader_setup.vader"
call ReloadVimwiki()
Execute (Assert: 2 wiki in Index):
AssertEqual 2, len(vimwiki_wikilocal_vars)
Execute (VimwikiIndex):
VimwikiIndex 1
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
AssertEqual 'vimwiki', &filetype
AssertEqual 'test/resources/testmarkdown/', vimwiki_wikilocal_vars[0]['path']
AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
Execute (Open buzz bozz):
edit test/resources/testmarkdown/buzz_bozz.md
AssertEqual 'test/resources/testmarkdown/buzz_bozz.md', expand('%')
# 1 Global {{{1
###############
Execute (===========================================================):
Log "Checking global map"
Do (,ww -> open index [Assert]):
,ww
:AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wt -> open index in tab [Assert]):
,wt
:AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(2)
\<CR>
Do (,w,w -> open diary [Assert]):
,w,w
:AssertEqual 'test/resources/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,t -> open diary in tab [Assert]):
,w,t
:AssertEqual 'test/resources/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
\<CR>
:call AssertTab(2)
\<CR>
Do (,ws -> list and select wiki [Assert]):
,ws
1
\<CR>
:AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wi -> open diary index [Assert]):
,wi
:AssertEqual 'test/resources/testmarkdown/diary/diary.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,y -> open yesterday [Assert]):
,w,y
:AssertEqual 'test/resources/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 'test/resources/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.1 Heading {{{2
##############
Do (,wn -> Create new wiki [Assert]):
,wn
new_file1
\<CR>
:AssertEqual 'test/resources/testmarkdown/new_file1.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wd -> Delete wiki yes [Assert]):
:edit 'test/resources/testmarkdown/file_new1.md'
\<CR>
,wn
new_file2
\<CR>
ithis is content 2
\<Esc>
,wd
yes
\<CR>
:AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
\<CR>
Do (,wd -> Delete wiki no [Assert]):
:edit 'test/resources/testmarkdown/file_new1.md'
\<CR>
,wn
new_file2
\<CR>
ithis is content 1
\<Esc>
,wd
no
\<CR>
:AssertEqual 'test/resources/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 'test/resources/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
##############
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
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
# 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
Include: vader_teardown
# vim: foldmethod=marker foldlevel=30 sw=2
-1
View File
@@ -1 +0,0 @@
../vader_includes/vader_setup.vader
-1
View File
@@ -1 +0,0 @@
../vader_includes/vader_teardown.vader
+35
View File
@@ -0,0 +1,35 @@
# Issue: #1261: Feature: Support for <mark> in Markdown
Given vimwiki (Single line mark):
<mark>Single line</mark>
01234567890
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert all is yaml except after the closing ---):
AssertEqual 'VimwikiMarkTag1', GetSyntaxStack(1, 7)[0] . 1
AssertEqual '02', len(GetSyntaxStack(2, 7)) . 2
Given vimwiki (Multiple line mark):
<mark>Start
Multiple
Line
end</mark>
01234567890
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert all is yaml except after the closing ---):
AssertEqual 'VimwikiMarkTag1', GetSyntaxStack(1, 7)[0] . 1
AssertEqual 'VimwikiMarkTag2', GetSyntaxStack(2, 2)[0] . 2
AssertEqual 'VimwikiMarkTag3', GetSyntaxStack(3, 2)[0] . 3
AssertEqual 'VimwikiMarkTag4', GetSyntaxStack(4, 2)[0] . 4
AssertEqual '05', len(GetSyntaxStack(5, 7)) . 5
+41
View File
@@ -0,0 +1,41 @@
# Non regression tests for issue: #1270
Given vimwiki (Dummy heading):
# Test
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (call add header 1):
call vimwiki#base#AddHeaderLevel(1)
Expect (Heading 2):
## Test
Execute (call add header 2):
call vimwiki#base#AddHeaderLevel(2)
Expect (Heading 3):
### Test
Execute (call add header 5):
call vimwiki#base#AddHeaderLevel(5)
Expect (Heading6):
###### Test
Do (5=):
5=
Expect (Heading6):
###### Test
Given vimwiki (Dummy heading 6):
###### Test
Do (5-):
5-
Expect (Heading decreased by 5):
# Test
+75
View File
@@ -0,0 +1,75 @@
# Issue: #1274
# Feature: Markdown -- Continue blockquote when <CR> is pressed in insert mode.
Given vimwiki (Blockquote with test {{{1):
> Dummy text 1
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Press insert, enter and type):
A
\<Cr>
Dummy text 2
Expect(Marker added 1):
> Dummy text 1
> Dummy text 2
Do (Press o and type):
o
Dummy text 2
Expect(Marker added 2):
> Dummy text 1
> Dummy text 2
Do (Press O and type):
O
Dummy text 2
Expect(Marker added 3, above):
> Dummy text 2
> Dummy text 1
Given vimwiki (Blockquote without test {{{1):
>
Do (Press insert, enter and type):
A
\<Cr>
Dummy text 2
Expect(Marker removed):
Dummy text 2
Do (Press o):
o
Dummy text 2
Expect(Marker appended, below):
>
> Dummy text 2
Do (Press O):
O
Dummy text 2
Expect(Marker appended, above):
> Dummy text 2
>
+32
View File
@@ -0,0 +1,32 @@
# Non regression tests for issue: #1279
# Fix/Improvement: When re-wrap a long line in a definition by 'gq' it should insert ':: ' at the new line
Given vimwiki (Dummy heading):
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
Do (gqq):
gqq
Expect (Wrapped with the :: prefix prepended):
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
:: aaa aaa aaa
Given vimwiki (Small heading):
:: aaa
Execute (Log):
call SetSyntax("default")
Log 'Comments: ' . &comments
Log 'Formatoptions: ' . &formatoptions
Log 'Blockquote_markers: ' . string(vimwiki#vars#get_syntaxlocal('blockquote_markers'))
Log 'Syntax: ' . vimwiki#vars#get_wikilocal('syntax')
Do (A <CR>):
A\<CR>
Expect (Bloquote prefix :: inserted):
:: aaa
::
+99
View File
@@ -0,0 +1,99 @@
# Non regression tests for issue: #1287
Before(Define function for yaml inspection):
function! Issue1287Yaml(line)
" The line where the yaml delimiter is: 1 if at top
let l = a:line
Log "1: " . string(GetSyntaxStack(l + 0, 2))
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 0, 2)[0]
Log '2: ' . string(GetSyntaxStack(l + 0, 2))
AssertEqual 'VimwikiPre', GetSyntaxStack(l + 0, 2)[1]
Log '3: ' . string(GetSyntaxStack(l + 1, 2))
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 1, 2)[0]
Log '4: ' . string(GetSyntaxStack(l + 2, 2))
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 2, 2)[0]
Log '5: ' . string(GetSyntaxStack(l + 2, 20))
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 2, 20)[0]
Log '6: ' . string(GetSyntaxStack(l + 3, 2))
AssertEqual 'VimwikiPre', GetSyntaxStack(l + 3, 2)[-1]
endfunction
Given vimwiki (Yaml with --- at top):
---
title: my title
description: my description
---
Execute (Assert delimiter with --- at top):
call Issue1287Yaml(1)
Given vimwiki (Yaml with --- at bottom):
---
title: my title
description: my description
...
Execute (Assert delimiter with ... at bottom):
call Issue1287Yaml(1)
Given vimwiki (Yaml with --- after empty line):
A stupid block
of 2 lines
---
title: my title
description: my description
---
Execute (Assert delimiter with --- after empty line):
call Issue1287Yaml(4)
Given vimwiki (Yaml with --- mixed with ...):
---
title: my title
...
comment: my comment
description: my description
---
And a text follows
Execute (Assert all is yaml except after the closing ---):
AssertEqual 'textSnipYAML1', GetSyntaxStack(1, 2)[0] . 1
AssertEqual 'VimwikiPre1', GetSyntaxStack(1, 2)[1] . 1
AssertEqual 'textSnipYAML1', GetSyntaxStack(1, 2)[0] . 1
AssertEqual 'textSnipYAML2', GetSyntaxStack(2, 2)[0] . 2
AssertEqual 'VimwikiPre3', GetSyntaxStack(3, 2)[0] . 3
AssertEqual 0, len(GetSyntaxStack(7, 2))
AssertEqual 0, len(GetSyntaxStack(8, 2))
Given vimwiki (Yaml with --- with a --- not a start of line):
---
title: my title
comment: my comment ---
description: my description
---
And a text follows
Execute (Assert all is yaml except after the closing ---):
AssertEqual 'textSnipYAML1', GetSyntaxStack(1, 2)[0] . 1
AssertEqual 'VimwikiPre1', GetSyntaxStack(1, 2)[1] . 1
AssertEqual 'textSnipYAML1', GetSyntaxStack(1, 2)[0] . 1
AssertEqual 'textSnipYAML2', GetSyntaxStack(2, 2)[0] . 2
AssertEqual 'textSnipYAML3', GetSyntaxStack(3, 2)[0] . 3
AssertEqual 'textSnipYAML4', GetSyntaxStack(4, 2)[0] . 4
AssertEqual 'VimwikiPre5', GetSyntaxStack(5, 2)[-1] . 5
AssertEqual 0, len(GetSyntaxStack(6, 2))
AssertEqual 0, len(GetSyntaxStack(7, 2))
+45
View File
@@ -0,0 +1,45 @@
# Non regression tests for issue TODO
# -- TODO copy-paste issue description
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Empty file):
Execute (Set vimwiki property rxTableSep):
call SetSyntax('markdown')
call vimwiki#vars#set_syntaxlocal('rxTableSep', '│' )
AssertEqual '│', vimwiki#vars#get_syntaxlocal('rxTableSep'), "Conf has been changed"
Execute(VimwikiTable):
VimwikiTable
Expect (Unicode table created):
│ │ │ │ │ │
│---│---│---│---│---│
│ │ │ │ │ │
Given vimwiki (Unicode table):
│ bla bla bla │ │ │ │ │
│---│---│---│---│---│
│ │ │ │ │ │
Execute (Rename file wiki_test.md for table expand):
file wiki_test.md
call SetSyntax('markdown')
call vimwiki#vars#set_syntaxlocal('rxTableSep', '│' )
Do (Expand table):
:AssertEqual '│', vimwiki#vars#get_syntaxlocal('rxTableSep'), "Conf has been changed"\<Cr>
A
Expect (Unicode table expanded):
│ bla bla bla │ │ │ │ │
│-------------│---│---│---│---│
│ │ │ │ │ │
@@ -0,0 +1,36 @@
# Non regression tests for issue #1311
# -- Can't enable syntax highlighting for codes in HTML files when converting wiki to HTML
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file with python code):
{{{type=py
if (a == 2):
print("2")
else:
print("other")
}}}
Execute (Convert to HTML):
Log "HTML path: " . vimwiki#vars#get_wikilocal('path_html')
let g:bck_command = g:vimwiki_global_vars['listing_hl_command']
let g:vimwiki_global_vars['listing_hl_command'] = 'cat'
call ConvertWiki2Body()
g/^\s*$/d
Expect (Output with good newlines):
<pre type=py>
if (a == 2):
print("2")
else:
print("other")
</pre>
Execute (restore):
let g:vimwiki_global_vars['listing_hl_command'] = g:bck_command
+36
View File
@@ -0,0 +1,36 @@
# Non regression tests for issue:
# -- How to turn off inline math highlights?
Given vimwiki (All math inline possible):
12345678901234567890123456789
2023-06-22
23-06-22
due:2023-06-22
+ProjectName project description
@ContextName context description
Other +ProjectName and desc
Other @ContectName and desc
Execute (Assert all lines):
# Math
AssertEqual 'normal', GetSyntaxVimwiki(1, 1)
AssertEqual 'TodoDate', GetSyntaxVimwiki(2, 1)
AssertEqual 'TodoDate', GetSyntaxVimwiki(3, 1)
AssertEqual 'TodoDueDate', GetSyntaxVimwiki(4, 1)
AssertEqual 'TodoProject', GetSyntaxVimwiki(6, 1)
AssertEqual 'normal', GetSyntaxVimwiki(6, 15)
AssertEqual 'TodoContext', GetSyntaxVimwiki(7, 1)
AssertEqual 'normal', GetSyntaxVimwiki(7, 15)
AssertEqual 'normal', GetSyntaxVimwiki(9, 1)
AssertEqual 'TodoProject', GetSyntaxVimwiki(9, 10)
AssertEqual 'normal', GetSyntaxVimwiki(9, 20)
AssertEqual 'normal', GetSyntaxVimwiki(10, 1)
AssertEqual 'TodoContext', GetSyntaxVimwiki(10, 10)
AssertEqual 'normal', GetSyntaxVimwiki(10, 20)
+46
View File
@@ -0,0 +1,46 @@
# Non regression tests for issue 1323
# -- Folding code blocks using markdown syntax folds the entire rest of the file #1323
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file):
# Header
```sql
SELECT blah FROM bleh;
```
More text in session one
# Header two
More text in session two
Execute (Cheat vars):
call SetSyntax('markdown')
let old_foldexpr = &foldexpr
let old_foldmethod = &foldmethod
set foldexpr=VimwikiFoldLevel(v:lnum)
set foldmethod=expr
Execute (Call function to verify):
AssertEqual 'line 1 => 1', 'line 1 => ' . foldlevel(1)
AssertEqual 'line 2 => 1', 'line 2 => ' . foldlevel(2)
AssertEqual 'line 3 => 2', 'line 3 => ' . foldlevel(3)
AssertEqual 'line 4 => 2', 'line 4 => ' . foldlevel(4)
AssertEqual 'line 5 => 2', 'line 5 => ' . foldlevel(5)
AssertEqual 'line 6 => 1', 'line 6 => ' . foldlevel(6)
AssertEqual 'line 7 => 1', 'line 7 => ' . foldlevel(7)
AssertEqual 'line 8 => 1', 'line 8 => ' . foldlevel(8)
AssertEqual 'line 9 => 0', 'line 9 => ' . foldlevel(9)
# AssertEqual 'line 10 => 1', 'line 10 => ' . foldlevel(10)
# AssertEqual 'line 11 => 1', 'line 11 => ' . foldlevel(11)
Execute (Restore vars):
# call SetSyntax('default')
let &foldexpr = old_foldexpr
let &foldmethod = old_foldmethod
+29
View File
@@ -0,0 +1,29 @@
# Non regression tests for issue: #1325
# -- Bold syntax highlighting broken for default syntax since 72d0220 (tk Brennen)
Given vimwiki (All math inline possible):
*foo:* bar #1: Bold
<!-- exec-raw zsh -c 'grep --exclude-dir="*logscratch" -rino -- "- \[ \].*$" ~/notes/vimwiki' | perl -pe 's{^/home/brennen/notes/vimwiki/(.*?)\.wiki:(\d+):- \[ \] (.*?)$}{ - [[$1|$1]] - ($2) $3}' -->
# 2: Online comment # 3
<!--
multiple line # 5
comment # 6
-->
123456789
Execute (Set syntax wiki):
call SetSyntax('default')
Log &foldexpr
Log &foldmethod
Execute (Assert syntax):
# Bold
# AssertEqual 'VimwikiBold1', GetSyntaxStack(1, 2)[0] . 1
AssertEqual '02', len(GetSyntaxStack(1, 8)) . 2
# HTML Comment
AssertEqual 'VimwikiComment3', GetSyntaxStack(2, 6)[0] . 3
# Multiline HTML Comment
AssertEqual 'VimwikiComment4', GetSyntaxStack(5, 2)[0] . 4
@@ -0,0 +1,65 @@
# Tests for issue: 1326
# Multiple discrete tags on one line
# cause duplicate entries in .vimwiki_tags
# For example, this line:
# :tag1:tag2:
# gives correct results in .vimwiki_tags when VimwikiRebuildTags is called.
# This line
# :tag3: :tag4:
# gives duplicate entries for tag4.
Execute (Start with no content or .vimwiki_tags files - Start issue 1326 test):
call system("rm $HOME/testwiki/.vimwiki_tags")
call system("rm $HOME/testwiki/Test-Tag-issue-1326.wiki")
Do (Create file with tags and rebuild all tags):
:edit! $HOME/testwiki/Test-Tag-issue-1326.wiki\<CR>
I
:discrete1: :discrete2:\<CR>
:concat1:concat2:\<CR>
:mixed1:mixed2: :mixed3: :mixed4:\<CR>
\<Esc>
:write\<CR>
:VimwikiRebuildTags!\<CR>
Execute (Examine .vimwiki_tags file for generated tag entries.):
edit $HOME/testwiki/.vimwiki_tags
AssertEqual $HOME . '/testwiki/.vimwiki_tags', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
# For each tag, make sure it is found # once and ONLY once in
# the .vimwiki_tags file.
# The "AssertNotEqual" tests that the tag is present at least once.
# The "AssertEqual" searches for the tag 2 times and checks that the
# line number where it was found is the same both times.
# The 'w' flag tells search to wrap around at the end of the file.
# The 'e' flag makes search position the cursor at the end of the match.
AssertNotEqual 0, search('concat1', 'we'), 'Expected tag "concat1" was not found.'
AssertEqual search('concat1', 'we'), search('concat1', 'we'), 'More than 1 instance of tag "concat1" found'
AssertNotEqual 0, search('concat2', 'we'), 'Expected tag "concat2" was not found.'
AssertEqual search('concat2', 'we'), search('concat2', 'we'), 'More than 1 instance of tag "concat2" found'
AssertNotEqual 0, search('discrete1', 'we'), 'Expected tag "discrete1" was not found.'
AssertEqual search('discrete1', 'we'), search('discrete1', 'we'), 'More than 1 instance of tag "discrete1" found'
AssertNotEqual 0, search('discrete2', 'we'), 'Expected tag "discrete2" was not found.'
AssertEqual search('discrete2', 'we'), search('discrete2', 'we'), 'More than 1 instance of tag "discrete2" found'
AssertNotEqual 0, search('mixed1', 'we'), 'Expected tag "mixed1" was not found.'
AssertEqual search('mixed1', 'we'), search('mixed1', 'we'), 'More than 1 instance of tag "mixed1" found'
AssertNotEqual 0, search('mixed2', 'we'), 'Expected tag "mixed2" was not found.'
AssertEqual search('mixed2', 'we'), search('mixed2', 'we'), 'More than 1 instance of tag "mixed2" found'
AssertNotEqual 0, search('mixed3', 'we'), 'Expected tag "mixed3" was not found.'
AssertEqual search('mixed3', 'we'), search('mixed3', 'we'), 'More than 1 instance of tag "mixed3" found'
AssertNotEqual 0, search('mixed4', 'we'), 'Expected tag "mixed4" was not found.'
AssertEqual search('mixed4', 'we'), search('mixed4', 'we'), 'More than 1 instance of tag "mixed4" found'
Execute (Remove content and tags files - End issue 1326 test):
call system("rm $HOME/testwiki/.vimwiki_tags")
call system("rm $HOME/testwiki/Test-Tag-issue-1326.wiki")
+148
View File
@@ -0,0 +1,148 @@
# Non regression tests for issue TODO
# -- TODO copy-paste issue description
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Execute (Set syntax markdown):
call SetSyntax('markdown')
file issue1356.md
Log 'Initial file:' . resolve(expand('%:p'))
Do (Jump1):
1G
\<Cr>
A--Link1\<Esc>
Expect(Link1):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne--Link1
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Do (Jump2):
2G
\<Cr>
A--Link2\<Esc>
Expect (Link2):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo--Link2
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Do (Jump3):
3G
\<Cr>
A--Link3\<Esc>
Expect (Link3):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo--Link3
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Do (Jump4):
4G
\<Cr>
A--Link4\<Esc>
Expect (Link4):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo--Link4
## SubCategoryThree
Do (Jump5):
5G
\<Cr>
A--Link5\<Esc>
Expect (Link5):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree--Link5
+35
View File
@@ -0,0 +1,35 @@
# Non regression tests for issue: #150
# -- How to turn off inline math highlights?
# From: https://pandoc.org/MANUAL.html#math
# Anything between two $ characters will be treated as TeX math. The opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus, $20,000 and $30,000 wont parse as math. If for some reason you need to enclose text in literal $ characters, backslash-escape them and they wont be treated as math delimiters.
Given vimwiki (All math inline possible):
12345678901234567890 # 01 Just a counter
This $math \sum{2, 3}$ # 02 Math no trap
$This math 3 \times 4 = 12$ # 03 Math all line
This $3 and $4 is not math # 04 Not math as the last $ is followed by 4
This 3$ and 4$ is not math # 05 Not math as the first $ is folowed by space
This \$3 and $4 is not math at all # 06 Not math as first escaped
This $3 and \$4 is not math at all # 07 Not math as last escaped
This \$3 and \$4 is not math at all # 08 Not math as both escaped
This $is not math either $320 # 09 Not math as last followd by number (bis)
Execute (Assert all lines):
# Hi
Log 'Normal: ' . string(GetSyntaxStack(1, 10))
Log 'Math: ' . string(GetSyntaxStack(2, 10))
AssertEqual '01', len(GetSyntaxStack(1, 10)) . 1
# Math
AssertEqual 'textSnipTEX2', GetSyntaxStack(2, 10)[0] . 2
AssertEqual 'textSnipTEX3', GetSyntaxStack(3, 10)[0] . 3
# Not Math
AssertEqual '04', len(GetSyntaxStack(10, 4)) . 4
AssertEqual '05', len(GetSyntaxStack(10, 5)) . 5
AssertEqual '06', len(GetSyntaxStack(10, 6)) . 6
AssertEqual '07', len(GetSyntaxStack(10, 7)) . 7
AssertEqual '08', len(GetSyntaxStack(10, 8)) . 8
AssertEqual '09', len(GetSyntaxStack(10, 9)) . 9
+16
View File
@@ -0,0 +1,16 @@
# Non regression tests for issue TODO
# -- TODO copy-paste issue description
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file):
test
Execute (Call function to verify):
echo 'Dummy command, not displayed'
Log 'Debug message displayed in Vader output'
AssertEqual 'test', getline(1), 'Dummy assertion'
Expect (Output file):
test
+177
View File
@@ -0,0 +1,177 @@
# Non regression tests for issues, see changelog
# In reverse chronological order
#
# Thanks to all contributors with issues and pull request on github
#
Given vimwiki (a):
a
Execute (Set filename wiki_test.md):
file wiki_test.md
Expect (a):
a
################################################################################
Execute (Log):
Log '#915 Vimwiki Markdown Blockquote Syntax issue'
call SetSyntax('markdown')
Given vimwiki (One blockquote):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.
Do (gqq):
gqq
Expect (Well formated and cursor on Sed):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
> est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
> vel.
Do (move cursor and gww):
fS
gww
i__HERE__
Expect (Well formated and cursor on Sed):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
> est sed facilisis. __HERE__Sed imperdiet massa tellus, eu fermentum felis fringilla
> vel.
Given vimwiki (Multiple line blockquote):
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
> est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
> vel.
Execute (no JJ && Assert for Version > 7.3):
normal JJ
if v:version > 703
AssertEqual getline(1), '> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.'
endif
################################################################################
Execute (Log):
Log '#949 <Enter> create link bug with Chinese characters'
call SetSyntax('markdown')
Given vimwiki (Madarin with vimwiki Yeeepy):
你好
你们好
你们好啊
你们好啊啊
你们好啊aaaaa
aaaaa你们好啊
Do (Enter in all):
\<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j
Expect (all WORDS are links):
[你](你)
[你好](你好)
[你们好](你们好)
[你们好啊](你们好啊)
[你们好啊啊](你们好啊啊)
[你们好啊aaaaa](你们好啊aaaaa)
[aaaaa你们好啊](aaaaa你们好啊)
################################################################################
Execute (Log):
Log '#735 Fix off-by-one error in get_next_line and get_prev_line'
file wiki_test.md
call SetSyntax('markdown')
Given vimwiki (P#735 -> I#407):
1. item1
2. item2
```
echo "hello world"
```
3. item3
Do (o):
o
Expect (Renumber all):
1. item1
2.
3. item2
```
echo "hello world"
```
4. item3
################################################################################
Execute (Log):
Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)'
call SetSyntax('markdown')
Given vimwiki (Void):
Execute (conceal):
set conceallevel=1
let g:vimwiki_global_vars['conceallevel']=2
Log ' ConcealLevel is set to vimwiki for a .md'
call SetSyntax('markdown')
file main.md
edit
AssertEqual &ft, 'vimwiki'
AssertEqual @%, 'main.md'
if exists('+conceallevel')
AssertEqual &conceallevel, 2
endif
Log ' ConcealLevel is set to vim for a no_ext'
edit no_ext
AssertEqual &ft, ''
if exists('+conceallevel')
AssertEqual &conceallevel, 1
endif
Log ' Again ConcealLevel is set to vimwiki for a .md (just for fun)'
let g:vimwiki_global_vars['conceallevel']=0
edit new.md
AssertEqual &ft, 'vimwiki'
AssertEqual @%, 'new.md'
if exists('+conceallevel')
AssertEqual &conceallevel, 0
endif
################################################################################
Execute (Log):
Log 'PR #528: Add option |g:vimwiki_create_link| to prevent link creation'
call SetSyntax('markdown')
Given vimwiki (Link):
Link
Do (Enter):
\<CR>
# TODO should be Link.md, revise the test
Expect (Link):
[Link](Link)
Do (<CR><CR>):
\<CR>\<CR>
:AssertEqual expand('%:t'), 'Link.md'\<CR>
Given vimwiki (Link):
Link
Do (No link: <CR><CR>):
:call vimwiki#vars#set_global('markdown_create_link', 0)
\<CR>\<CR>
:AssertEqual expand('%:t'), 'main.md'\<CR>
Expect (Link):
[Link](Link)
Execute (wipeout):
" This solves many things
file /testplugin/[Vader-workbench]
+51
View File
@@ -0,0 +1,51 @@
# See Issue #580
Given vimwiki (Void):
Tabnext
Execute (Set fold method):
let g:vimwiki_folding = 'expr:quick'
call ReloadVimwiki()
Execute (Expect < 0.5 second delay: Issue #580):
let mode = mode(1)
Log 'Mode : ' .mode
if mode ==# 'ce' || mode ==# 'cv' " -es (silent ex mode)
Log 'Skiped: Tabedit and tabnext are not working weel with -Es'
else
Log 'Prepare: Edit: mode: ' . mode
edit /testplugin/test/resources/delay.wiki
Log 'Prepare: Assert'
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
Log 'Prepare: Goto 50%'
normal! 50%
# "TODO set ft and set wiki syntax or this error (no fold found)
# "normal! zozo
Log 'Run: tabedit'
let start = reltime()
tabedit
let end = str2float(reltimestr(reltime(start)))
Log 'Verify redraw'
Log 'Elapsed time Tabedit = ' . string(end)
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
Log 'Run: redraw'
let start = reltime()
tabprev
redraw
let end = str2float(reltimestr(reltime(start)))
Log 'Verify redraw'
Log 'Elapsed time redraw = ' . string(end)
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
endif
Execute (Reset variables):
call DeleteFile('/testplugin/test/resources/delay.wiki')
let g:vimwiki_folding = ''
call ReloadVimwiki()
Expect vimwiki (Tabnext):
Tabnext
+440
View File
@@ -0,0 +1,440 @@
# 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
+352 -2
View File
@@ -1,4 +1,351 @@
Include: vader_includes/vader_setup.vader
# 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
@@ -122,4 +469,7 @@ Expect (Mediawiki links):
[[file.md]]
[[file.mw]]
Include: vader_includes/vader_teardown.vader
Execute(Clean: Icreated many temporary wiki):
call ReloadVimwiki()
# vim: foldmethod=marker foldlevel=30
+262
View File
@@ -0,0 +1,262 @@
# Automatic link generation
# Related to:
# - wiki file discovery
# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
Execute (Reset sw to default (due to batch)):
set sw=8
# 1 VimwikiGenerateLinks {{{1
##########################
# Wiki Syntax (no caption, default) {{{2
#################
Execute (Log):
Log 'Wiki Syntax (no caption, default)'
call ReloadVimwiki()
AssertEqual '-1_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
Given (Void):
Execute (VimwikiGenerateLinks):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
Expect (The links with a header):
= Generated Links =
- [[buzz_bozz]]
- [[index]]
- [[link_syntax]]
- [[link_syntax/nested]]
Execute (VimwikiGenerateLinks x 2):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
call append('$', 'Last Line')
VimwikiGenerateLinks
Expect (The links with a header (bis)):
= Generated Links =
- [[buzz_bozz]]
- [[index]]
- [[link_syntax]]
- [[link_syntax/nested]]
Last Line
Execute (Clean Test.wiki):
call DeleteFile('$HOME/testwiki/Test.wiki')
# Wiki Syntax (with caption) {{{2
#################
Execute (Log):
Log 'Wiki Syntax (with caption)'
let vimwiki_default.generated_links_caption = 1
call ReloadVimwiki()
AssertEqual '-1_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
Given (Void):
Execute (VimwikiGenerateLinks):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
Expect (The links with a header):
= Generated Links =
- [[buzz_bozz|Buzz Bozz]]
- [[index|Test Wiki]]
- [[link_syntax]]
- [[link_syntax/nested]]
Execute (VimwikiGenerateLinks x 2):
edit $HOME/testwiki/Test.wiki
VimwikiGenerateLinks
call append('$', 'Last Line')
VimwikiGenerateLinks
Expect (The links with a header (bis)):
= Generated Links =
- [[buzz_bozz|Buzz Bozz]]
- [[index|Test Wiki]]
- [[link_syntax]]
- [[link_syntax/nested]]
Last Line
Execute (Clean Test.wiki):
call DeleteFile('$HOME/testwiki/Test.wiki')
# Markdown Syntax {{{2
#################
Execute (Log):
Log 'Markdown Syntax'
Given (Void):
Execute (Goto markdown resource wiki):
VimwikiIndex 2
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
Execute (Edit Test file / VimwikiGenerateLinks):
edit $HOME/testmarkdown/Test.md
AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
VimwikiGenerateLinks
Expect (The links with a header):
# Generated Links
- [Buzz Bozz](buzz_bozz)
- [Test Wiki](index)
- [link_syntax](link_syntax)
- [link_syntax/nested](link_syntax/nested)
Do (Save Test.md && Re-GenerateLinks):
:edit $HOME/testmarkdown/Test.md\<CR>
:call WriteMe()\<CR>
:VimwikiGenerateLinks\<CR>
:VimwikiGenerateLinks\<CR>
Expect (The links with a header with file Test):
# Generated Links
- [Generated Links](Test)
- [Buzz Bozz](buzz_bozz)
- [Test Wiki](index)
- [link_syntax](link_syntax)
- [link_syntax/nested](link_syntax/nested)
Execute (Clean: Remove Test.md):
call DeleteFile('$HOME/testmarkdown/Test.md')
# 2 VimwikiDiaryGenerateLinks {{{1
#############################
# Wiki Syntax {{{1
#################
Execute (Log):
Log 'Wiki Syntax'
Do (Create diary files):
:edit $HOME/testwiki/diary/2019-12-10.wiki\<Cr>
:call append('$', 'Content')\<Cr>
:call WriteMe()\<Cr>
:edit $HOME/testwiki/diary/2019-07-13.wiki\<Cr>
:call append('$', 'Content')\<Cr>
:call WriteMe()\<Cr>
:edit $HOME/testwiki/diary/2019-03-01.wiki\<Cr>
:call append('$', 'Content')\<Cr>
:call WriteMe()\<Cr>
Do (Edit diary.wiki && GenerateDiaryLinks):
:edit $HOME/testwiki/diary/diary.wiki\<CR>
:VimwikiDiaryGenerateLinks\<CR>
Expect (diary index generated):
= Diary =
== 2020 ==
=== July ===
- [[2020-07-25|day 4]]
- [[2020-07-24|day 3]]
- [[2020-07-23|Day 2]]
- [[2020-07-22]]
== 2019 ==
=== December ===
- [[2019-12-10]]
=== July ===
- [[2019-07-13]]
=== March ===
- [[2019-03-01]]
Execute (Clean):
Log "End: Clean"
call DeleteFile('$HOME/testwiki/diary/2019-12-10.wiki')
call DeleteFile('$HOME/testwiki/diary/2019-07-13.wiki')
call DeleteFile('$HOME/testwiki/diary/2019-03-01.wiki')
Log "End: Reset shiftwidth to the default: 8"
# Wiki Markdown {{{1
#################
Execute (Log):
Log 'Markdown Syntax'
Execute (New Command):
Log "2. Testing VimwikiDiaryGenerateLinks TODO"
set sw=4
AssertEqual 4, &sw
Do (Edit diary/2019-12-10):
:edit $HOME/testmarkdown/diary/2019-12-10.md\<CR>
iinformative content\<Esc>
:call WriteMe()\<CR>
Do (Edit and save diary/2019-07-13):
:edit $HOME/testmarkdown/diary/2019-07-13.md\<CR>
i# informative title\<Esc>
:call WriteMe()\<CR>
Do (Edit and save diary/2018-03-01):
:edit $HOME/testmarkdown/diary/2019-03-01.md\<CR>
:call WriteMe()\<CR>
Do (Edit diary.md && GenerateDiaryLinks):
:edit $HOME/testmarkdown/diary/diary.md\<CR>
:VimwikiDiaryGenerateLinks\<CR>
Expect (diary index generated):
# Diary
## 2020
### July
- [2020-07-22](2020-07-22)
## 2019
### December
- [2019-12-10](2019-12-10)
### July
- [informative title](2019-07-13)
### March
- [2019-03-01](2019-03-01)
Execute (Clean):
call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')
Log "End: Reset shiftwidth to the default: 8"
set sw&
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
-225
View File
@@ -1,225 +0,0 @@
Include: vader_includes/vader_setup.vader
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):
file wiki_test.md
call SetSyntax('markdown')
Do (Navigate with <Tab>):
A more Contents\<Esc>
\<Tab>
\<Enter>
A more Test1\<Esc>
\<Tab>
\<Tab>
\<Enter>
A more Test2\<Esc>
Expect (Content added to titles):
# Contents more Contents
- [Test1](#Test1)
- [Test2](#Test2)
# Test1 more Test1
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
# Test2 more Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew)
Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
\<Tab>
\<Enter>
# Cursor at Test1
\<Tab>
\<Tab>
\<Enter>
# Cursor at Test2
\<Tab>
\<Tab>
\<Tab>
# Cursor at Test2/filenew
A not yet\<Esc>
\<Bs>
# Cursor at Test1/test2
A near Test1/test2
\<Esc>
\<Bs>
# Cursor at Contents/test1
A near Contents/test1
\<Esc>
Expect (Vimwiki links):
# Contents
- [Test1](#Test1) near Contents/test1
- [Test2](#Test2)
# Test1
- [Test1](#Test1)
- [Test2](#Test2) near Test1/test2
- [filenew](filenew)
# Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew) not yet
Do (Navigate with <Tab> comeback with <Bs> from filenew):
\<Tab>
A first shot\<Esc>
0\<Tab>
# Cursor at Contents/test1
\<Enter>
\<Tab>
\<Tab>
A first shot\<Esc>
0\<Tab>
# Cursor at Test1/test2
\<Enter>
G
# Cursor at Test2/filenew
A first shot\<Esc>
0\<Tab>
# Cursor at Test2/filenew
\<Enter>
# Cursor in filenew (a new file)
A anything in filenew: empirically it does not count\<Esc>
\<Bs>
# Cursor at Test2/filenew
\<Bs>
# Cursor at Test1/test2
\<Bs>
# Cursor at Contents/test1
A second shot
Expect (Just Contents/test1 got the second shot):
# Contents
- [Test1](#Test1) first shot second shot
- [Test2](#Test2)
# Test1
- [Test1](#Test1)
- [Test2](#Test2) first shot
- [filenew](filenew)
# Test2
- [Test1](#Test1)
- [Test2](#Test2)
- [filenew](filenew) first shot
Execute (Delete filenew buffer):
bd! /testplugin/filenew.md
Do (Navigate with <Tab> comeback with <Bs> too far):
\<Tab>
# Cursor at Contents/test1
\<Enter>
\<Tab>
\<Tab>
# Cursor at Test1/test2
\<Enter>
\<Tab>
# Cursor at Test2/test1
\<Enter>
\<Tab>
\<Tab>
# Cursor at Test1/test2
\<Enter>
A first test2\<Esc>
\<Tab>
# Cursor at Test2/test1
\<Enter>
A first test1\<Esc>
# Back
\<Bs>
# Cursor at Test2/test1
A second test2/test1\<Esc>
\<Bs>
# Cursor at Test1/test2
A second test1/test2\<Esc>
\<Bs>
# Cursor at Test2/test1
\<Bs>
# Cursor at Test1/test2
\<Bs>
# Cursor at Contents/test1
# Finished
\<Bs>
\<Bs>
\<Bs>
\<Bs>
A 1\<Esc>
\<Bs>
A 2\<Esc>
\<Bs>
A 3\<Esc>
\<Bs>
A 4\<Esc>
Expect (After too many <Bs>, cursor stays at the first <Enter> spot in first file: Contents/test1):
# Contents
- [Test1](#Test1) 1 2 3 4
- [Test2](#Test2)
# Test1 first test1
- [Test1](#Test1)
- [Test2](#Test2) second test1/test2
- [filenew](filenew)
# Test2 first test2
- [Test1](#Test1) second test2/test1
- [Test2](#Test2)
- [filenew](filenew)
Given vimwiki (link to self):
- [Bad link](Very bad.html)
- [My own file](wiki_test)
- [Test1](#Test1)
- [Test2](#Test2)
Do (Follow link to self and append chars):
\<Tab>
\<Tab>
\<Enter>
a this_is_18_chars \<Esc>
Expect (Some chars appended at self link):
- [Bad link](Very bad.html)
- [ this_is_18_chars My own file](wiki_test)
- [Test1](#Test1)
- [Test2](#Test2)
Include: vader_includes/vader_teardown.vader
@@ -1,10 +1,10 @@
Include: vader_includes/vader_setup.vader
# VimwikiRenameFile
# Related to link, file navigation
# Many commands are made with Do: They block with Execute
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
# Create directories I remove at end {{{1
##########################################
Execute (Mkdir dir1 dir2 dir11 dir12):
call system("mkdir $HOME/testmarkdown/dir1")
@@ -13,6 +13,112 @@ Execute (Mkdir dir1 dir2 dir11 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):
@@ -55,9 +161,14 @@ Do (Create in_root):
0\<CR>\<CR>
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
:Log 'One backspace for fun'\<CR>
\<BS>
:AssertEqual 'file ' . $HOME . '/testmarkdown/in_root.md', 'file ' . expand('%')\<CR>
# 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):
@@ -86,7 +197,10 @@ Execute (Fill in_dir11 content):
call WriteMe()
Do (RenameLink in_dir11 -> new_dir11):
# 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>
@@ -129,7 +243,6 @@ Expect (Link to in_dir11_new):
[dir2 in_dir2](dir2/in_dir2.md)
Do (in_dir2 -> in_dir2_new):
:edit $HOME/testmarkdown/dir2/in_dir2.md\<CR>
@@ -184,6 +297,4 @@ Execute (Clean dir1 and dir2):
call system('rm -r $HOME/testmarkdown/dir2')
Include: vader_includes/vader_teardown.vader
# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=#
# vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#
+122
View File
@@ -0,0 +1,122 @@
# Test resolution of as many link types as possible in Markdown syntax
# This relies on the line numbers for each type of link in link_syntax.md and
# link_syntax/nested.md, which seems primitive, but does seem to work.
# Links in a top-level page {{{
Execute (Assure link_syntax.md exists):
Log "Testing links in a top-level page with native syntax."
VimwikiIndex 2
VimwikiGoto link_syntax
AssertEqual $HOME . '/testmarkdown/link_syntax.md', expand('%')
Do (Check plain wiki page link to index):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
Do (Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.md', expand('%')\<CR>
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
Do (Check diary link):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/diary/2020-07-22.md', expand('%')\<CR>
Do (Check link to nested page):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
Do (Check relative link to nested page with ./link_syntax/nested):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax\<CR>
:7\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
# }}}
# Links in a nested file {{{
Execute (Assure link_syntax/nested.md exists):
Log "Testing links in a nested page with native syntax."
VimwikiIndex 2
VimwikiGoto link_syntax/nested
AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')
Do (Nested: Check plain wiki page link to self - link_syntax/nested.md):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.md', expand('%')\<CR>
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
Do (Nested: Check diary link):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/diary/2020-07-22.md', expand('%')\<CR>
Do (Nested: Check relative link to page in parent directory):
:VimwikiIndex 2\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testmarkdown/link_syntax.md', expand('%')\<CR>
# }}}
# To be perfectly honest I don't know why or if this is necessary, but without
# it I was getting leftover tabs for the last file visited here. -- brennen
Execute (Clean):
call ReloadVimwiki()
+122
View File
@@ -0,0 +1,122 @@
# Test resolution of as many link types as possible in VimWiki syntax
# This relies on the line numbers for each type of link in link_syntax.wiki and
# link_syntax/nested.wiki, which seems primitive, but does seem to work.
# Links in a top-level page {{{
Execute (Assure link_syntax.wiki exists):
Log "Testing links in a top-level page with native syntax."
VimwikiIndex 1
VimwikiGoto link_syntax
AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')
Do (Check plain wiki page link to index):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Check diary link):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
Do (Check link to nested page):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
Do (Check relative link to nested page with ./link_syntax/nested):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:7\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
# }}}
# Links in a nested file {{{
Execute (Assure link_syntax/nested.wiki exists):
Log "Testing links in a nested page with native syntax."
VimwikiIndex 1
VimwikiGoto link_syntax/nested
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')
Do (Nested: Check plain wiki page link to self - link_syntax/nested.wiki):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Nested: Check diary link):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
Do (Nested: Check relative link to page in parent directory):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')\<CR>
# }}}
# To be perfectly honest I don't know why or if this is necessary, but without
# it I was getting leftover tabs for the last file visited here. -- brennen
Execute (Clean):
call ReloadVimwiki()
+413
View File
@@ -0,0 +1,413 @@
# VimwikiTOC {{{1
#
# Just generate the TOC
# See: link_* for link movement and creation
#
# TODO (10min) test if g:vimwiki_to_header well readen
# TODO (10min) test vimviki_toc_link_format
# TODO (1h) test if really wiki dependant (for 2 diffrent wikis)
# TODO if link in heading
Given vimwiki (Wiki with spaces {{{1):
= h1 h2 h3 h4 =
Execute (Toc and enter (alpha)):
call SetSyntax('default')
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
AssertEqual -1, vimwiki#vars#get_wikilocal('list_margin')
VimwikiTOC
Expect (Toc alpha):
= Contents =
- [[#h1 h2 h3 h4]]
= h1 h2 h3 h4 =
Given vimwiki (Wiki with bad characters {{{1):
= h!@$%^&() =
Execute (Toc and beta):
call SetSyntax('default')
file wiki.wiki
VimwikiTOC
Expect (Toc and jumpes well):
= Contents =
- [[#h!@$%^&()]]
= h!@$%^&() =
Given vimwiki (One word headings (#981) {{{1):
= head1 =
== head2 ==
=== head3 ===
Execute (Wiki: toc_link_format=1 (to restore) VimwikiTOC x 1):
set sw=2
let vimwiki_toc_link_format = 1
call ReloadVimwiki()
call SetSyntax('default')
VimwikiTOC
Expect(Headinds TOC one word (1)):
= Contents =
- [[#head1|head1]]
- [[#head1#head2|head2]]
- [[#head1#head2#head3|head3]]
= head1 =
== head2 ==
=== head3 ===
Execute (Wiki: toc_link_format=0 (restoring default) VimwikiTOC x 1):
let vimwiki_toc_link_format = 0
call ReloadVimwiki()
call SetSyntax('default')
VimwikiTOC
Expect(Headinds TOC one word (0)):
= Contents =
- [[#head1]]
- [[#head2]]
- [[#head3]]
= head1 =
== head2 ==
=== head3 ===
Execute (Clean wiki TOC):
Given vimwiki (One heading: May delete last line (#910) {{{1):
# Basic-title
Execute (VimwikiTOC x 1):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect(Good content with 1 item x 1):
# Contents
- [Basic-title](#basic-title)
# Basic-title
Execute (VimwikiTOC x 2):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
VimwikiTOC
Expect(Good content with 1 item x 1):
# Contents
- [Basic-title](#basic-title)
# Basic-title
Given vimwiki (With link header (#182) {{{1):
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
Execute (VimwikiTOC: Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect vimwiki (With link header (#182) {{{1):
# Contents
- [A link B](#a-link-b)
- [tlink](#tlink)
- [7.4.1528](#741528)
# A [link](anything here) B
# t[link](anything here)
## 7.4.1528
Given vimwiki (Underline header (SetExt) (#209) {{{1):
First with spaces
=====
toto
Second
-------
toto
Third
-----
toto
Four
=====
toto
Last
----
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Heading SetExt created):
# Contents
- [First with spaces](#first-with-spaces)
- [Second](#second)
- [Third](#third)
- [Four](#four)
- [Last](#last)
First with spaces
=====
toto
Second
-------
toto
Third
-----
toto
Four
=====
toto
Last
----
Given vimwiki (Two same heading (#968) {{{1):
# One
toto
# ONE
like
## oNe
you
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Suffix -2 and -3):
# Contents
- [One](#one)
- [ONE](#one-2)
- [oNe](#one-3)
# One
toto
# ONE
like
## oNe
you
Given vimwiki (Heading with many bad caracters {{{1):
# One !@#@#(!%#&$^(!@
## Two !!~!!:"@!>@!>?<
Execute (Set syntax markdown && VimwikiTOC):
call SetSyntax('markdown')
set sw=8
VimwikiTOC
Expect (Bad characters are removed):
# Contents
- [One !@#@#(!%#&$^(!@](#one-)
- [Two !!~!!:"@!>@!>?<](#two-)
# One !@#@#(!%#&$^(!@
## Two !!~!!:"@!>@!>?<
# Large previous tests {{{1
Execute (Reset TOC header to default):
call vimwiki#vars#set_wikilocal('toc_header', 'Contents')
Given vimwiki (Headings):
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (Set syntax markdown && Set sw=8):
call SetSyntax('markdown')
set sw=8
Execute (VimwikiTOC):
VimwikiTOC
Expect (With a TOC sw=8):
# Contents
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (Set sw=4 && VimwikiTOC):
set sw=4
VimwikiTOC
Expect (With a TOC sw=4):
# Contents
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Do (Destroy some stuff):
jj
dd
jj
dd
Execute (VimwikiTOC):
VimwikiTOC
Expect (Brand new TOC):
# Contents
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (Let toc_header = Sommaire && VimwikiTOC):
call vimwiki#vars#set_wikilocal('toc_header', 'Sommaire')
VimwikiTOC
Expect (Append a Sommaire && Leave Contents alone):
# Sommaire
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Do (Destroy some stuff):
jj
dd
jj
dd
Execute (VimwikiTOC):
VimwikiTOC
Expect (Brand new TOC with sommaire):
# Sommaire
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
Execute (call vimwiki#vars#set_global('toc_header_level', 6):
call vimwiki#vars#set_wikilocal('toc_header_level', 6)
VimwikiTOC
# Reset default
call vimwiki#vars#set_wikilocal('toc_header_level', 1)
Expect (Content prepended):
###### Sommaire
- [Header 1](#header-1)
- [Header 1.1](#header-11)
- [Header 1.1.1](#header-111)
- [Header 2](#header-2)
- [Header 2.1.1](#header-211)
# Header 1
random text
## Header 1.1
random text
### Header 1.1.1
random text
# Header 2
### Header 2.1.1
" vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#
+196
View File
@@ -0,0 +1,196 @@
# Task List with commands
Given vimwiki (simple list):
* [X] Done 1
* [ ] Todo 1
* [X] Done 2
* [ ] Todo 2
Execute (Set syntax to default):
call SetSyntax('default')
Do (clean done, without recursion):
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
Expect (two removed):
* [ ] Todo 1
* [ ] Todo 2
Given vimwiki (simple list):
* [X] Done 1
* [ ] Todo 1
* [X] Done 2
* [ ] Todo 2
Do (clean done with recursion, function):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (two removed):
* [ ] Todo 1
* [ ] Todo 2
Given vimwiki (simple list):
* [X] Done 1
* [ ] Todo 1
* [X] Done 2
* [ ] Todo 2
Do (clean done with recursion, command):
:VimwikiRemoveDone\<Enter>
Expect (two removed):
* [ ] Todo 1
* [ ] Todo 2
Given vimwiki (with sub items):
* [X] Done 1
* [X] Subdone 1
* [ ] Todo 1
* [o] Done 2
* [X] Subdone1
* [ ] Subtodo
* [ ] Todo 2
Do (clean done, without recursion):
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
Expect (first removed):
* [ ] Todo 1
* [o] Done 2
* [X] Subdone1
* [ ] Subtodo
* [ ] Todo 2
Given vimwiki (with sub items):
* [ ] Todo 1
* [o] Done 2
* [X] Subdone1
* [ ] Subtodo
* [ ] Todo 2
Do (clean done, with recursion):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (all removed):
* [ ] Todo 1
* [ ] Done 2
* [ ] Subtodo
* [ ] Todo 2
Given vimwiki (nested list with space and code):
* [X] Done 1
* [ ] Todo 1
* [ ] Todo Post space
* [X] Done Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
* [X] Post code Done
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
Do (clean done, without recursion):
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
Expect (removed):
* [ ] Todo 1
* [ ] Todo Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
Given vimwiki (nested list with space and code):
* [X] Done 1
* [ ] Todo 1
* [ ] Todo Post space
* [X] Done Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
* [X] Post code Done
* [X] Done Sub-child
* [X] Sub-sub-child
* Without cb
Do (clean done, with recursion):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (removed):
* [ ] Todo 1
* [ ] Todo Post space
* [ ] Todo code
{{{code
* [X] print "hello, world"
}}}
* [ ] Post code Todo
Given vimwiki (two lists):
* [X] Done 1
* [ ] Todo 1
Line in between.
* [ ] Todo Post space
* [X] Done Post space
Do (clean done, with recursion):
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
Expect (only first is removed):
* [ ] Todo 1
Line in between.
* [ ] Todo Post space
* [X] Done Post space
Given vimwiki (list):
* [X] Done 1
* [ ] Todo 1
Line in between.
* [X] Done 2
* [X] Done 3
* [ ] Todo 2
* [X] Done 4
Do (clean done, with range):
:1,6VimwikiRemoveDone\<Enter>
Expect (only first is removed):
* [ ] Todo 1
Line in between.
* [X] Done 3
* [ ] Todo 2
* [X] Done 4
+6 -2
View File
@@ -1,4 +1,4 @@
Include: vader_includes/vader_setup.vader
# List indentation <= shiftwidth
Execute (Create temp directory):
silent execute '!mkdir -p $HOME/list_margin/'
@@ -37,6 +37,7 @@ Expect (Links with default margin):
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):
@@ -52,6 +53,7 @@ Execute (Set syntax media):
Execute (Generate Links):
VimwikiGenerateLinks
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
Expect (Links with default margin):
@@ -64,6 +66,7 @@ Expect (Links with default margin):
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):
@@ -92,6 +95,7 @@ Expect (Links with default margin):
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):
@@ -105,4 +109,4 @@ Expect (Links with margin == 5):
Execute (Return to default location & cleanup):
cd /testplugin
Include: vader_includes/vader_teardown.vader
# vim: sw=2:foldlevel=30:foldmethod=indent:
+45
View File
@@ -0,0 +1,45 @@
# Move and edit a list (autocommand, config_
# Test J {{{1
############################################################
Given vimwiki (Markdown * [ ] list {{{2):
* [ ] Top Level
* [o] Child 1
* [X] Child 2
* [X] Post space
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (JJJJ):
JJJJ
0y$
:call AssertIfVersion(704, '* [ ] Top Level Child 1 Child 2 Post space', @")\<Cr>
Given vimwiki (Markdown * and - list {{{2):
* one
* two
- three
- for
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (JjJ):
JjJ
gg
0y$
:call AssertIfVersion(704, '* one two', @")\<Cr>
G
0y$
:call AssertIfVersion(704, '- three for', @")\<Cr>
# vim: sw=2:foldlevel=30:foldmethod=indent:
@@ -2,9 +2,105 @@
#
# 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 ...)
Include: vader_includes/vader_setup.vader
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
@@ -279,4 +375,5 @@ Expect (List per VimwikiReturn 3 5):
1.
---
Include: vader_includes/vader_teardown.vader
# vim: sw=2:foldlevel=30:foldmethod=indent:
+249
View File
@@ -0,0 +1,249 @@
# Todo lists
Given vimwiki (Todo list):
* [ ] Chap1
* [ ] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Execute (Set syntax markdown):
call SetSyntax('markdown')
Do (Toogle Chap2: <C-Space>):
Gk\<C-Space>
Expect (Toogle Chap2):
* [ ] Chap1
* [ ] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [ ] Chap2
End
Do (Toogle Chap1: <C-Space>):
\<C-Space>
Expect (Remove nested [ ] -> [X]):
* [X] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [X] Section1.5
* [X] Section1.6
* [X] Section1.7
* [X] Section1.8
* [X] Section1.9
* [X] Section1.10
* [X] Chap2
End
Do (Toogle sub 1):
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [.] Chap1
* [X] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle sub4):
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [o] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle sub7):
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [O] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [X] Section1.5
* [X] Section1.6
* [X] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle sub10):
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
j\<C-Space>
Expect (Completing [ ] -> [.]):
* [X] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [X] Section1.5
* [X] Section1.6
* [X] Section1.7
* [X] Section1.8
* [X] Section1.9
* [X] Section1.10
* [X] Chap2
End
Do (Toogle delete todo box [gl]):
gl\<Space>
Expect (Chap1 no checkbox):
* Chap1
* [ ] Section1.1
* [ ] Section1.2
* [ ] Section1.3
* [ ] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
Do (Toogle delete todo boxes [gL<Space>]):
jgL\<Space>
Expect (Chap1.x no checkbox):
* [ ] Chap1
* Section1.1
* Section1.2
* Section1.3
* Section1.4
* Section1.5
* Section1.6
* Section1.7
* Section1.8
* Section1.9
* Section1.10
* [X] Chap2
End
Do (Visual toogl [v<C-Space>]):
jvjjj\<C-Space>
Expect (4 items toogled):
* [o] Chap1
* [X] Section1.1
* [X] Section1.2
* [X] Section1.3
* [X] Section1.4
* [ ] Section1.5
* [ ] Section1.6
* [ ] Section1.7
* [ ] Section1.8
* [ ] Section1.9
* [ ] Section1.10
* [X] Chap2
End
################################################################################
# Todo list with text above
Given vimwiki (TODO list):
Some other text
- [ ] Todo Item
Execute (:VimwikiNextTask):
:execute "VimwikiNextTask" | execute 'normal yyp'
Expect (Introduce new todo item):
Some other text
- [ ] Todo Item
- [ ] Todo Item
################################################################################
# Numbered Todo list
Given vimwiki (Number TODO list):
1. [ ] Chap1
2. [ ] Chap2
Do (Go):
Go
# Note the space at the end of 3
Expect (Introduce new Number todo item):
1. [ ] Chap1
2. [ ] Chap2
3. [ ]
Do (New item and ident):
o\<C-t>Chap1.1
# Note the tab
Expect (Introduce Chap1.1):
1. [ ] Chap1
1. [ ] Chap1.1
2. [ ] Chap2
Do (Toogle <C-Space>):
\<C-Space>
Expect (Chap1 Done):
1. [X] Chap1
2. [ ] Chap2
+2 -2
View File
@@ -1,4 +1,4 @@
Include: vader_includes/vader_setup.vader
# Task list update
Given vimwiki (Sample nested list, vimwiki syntax):
* [ ] Top Level
@@ -188,4 +188,4 @@ Expect (Sub-child toggled, parents updated):
* [X] Sub-sub-child
Include: vader_includes/vader_teardown.vader
# vim: sw=2:foldlevel=30:foldmethod=indent:
+87
View File
@@ -0,0 +1,87 @@
# Task list update, propagation disabled
Given vimwiki (Sample nested list, vimwiki syntax):
* [ ] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Child 3
Execute (Set syntax to default):
set sw=2
call SetSyntax('default')
call vimwiki#vars#set_wikilocal('listsyms_propagate', 0)
Do (Toggle top-level):
\<C-Space>
Expect vimwiki (Only top updated):
* [X] Top Level
* [ ] Child 1
* [ ] Child 2
* [ ] Child 3
Do (Toggle child 1):
j
\<C-Space>
Expect vimwiki (Only child 1 updated):
* [ ] Top Level
* [X] Child 1
* [ ] Child 2
* [ ] Child 3
Do (Toggle all children):
j
\<C-Space>
j
\<C-Space>
j
\<C-Space>
Expect vimwiki (Only children updated):
* [ ] Top Level
* [X] Child 1
* [X] Child 2
* [X] Child 3
Given vimwiki (Deeply nested list, vimwiki syntax):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
Do (Indent child 2):
jj
a\<C-D>
Expect vimwiki (Child 2 indent changed, checkmarks unchanged):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
Do (Add child 3):
jj
o
Child 3
Expect vimwiki (Child 3 added, checkmarks unchanged):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
* [ ] Child 3
Do (Add and indent child 3):
jj
o
\<C-T>
Child 3
Expect vimwiki (Child 3 added, checkmarks unchanged):
* [ ] Top Level
* [ ] Child 1
* [X] Child 2
* [ ] Child 3
Execute (Clean):
set sw&
# vim: sw=2:foldlevel=30:foldmethod=indent:
+654
View File
@@ -0,0 +1,654 @@
# Maps
# TODO make it without side effects
# -- Use the normal vimwiki or reset it
# 0 Configure {{{1
##################
Execute (VimwikiIndex):
call SetSyntax('markdown')
VimwikiIndex 2
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
AssertEqual 'vimwiki', &filetype
AssertEqual $HOME . '/testmarkdown/', vimwiki_wikilocal_vars[1]['path']
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
Execute (Open buzz bozz):
edit $HOME/testmarkdown/buzz_bozz.md
AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
# 1 Global {{{1
###############
Execute (===========================================================):
Log "Checking global map"
Do (,ww -> open index [Assert]):
,ww
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wt -> open index in tab [Assert]):
,wt
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(2)
\<CR>
Do (,w,w -> open diary [Assert]):
,w,w
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,t -> open diary in tab [Assert]):
,w,t
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
\<CR>
:call AssertTab(2)
\<CR>
Do (,ws -> list and select wiki [Assert]):
,ws
1
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wi -> open diary index [Assert]):
,wi
:AssertEqual $HOME . '/testmarkdown/diary/diary.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,y -> open yesterday [Assert]):
,w,y
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() - 60*60*24) . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,w,m -> open tomorrow [Assert]):
,wm
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() + 60*60*24) . '.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
# 2 Local {{{1
##############
#Execute (===========================================================):
# Log "Checking local map"
#
#
## 2.3 Font color {{{2
Given (Some paragraphs):
Some paragraph with some words 1
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Execute(Colorize1: Current line):
set ft=vimwiki
call SetSyntax('markdown')
AssertEqual 3, vimwiki#vars#get_bufferlocal('wiki_nr')
AssertEqual 'vimwiki', &ft
"AssertEqual ',', mapleader
" Returns: Undefeind mapleader
VimwikiColorize red
Expect (Some paragraphs):
<span style="color:#cc241d;">Some paragraph with some words 1</span>
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Execute(Colorize2: 2 lines):
2,3VimwikiColorize red
Expect (Some paragraphs):
Some paragraph with some words 1
<span style="color:#cc241d;">Some paragraph with some words 2
Some paragraph with some words 3</span>
Some paragraph with some words 4
Do(,wc):
\wc1\<Cr>\<Cr>
Expect (Some paragraphs):
<span style="background:#458588;">Some paragraph with some words 1</span>
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Do(User leave menu):
,wc\<Esc>
Expect (Some paragraphs, nothing changed):
Some paragraph with some words 1
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
Do(v,wc):
jwll
v
jjllll
\wc14\<Cr>
Expect (Some paragraphs):
Some paragraph with some words 1
Some pa<span style="color:#cc241d;">ragraph with some words 2
Some paragraph with some words 3
Some paragra</span>ph with some words 4
Do(With emoji):
Go
🤥 abcdefghi 🤥 🤥\<Cr>
🤥 abcdefghi 🤥 🤥\<Cr>
🤥 abcdefghi 🤥 🤥\<Esc>
/abc\<Cr>
ll
\<esc>\<C-v>
jjllll
\wc1\<Cr>
Expect (Some paragraphs):
Some paragraph with some words 1
Some paragraph with some words 2
Some paragraph with some words 3
Some paragraph with some words 4
🤥 ab<span style="background:#458588;">cdefghi 🤥 🤥
🤥 abcdefghi 🤥 🤥
🤥 abcdefg</span>hi 🤥 🤥
# 2.1 Heading {{{2
##############
Do (,wn -> Create new wiki [Assert]):
,wn
new_file1
\<CR>
:AssertEqual $HOME . '/testmarkdown/new_file1.md', expand('%')
\<CR>
:call AssertTab(1)
\<CR>
Do (,wd -> Delete wiki yes [Assert]):
:edit $HOME . '/testmarkdown/file_new1.md'
\<CR>
,wn
new_file2
\<CR>
ithis is content 2
\<Esc>
,wd
yes
\<CR>
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
\<CR>
Do (,wd -> Delete wiki no [Assert]):
:edit $HOME . '/testmarkdown/file_new1.md'
\<CR>
,wn
new_file2
\<CR>
ithis is content 1
\<Esc>
,wd
no
\<CR>
:AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
\<CR>
Do (,wn -> Rename wiki [Assert]):
,wn
new_file1
\<CR>
ithis is content 1
\<Esc>
,wn
new_file2
\<CR>
:AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
\<CR>
Given (Some headings):
# Head 1
## Head 1.1
content 1
# Head2
content 2
Execute (file .md):
file toto.md
edit!
AssertEqual 'vimwiki', &ft
Do (= -> add header level):
=
Expect (Inc header level):
## Head 1
## Head 1.1
content 1
# Head2
content 2
Do (- -> Dec header level):
j
-
Expect (Dec header level):
# Head 1
# Head 1.1
content 1
# Head2
content 2
# TODO fix for vim_7.3.429
# Do ([[ -> Go to the previous header):
# G
# k
# [[
# A placeholder
#
# Expect (placeholder):
# # Head 1
# ## Head 1.1 placeholder
# content 1
#
# # Head2
# content 2
#
# Do (]] -> Go to the next header):
# ]]
# A placeholder
#
# Expect (placeholder):
# # Head 1
# ## Head 1.1 placeholder
# content 1
#
# # Head2
# content 2
#
# Do ([= -> Go to the previous header which has the same level):
# G
# k
# [=
# A placeholder
#
# Expect (placeholder):
# # Head 1 placeholder
# ## Head 1.1
# content 1
#
# # Head2
# content 2
#
# Do (]= -> Go to the next header which has the same level):
# ]=
# A placeholder
#
# Expect (placeholder):
# # Head 1
# ## Head 1.1
# content 1
#
# # Head2 placeholder
# content 2
#
# Do (]u Go one level up):
# j
# ]u
# A placeholder
#
# Expect (placeholder):
# # Head 1 placeholder
# ## Head 1.1
# content 1
#
# # Head2
# content 2
#
# Do ([u Go one level up):
# j
# [u
# A placeholder
#
# Expect (placeholder):
# # Head 1 placeholder
# ## Head 1.1
# content 1
#
# # Head2
# content 2
# 2.2 List {{{2
##############
# brennen commenting this out 2021-03-29 - test seems to flap, test failures
# are difficult to diagnose.
#
# Given vimwiki (Completion list #813 {{{3):
# complete1
# complete2
# complete3
#
# Do (Insert a list item and complete):
# Go
# * comp\<C-n>\<C-n>\<Cr>\<Esc>
# # -Es -> Delete trailing *
# :let mode = mode(1)\<Cr>
# :Log 'Mode : ' .mode\<Cr>
# :if mode ==# 'ce' || mode ==# 'cv' || v:version < 704\<Cr>
# Log 'Cheating'\<Cr>
# try\<Cr>
# g/^\* \?$/d\<Cr>
# endtry\<Cr>
# endif\<Cr>
#
# Expect (With a completion but no new list item):
# complete1
# complete2
# complete3
# * complete2
#
Given (Number list):
1. I
1. Relly
2. Love
1. Very
1. Much
3. You
Execute (file .md):
file toto.md
edit!
AssertEqual 'vimwiki', &ft
set sw=2
Do (gll):
gll
Expect (Increase):
1. I
2. Relly
1. Love
1. Very
1. Much
2. You
Do (gLl):
gLl
Expect (Increase self + child):
1. I
1. Relly
1. Love
1. Very
1. Much
2. You
Do (glh):
jjj
glh
Expect (Decrease):
1. I
1. Relly
2. Love
3. Very
1. Much
4. You
Do (gLh):
jjj
gLh
Expect (Decrease self + child):
1. I
1. Relly
2. Love
3. Very
1. Much
4. You
Do (glr):
\<C-A>\<C-A>
glr
Expect (Renumber):
1. I
1. Relly
2. Love
1. Very
1. Much
3. You
# New launch
#
Given (Number list):
1. I
1. Relly
2. Love
1. Very
1. Much
3. You
Execute (file .md):
file toto.md
edit!
AssertEqual 'vimwiki', &ft
set sw=2
Do (gl*):
gl*
Expect (item -> *):
* I
1. Relly
1. Love
1. Very
1. Much
2. You
Do (gL*):
gL*
Expect (list -> *):
* I
1. Relly
* Love
1. Very
1. Much
* You
# New launch
#
Given (Bulleted list):
* I
- Relly
* Love
- Very
+ Much
* You
Execute (file .md):
set sw=2
file toto.md
edit!
let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
let g:vimwiki_syntaxlocal_vars['markdown']['bullet_types'] = ['*', '-', '+']
AssertEqual 'vimwiki', &ft
Do (gLl):
gLl
Expect (Increase):
- I
+ Relly
* Love
- Very
+ Much
* You
Do (3glh):
gLh
Expect (Decrease):
* I
- Relly
* Love
- Very
+ Much
* You
Given (Bulleted list 2):
* Love
- Very
- Much
Do (Go):
Go
Expect (New item):
* Love
- Very
- Much
-
# New launch
#
Given (List ->):
* Item1
Execute (file toto.md):
" Note: let s:markdown_syntax.bullet_types = ['*', '-', '+']
file toto.md
edit!
Log "Cycle bullets"
let g:vimwiki_syntaxlocal_vars['bullet_types'] = ['*', '-']
let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
AssertEqual g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'], 1
AssertEqual 'vimwiki', &ft
set sw=2
set expandtab " Otherwise, getting some tab before some items, when enought space
Do (o):
oItem2
Expect (Good bullet type):
* Item1
* Item2
# TODO test more, (see real cycle, but do not work with low vim)
Do (o + <C-t>):
o2
\<C-t>\<Esc>
o3
\<C-t>\<Esc>
Expect (Good bullet type):
* Item1
- 2
+ 3
Do (o + <Cr>):
A1\<Cr>
2\<C-t>\<Cr>
3\<C-t>
Expect (Good nested bullet type):
* Item11
- 2
+ 3
# TODO test: let g:vimwiki_bullet_types = ['-', '•', '→', '*']
# 3 Text Object {{{1
####################
Execute (===========================================================):
Log "Checking text object"
# 3.1 HEading Object {{{2
####################
Given (Some headings):
# Head 1
## Head 1.1
content 1
# Head2
content 2
Do (ah):
j
dah
Expect (Change A header including its content up to the next header):
# Head 1
# Head2
content 2
Do (ih):
j
dih
Expect (The content under a header):
# Head 1
## Head 1.1
# Head2
content 2
Do (aH):
daH
Expect (A header including all of its subheaders):
# Head2
content 2
Do (iH):
diH
Expect (Like 'aH', but excluding the header itself):
# Head 1
# Head2
content 2
# vim: foldmethod=marker foldlevel=30 sw=2
+3
View File
@@ -0,0 +1,3 @@
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
@@ -0,0 +1,7 @@
[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)
@@ -0,0 +1,6 @@
[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)
@@ -0,0 +1 @@
example diary entry for day 1.
@@ -0,0 +1,3 @@
= Day 2 =
another diary entry
@@ -0,0 +1,5 @@
%nohtml
== day 3 ==
and yet *another* diary entry.
@@ -0,0 +1,17 @@
= day 4 =
== subsection 1 ==
here is some code:
{{{
#!/bin/sh
echo "hello world"
}}}
== subsection 2 ==
an important list:
* point 1
* point 2
+7
View File
@@ -0,0 +1,7 @@
[[index]]
[[/index]]
[[///tmp/some_page]]
[[//~/testwiki/index]]
[[diary:2020-07-22]]
[[link_syntax/nested]]
[[./link_syntax/nested]]
@@ -0,0 +1,6 @@
[[nested]]
[[/index]]
[[///tmp/some_page]]
[[//~/testwiki/index]]
[[diary:2020-07-22]]
[[../link_syntax]]
@@ -0,0 +1,7 @@
<html>
<body>
<div class="content">
<p><small>Last updated on %date%</small></p>
</div>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
files.extend-exclude = ["test", "autoload/vimwiki/emoji.vim", "doc/vimwiki-emoji.txt"]
[default.extend-words]
# For the fo-table
fo = "fo"
Gude = "Gude"
+413 -233
View File
@@ -1,248 +1,428 @@
#!/usr/bin/env bash
# shellcheck disable=SC2155 # Declare and assign separately to avoid masking return values
: '
Vimwiki vader test script
Credit: https://github.com/w0rp/ale for script ideas and the color vader output function.
'
# Capture start time now
declare -g start_time=$(date +%s)
# credit to https://github.com/w0rp/ale for script ideas and the color vader
# output function.
printHelp() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Runs Vimwiki Vader tests or Vint in a Docker container"
echo ""
echo "-h Print help message"
echo ""
echo "-n Specify vim/nvim version to run tests for."
echo " Multiple versions can be specified by quoting the value and"
echo " separating versions with a space. E.g. -v \"vim1 vim2\"."
echo " Default is all available versions."
echo ""
echo "-l List available versions that can be used with the '-v' option"
echo ""
echo "-t Select test type: 'vader', 'vint', or 'all'"
echo ""
echo "-o Comma seperated list of tests to run."
echo " E.g. -o \"list_margin,command_toc\""
echo ""
echo "-v Turn on verbose output."
exit 0
: 'Print usage to stdout'
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
}
printVersions() {
# print the names of all vim/nvim versions
getVers
run_test(){
: 'Main function'
local -i res=0
# Hi
echo -en "Starting $(basename "$0") for VimWiki\n"
# Hook ctrl-c or ctrl-z to stop tests
trap exit 1 SIGINT SIGTERM
# 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
# WORK
parse_argument "$@"; ((res |= $?))
execute_test_argument; ((res |= $?))
# Print ellapsed time (after calculate it)
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))
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $res\n\n"
return "$res"
}
runVader() {
echo "Starting Docker container and Vader tests."
if [[ -z $only ]]; then
ind="test/independent_runs/*.vader"
res="test/*"
else
IFS=',' read -ra TEST <<< "$only"
for i in "${TEST[@]}"; do
if [[ -f "$i" ]]; then
res="$res test/${i}"
elif [[ -f "${i}.vader" ]]; then
res="$res test/${i}.vader"
elif [[ -f "independent_runs/${i}" ]]; then
ind="$ind test/independent_runs/${i}"
elif [[ -f "independent_runs/${i}.vader" ]]; then
ind="$ind test/independent_runs/${i}.vader"
else
printf "WARNING: Test \"%s\" not found.\n", "$i"
fi
done
fi
parse_argument(){
: 'Parse user argument'
# Declare color helper
declare -g red='\033[0;31m'
declare -g green='\033[0;32m'
declare -g nc='\033[0m'
# run tests for each specified version
for v in $vers; do
echo ""
echo "Running version: $v"
vim="/vim-build/bin/$v -u test/vimrc -i NONE"
test_cmd="for VF in ${ind}; do $vim \"+Vader! \$VF\"; done"
set -o pipefail
# tests that must be run in individual vim instances
# see README.md for more information
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
/bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color
# remaining tests
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
"$v" -u test/vimrc -i NONE "+Vader! ${res}" 2>&1 | vader_filter | vader_color
set +o pipefail
done
}
runVint() {
echo "Starting Docker container and running Vint."
docker run -a stdout "${flags[@]}" vint -s .
}
getVers() {
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
}
vader_filter() {
local err=0
while read -r; do
if [[ "$verbose" == 0 ]]; then
# only print possible error cases
if [[ "$REPLY" = *'docker:'* ]] || \
[[ "$REPLY" = *'Starting Vader:'* ]] || \
[[ "$REPLY" = *'Vader error:'* ]] || \
[[ "$REPLY" = *'Vim: Error '* ]]; then
echo "$REPLY"
elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
echo "$REPLY"
err=1
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
if [ "$success" -lt "$total" ]; then
err=1
fi
echo "$REPLY"
fi
else
# just print everything
echo "$REPLY"
fi
done
if [[ "$err" == 1 ]]; then
echo ""
echo "!---------Failed tests detected---------!"
echo "Run with the '-v' flag for verbose output"
echo ""
fi
}
# Say Hi
echo -en "Starting $(basename $0) for VimWiki\n"
red='\033[0;31m'
green='\033[0;32m'
nc='\033[0m'
vader_color() {
while read -r; do
if [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
[[ "$REPLY" = *'[ EXPECT] (X)'* ]] || \
[[ "$REPLY" = *'Vim: Error '* ]] || \
[[ "$REPLY" = *'Vader error:'* ]]; then
echo -en "$red"
elif [[ "$REPLY" = *'[EXECUTE]'* ]] || [[ "$REPLY" = *'[ GIVEN]'* ]]; then
echo -en "$nc"
fi
if [[ "$REPLY" = *'Success/Total'* ]]; then
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
if [ "$success" -lt "$total" ]; then
echo -en "$red"
else
echo -en "$green"
fi
echo "$REPLY"
echo -en "$nc"
else
echo "$REPLY"
fi
done
echo -en "$nc"
}
# list of vim/nvim versions
vers="$(getVers)"
# type of tests to run - vader/vint/all
type="all"
# verbose output flag
verbose=0
# only run these tests
only=""
# docker flags
flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
while getopts ":hvn:lt:o:" opt; do
# Declare: Path of the script, supposing no spaces
declare -g g_script_file=$(dirname "$0")
declare -g g_script_path=$(realpath "$g_script_file")
declare -g g_wiki_path=$(realpath "$g_script_path/..")
declare -g g_tmp_dir=$(dirname "$(mktemp -u)")
# Declare: list of vim/nvim versions
declare -g g_vers="$(print_versions)"
# Declare: type of tests to run - vader/vint/all
declare -g g_type="all"
# Declare: verbose output flag
declare -g g_verbose=0
# Declare: only run these tests
declare -g g_file_test=""
# Declare: docker flags
declare -g flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
# Parse all argument options
while getopts ":hvn:lt:f:" opt; do
case ${opt} in
h )
printHelp
;;
n )
vers="$OPTARG"
;;
v )
verbose=1
;;
l )
printVersions
;;
t )
type="$OPTARG"
;;
o )
only="$OPTARG"
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
exit 1
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
exit 1
;;
h)
printHelp
;;
n)
g_vers="$OPTARG"
;;
v)
g_verbose=1
;;
l)
print_versions
;;
t)
g_type="$OPTARG"
;;
f)
g_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
done
# Shift out parameters already processed
shift $((OPTIND -1))
# Handle error for non-option arguments
if [[ $# -ne 0 ]]; then
echo "Error: Got $# non-option arguments." 1>&2
exit 1
fi
}
execute_test_argument(){
: 'Execute test according to global variable'
# Global error return of the script
local -i res=0 ret=0
# Select and run tests
case $g_type in
vader)
run_vader; ret=$?
echo "Main Vader: returned $ret"
((res |= ret))
;;
vint)
run_vint; ret=$?
echo "Main Vint: returned $ret"
((res |= ret))
;;
all)
run_vint; ret=$?
echo "Main Vint: returned $ret"
((res |= ret))
run_vader; ret=$?
echo "Main Vader: returned $ret"
((res |= ret))
;;
*)
echo "Error: invalid type - '$g_type'" 1>&2
exit 1
esac
return "$res"
}
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 -i res=0
local opt='' current_test=''
echo "Tin 1 $g_file_test"
# Parse tests files to execute
if [[ -z "$g_file_test" ]]; then
opt="test/*"
else
read -ra TEST <<< "$g_file_test"
for current_test in "${TEST[@]}"; do
# Remove quotes
current_test=${current_test#\'}
current_test=${current_test%\'}
if [[ "$current_test" == *"*"* ]]; then
opt+=" test/${current_test}"
elif [[ -f "$current_test" ]]; then
opt+=" test/${current_test}"
elif [[ -f "${current_test}.vader" ]]; then
opt+=" test/${current_test}.vader"
else
printf "WARNING: Test \"%s\" not found.\n", "$current_test"
fi
done
fi
echo "Tin 2 $opt"
# Run tests for each specified version
for v in $g_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 "$g_tmp_dir/vader_wiki"
mkdir -p "$g_tmp_dir/vader_wiki/home"
mkdir -p "$g_tmp_dir/vader_wiki/home/test"
mkdir -p "$g_tmp_dir/vader_wiki/testplugin"
# Set vars
export ROOT="$g_tmp_dir/vader_wiki/"
export HOME="$g_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 "$g_wiki_path/"* "$ROOT/testplugin/"
# Copy home
cp -rf "$g_script_path/"* "$HOME/test/"
# Copy rtp.vim
cp -rf "$g_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 [[ "$opt" != "" ]]; then
if [[ "$v" == "local" ]]; then
pushd "$g_tmp_dir/vader_wiki/testplugin" \
|| echo 'Warning pushd testplugin failed'
# Run the tests
fcmd(){
$vim $vim_opt "+Vader! ${opt}" 2>&1 \
| vader_filter | vader_color
return ${PIPESTATUS[1]}
}
echo -e "\nStarting Batch Vim/Vader:\n<- $opt\n"
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
fcmd; ret=$?
echo -e "\nReturned Batch Vim/Vader -> $ret"
(( res |= ret ))
popd || echo 'Warning popd failed'
else
# In docker
fcmd() {
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
"${flags[@]}" "$v" $vim_opt "+Vader! ${opt}" 2>&1 \
| vader_filter | vader_color
return ${PIPESTATUS[1]}
}
echo -e "\nStarting Batch Vim/Vader with: $opt\n"
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
fcmd; ret=$?
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
(( res |= ret ))
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 "$res"
}
run_vint() {
: 'Run Vint test'
local -i res=0
local cmd="vint -s . && vint -s test/vimrc"
if echo "$g_vers" | grep "local" > /dev/null; then
echo -e "\nRunning Vint: $cmd : in $g_wiki_path"
pushd "$g_wiki_path" > /dev/null \
|| echo 'Warning pushd wiki_path failed'
$cmd
res=$(( res | $? ))
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"
res=$(( res | $? ))
fi
return "$res"
}
vader_filter() {
: 'Pipe Helper: Filter Vader Stdout'
local -i res=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"
res=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
res=1
fi
echo "$REPLY"
elif [[ "$g_verbose" != 0 ]]; then
# just print everything
echo "$REPLY"
fi
done
if (( res == 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 "$res"
}
vader_color() {
: 'Pipe Helper: Filter to add color to Vader'
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"
}
if ! (return 0 2>/dev/null); then
run_test "$@"; exit $?
fi
# stop tests on ctrl-c or ctrl-z
trap exit 1 SIGINT SIGTERM
# select which tests should run
o_error=0
case $type in
"vader" )
runVader
echo "Vader: returned $?"
o_error=$(( $? | $o_error ))
;;
"vint" )
runVint
echo "Vint: returned $?"
o_error=$(( $? | $o_error ))
;;
"all" )
runVint
echo "Vint: returned $?"
o_error=$(( $? | $o_error ))
runVader
echo "Vader: returned $?"
o_error=$(( $? | $o_error ))
;;
* )
echo "Error: invalid type - '$type'" 1>&2
exit 1
esac
echo "Script $(basename $0) exiting: $o_error"
exit $o_error
@@ -1,14 +1,22 @@
Include: vader_setup
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
" Execute command and grab output
redir => output
silent execute a:search_command
redir END
" The location list should not be empty
Assert !empty(getloclist(0)), a:test_name.": no location list result"
" The location list should contains entries
Assert match(output, '\d of \d') > -1, a:test_name.": no result message"
" Tests that VimwikiSearch is quoting the pattern correctly.
@@ -28,7 +36,6 @@ Execute (Search test wiki):
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 ''\''')
@@ -61,6 +68,6 @@ Execute (Search failure message):
redir => output
silent VimwikiSearch not_exist
redir END
Assert match(output, 'VimwikiSearch: No match found.') > -1, "expected custom error"
Include: vader_teardown
if v:version > 703
Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"
endif
+594 -72
View File
@@ -1,9 +1,390 @@
Include: vader_includes/vader_setup.vader
# Syntax and Highlight
# 0 Escape {{{1
#################
Given vimwiki (Most easy typeface):
1. 567890123
2. __bold__
3. *Italic*
4. ***Bold Italic***
5. ~~Strikethrough~~
6. <sub>Subscript</sub>
7. <sup>Superscript</sup>
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax basic typeface):
AssertEqual '1' , SyntaxAt(1, 9) . 1
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 9) . 2
AssertEqual 'VimwikiItalic3' , SyntaxAt(3, 9) . 3
AssertEqual 'VimwikiBoldItalic4' , SyntaxAt(4, 9) . 4
AssertEqual 'VimwikiDelText5' , SyntaxAt(5, 9) . 5
AssertEqual 'VimwikiSubScript6' , SyntaxAt(6, 9) . 6
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 9) . 7
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 __isss still bold__ Bold 4
and _itaaa_licccontinues and end_ Italic 5
*this aa 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
012345678901234567890
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
" TODO
" AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
" See: #1303 where an escape start can close the region
" Fixed removing vars.vim::expand_delimiter
AssertEqual 'VimwikiItalic6' , 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 $eequationeeeee$ 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
@@ -20,6 +401,29 @@ Execute (Assert Syntax 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__
@@ -36,16 +440,16 @@ Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax for typeface):
AssertEqual SyntaxAt(1, 4), 'VimwikiBold'
AssertEqual SyntaxAt(2, 4), 'VimwikiBold'
AssertEqual SyntaxAt(3, 4), 'VimwikiItalic'
AssertEqual SyntaxAt(4, 4), 'VimwikiItalic'
AssertEqual SyntaxAt(5, 4), 'VimwikiBoldItalic'
AssertEqual SyntaxAt(6, 4), 'VimwikiItalicBold'
AssertEqual SyntaxAt(7, 4), 'VimwikiDelText'
AssertEqual SyntaxAt(8, 4), 'VimwikiCode'
AssertEqual SyntaxAt(9, 4), 'VimwikiSuperScript'
AssertEqual SyntaxAt(10, 4), 'VimwikiSubScript'
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
@@ -90,24 +494,24 @@ Given vimwiki (Wiki Links):
[[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]]
Execute (Assert Syntax link):
AssertEqual SyntaxAt(2, 6), 'VimwikiLink'
AssertEqual SyntaxAt(4, 6), 'VimwikiLink'
AssertEqual SyntaxAt(6, 6), 'VimwikiLink'
AssertEqual SyntaxAt(8, 6), 'VimwikiLink'
AssertEqual SyntaxAt(10, 6), 'VimwikiLink'
AssertEqual SyntaxAt(12, 6), 'VimwikiLink'
AssertEqual SyntaxAt(14, 6), 'VimwikiLink'
AssertEqual SyntaxAt(16, 6), 'VimwikiLink'
AssertEqual SyntaxAt(18, 6), 'VimwikiLink'
AssertEqual SyntaxAt(20, 6), 'VimwikiLink'
AssertEqual SyntaxAt(22, 6), 'VimwikiLink'
AssertEqual SyntaxAt(24, 6), 'VimwikiLink'
AssertEqual SyntaxAt(26, 6), 'VimwikiLink'
AssertEqual SyntaxAt(28, 6), 'VimwikiLink'
AssertEqual SyntaxAt(30, 6), 'VimwikiLink'
AssertEqual SyntaxAt(32, 6), 'VimwikiLink'
AssertEqual SyntaxAt(34, 6), 'VimwikiLink'
AssertEqual SyntaxAt(36, 6), 'VimwikiLink'
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: >
@@ -124,14 +528,28 @@ Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax link):
AssertEqual SyntaxAt(2, 8), 'VimwikiWeblink1'
AssertEqual SyntaxAt(5, 8), 'VimwikiImage'
AssertEqual SyntaxAt(8, 8), 'VimwikiWikiLink1'
AssertEqual SyntaxAt(9, 8), 'VimwikiWikiLink1'
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 =
@@ -144,13 +562,13 @@ Given vimwiki (Wiki Headers):
Execute (Set syntax default):
call SetSyntax('default')
Execute (Assert Syntax Header):
AssertEqual SyntaxAt(1, 10), 'VimwikiHeader1'
AssertEqual SyntaxAt(2, 10), 'VimwikiHeader2'
AssertEqual SyntaxAt(3, 10), 'VimwikiHeader3'
AssertEqual SyntaxAt(4, 10), 'VimwikiHeader4'
AssertEqual SyntaxAt(5, 10), 'VimwikiHeader5'
AssertEqual SyntaxAt(6, 10), 'VimwikiHeader6'
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
@@ -163,15 +581,83 @@ Given vimwiki (Markdown Headers):
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert Syntax Header):
AssertEqual SyntaxAt(1, 10), 'VimwikiHeader1'
AssertEqual SyntaxAt(2, 10), 'VimwikiHeader2'
AssertEqual SyntaxAt(3, 10), 'VimwikiHeader3'
AssertEqual SyntaxAt(4, 10), 'VimwikiHeader4'
AssertEqual SyntaxAt(5, 10), 'VimwikiHeader5'
AssertEqual SyntaxAt(6, 10), 'VimwikiHeader6'
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
#################################
@@ -232,26 +718,26 @@ Execute (Set syntax markdown):
Execute (Assert ft, normal syntax and VimwikiTodo):
AssertEqual &ft, 'vimwiki'
AssertEqual SyntaxAt(1, 1), ''
AssertEqual SyntaxAt(2, 9), 'VimwikiTodo'
AssertEqual '', SyntaxAt(1, 1)
AssertEqual 'VimwikiTodo', SyntaxAt(2, 9)
Execute (Assert Code syntax):
AssertEqual SyntaxAt(4, 1), 'VimwikiPreDelim'
AssertEqual SyntaxAt(5, 1), 'VimwikiPre'
AssertEqual SyntaxAt(9, 1), 'vimLineComment'
AssertEqual SyntaxAt(10, 1), 'vimCommand'
AssertEqual SyntaxAt(13, 1), 'VimwikiPre'
AssertEqual SyntaxAt(14, 1), 'vimLineComment'
AssertEqual SyntaxAt(15, 1), 'vimCommand'
AssertEqual SyntaxAt(16, 1), 'VimwikiPre'
AssertEqual SyntaxAt(18, 1), 'VimwikiPre'
AssertEqual SyntaxAt(19, 1), 'vimLineComment'
AssertEqual SyntaxAt(20, 1), 'vimCommand'
AssertEqual SyntaxAt(21, 1), 'VimwikiPre'
AssertEqual SyntaxAt(23, 1), 'VimwikiPre'
AssertEqual SyntaxAt(24, 1), 'vimLineComment'
AssertEqual SyntaxAt(25, 1), 'vimCommand'
AssertEqual SyntaxAt(26, 1), 'VimwikiPre'
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
@@ -259,7 +745,7 @@ Execute (Assert Code syntax):
#######################
Given vimwiki (Math markdown):
math inline: $ \sum_i a_i^2 = 1 $
math inline: $aaaaaaaaaaaaaaa \sum_i a_i^2 = 1 end$
math block:
$$
@@ -277,8 +763,8 @@ Given vimwiki (Math markdown):
Execute (Set syntax markdown):
call SetSyntax('markdown')
Execute (Assert math syntax):
AssertEqual SyntaxAt(1, 18), 'VimwikiEqIn'
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)
@@ -289,7 +775,7 @@ Execute (Assert math syntax):
##############################
Given vimwiki (Math wiki):
math inline: $ \sum_i a_i^2 = 1 $
math inline: $aaaaaaaaaaaaaaaaaaaaaaaaaa \sum_i a_i^2 = 1$
math block:
{{$
@@ -307,12 +793,48 @@ Given vimwiki (Math wiki):
Execute (Set syntax default):
call SetSyntax('default')
Execute (Assert math syntax):
AssertEqual SyntaxAt(1, 18), 'VimwikiEqIn'
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'
Include: vader_includes/vader_teardown.vader
# 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

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