Compare commits
82 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf05d533a4 | |||
| 72792615e7 | |||
| 5cca07970c | |||
| 705ad1e0dd | |||
| 7ad424ea42 | |||
| 69318e74c8 | |||
| fde35bb87e | |||
| 2d17e6147b | |||
| d0e6d5e517 | |||
| 0bb1b4945b | |||
| a479154770 | |||
| 90b23b466f | |||
| 68664e5d72 | |||
| 5d86b625f5 | |||
| 65575fb103 | |||
| f0fe154ede | |||
| 09804c2a5f | |||
| acc92fb648 | |||
| 65b9f0e68b | |||
| c79f15a90b | |||
| 26adc84dc3 | |||
| 942da42b96 | |||
| c5b7f7e76f | |||
| bc3bc208d7 | |||
| 40c2bbdcf3 | |||
| e0a04e11b8 | |||
| 322d22bef8 | |||
| 5d0c9d3173 | |||
| f3b50e5f17 | |||
| 85c47d1f97 | |||
| 89315912b1 | |||
| a1ca439719 | |||
| 22fd036804 | |||
| 88620a2be0 | |||
| 0069c5fb4e | |||
| 738e24134e | |||
| 298a409b74 | |||
| 69a5682d6f | |||
| 0700fa4068 | |||
| 2cff9776e8 | |||
| 65c3d48227 | |||
| cd2fa19f86 | |||
| d63948d873 | |||
| cd9cfd299e | |||
| 7a48268d24 | |||
| 71edcf6802 | |||
| be45bd65f5 | |||
| ba02c38346 | |||
| 864f066405 | |||
| 8f651834fd | |||
| 11350f572b | |||
| dec6a9ecab | |||
| 57107c7c56 | |||
| 72d02207b0 | |||
| f4bd841a4c | |||
| 5eb5c9c71f | |||
| 8640988c5c | |||
| f5399ffdfa | |||
| a7aa5eb1ea | |||
| 1d35ff035d | |||
| c9af9c7807 | |||
| 8374bcfccf | |||
| cde5dbc92a | |||
| 6993610585 | |||
| 29ac6ee589 | |||
| 035b2f15c7 | |||
| eab70aedaa | |||
| 91fe25ad5f | |||
| 5db16850da | |||
| 87c44caef9 | |||
| 7f1357472d | |||
| 2f1f497f88 | |||
| f55e700828 | |||
| 8bf4d6363c | |||
| 34ceee8aaa | |||
| cd5ef6c4c7 | |||
| 6d4208157d | |||
| 48ce5b811d | |||
| acff8a5b1d | |||
| 59402cdf8b | |||
| fea8bee382 | |||
| 6d87df76cb |
@@ -1,7 +1,6 @@
|
|||||||
Prior to submitting a new issue make sure to complete these steps:
|
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.
|
- [ ] Include the VimWiki settings from your `.vimrc`
|
||||||
The `dev` branch contains fixes that may not have been merged to `master` yet.
|
- [ ] Include the syntax you are using (default / Markdown / MediaWiki)
|
||||||
- [ ] Post the syntax you are using (default/mediawiki/markdown) **and** your vimwiki settings from your `.vimrc`
|
|
||||||
- [ ] Provide a detailed description of the problem including **steps to reproduce the issue**.
|
- [ ] Provide a detailed description of the problem including **steps to reproduce the issue**.
|
||||||
- [ ] Include the output of `:VimwikiShowVersion`.
|
- [ ] Include the output of `:VimwikiShowVersion`.
|
||||||
|
|||||||
@@ -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 }}
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
# No language: we download vim and compile it oursselves
|
# 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
|
language: generic
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
|
|||||||
+9
-7
@@ -15,11 +15,13 @@ WORKDIR /vader
|
|||||||
RUN git checkout de8a976f1eae2c2b680604205c3e8b5c8882493c
|
RUN git checkout de8a976f1eae2c2b680604205c3e8b5c8882493c
|
||||||
|
|
||||||
# Build vim and neovim versions we want to test
|
# Build vim and neovim versions we want to test
|
||||||
# TODO add nvim tag
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN install_vim -tag v7.3.429 -name vim_7.3.429 -build \
|
|
||||||
-tag v7.4.1099 -name vim_7.4.1099 -build \
|
RUN install_vim -tag v7.4.2367 -name vim_7.4.2367 -build
|
||||||
-tag v7.4.1546 -name vim_7.4.1546 -build \
|
RUN install_vim -tag v8.2.5172 -name vim_8.2.5172 -build
|
||||||
-tag v8.0.0027 -name vim_8.0.0027 -build \
|
RUN install_vim -tag v9.0.2190 -name v9.0.2190 -build
|
||||||
-tag v8.1.0519 -name vim_8.1.0519 -build \
|
RUN install_vim -tag v9.1.0786 -name v9.1.0786 -build
|
||||||
-tag neovim:v0.3.8 -name nvim_0.3.8 -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.)
|
||||||
|
|||||||
@@ -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/)
|
their own syntax highlighting. See the [VimWiki Wiki](https://vimwiki.github.io/vimwikiwiki/)
|
||||||
for an example website built with VimWiki!
|
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).
|
If you are interested in contributing see [this section](#helping-vimwiki).
|
||||||
|
|
||||||
With VimWiki, you can:
|
With VimWiki, you can:
|
||||||
@@ -40,8 +39,8 @@ With VimWiki, you can:
|
|||||||
- Export everything to HTML
|
- Export everything to HTML
|
||||||
|
|
||||||
To do a quick start, press `<Leader>ww` (default is `\ww`) to go to your index
|
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`
|
wiki file. By default, it is located in `~/vimwiki/index.wiki`. See
|
||||||
for registering a different path/wiki.
|
`:h vimwiki_list` for registering a different path/wiki.
|
||||||
|
|
||||||
Feed it with the following example:
|
Feed it with the following example:
|
||||||
|
|
||||||
@@ -77,8 +76,10 @@ The result should look something like:
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
VimWiki has been tested on **Vim >= 7.3**. It will likely work on older
|
VimWiki has been tested on **Vim >= 7.3**. It may work on older versions but
|
||||||
versions but will not be officially supported.
|
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
|
### Prerequisites
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ vim +PluginInstall +qall
|
|||||||
|
|
||||||
#### Manual Install
|
#### 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/`
|
and extract it in `~/.vim/bundle/`
|
||||||
|
|
||||||
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was
|
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`
|
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
|
## Key bindings
|
||||||
|
|
||||||
### Normal mode
|
### Normal mode
|
||||||
@@ -222,11 +233,13 @@ more bindings.
|
|||||||
## Changing Wiki Syntax
|
## Changing Wiki Syntax
|
||||||
|
|
||||||
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown
|
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown
|
||||||
(markdown), and MediaWiki (media).
|
(markdown), and MediaWiki (media). 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
|
**NOTE:** Only the default syntax ships with a built-in HTML converter. For
|
||||||
Markdown or MediaWiki see `:h vimwiki-option-custom_wiki2html`. Some examples
|
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
|
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
|
||||||
following option in your `.vimrc`:
|
following option in your `.vimrc`:
|
||||||
@@ -234,18 +247,31 @@ following option in your `.vimrc`:
|
|||||||
```vim
|
```vim
|
||||||
|
|
||||||
let g:vimwiki_list = [{'path': '~/vimwiki/',
|
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
|
This option will treat all markdown files in your system as part of vimwiki
|
||||||
|
(check `set filetype?`). Add
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
let g:vimwiki_global_ext = 0
|
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.
|
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).
|
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
|
## Getting help
|
||||||
|
|
||||||
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
|
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
|
||||||
@@ -253,18 +279,20 @@ method for raising bug reports or feature requests.
|
|||||||
|
|
||||||
Additional resources:
|
Additional resources:
|
||||||
|
|
||||||
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on irc.libera.chat
|
- 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)
|
- [Connect via webchat](https://web.libera.chat/?channels=#vimwiki)
|
||||||
- Connect via Matrix/Element: [#vimwiki:libera.chat](https://matrix.to/#/#vimwiki:libera.chat)
|
- [@vimwiki@wikis.world](https://wikis.world/@vimwiki) on the Fediverse
|
||||||
- Post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
|
|
||||||
|
|
||||||
## Helping VimWiki
|
## Helping VimWiki
|
||||||
|
|
||||||
VimWiki has a lot of users but only very few recurring developers or people
|
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!
|
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) and [design_notes.md](doc/design_notes.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)
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
+131
-52
@@ -262,11 +262,20 @@ function! vimwiki#base#resolve_link(link_text, ...) abort
|
|||||||
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
" append extension iff one not already present or it's not the targeted
|
" append extension if one not already present or it's not the targeted
|
||||||
" wiki extension - https://github.com/vimwiki/vimwiki/issues/950
|
" wiki extension - https://github.com/vimwiki/vimwiki/issues/950
|
||||||
let ext = fnamemodify(link_text, ':e')
|
let ext = fnamemodify(link_text, ':e')
|
||||||
let ext_with_dot = '.' . ext
|
let ext_with_dot = '.' . ext
|
||||||
if ext ==? '' || ext_with_dot !=? vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
|
||||||
|
" Check if a .md must be added
|
||||||
|
" See #1271 to modify files with a "."
|
||||||
|
let do_add_ext = ext ==? ''
|
||||||
|
if vimwiki#vars#get_syntaxlocal('open_link_add_ext')
|
||||||
|
let do_add_ext = do_add_ext || ext_with_dot !=? vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Add the dot
|
||||||
|
if do_add_ext
|
||||||
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -394,9 +403,33 @@ function! vimwiki#base#open_link(cmd, link, ...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#base#nop1(stg) abort
|
||||||
|
" Nop with one arg, used if callback is required
|
||||||
|
return a:stg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#get_globlinks_escaped(...) abort
|
function! vimwiki#base#get_globlinks_escaped(...) abort
|
||||||
|
" Proxy: Called by command completion
|
||||||
|
let args = copy(a:000)
|
||||||
|
call insert(args, 'fnameescape')
|
||||||
|
return call('vimwiki#base#get_globlinks_callback', args)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#base#get_globlinks_raw(...) abort
|
||||||
|
" Proxy: Called by command completion
|
||||||
|
let args = copy(a:000)
|
||||||
|
call insert(args, 'vimwiki#base#nop1')
|
||||||
|
return call('vimwiki#base#get_globlinks_callback', args)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#base#get_globlinks_callback(callback, ...) abort
|
||||||
" Escape global link
|
" Escape global link
|
||||||
" Called by command completion
|
" Called by command completion
|
||||||
|
" [1] callback <string> of a function converting file <string> => escaped file <string>
|
||||||
|
" -- ex: fnameescape
|
||||||
let s_arg_lead = a:0 > 0 ? a:1 : ''
|
let s_arg_lead = a:0 > 0 ? a:1 : ''
|
||||||
" only get links from the current dir
|
" only get links from the current dir
|
||||||
" change to the directory of the current file
|
" change to the directory of the current file
|
||||||
@@ -414,8 +447,8 @@ function! vimwiki#base#get_globlinks_escaped(...) abort
|
|||||||
" " use smart case matching
|
" " use smart case matching
|
||||||
let r_arg = substitute(s_arg_lead, '\u', '[\0\l\0]', 'g')
|
let r_arg = substitute(s_arg_lead, '\u', '[\0\l\0]', 'g')
|
||||||
call filter(lst, '-1 != match(v:val, r_arg)')
|
call filter(lst, '-1 != match(v:val, r_arg)')
|
||||||
" Apply fnameescape() to each item
|
" Apply callback to each item
|
||||||
call map(lst, 'fnameescape(v:val)')
|
call map(lst, a:callback . '(v:val)')
|
||||||
" Return list (for customlist completion)
|
" Return list (for customlist completion)
|
||||||
return lst
|
return lst
|
||||||
endfunction
|
endfunction
|
||||||
@@ -449,7 +482,7 @@ function! vimwiki#base#generate_links(create, ...) abort
|
|||||||
let use_caption = vimwiki#vars#get_wikilocal('generated_links_caption', wiki_nr)
|
let use_caption = vimwiki#vars#get_wikilocal('generated_links_caption', wiki_nr)
|
||||||
for link in links
|
for link in links
|
||||||
let link_infos = vimwiki#base#resolve_link(link)
|
let link_infos = vimwiki#base#resolve_link(link)
|
||||||
if !vimwiki#base#is_diary_file(link_infos.filename, copy(l:diary_file_paths))
|
if !vimwiki#base#is_among_diary_files(link_infos.filename, copy(l:diary_file_paths))
|
||||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
|
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
|
||||||
|
|
||||||
let link_caption = vimwiki#base#read_caption(link_infos.filename)
|
let link_caption = vimwiki#base#read_caption(link_infos.filename)
|
||||||
@@ -492,15 +525,20 @@ endfunction
|
|||||||
function! vimwiki#base#goto(...) abort
|
function! vimwiki#base#goto(...) abort
|
||||||
" Jump: to other wikifile, specified on command mode
|
" Jump: to other wikifile, specified on command mode
|
||||||
" Called: by command VimwikiGoto (Exported)
|
" Called: by command VimwikiGoto (Exported)
|
||||||
let key = a:0 > 0 ? a:1 : input('Enter name: ', '',
|
let key = a:0 > 0 && a:1 !=# '' ? a:1 : input('Enter name: ', '',
|
||||||
\ 'customlist,vimwiki#base#complete_links_escaped')
|
\ 'customlist,vimwiki#base#complete_links_raw')
|
||||||
|
|
||||||
|
if key ==# ''
|
||||||
|
" Input cancelled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
let anchor = a:0 > 1 ? a:2 : ''
|
let anchor = a:0 > 1 ? a:2 : ''
|
||||||
|
|
||||||
" Save current file pos
|
" Save current file pos
|
||||||
let vimwiki_prev_link = [vimwiki#path#current_wiki_file(), getpos('.')]
|
let vimwiki_prev_link = [vimwiki#path#current_wiki_file(), getpos('.')]
|
||||||
|
|
||||||
call vimwiki#base#edit_file(':e',
|
call vimwiki#base#edit_file('edit',
|
||||||
\ vimwiki#vars#get_wikilocal('path') . key . vimwiki#vars#get_wikilocal('ext'),
|
\ vimwiki#vars#get_wikilocal('path') . key . vimwiki#vars#get_wikilocal('ext'),
|
||||||
\ anchor,
|
\ anchor,
|
||||||
\ vimwiki_prev_link,
|
\ vimwiki_prev_link,
|
||||||
@@ -664,7 +702,7 @@ function! vimwiki#base#get_anchors(filename, syntax) abort
|
|||||||
let h_match = matchlist(line, rxheader)
|
let h_match = matchlist(line, rxheader)
|
||||||
if !empty(h_match)
|
if !empty(h_match)
|
||||||
let header = vimwiki#base#normalize_anchor(h_match[2])
|
let header = vimwiki#base#normalize_anchor(h_match[2])
|
||||||
" Mesure: header level
|
" Measure: header level
|
||||||
let level = len(h_match[1])
|
let level = len(h_match[1])
|
||||||
call add(anchors, header)
|
call add(anchors, header)
|
||||||
let anchor_level[level-1] = header
|
let anchor_level[level-1] = header
|
||||||
@@ -755,7 +793,7 @@ function! vimwiki#base#normalize_anchor(anchor, ...) abort
|
|||||||
|
|
||||||
" 4 Append '-1', '-2', '-3',... to make it unique <= If that not unique
|
" 4 Append '-1', '-2', '-3',... to make it unique <= If that not unique
|
||||||
if has_key(previous_anchors, anchor)
|
if has_key(previous_anchors, anchor)
|
||||||
" Inc anchor number (before modifing the anchor)
|
" Inc anchor number (before modifying the anchor)
|
||||||
let anchor_nb = previous_anchors[anchor] + 1
|
let anchor_nb = previous_anchors[anchor] + 1
|
||||||
let previous_anchors[anchor] = anchor_nb
|
let previous_anchors[anchor] = anchor_nb
|
||||||
" Append suffix
|
" Append suffix
|
||||||
@@ -816,7 +854,7 @@ function! vimwiki#base#unnormalize_anchor(anchor) abort
|
|||||||
" For each char
|
" For each char
|
||||||
let anchor_loop = ''
|
let anchor_loop = ''
|
||||||
for char in split(anchor, '\zs')
|
for char in split(anchor, '\zs')
|
||||||
" Nest the char for easyer debugging
|
" Nest the char for easier debugging
|
||||||
let anchor_loop .= '\%('
|
let anchor_loop .= '\%('
|
||||||
|
|
||||||
" 3 Change any space to a hyphen
|
" 3 Change any space to a hyphen
|
||||||
@@ -825,7 +863,7 @@ function! vimwiki#base#unnormalize_anchor(anchor) abort
|
|||||||
let anchor_loop .= invisible_rx.'\+'
|
let anchor_loop .= invisible_rx.'\+'
|
||||||
|
|
||||||
" 2 Remove anything that is not a letter, number, CJK character, hyphen or space
|
" 2 Remove anything that is not a letter, number, CJK character, hyphen or space
|
||||||
" -- So add puncutation regex at each char
|
" -- So add punctuation regex at each char
|
||||||
else
|
else
|
||||||
" Match My_char . punctuation . ( link . punctuaction )?
|
" Match My_char . punctuation . ( link . punctuaction )?
|
||||||
" Note: Because there may be punctuation before ad after link
|
" Note: Because there may be punctuation before ad after link
|
||||||
@@ -847,12 +885,15 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:jump_to_anchor(anchor) abort
|
function! s:jump_to_anchor(anchor) abort
|
||||||
" Jump: to anchor, doing the oposite of normalize_anchor
|
" Jump: to anchor, doing the opposite of normalize_anchor
|
||||||
" Called: edit_file
|
" Called: edit_file
|
||||||
" Get segments <= anchor
|
" Get segments <= anchor
|
||||||
let anchor = vimwiki#u#escape(a:anchor)
|
let anchor = vimwiki#u#escape(a:anchor)
|
||||||
let segments = split(anchor, '#', 0)
|
let segments = split(anchor, '#', 0)
|
||||||
|
|
||||||
|
" Start at beginning => Independent of link position
|
||||||
|
call cursor(1, 1)
|
||||||
|
|
||||||
" For markdown: there is only one segment
|
" For markdown: there is only one segment
|
||||||
for segment in segments
|
for segment in segments
|
||||||
" Craft segment pattern so that it is case insensitive and also matches dashes
|
" Craft segment pattern so that it is case insensitive and also matches dashes
|
||||||
@@ -873,7 +914,6 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
|
|||||||
" Called: jump_to_anchor with suffix and withtou suffix
|
" Called: jump_to_anchor with suffix and withtou suffix
|
||||||
" Save cursor %% Initialize at top of line
|
" Save cursor %% Initialize at top of line
|
||||||
let oldpos = getpos('.')
|
let oldpos = getpos('.')
|
||||||
call cursor(1, 1)
|
|
||||||
|
|
||||||
" Get anchor regex
|
" Get anchor regex
|
||||||
let anchor_header = s:safesubstitute(
|
let anchor_header = s:safesubstitute(
|
||||||
@@ -886,7 +926,7 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
|
|||||||
\ vimwiki#vars#get_syntaxlocal('tag_match'),
|
\ vimwiki#vars#get_syntaxlocal('tag_match'),
|
||||||
\ '__Tag__', a:segment, 'g')
|
\ '__Tag__', a:segment, 'g')
|
||||||
|
|
||||||
" Go: Move cursor: maybe more than onces (see markdown suffix)
|
" Go: Move cursor: maybe more than once (see markdown suffix)
|
||||||
let success_nb = 0
|
let success_nb = 0
|
||||||
let is_last_segment = 0
|
let is_last_segment = 0
|
||||||
for i in range(a:segment_nb)
|
for i in range(a:segment_nb)
|
||||||
@@ -898,7 +938,7 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
|
|||||||
|
|
||||||
" Succeed: Get the result and reloop or leave
|
" Succeed: Get the result and reloop or leave
|
||||||
if pos != 0
|
if pos != 0
|
||||||
" Avance, one line more to not rematch the same pattern if not last segment_nb
|
" Advance, one line more to not rematch the same pattern if not last segment_nb
|
||||||
if success_nb < a:segment_nb-1
|
if success_nb < a:segment_nb-1
|
||||||
let pos += 1
|
let pos += 1
|
||||||
let is_last_segment = -1
|
let is_last_segment = -1
|
||||||
@@ -931,9 +971,6 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Or keep on (i.e more than once segment)
|
|
||||||
let oldpos = getpos('.')
|
|
||||||
|
|
||||||
" Said 'fail' to caller
|
" Said 'fail' to caller
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
@@ -1102,11 +1139,11 @@ endfunction
|
|||||||
function! vimwiki#base#edit_file(command, filename, anchor, ...) abort
|
function! vimwiki#base#edit_file(command, filename, anchor, ...) abort
|
||||||
" Edit File: (like :e)
|
" Edit File: (like :e)
|
||||||
" :param: command <string>: ':e'
|
" :param: command <string>: ':e'
|
||||||
" :param: filename <strign> vimwiki#vars#get_wikilocal('path') . key . vimwiki#vars#get_wikilocal('ext')
|
" :param: filename <string> vimwiki#vars#get_wikilocal('path') . key . vimwiki#vars#get_wikilocal('ext')
|
||||||
" :param: anchor
|
" :param: anchor
|
||||||
" :param: (1) vimwiki_prev_link
|
" :param: (1) vimwiki_prev_link
|
||||||
" :param: (2) vimwiki#u#ft_is_vw()
|
" :param: (2) vimwiki#u#ft_is_vw()
|
||||||
let fname = escape(a:filename, '% *|#`')
|
let fname = fnameescape(a:filename)
|
||||||
let dir = fnamemodify(a:filename, ':p:h')
|
let dir = fnamemodify(a:filename, ':p:h')
|
||||||
|
|
||||||
let ok = vimwiki#path#mkdir(dir, 1)
|
let ok = vimwiki#path#mkdir(dir, 1)
|
||||||
@@ -1117,10 +1154,10 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Check if the file we want to open is already the current file
|
" Check if the file we want to open is already the current file
|
||||||
" which happens if we jump to an achor in the current file.
|
" which happens if we jump to an anchor in the current file.
|
||||||
" This hack is necessary because apparently Vim messes up the result of
|
" This hack is necessary because apparently Vim messes up the result of
|
||||||
" getpos() directly after this command. Strange.
|
" getpos() directly after this command. Strange.
|
||||||
if !(a:command ==# ':e ' && vimwiki#path#is_equal(a:filename, expand('%:p')))
|
if !(a:command =~# ':\?[ed].*' && vimwiki#path#is_equal(a:filename, expand('%:p')))
|
||||||
try
|
try
|
||||||
execute a:command fname
|
execute a:command fname
|
||||||
catch /E37:/
|
catch /E37:/
|
||||||
@@ -1130,6 +1167,10 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) abort
|
|||||||
catch /E325:/
|
catch /E325:/
|
||||||
call vimwiki#u#warn('Vim couldn''t open the file, probably because a swapfile already exists. See :h E325.')
|
call vimwiki#u#warn('Vim couldn''t open the file, probably because a swapfile already exists. See :h E325.')
|
||||||
return
|
return
|
||||||
|
catch /E319:/
|
||||||
|
call vimwiki#u#warn('Vim couldn''t open the file, cannot launch the drop command. See :h E319.')
|
||||||
|
execute 'edit' fname
|
||||||
|
return
|
||||||
endtry
|
endtry
|
||||||
" If the opened file was not already loaded by Vim, an autocommand is
|
" If the opened file was not already loaded by Vim, an autocommand is
|
||||||
" triggered at this point
|
" triggered at this point
|
||||||
@@ -1391,7 +1432,7 @@ endfunction
|
|||||||
function! s:open_wiki_buffer(item) abort
|
function! s:open_wiki_buffer(item) abort
|
||||||
" Edit wiki file.
|
" Edit wiki file.
|
||||||
" Called: by rename_file: Usefull for buffer commands
|
" Called: by rename_file: Usefull for buffer commands
|
||||||
call vimwiki#base#edit_file(':e', a:item[0], '')
|
call vimwiki#base#edit_file('edit', a:item[0], '')
|
||||||
if !empty(a:item[1])
|
if !empty(a:item[1])
|
||||||
call vimwiki#vars#set_bufferlocal('prev_links', a:item[1], a:item[0])
|
call vimwiki#vars#set_bufferlocal('prev_links', a:item[1], a:item[0])
|
||||||
endif
|
endif
|
||||||
@@ -1421,7 +1462,7 @@ function! vimwiki#base#nested_syntax(filetype, start, end, textSnipHl) abort
|
|||||||
" attempting to include them.
|
" attempting to include them.
|
||||||
" https://vi.stackexchange.com/a/10354
|
" https://vi.stackexchange.com/a/10354
|
||||||
" Previously, this used a try/catch block to intercept any errors thrown
|
" Previously, this used a try/catch block to intercept any errors thrown
|
||||||
" when attempting to include files. The error(s) interferred with running
|
" when attempting to include files. The error(s) interfered with running
|
||||||
" with Vader tests (specifically, testing VimwikiSearch).
|
" with Vader tests (specifically, testing VimwikiSearch).
|
||||||
if !empty(globpath(&runtimepath, 'syntax/'.a:filetype.'.vim'))
|
if !empty(globpath(&runtimepath, 'syntax/'.a:filetype.'.vim'))
|
||||||
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
|
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
|
||||||
@@ -1651,7 +1692,7 @@ function! vimwiki#base#follow_link(split, ...) abort
|
|||||||
\ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'))
|
\ vimwiki#vars#get_syntaxlocal('rxWeblinkMatchUrl'))
|
||||||
if lnk !=# ''
|
if lnk !=# ''
|
||||||
if lnk !~# '\%(\%('.vimwiki#vars#get_global('schemes_web').'\):\%(\/\/\)\?\)\S\{-1,}'
|
if lnk !~# '\%(\%('.vimwiki#vars#get_global('schemes_web').'\):\%(\/\/\)\?\)\S\{-1,}'
|
||||||
" prepend file: scheme so link is opened by sytem handler if it isn't a web url
|
" prepend file: scheme so link is opened by system handler if it isn't a web url
|
||||||
let lnk = 'file:'.lnk
|
let lnk = 'file:'.lnk
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -1665,23 +1706,26 @@ function! vimwiki#base#follow_link(split, ...) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if a:split ==# 'hsplit'
|
if a:split ==# 'hsplit'
|
||||||
let cmd = ':split '
|
let cmd = 'split'
|
||||||
elseif a:split ==# 'vsplit'
|
elseif a:split ==# 'vsplit'
|
||||||
let cmd = ':vsplit '
|
let cmd = 'vsplit'
|
||||||
elseif a:split ==# 'badd'
|
elseif a:split ==# 'badd'
|
||||||
let cmd = ':badd '
|
let cmd = 'badd'
|
||||||
elseif a:split ==# 'tab'
|
elseif a:split ==# 'tab'
|
||||||
let cmd = ':tabnew '
|
let cmd = 'tabnew'
|
||||||
elseif a:split ==# 'tabdrop'
|
elseif a:split ==# 'tabdrop'
|
||||||
" Use tab drop if we've already got the file open in an existing tab
|
" Use tab drop if we've already got the file open in an existing tab
|
||||||
let cmd = ':tab drop '
|
let cmd = 'tab edit'
|
||||||
|
if exists(':drop') == 2
|
||||||
|
let cmd = 'tab drop'
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
" Same as above - doing this by default reduces incidence of multiple
|
" Same as above - doing this by default reduces incidence of multiple
|
||||||
" tabs with the same file. We default to :e just in case :drop doesn't
|
" tabs with the same file. We default to :e just in case :drop doesn't
|
||||||
" exist in the current build.
|
" exist in the current build.
|
||||||
let cmd = ':e '
|
let cmd = 'edit'
|
||||||
if exists(':drop')
|
if exists(':drop') == 2 && has('windows')
|
||||||
let cmd = ':drop '
|
let cmd = 'drop'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1691,7 +1735,7 @@ function! vimwiki#base#follow_link(split, ...) abort
|
|||||||
let previous_window_nr = winnr('#')
|
let previous_window_nr = winnr('#')
|
||||||
if previous_window_nr > 0 && previous_window_nr != winnr()
|
if previous_window_nr > 0 && previous_window_nr != winnr()
|
||||||
execute previous_window_nr . 'wincmd w'
|
execute previous_window_nr . 'wincmd w'
|
||||||
let cmd = ':e'
|
let cmd = ':edit'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1739,8 +1783,14 @@ function! vimwiki#base#go_back_link() abort
|
|||||||
" Jump to target with edit_file
|
" Jump to target with edit_file
|
||||||
if !empty(prev_link)
|
if !empty(prev_link)
|
||||||
" go back to saved wiki link
|
" go back to saved wiki link
|
||||||
call vimwiki#base#edit_file(':e ', prev_link[0], '')
|
" Change file if required lazy
|
||||||
call setpos('.', prev_link[1])
|
let file = prev_link[0]
|
||||||
|
let pos = prev_link[1]
|
||||||
|
" Removed the filereadable check for Vader
|
||||||
|
if !(vimwiki#path#is_equal(file, expand('%:p')))
|
||||||
|
call vimwiki#base#edit_file('edit', file, '')
|
||||||
|
endif
|
||||||
|
call setpos('.', pos)
|
||||||
else
|
else
|
||||||
" maybe we came here by jumping to a tag -> pop from the tag stack
|
" maybe we came here by jumping to a tag -> pop from the tag stack
|
||||||
silent! pop!
|
silent! pop!
|
||||||
@@ -1955,7 +2005,7 @@ function! vimwiki#base#rename_file(...) abort
|
|||||||
else
|
else
|
||||||
" Should not happen
|
" Should not happen
|
||||||
call vimwiki#u#error('New buffer is the same as old, so will not delete: '
|
call vimwiki#u#error('New buffer is the same as old, so will not delete: '
|
||||||
\ . buf_new_nb . '.Please open an issue if see this messsage')
|
\ . buf_new_nb . '.Please open an issue if see this message')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Log success
|
" Log success
|
||||||
@@ -2223,7 +2273,7 @@ function! vimwiki#base#AddHeaderLevel(...) abort
|
|||||||
" Clause, argument must be <= 1
|
" Clause, argument must be <= 1
|
||||||
" Actually argument is not used :-)
|
" Actually argument is not used :-)
|
||||||
if a:1 > 1
|
if a:1 > 1
|
||||||
call vimwiki#base#AddHeaderLevel(1)
|
call vimwiki#base#AddHeaderLevel(a:1 - 1)
|
||||||
endif
|
endif
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
@@ -2257,7 +2307,7 @@ function! vimwiki#base#RemoveHeaderLevel(...) abort
|
|||||||
" Clause, argument must be <= 1
|
" Clause, argument must be <= 1
|
||||||
" Actually argument is not used :-)
|
" Actually argument is not used :-)
|
||||||
if a:1 > 1
|
if a:1 > 1
|
||||||
call vimwiki#base#RemoveHeaderLevel(1)
|
call vimwiki#base#RemoveHeaderLevel(a:1 - 1)
|
||||||
endif
|
endif
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
@@ -2492,7 +2542,7 @@ function! vimwiki#base#table_of_contents(create) abort
|
|||||||
" copy all local variables into dict (add a: if arguments are needed)
|
" copy all local variables into dict (add a: if arguments are needed)
|
||||||
let GeneratorTOC = copy(l:)
|
let GeneratorTOC = copy(l:)
|
||||||
function! GeneratorTOC.f() abort
|
function! GeneratorTOC.f() abort
|
||||||
" Clean heading informations
|
" Clean heading information
|
||||||
let numbering = vimwiki#vars#get_global('html_header_numbering')
|
let numbering = vimwiki#vars#get_global('html_header_numbering')
|
||||||
" TODO numbering not used !
|
" TODO numbering not used !
|
||||||
let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
|
let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
|
||||||
@@ -2626,13 +2676,10 @@ function! s:clean_url(url) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#is_diary_file(filename, ...) abort
|
function! vimwiki#base#is_among_diary_files(filename, diary_file_paths) abort
|
||||||
" Check if 1.filename is a diary file
|
" Check if filename is in a list of diary files
|
||||||
" An optional second argument allows you to pass in a list of diary files rather
|
|
||||||
" than generating a list on each call to the function.
|
|
||||||
let l:diary_file_paths = a:0 > 0 ? a:1 : vimwiki#diary#get_diary_files()
|
|
||||||
let l:normalised_file_paths =
|
let l:normalised_file_paths =
|
||||||
\ map(l:diary_file_paths, 'vimwiki#path#normalize(v:val)')
|
\ map(a:diary_file_paths, 'vimwiki#path#normalize(v:val)')
|
||||||
" Escape single quote (Issue #886)
|
" Escape single quote (Issue #886)
|
||||||
let filename = substitute(a:filename, "'", "''", 'g')
|
let filename = substitute(a:filename, "'", "''", 'g')
|
||||||
let l:matching_files =
|
let l:matching_files =
|
||||||
@@ -2641,6 +2688,32 @@ function! vimwiki#base#is_diary_file(filename, ...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#base#is_diary_file(filename, ...) abort
|
||||||
|
" Check if filename is a diary file.
|
||||||
|
"
|
||||||
|
" For our purposes, a diary file is any readable file with the current wiki
|
||||||
|
" extension in diary_rel_path.
|
||||||
|
"
|
||||||
|
" An optional second argument allows you to pass in a list of diary files
|
||||||
|
" rather than generating a list on each call to the function. This is
|
||||||
|
" handled by passing off to is_among_diary_files(). This behavior is
|
||||||
|
" retained just in case anyone has scripted against is_diary_file(), but
|
||||||
|
" shouldn't be used internally by VimWiki code. Call is_among_diary_files()
|
||||||
|
" directly instead.
|
||||||
|
|
||||||
|
" Handle the case with diary file paths passed in:
|
||||||
|
if a:0 > 0
|
||||||
|
return vimwiki#base#is_among_diary_files(a:filename, a:1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:readable = filereadable(a:filename)
|
||||||
|
let l:diary_path = vimwiki#vars#get_wikilocal('path') .
|
||||||
|
\ vimwiki#vars#get_wikilocal('diary_rel_path')
|
||||||
|
let l:in_diary_path = (0 == stridx(a:filename, l:diary_path))
|
||||||
|
return l:readable && l:in_diary_path
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
||||||
" Treat link string towards normalization
|
" Treat link string towards normalization
|
||||||
" [__LinkDescription__](__LinkUrl__.__FileExtension__)
|
" [__LinkDescription__](__LinkUrl__.__FileExtension__)
|
||||||
@@ -2655,7 +2728,7 @@ function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
|||||||
let descr = s:clean_url(url)
|
let descr = s:clean_url(url)
|
||||||
if descr ==# '' | return url | endif
|
if descr ==# '' | return url | endif
|
||||||
endif
|
endif
|
||||||
" Substiture placeholders
|
" Substitute placeholders
|
||||||
let lnk = s:safesubstitute(a:template, '__LinkDescription__', descr, '')
|
let lnk = s:safesubstitute(a:template, '__LinkDescription__', descr, '')
|
||||||
let lnk = s:safesubstitute(lnk, '__LinkUrl__', url, '')
|
let lnk = s:safesubstitute(lnk, '__LinkUrl__', url, '')
|
||||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||||
@@ -2827,13 +2900,19 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#complete_links_escaped(ArgLead, CmdLine, CursorPos) abort
|
function! vimwiki#base#complete_links_escaped(ArgLead, CmdLine, CursorPos) abort
|
||||||
" Complete escaping globlinks
|
" Complete globlinks escaping
|
||||||
return vimwiki#base#get_globlinks_escaped(a:ArgLead)
|
return vimwiki#base#get_globlinks_escaped(a:ArgLead)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#base#complete_links_raw(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
" Complete globlinks as raw string (unescaped)
|
||||||
|
return vimwiki#base#get_globlinks_raw(a:ArgLead)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#complete_file(ArgLead, CmdLine, CursorPos) abort
|
function! vimwiki#base#complete_file(ArgLead, CmdLine, CursorPos) abort
|
||||||
" Complete filename relatie to current file
|
" Complete filename relative to current file
|
||||||
" Called: rename_file
|
" Called: rename_file
|
||||||
" Start from current file
|
" Start from current file
|
||||||
let base_path = expand('%:h')
|
let base_path = expand('%:h')
|
||||||
@@ -2900,7 +2979,7 @@ function! s:get_title(match) abort
|
|||||||
" Do not overwrite if g:page_title is already set
|
" Do not overwrite if g:page_title is already set
|
||||||
" when there are multiple <title> tags, only use the first one
|
" when there are multiple <title> tags, only use the first one
|
||||||
" this is a side effect of the substitute's 'n' flag (count number of
|
" this is a side effect of the substitute's 'n' flag (count number of
|
||||||
" occurences and evaluate \= for each one
|
" occurrences and evaluate \= for each one
|
||||||
if (g:page_title !=# '')
|
if (g:page_title !=# '')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -3005,7 +3084,7 @@ function! vimwiki#base#colorize(...) range abort
|
|||||||
" TODO Must be coherent with color_tag_template
|
" TODO Must be coherent with color_tag_template
|
||||||
" Arg1: Key, list them with VimwikiColorize completion
|
" Arg1: Key, list them with VimwikiColorize completion
|
||||||
" Arg2: visualmode()
|
" Arg2: visualmode()
|
||||||
" -- Just removeing spaces, \/ -> /, replacing COLORFG will do it
|
" -- Just removing spaces, \/ -> /, replacing COLORFG will do it
|
||||||
let key = a:0 ? a:1 : 'default'
|
let key = a:0 ? a:1 : 'default'
|
||||||
let mode = a:0 > 1 ? a:2 : ''
|
let mode = a:0 > 1 ? a:2 : ''
|
||||||
let color_dic = vimwiki#vars#get_wikilocal('color_dic')
|
let color_dic = vimwiki#vars#get_wikilocal('color_dic')
|
||||||
|
|||||||
+20
-13
@@ -37,8 +37,12 @@ endfunction
|
|||||||
|
|
||||||
function! vimwiki#diary#diary_date_link(...) abort
|
function! vimwiki#diary#diary_date_link(...) abort
|
||||||
" Return: <String> date
|
" Return: <String> date
|
||||||
|
if a:0 > 2
|
||||||
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
" user supply wiki number as 1 indexed, not 0 indexed
|
||||||
|
let wiki_nr = a:3 - 1
|
||||||
|
else
|
||||||
|
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
endif
|
||||||
if wiki_nr < 0 " this happens when called outside a wiki buffer
|
if wiki_nr < 0 " this happens when called outside a wiki buffer
|
||||||
let wiki_nr = 0
|
let wiki_nr = 0
|
||||||
endif
|
endif
|
||||||
@@ -184,7 +188,7 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:read_captions(files) abort
|
function! s:read_captions(files) abort
|
||||||
" Read all cpation in 1. <List>files
|
" Read all caption in 1. <List>files
|
||||||
" Return: <Dic>: key -> caption
|
" Return: <Dic>: key -> caption
|
||||||
let result = {}
|
let result = {}
|
||||||
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level')
|
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level')
|
||||||
@@ -299,20 +303,23 @@ function! vimwiki#diary#make_note(wnum, ...) abort
|
|||||||
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
|
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
|
||||||
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
|
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
|
||||||
|
|
||||||
let cmd = 'edit'
|
let cmd = ':edit'
|
||||||
if a:0
|
if a:0
|
||||||
if a:1 == 1
|
if a:1 == 1
|
||||||
let cmd = 'tabedit'
|
let cmd = ':tabedit'
|
||||||
elseif a:1 == 2
|
elseif a:1 == 2
|
||||||
let cmd = 'split'
|
let cmd = ':split'
|
||||||
elseif a:1 == 3
|
elseif a:1 == 3
|
||||||
let cmd = 'vsplit'
|
let cmd = ':vsplit'
|
||||||
elseif a:1 == 4
|
elseif a:1 == 4
|
||||||
let cmd = 'tab drop'
|
let cmd = ':tab edit'
|
||||||
|
if exists(':drop') == 2
|
||||||
|
let cmd = ':tab drop'
|
||||||
|
endif
|
||||||
elseif a:1 == 5
|
elseif a:1 == 5
|
||||||
let cmd = 'drop'
|
let cmd = ':edit'
|
||||||
if exists(':drop')
|
if exists(':drop') == 2
|
||||||
let cmd = 'drop'
|
let cmd = ':drop'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -449,7 +456,7 @@ function! vimwiki#diary#generate_diary_section() abort
|
|||||||
let extension = vimwiki#vars#get_wikilocal('ext', wiki_nr)
|
let extension = vimwiki#vars#get_wikilocal('ext', wiki_nr)
|
||||||
let entry = substitute(entry, '__FileExtension__', extension, 'g')
|
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 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
|
" file and multiple H1 headers will be indented by shiftwidth
|
||||||
call add(lines, repeat(' ', vimwiki#lst#get_list_margin()).bullet.entry)
|
call add(lines, repeat(' ', vimwiki#lst#get_list_margin()).bullet.entry)
|
||||||
|
|
||||||
@@ -520,7 +527,7 @@ endfunction
|
|||||||
function! vimwiki#diary#calendar_sign(day, month, year) abort
|
function! vimwiki#diary#calendar_sign(day, month, year) abort
|
||||||
" Callback function for Calendar.vim
|
" Callback function for Calendar.vim
|
||||||
" Clause: no wiki no sign #290
|
" Clause: no wiki no sign #290
|
||||||
if len(g:vimwiki_list) <= 0
|
if exists('g:vimwiki_list') && len(g:vimwiki_list) <= 0
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let day = s:prefix_zero(a:day)
|
let day = s:prefix_zero(a:day)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ endif
|
|||||||
let g:loaded_vimwiki_html_auto = 1
|
let g:loaded_vimwiki_html_auto = 1
|
||||||
|
|
||||||
" FIXME: Magics: Why not use the current syntax highlight
|
" FIXME: Magics: Why not use the current syntax highlight
|
||||||
" This is due to historical copy paste and lazyness of markdown user
|
" This is due to historical copy paste and laziness of markdown user
|
||||||
" text: *strong*
|
" text: *strong*
|
||||||
" let s:default_syntax.rxBold = '\*[^*]\+\*'
|
" let s:default_syntax.rxBold = '\*[^*]\+\*'
|
||||||
let s:rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
let s:rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||||
@@ -1081,7 +1081,7 @@ function! s:process_tag_list(line, lists, lstLeadingSpaces) abort
|
|||||||
return [processed, lines, lstLeadingSpaces]
|
return [processed, lines, lstLeadingSpaces]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Can embeded indented code in list (Issue #55)
|
" Can embedded indented code in list (Issue #55)
|
||||||
let b_permit = in_list
|
let b_permit = in_list
|
||||||
let blockquoteRegExp = '^\s\{' . (lstLeadingSpaces + 2) . ',}[^[:space:]>*-]'
|
let blockquoteRegExp = '^\s\{' . (lstLeadingSpaces + 2) . ',}[^[:space:]>*-]'
|
||||||
let b_match = lstSym ==# '' && a:line =~# blockquoteRegExp
|
let b_match = lstSym ==# '' && a:line =~# blockquoteRegExp
|
||||||
@@ -1884,26 +1884,26 @@ function! s:convert_file(path_html, wikifile) abort
|
|||||||
endif
|
endif
|
||||||
call vimwiki#path#mkdir(path_html)
|
call vimwiki#path#mkdir(path_html)
|
||||||
|
|
||||||
if g:vimwiki_global_vars['listing_hl'] > 0 && has("unix")
|
if g:vimwiki_global_vars['listing_hl'] > 0 && has('unix')
|
||||||
let i = 0
|
let i = 0
|
||||||
while i < len(html_lines)
|
while i < len(html_lines)
|
||||||
if html_lines[i] =~ '^<pre .*type=.\+>'
|
if html_lines[i] =~# '^<pre .*type=.\+>'
|
||||||
let type = split(split(split(html_lines[i], 'type=')[1], '>')[0], '\s\+')[0]
|
let type = split(split(split(html_lines[i], 'type=')[1], '>')[0], '\s\+')[0]
|
||||||
let attr = split(split(html_lines[i], '<pre ')[0], '>')[0]
|
let attr = split(split(html_lines[i], '<pre ')[0], '>')[0]
|
||||||
let start = i + 1
|
let start = i + 1
|
||||||
let cur = start
|
let cur = start
|
||||||
|
|
||||||
while html_lines[cur] !~ '^<\/pre>'
|
while html_lines[cur] !~# '^<\/pre>'
|
||||||
let cur += 1
|
let cur += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
let tmp = ('tmp'. split(system('mktemp -p . --suffix=.' . type, 'silent'), 'tmp')[-1])[:-2]
|
let tmp = ('tmp'. split(system('mktemp -p . --suffix=.' . type, 'silent'), 'tmp')[-1])[:-2]
|
||||||
call system('echo ' . shellescape(join(html_lines[start:cur - 1], '\n')) . ' > ' . tmp)
|
call system('echo ' . shellescape(join(html_lines[start : cur - 1], "\n")) . ' > ' . tmp)
|
||||||
call system(g:vimwiki_global_vars['listing_hl_command'] . ' ' . tmp . ' > ' . tmp . '.html')
|
call system(g:vimwiki_global_vars['listing_hl_command'] . ' ' . tmp . ' > ' . tmp . '.html')
|
||||||
let html_out = system('cat ' . tmp . '.html')
|
let html_out = system('cat ' . tmp . '.html')
|
||||||
call system('rm ' . tmp . ' ' . tmp . '.html')
|
call system('rm ' . tmp . ' ' . tmp . '.html')
|
||||||
let i = cur
|
let i = cur
|
||||||
let html_lines = html_lines[0:start - 1] + split(html_out, '\n') + html_lines[cur:]
|
let html_lines = html_lines[0 : start - 1] + split(html_out, "\n") + html_lines[cur : ]
|
||||||
endif
|
endif
|
||||||
let i += 1
|
let i += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|||||||
+48
-10
@@ -1,9 +1,18 @@
|
|||||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
" Title: Vimwiki list functions
|
||||||
" Vimwiki autoload plugin file
|
"
|
||||||
" Description: Everything concerning lists and checkboxes
|
" 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/
|
" Home: https://github.com/vimwiki/vimwiki/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if exists('g:loaded_vimwiki_list_auto') || &compatible
|
if exists('g:loaded_vimwiki_list_auto') || &compatible
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
@@ -145,11 +154,24 @@ function! s:line_has_marker(lnum) abort
|
|||||||
" Returns: 2 if there is a marker and text
|
" Returns: 2 if there is a marker and text
|
||||||
" 1 for a marker and no text
|
" 1 for a marker and no text
|
||||||
" 0 for no marker at all (empty line or only text)
|
" 0 for no marker at all (empty line or only text)
|
||||||
if getline(a:lnum) =~# vimwiki#vars#get_wikilocal('rxListItem').'\s*$'
|
|
||||||
|
" 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
|
return 1
|
||||||
elseif getline(a:lnum) =~# vimwiki#vars#get_wikilocal('rxListItem').'\s*\S'
|
elseif getline(a:lnum) =~# rx_list_or_blockquote . '\s*\S'
|
||||||
|
" Found with text
|
||||||
return 2
|
return 2
|
||||||
else
|
else
|
||||||
|
" Not found
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -178,12 +200,17 @@ endfunction
|
|||||||
" ---------------------------------------------------------
|
" ---------------------------------------------------------
|
||||||
|
|
||||||
function! s:get_item(lnum) abort
|
function! s:get_item(lnum) abort
|
||||||
" Returns: the mainly used data structure in this file
|
" Return: the mainly used data structure in this file
|
||||||
" An item represents a single list item and is a dictionary with the keys
|
" An item represents a single list item and is a dictionary with the keys
|
||||||
" lnum - the line number of the list item
|
" lnum - the line number of the list item
|
||||||
" type - 1 for bulleted item, 2 for numbered item, 0 for a regular line (default)
|
" 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 '')
|
" mrkr - the concrete marker, e.g. '**' or 'b)' (default '')
|
||||||
" cb - the char in the checkbox or '' if there is no checkbox
|
" cb - the char in the checkbox or '' if there is no checkbox
|
||||||
|
|
||||||
" Init default
|
" Init default
|
||||||
let item = {'lnum': a:lnum}
|
let item = {'lnum': a:lnum}
|
||||||
let item.type = 0
|
let item.type = 0
|
||||||
@@ -195,7 +222,15 @@ function! s:get_item(lnum) abort
|
|||||||
return item
|
return item
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Search for list on current line
|
" 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'))
|
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem'))
|
||||||
" Clause: If not on a list line => do not work
|
" Clause: If not on a list line => do not work
|
||||||
if matches == [] ||
|
if matches == [] ||
|
||||||
@@ -205,6 +240,7 @@ function! s:get_item(lnum) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Fill item
|
" Fill item
|
||||||
|
" The checkbox inner is the last match
|
||||||
let item.cb = matches[3]
|
let item.cb = matches[3]
|
||||||
if matches[1] !=? ''
|
if matches[1] !=? ''
|
||||||
let item.type = 1
|
let item.type = 1
|
||||||
@@ -1117,7 +1153,7 @@ function! s:remove_done_in_list(item, recursive) abort
|
|||||||
if a:item.type == 0
|
if a:item.type == 0
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Recurse self on list item
|
" Recurse self on list item
|
||||||
let first_item = s:get_first_item_in_list(a:item, 0)
|
let first_item = s:get_first_item_in_list(a:item, 0)
|
||||||
let total_lines_removed = 0
|
let total_lines_removed = 0
|
||||||
@@ -1183,7 +1219,7 @@ function! vimwiki#lst#remove_done_in_range(first_line, last_line) abort
|
|||||||
endif
|
endif
|
||||||
let cur_ln = s:get_next_line(cur_ln)
|
let cur_ln = s:get_next_line(cur_ln)
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Update all parent state (percentage of done)
|
" Update all parent state (percentage of done)
|
||||||
for parent_item in parent_items_of_lines
|
for parent_item in parent_items_of_lines
|
||||||
call s:update_state(parent_item)
|
call s:update_state(parent_item)
|
||||||
@@ -1842,3 +1878,5 @@ function! vimwiki#lst#fold_level(lnum) abort
|
|||||||
endif
|
endif
|
||||||
return '='
|
return '='
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ function! s:normalize_link_syntax_n() abort
|
|||||||
let sub = vimwiki#base#normalize_link_in_diary(lnk)
|
let sub = vimwiki#base#normalize_link_in_diary(lnk)
|
||||||
else
|
else
|
||||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||||
\ vimwiki#vars#get_global('rxWord'), '',
|
\ vimwiki#vars#get_global('rxWord'),
|
||||||
|
\ vimwiki#vars#get_global('rxWord'),
|
||||||
\ vimwiki#vars#get_syntaxlocal('Link1'))
|
\ vimwiki#vars#get_syntaxlocal('Link1'))
|
||||||
endif
|
endif
|
||||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function! s:windowsify(path) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Define: os specific path convertion
|
" Define: os specific path conversion
|
||||||
if vimwiki#u#is_windows()
|
if vimwiki#u#is_windows()
|
||||||
function! s:osxify(path) abort
|
function! s:osxify(path) abort
|
||||||
return s:windowsify(a:path)
|
return s:windowsify(a:path)
|
||||||
|
|||||||
+96
-76
@@ -117,43 +117,40 @@ function! s:scan_tags(lines, page_name) abort
|
|||||||
endfor
|
endfor
|
||||||
let current_complete_anchor .= header
|
let current_complete_anchor .= header
|
||||||
endif
|
endif
|
||||||
continue " tags are not allowed in headers
|
" See: issue #1316 to allow tags in header
|
||||||
|
" continue " tags are not allowed in headers
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Scan line for tags. There can be many of them.
|
" Scan line for tags. There can be many of them.
|
||||||
let str = line
|
let str = line
|
||||||
while 1
|
" Get all matches
|
||||||
" Get all matches
|
let tag_groups = []
|
||||||
let tag_groups = []
|
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
|
||||||
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
|
if tag_groups == []
|
||||||
if tag_groups == []
|
continue
|
||||||
break
|
endif
|
||||||
endif
|
for tag_group in tag_groups
|
||||||
let tagend = matchend(str, tag_search_rx)
|
for tag in split(tag_group, tag_format.sep)
|
||||||
let str = str[(tagend):]
|
" Create metadata entry
|
||||||
for tag_group in tag_groups
|
let entry = {}
|
||||||
for tag in split(tag_group, tag_format.sep)
|
let entry.tagname = tag
|
||||||
" Create metadata entry
|
let entry.lineno = line_nr
|
||||||
let entry = {}
|
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
|
||||||
let entry.tagname = tag
|
" Tag appeared at the top of the file
|
||||||
let entry.lineno = line_nr
|
let entry.link = a:page_name
|
||||||
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
|
let entry.description = entry.link
|
||||||
" Tag appeared at the top of the file
|
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
|
||||||
let entry.link = a:page_name
|
" Tag appeared right below a header
|
||||||
let entry.description = entry.link
|
let entry.link = a:page_name . '#' . current_complete_anchor
|
||||||
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
|
let entry.description = current_header_description
|
||||||
" Tag appeared right below a header
|
else
|
||||||
let entry.link = a:page_name . '#' . current_complete_anchor
|
" Tag stands on its own
|
||||||
let entry.description = current_header_description
|
let entry.link = a:page_name . '#' . tag
|
||||||
else
|
let entry.description = entry.link
|
||||||
" Tag stands on its own
|
endif
|
||||||
let entry.link = a:page_name . '#' . tag
|
call add(entries, entry)
|
||||||
let entry.description = entry.link
|
|
||||||
endif
|
|
||||||
call add(entries, entry)
|
|
||||||
endfor
|
|
||||||
endfor
|
endfor
|
||||||
endwhile
|
endfor
|
||||||
|
|
||||||
endfor " loop over lines
|
endfor " loop over lines
|
||||||
return entries
|
return entries
|
||||||
@@ -247,7 +244,7 @@ function! s:tags_entry_cmp(i1, i2) abort
|
|||||||
"
|
"
|
||||||
" This function is needed for tags sorting, since plain sort() compares line
|
" This function is needed for tags sorting, since plain sort() compares line
|
||||||
" numbers as strings, not integers, and so, for example, tag at line 14
|
" numbers as strings, not integers, and so, for example, tag at line 14
|
||||||
" preceeds the same tag on the same page at line 9. (Because string "14" is
|
" precedes the same tags on the same page at line 9. (Because string "14" is
|
||||||
" alphabetically 'less than' string "9".)
|
" alphabetically 'less than' string "9".)
|
||||||
let items = []
|
let items = []
|
||||||
for orig_item in [a:i1, a:i2]
|
for orig_item in [a:i1, a:i2]
|
||||||
@@ -363,65 +360,70 @@ function! vimwiki#tags#generate_tags(create, ...) abort
|
|||||||
|
|
||||||
" make a dictionary { tag_name: [tag_links, ...] }
|
" make a dictionary { tag_name: [tag_links, ...] }
|
||||||
let tags_entries = {}
|
let tags_entries = {}
|
||||||
|
for tagname in self.specific_tags
|
||||||
|
let tags_entries[tagname] = []
|
||||||
|
endfor
|
||||||
|
|
||||||
for entries in values(metadata)
|
for entries in values(metadata)
|
||||||
for entry in entries
|
for entry in entries
|
||||||
if has_key(tags_entries, entry.tagname)
|
if has_key(tags_entries, entry.tagname)
|
||||||
call add(tags_entries[entry.tagname], [entry.link, entry.description])
|
call add(tags_entries[entry.tagname], [entry.link, entry.description])
|
||||||
else
|
else
|
||||||
let tags_entries[entry.tagname] = [[entry.link, entry.description]]
|
if need_all_tags
|
||||||
|
let tags_entries[entry.tagname] = [[entry.link, entry.description]]
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
unlet entry " needed for older vims with sticky type checking since name is reused
|
unlet entry " needed for older vims with sticky type checking since name is reused
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
let tagnames = need_all_tags ? sort(keys(tags_entries)) : self.specific_tags
|
||||||
let lines = []
|
let lines = []
|
||||||
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
|
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
|
||||||
let current_dir = vimwiki#base#current_subdir()
|
let current_dir = vimwiki#base#current_subdir()
|
||||||
for tagname in sort(keys(tags_entries))
|
for tagname in tagnames
|
||||||
if need_all_tags || index(self.specific_tags, tagname) != -1
|
if len(lines) > 0
|
||||||
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, '')
|
call add(lines, '')
|
||||||
endif
|
|
||||||
|
|
||||||
let tag_tpl = printf('rxH%d_Template', self.header_level + 1)
|
|
||||||
call add(lines, s:safesubstitute(vimwiki#vars#get_syntaxlocal(tag_tpl), '__Header__', tagname, ''))
|
|
||||||
|
|
||||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
|
|
||||||
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
|
|
||||||
call add(lines, '')
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
for [taglink, tagdescription] in sort(tags_entries[tagname])
|
|
||||||
let taglink = vimwiki#path#relpath(current_dir, taglink)
|
|
||||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
|
|
||||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink3Template')
|
|
||||||
let link_infos = vimwiki#base#resolve_link(taglink)
|
|
||||||
if empty(link_infos.anchor)
|
|
||||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
|
|
||||||
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', taglink, '')
|
|
||||||
let entry = s:safesubstitute(entry, '__LinkDescription__', tagdescription, '')
|
|
||||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
|
||||||
let entry = s:safesubstitute(entry, '__FileExtension__', file_extension , '')
|
|
||||||
else
|
|
||||||
let link_caption = split(tagdescription, '#', 0)[-1]
|
|
||||||
let link_text = split(taglink, '#', 1)[0]
|
|
||||||
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', link_text, '')
|
|
||||||
let entry = s:safesubstitute(entry, '__LinkAnchor__', link_infos.anchor, '')
|
|
||||||
let entry = s:safesubstitute(entry, '__LinkDescription__', link_caption, '')
|
|
||||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
|
||||||
let entry = s:safesubstitute(entry, '__FileExtension__', file_extension , '')
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(lines, bullet . entry)
|
|
||||||
else
|
|
||||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
|
|
||||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
|
||||||
let link_tpl = s:safesubstitute(link_tpl, '__FileExtension__', file_extension , '')
|
|
||||||
call add(lines, bullet . substitute(link_tpl, '__LinkUrl__', taglink, ''))
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
endif
|
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
|
endfor
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
@@ -448,3 +450,21 @@ function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
|
|||||||
let taglist = vimwiki#tags#get_tags()
|
let taglist = vimwiki#tags#get_tags()
|
||||||
return join(taglist, "\n")
|
return join(taglist, "\n")
|
||||||
endfunction
|
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
|
||||||
|
|||||||
@@ -149,7 +149,9 @@ function! vimwiki#tbl#get_cells(line, ...) abort
|
|||||||
let state = 'NONE'
|
let state = 'NONE'
|
||||||
let cell_start = 0
|
let cell_start = 0
|
||||||
let quote_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
|
" 'Simple' FSM
|
||||||
while state !=# 'CELL'
|
while state !=# 'CELL'
|
||||||
@@ -157,10 +159,9 @@ function! vimwiki#tbl#get_cells(line, ...) abort
|
|||||||
let state = 'CELL'
|
let state = 'CELL'
|
||||||
endif
|
endif
|
||||||
for idx in range(quote_start, len)
|
for idx in range(quote_start, len)
|
||||||
" The only way I know Vim can do Unicode...
|
let ch = chars[idx]
|
||||||
let ch = a:line[idx]
|
|
||||||
if state ==# 'NONE'
|
if state ==# 'NONE'
|
||||||
if ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
|
if ch ==# s:s_sep() && (idx < 1 || chars[idx-1] !=# '\')
|
||||||
let cell_start = idx + 1
|
let cell_start = idx + 1
|
||||||
let state = 'CELL'
|
let state = 'CELL'
|
||||||
endif
|
endif
|
||||||
@@ -168,8 +169,8 @@ function! vimwiki#tbl#get_cells(line, ...) abort
|
|||||||
if ch ==# '[' || ch ==# '{'
|
if ch ==# '[' || ch ==# '{'
|
||||||
let state = 'BEFORE_QUOTE_START'
|
let state = 'BEFORE_QUOTE_START'
|
||||||
let quote_start = idx
|
let quote_start = idx
|
||||||
elseif ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
|
elseif ch ==# s:s_sep() && (idx < 1 || chars[idx-1] !=# '\')
|
||||||
let cell = strpart(a:line, cell_start, idx - cell_start)
|
let cell = join(chars[cell_start : idx-1], '')
|
||||||
if a:0 && a:1
|
if a:0 && a:1
|
||||||
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
|
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
|
||||||
else
|
else
|
||||||
|
|||||||
+74
-24
@@ -53,9 +53,9 @@ function! vimwiki#u#deprecate(old, new) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vimwiki#u#get_selection(...) abort
|
function! vimwiki#u#get_selection(...) abort
|
||||||
" Get visual selection text content, optionaly replace its content
|
" Get visual selection text content, optionally replace its content
|
||||||
" :param: Text to replace selection
|
" :param: Text to replace selection
|
||||||
" Copyed from DarkWiiPlayer at stackoverflow
|
" Copied from DarkWiiPlayer at stackoverflow
|
||||||
" https://stackoverflow.com/a/47051271/2544873
|
" https://stackoverflow.com/a/47051271/2544873
|
||||||
" Get selection extremity position,
|
" Get selection extremity position,
|
||||||
" Discriminate selection mode
|
" Discriminate selection mode
|
||||||
@@ -271,7 +271,7 @@ endfunction
|
|||||||
|
|
||||||
function! vimwiki#u#get_syntax_dic(...) abort
|
function! vimwiki#u#get_syntax_dic(...) abort
|
||||||
" Helper: Getter
|
" Helper: Getter
|
||||||
" :param: syntax <string> to retrive, default to current
|
" :param: syntax <string> to retrieve, default to current
|
||||||
let syntax = a:0 ? a:1 : vimwiki#vars#get_wikilocal('syntax')
|
let syntax = a:0 ? a:1 : vimwiki#vars#get_wikilocal('syntax')
|
||||||
return g:vimwiki_syntaxlocal_vars[syntax]
|
return g:vimwiki_syntaxlocal_vars[syntax]
|
||||||
endfunction
|
endfunction
|
||||||
@@ -295,34 +295,82 @@ endfunction
|
|||||||
function! vimwiki#u#get_punctuation_string() abort
|
function! vimwiki#u#get_punctuation_string() abort
|
||||||
" Faster
|
" Faster
|
||||||
" See: https://github.github.com/gfm/#ascii-punctuation-character
|
" See: https://github.github.com/gfm/#ascii-punctuation-character
|
||||||
return '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
|
" res = '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
|
||||||
|
" But I removed the * as it is treated as a special case
|
||||||
|
return '!"#$%&''()+,-./:;<=>?@\[\\\]^`{}|~'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#u#hi_expand_regex(lst) abort
|
function! vimwiki#u#hi_expand_regex(lst) abort
|
||||||
" Helper: Expand regex from reduced typeface delimiters
|
" Helper: Expand regex from reduced typeface delimiters
|
||||||
" :param: list<list,delimiters>> with reduced regex
|
" :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)
|
" Return: list with extended regex delimiters (not inside a word)
|
||||||
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
|
" -- [['\*_', '_\*']] -> [['\*_\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
|
" See: https://github.github.com/gfm/#left-flanking-delimiter-run
|
||||||
let res = []
|
let res = []
|
||||||
let p = vimwiki#u#get_punctuation_string()
|
let punctuation = vimwiki#u#get_punctuation_string()
|
||||||
for delimiters in a:lst
|
|
||||||
let r_prefix = '\(^\|[[:space:]]\@<=\)'
|
" Iterate on (left delimiter, right delimiter pair)
|
||||||
" Regex Start: not preceded by backslash, not ended by space
|
for a_delimiter in a:lst
|
||||||
let r_start = r_prefix . delimiters[0] . '\S\@='
|
let r_left_del = a_delimiter[0]
|
||||||
" Regex End: not preceded by backslash or space, ended by punctuation or space
|
let r_right_del = a_delimiter[1]
|
||||||
let r_prefix = '\(^\|[^[:space:]\\]\@<=\)'
|
let r_repeat_del = len(a_delimiter) >= 3 ? a_delimiter[2] : '$^'
|
||||||
let r_end = r_prefix . delimiters[1] . '\%(\_[[:space:]' . p . ']\)\@='
|
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])
|
call add(res, [r_start, r_end])
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return res
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
|
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
|
||||||
" Helper: Create highlight region between two tags
|
" Helper: Create highlight region between two tags
|
||||||
" :param: tag <string> example '<b>'
|
" :param: tag_pre <string>: opening tag example '<b>'
|
||||||
|
" :param: tag_post <string>: closing tag example '</b>'
|
||||||
" :param: syntax_group <string> example: VimwikiBold
|
" :param: syntax_group <string> example: VimwikiBold
|
||||||
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
|
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
|
||||||
" :param: (1) <boolean> is contained
|
" :param: (1) <boolean> is contained
|
||||||
@@ -337,9 +385,9 @@ function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Craft command
|
" Craft command
|
||||||
|
" \ 'skip="\\' . a:tag_pre . '" ' .
|
||||||
let cmd = 'syn region ' . a:syntax_group . ' matchgroup=VimwikiDelimiter ' .
|
let cmd = 'syn region ' . a:syntax_group . ' matchgroup=VimwikiDelimiter ' .
|
||||||
\ opt_is_contained .
|
\ opt_is_contained .
|
||||||
\ 'skip="\\' . a:tag_pre . '" ' .
|
|
||||||
\ 'start="' . a:tag_pre . '" ' .
|
\ 'start="' . a:tag_pre . '" ' .
|
||||||
\ 'end="' . a:tag_post . '" ' .
|
\ 'end="' . a:tag_post . '" ' .
|
||||||
\ 'keepend ' .
|
\ 'keepend ' .
|
||||||
@@ -361,7 +409,7 @@ function! vimwiki#u#hi_typeface(dic) abort
|
|||||||
" The last syntax defined take precedence so that user can change at runtime (:h :syn-define)
|
" The last syntax defined take precedence so that user can change at runtime (:h :syn-define)
|
||||||
" Some cases are contained by default:
|
" Some cases are contained by default:
|
||||||
" -- ex: VimwikiCodeBoldUnderline is not defined in colorschemes -> VimwikiCode
|
" -- ex: VimwikiCodeBoldUnderline is not defined in colorschemes -> VimwikiCode
|
||||||
" -- see: #709 asking for concealing quotes in bold, so it must be higlighted differently
|
" -- see: #709 asking for concealing quotes in bold, so it must be highlighted differently
|
||||||
" -- -- for the user to understand what is concealed around
|
" -- -- for the user to understand what is concealed around
|
||||||
" VimwikiCheckBoxDone and VimwikiDelText are as their are even when nested in bold or italic
|
" 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
|
" -- This is because it would add a lot of code (as n**2) at startup and is not often used
|
||||||
@@ -370,6 +418,13 @@ function! vimwiki#u#hi_typeface(dic) abort
|
|||||||
|
|
||||||
let nested = vimwiki#u#get_syntax_dic().nested
|
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
|
" Italic
|
||||||
for i in a:dic['italic']
|
for i in a:dic['italic']
|
||||||
" -- Italic 1
|
" -- Italic 1
|
||||||
@@ -398,13 +453,6 @@ function! vimwiki#u#hi_typeface(dic) abort
|
|||||||
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2)
|
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Bold Italic
|
|
||||||
if has_key(a:dic, 'bold_italic')
|
|
||||||
for bi in a:dic['bold_italic']
|
|
||||||
call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline')
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Underline
|
" Underline
|
||||||
for u in a:dic['underline']
|
for u in a:dic['underline']
|
||||||
" -- Underline 1
|
" -- Underline 1
|
||||||
@@ -442,5 +490,7 @@ function! vimwiki#u#hi_typeface(dic) abort
|
|||||||
|
|
||||||
" Prevent var_with_underscore to trigger italic text
|
" Prevent var_with_underscore to trigger italic text
|
||||||
" -- See $VIMRUNTIME/syntax/markdown.vim
|
" -- See $VIMRUNTIME/syntax/markdown.vim
|
||||||
syn match VimwikiError "\w\@<=[_*]\w\@="
|
" But leave
|
||||||
|
" -- See https://github.github.com/gfm/#example-364
|
||||||
|
syn match VimwikiError "\w\@<=_\w\@="
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
+102
-27
@@ -1,6 +1,5 @@
|
|||||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
" Title: Vimwiki variable definition and manipulation functions
|
||||||
" Vimwiki autoload plugin file
|
"
|
||||||
" Description: Vimwiki variable definition and manipulation
|
|
||||||
" Home: https://github.com/vimwiki/vimwiki/
|
" Home: https://github.com/vimwiki/vimwiki/
|
||||||
|
|
||||||
" ------------------------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------------------------
|
||||||
@@ -43,7 +42,7 @@ endfunction
|
|||||||
function! s:check_users_value(key, users_value, value_infos, comes_from_global_variable) abort
|
function! s:check_users_value(key, users_value, value_infos, comes_from_global_variable) abort
|
||||||
" Helper: Check user setting
|
" Helper: Check user setting
|
||||||
" warn user with message if not good type
|
" warn user with message if not good type
|
||||||
" Param: 1: key <string>: varaible name
|
" Param: 1: key <string>: variable name
|
||||||
" Param: 2: vimwiki_key <obj>: user value
|
" Param: 2: vimwiki_key <obj>: user value
|
||||||
" Param: 3: value_infod <dict>: type and default value
|
" Param: 3: value_infod <dict>: type and default value
|
||||||
" Param: 4: coming from a global variable <bool>
|
" Param: 4: coming from a global variable <bool>
|
||||||
@@ -178,7 +177,7 @@ function! s:get_default_global() abort
|
|||||||
\ [
|
\ [
|
||||||
\ 'http', 'https', 'file', 'ftp', 'gopher', 'telnet', 'nntp', 'ldap',
|
\ 'http', 'https', 'file', 'ftp', 'gopher', 'telnet', 'nntp', 'ldap',
|
||||||
\ 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh',
|
\ 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh',
|
||||||
\ 'git', 'ssh', 'fish', 'sftp', 'thunderlink'
|
\ 'git', 'ssh', 'fish', 'sftp', 'thunderlink', 'message'
|
||||||
\ ]},
|
\ ]},
|
||||||
\ 'schemes_any': {'type': type([]), 'default': ['mailto', 'matrix', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data']},
|
\ 'schemes_any': {'type': type([]), 'default': ['mailto', 'matrix', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data']},
|
||||||
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
||||||
@@ -477,6 +476,7 @@ function! s:get_default_wikilocal() abort
|
|||||||
\ 'auto_toc': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
\ 'auto_toc': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'automatic_nested_syntaxes': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
\ 'automatic_nested_syntaxes': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
||||||
\ 'base_url': {'type': type(''), 'default': '', 'min_length': 1},
|
\ 'base_url': {'type': type(''), 'default': '', 'min_length': 1},
|
||||||
|
\ 'bullet_types': {'type': type([]), 'default': []},
|
||||||
\ 'color_dic': {'type': type({}), 'default': {
|
\ 'color_dic': {'type': type({}), 'default': {
|
||||||
\ 'default': ['', '#d79921'],
|
\ 'default': ['', '#d79921'],
|
||||||
\ 'red': ['#cc241d', ''],
|
\ 'red': ['#cc241d', ''],
|
||||||
@@ -498,6 +498,7 @@ function! s:get_default_wikilocal() abort
|
|||||||
\ 'css_name': {'type': type(''), 'default': 'style.css', 'min_length': 1},
|
\ 'css_name': {'type': type(''), 'default': 'style.css', 'min_length': 1},
|
||||||
\ 'custom_wiki2html': {'type': type(''), 'default': ''},
|
\ 'custom_wiki2html': {'type': type(''), 'default': ''},
|
||||||
\ 'custom_wiki2html_args': {'type': type(''), 'default': ''},
|
\ 'custom_wiki2html_args': {'type': type(''), 'default': ''},
|
||||||
|
\ 'cycle_bullets': {'type': type(0), 'default': 0},
|
||||||
\ 'diary_frequency': {'type': type(''), 'default': 'daily', 'possible_values': ['daily', 'weekly', 'monthly', 'yearly']},
|
\ 'diary_frequency': {'type': type(''), 'default': 'daily', 'possible_values': ['daily', 'weekly', 'monthly', 'yearly']},
|
||||||
\ 'diary_start_week_day': {'type': type(''), 'default': 'monday', 'possible_values': ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']},
|
\ 'diary_start_week_day': {'type': type(''), 'default': 'monday', 'possible_values': ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']},
|
||||||
\ 'diary_header': {'type': type(''), 'default': 'Diary', 'min_length': 1},
|
\ 'diary_header': {'type': type(''), 'default': 'Diary', 'min_length': 1},
|
||||||
@@ -507,8 +508,6 @@ function! s:get_default_wikilocal() abort
|
|||||||
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
|
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
|
||||||
\ 'exclude_files': {'type': type([]), 'default': []},
|
\ 'exclude_files': {'type': type([]), 'default': []},
|
||||||
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
|
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
|
||||||
\ 'bullet_types': {'type': type([]), 'default': []},
|
|
||||||
\ 'cycle_bullets': {'type': type(0), 'default': 0},
|
|
||||||
\ 'html_filename_parameterization': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
\ 'html_filename_parameterization': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'generated_links_caption': {'type': type(0), 'default': 0 },
|
\ 'generated_links_caption': {'type': type(0), 'default': 0 },
|
||||||
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
|
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
|
||||||
@@ -610,6 +609,8 @@ function! s:normalize_wikilocal_settings() abort
|
|||||||
endif
|
endif
|
||||||
call s:populate_list_vars(wiki_settings)
|
call s:populate_list_vars(wiki_settings)
|
||||||
|
|
||||||
|
call s:populate_blockquote_vars(wiki_settings)
|
||||||
|
|
||||||
" Check nested syntax
|
" Check nested syntax
|
||||||
for keyword in keys(wiki_settings.nested_syntaxes)
|
for keyword in keys(wiki_settings.nested_syntaxes)
|
||||||
if type(keyword) != type('') || empty(keyword) || type(wiki_settings.nested_syntaxes[keyword]) != type('') ||
|
if type(keyword) != type('') || empty(keyword) || type(wiki_settings.nested_syntaxes[keyword]) != type('') ||
|
||||||
@@ -673,7 +674,9 @@ endfunction
|
|||||||
function! s:get_default_syntaxlocal() abort
|
function! s:get_default_syntaxlocal() abort
|
||||||
" Get default syntaxlocal variable dictionary
|
" Get default syntaxlocal variable dictionary
|
||||||
" type, default, min, max, possible_values, min_length
|
" type, default, min, max, possible_values, min_length
|
||||||
|
|
||||||
return extend(s:get_common_syntaxlocal(), {
|
return extend(s:get_common_syntaxlocal(), {
|
||||||
|
\ 'blockquote_markers': {'type': type([]), 'default': ['>', '::']},
|
||||||
\ 'bold_match': {'type': type(''), 'default': '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*\%([[:punct:]]\|\s\|$\)\@='},
|
\ 'bold_match': {'type': type(''), 'default': '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*\%([[:punct:]]\|\s\|$\)\@='},
|
||||||
\ 'bold_search': {'type': type(''), 'default': '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='},
|
\ 'bold_search': {'type': type(''), 'default': '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='},
|
||||||
\ 'bullet_types': {'type': type([]), 'default': ['-', '*', '#']},
|
\ 'bullet_types': {'type': type([]), 'default': ['-', '*', '#']},
|
||||||
@@ -682,7 +685,6 @@ function! s:get_default_syntaxlocal() abort
|
|||||||
\ 'list_markers': {'type': type([]), 'default': ['-', '1.', '*', 'I)', 'a)']},
|
\ 'list_markers': {'type': type([]), 'default': ['-', '1.', '*', 'I)', 'a)']},
|
||||||
\ 'number_types': {'type': type([]), 'default': ['1)', '1.', 'i)', 'I)', 'a)', 'A)']},
|
\ 'number_types': {'type': type([]), 'default': ['1)', '1.', 'i)', 'I)', 'a)', 'A)']},
|
||||||
\ 'recurring_bullets': {'type': type(0), 'default': 0},
|
\ 'recurring_bullets': {'type': type(0), 'default': 0},
|
||||||
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$'},
|
|
||||||
\ 'header_symbol': {'type': type(''), 'default': '='},
|
\ 'header_symbol': {'type': type(''), 'default': '='},
|
||||||
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
|
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
|
||||||
\ 'rxListDefine': {'type': type(''), 'default': '::\(\s\|$\)'},
|
\ 'rxListDefine': {'type': type(''), 'default': '::\(\s\|$\)'},
|
||||||
@@ -697,10 +699,10 @@ function! s:get_default_syntaxlocal() abort
|
|||||||
\ 'post_mark': '}}}'}},
|
\ 'post_mark': '}}}'}},
|
||||||
\ 'symH': {'type': type(1), 'default': 1},
|
\ 'symH': {'type': type(1), 'default': 1},
|
||||||
\ 'typeface': {'type': type({}), 'default': {
|
\ 'typeface': {'type': type({}), 'default': {
|
||||||
\ 'bold': vimwiki#u#hi_expand_regex([['\*', '\*']]),
|
\ 'bold': vimwiki#u#hi_expand_regex([['\*', '\*', '[*]', 0]]),
|
||||||
\ 'italic': vimwiki#u#hi_expand_regex([['_', '_']]),
|
\ 'italic': vimwiki#u#hi_expand_regex([['_', '_', '[_]', 0]]),
|
||||||
\ 'underline': vimwiki#u#hi_expand_regex([]),
|
\ 'underline': vimwiki#u#hi_expand_regex([]),
|
||||||
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*'], ['_\*', '\*_']]),
|
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*', '[*_]', 1], ['_\*', '\*_', '[*_]', 1]]),
|
||||||
\ 'code': [
|
\ 'code': [
|
||||||
\ ['\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@=',
|
\ ['\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@=',
|
||||||
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
||||||
@@ -710,7 +712,7 @@ function! s:get_default_syntaxlocal() abort
|
|||||||
\ 'del': [['\~\~', '\~\~']],
|
\ 'del': [['\~\~', '\~\~']],
|
||||||
\ 'sup': [['\^', '\^']],
|
\ 'sup': [['\^', '\^']],
|
||||||
\ 'sub': [[',,', ',,']],
|
\ 'sub': [[',,', ',,']],
|
||||||
\ 'eq': [['\%(^\|[^$\\]\)\@<=\$\%($\|[^$]\)\@=', '\%(^\|[^$\\]\)\@<=\$\%($\|[^$]\)\@=']],
|
\ 'eq': [[s:rx_inline_math_start, s:rx_inline_math_end]],
|
||||||
\ }},
|
\ }},
|
||||||
\ 'wikilink': {'type': type(''), 'default': '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'},
|
\ 'wikilink': {'type': type(''), 'default': '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'},
|
||||||
\ })
|
\ })
|
||||||
@@ -735,7 +737,6 @@ function! s:get_markdown_syntaxlocal() abort
|
|||||||
\ 'list_markers': {'type': type([]), 'default': ['-', '*', '+', '1.']},
|
\ 'list_markers': {'type': type([]), 'default': ['-', '*', '+', '1.']},
|
||||||
\ 'number_types': {'type': type([]), 'default': ['1.']},
|
\ 'number_types': {'type': type([]), 'default': ['1.']},
|
||||||
\ 'recurring_bullets': {'type': type(0), 'default': 0},
|
\ 'recurring_bullets': {'type': type(0), 'default': 0},
|
||||||
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$\|<!--[^>]*-->'},
|
|
||||||
\ 'header_symbol': {'type': type(''), 'default': '#'},
|
\ 'header_symbol': {'type': type(''), 'default': '#'},
|
||||||
\ 'rxHR': {'type': type(''), 'default': '\(^---*$\|^___*$\|^\*\*\**$\)'},
|
\ 'rxHR': {'type': type(''), 'default': '\(^---*$\|^___*$\|^\*\*\**$\)'},
|
||||||
\ 'rxListDefine': {'type': type(''), 'default': '::\%(\s\|$\)'},
|
\ 'rxListDefine': {'type': type(''), 'default': '::\%(\s\|$\)'},
|
||||||
@@ -750,20 +751,31 @@ function! s:get_markdown_syntaxlocal() abort
|
|||||||
\ 'post_mark': '\%(`\{3,}\|\~\{3,}\)'}},
|
\ 'post_mark': '\%(`\{3,}\|\~\{3,}\)'}},
|
||||||
\ 'symH': {'type': type(0), 'default': 0},
|
\ 'symH': {'type': type(0), 'default': 0},
|
||||||
\ 'typeface': {'type': type({}), 'default': {
|
\ 'typeface': {'type': type({}), 'default': {
|
||||||
\ 'bold': vimwiki#u#hi_expand_regex([['__', '__'], ['\*\*', '\*\*']]),
|
\ 'bold': vimwiki#u#hi_expand_regex([
|
||||||
\ 'italic': vimwiki#u#hi_expand_regex([['\*', '\*'], ['_', '_']]),
|
\ ['__', '__', '[_*]', 1],
|
||||||
|
\ ['\*\*', '\*\*', '[_*]', 1],
|
||||||
|
\ ]),
|
||||||
|
\ 'italic': vimwiki#u#hi_expand_regex([
|
||||||
|
\ ['_', '_', '[_*]', 0],
|
||||||
|
\ ['\*', '\*', '[_*]', 0],
|
||||||
|
\ ['\*_', '_\*', '[_*]', 1],
|
||||||
|
\ ['_\*', '\*_', '[_*]', 1],
|
||||||
|
\ ]),
|
||||||
\ 'underline': vimwiki#u#hi_expand_regex([]),
|
\ 'underline': vimwiki#u#hi_expand_regex([]),
|
||||||
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*'], ['_\*', '\*_'], ['\*\*\*', '\*\*\*'], ['___', '___']]),
|
\ 'bold_italic': vimwiki#u#hi_expand_regex([
|
||||||
|
\ ['___', '___', '[_*]', 1],
|
||||||
|
\ ['\*\*\*', '\*\*\*', '[_*]', 1],
|
||||||
|
\ ]),
|
||||||
\ 'code': [
|
\ 'code': [
|
||||||
\ ['\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@=',
|
\ ['\%(^\|[^`\\]\)\@<=`\%($\|[^`]\)\@=',
|
||||||
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
||||||
\ ['\%(^\|[^`]\)\@<=``\%($\|[^`]\)\@=',
|
\ ['\%(^\|[^`\\]\)\@<=``\%($\|[^`]\)\@=',
|
||||||
\ '\%(^\|[^`]\)\@<=``\%($\|[^`]\)\@='],
|
\ '\%(^\|[^`]\)\@<=``\%($\|[^`]\)\@='],
|
||||||
\ ],
|
\ ],
|
||||||
\ 'del': [['\~\~', '\~\~']],
|
\ 'del': [['\~\~', '\~\~']],
|
||||||
\ 'sup': [['\^', '\^']],
|
\ 'sup': [['\^', '\^']],
|
||||||
\ 'sub': [[',,', ',,']],
|
\ 'sub': [[',,', ',,']],
|
||||||
\ 'eq': [['\%(^\|[^$]\)\@<=\$\%($\|[^$]\)\@=', '\%(^\|[^$]\)\@<=\$\%($\|[^$]\)\@=']],
|
\ 'eq': [[s:rx_inline_math_start, s:rx_inline_math_end]],
|
||||||
\ }},
|
\ }},
|
||||||
\ 'wikilink': {'type': type(''), 'default': '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'},
|
\ 'wikilink': {'type': type(''), 'default': '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'},
|
||||||
\ })
|
\ })
|
||||||
@@ -779,7 +791,6 @@ function! s:get_media_syntaxlocal() abort
|
|||||||
\ 'list_markers': {'type': type([]), 'default': ['*', '#']},
|
\ 'list_markers': {'type': type([]), 'default': ['*', '#']},
|
||||||
\ 'number_types': {'type': type([]), 'default': []},
|
\ 'number_types': {'type': type([]), 'default': []},
|
||||||
\ 'recurring_bullets': {'type': type(1), 'default': 1},
|
\ 'recurring_bullets': {'type': type(1), 'default': 1},
|
||||||
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$'},
|
|
||||||
\ 'header_symbol': {'type': type(''), 'default': '='},
|
\ 'header_symbol': {'type': type(''), 'default': '='},
|
||||||
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
|
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
|
||||||
\ 'rxListDefine': {'type': type(''), 'default': '^\%(;\|:\)\s'},
|
\ 'rxListDefine': {'type': type(''), 'default': '^\%(;\|:\)\s'},
|
||||||
@@ -807,7 +818,7 @@ function! s:get_media_syntaxlocal() abort
|
|||||||
\ 'del': [['\~\~', '\~\~']],
|
\ 'del': [['\~\~', '\~\~']],
|
||||||
\ 'sup': [['\^', '\^']],
|
\ 'sup': [['\^', '\^']],
|
||||||
\ 'sub': [[',,', ',,']],
|
\ 'sub': [[',,', ',,']],
|
||||||
\ 'eq': [['\%(^\|[^$]\)\@<=\$\%($\|[^$]\)\@=', '\%(^\|[^$]\)\@<=\$\%($\|[^$]\)\@=']],
|
\ 'eq': [[s:rx_inline_math_start, s:rx_inline_math_end]],
|
||||||
\ }},
|
\ }},
|
||||||
\ 'wikilink': {'type': type(''), 'default': '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'},
|
\ 'wikilink': {'type': type(''), 'default': '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'},
|
||||||
\ })
|
\ })
|
||||||
@@ -815,10 +826,35 @@ endfunction
|
|||||||
|
|
||||||
function! s:get_common_syntaxlocal() abort
|
function! s:get_common_syntaxlocal() abort
|
||||||
let res = {}
|
let res = {}
|
||||||
|
|
||||||
|
" Declare helper: a line with only --- or ...
|
||||||
|
let rx_yaml_start_pre = '\%(^\%(\%1l\|^$\n\)\@<=\)'
|
||||||
|
let rx_yaml_start_post = '\%(\%(\n^$\)\@!$\)'
|
||||||
|
let rx_yaml_start = rx_yaml_start_pre . '---' . rx_yaml_start_post
|
||||||
|
let rx_yaml_end = '^\%(---\|\.\.\.\)\s*$'
|
||||||
|
|
||||||
let res.nested_extended = {'type': type(''), 'default': 'VimwikiError,VimwikiPre,VimwikiCode,VimwikiEqIn,VimwikiSuperScript,VimwikiSubScript,textSnipTEX'}
|
let res.nested_extended = {'type': type(''), 'default': 'VimwikiError,VimwikiPre,VimwikiCode,VimwikiEqIn,VimwikiSuperScript,VimwikiSubScript,textSnipTEX'}
|
||||||
let res.nested_typeface = {'type': type(''), 'default': 'VimwikiBold,VimwikiItalic,VimwikiUnderline,VimwikiDelText'}
|
let res.nested_typeface = {'type': type(''), 'default': 'VimwikiBold,VimwikiItalic,VimwikiUnderline,VimwikiDelText'}
|
||||||
let res.nested = {'type': type(''), 'default': res.nested_extended.default . ',' . res.nested_typeface.default}
|
let res.nested = {'type': type(''), 'default': res.nested_extended.default . ',' . res.nested_typeface.default}
|
||||||
let res.rxTableSep = {'type': type(''), 'default': '|'}
|
let res.rxTableSep = {'type': type(''), 'default': '|'}
|
||||||
|
" See issue #1287
|
||||||
|
let res.yaml_metadata_block = {'type': type([]), 'default': [[rx_yaml_start, rx_yaml_end]]}
|
||||||
|
|
||||||
|
" Declare helper for inline math nested variable
|
||||||
|
let s:rx_inline_math_start = '\%(^\|[^$\\]\)\@<=\$\%($\|[^$[:space:]]\)\@='
|
||||||
|
let s:rx_inline_math_end = '\%(^\|[^$\\[:space:]]\)\@<=\$\%($\|[^$0-9]\)\@='
|
||||||
|
|
||||||
|
" Blockquote marker (#1274)
|
||||||
|
" -- it should not be changed but let's avoid hardcoding
|
||||||
|
let res.blockquote_markers = {'type': type([]), 'default': ['>']}
|
||||||
|
|
||||||
|
" HTML comment
|
||||||
|
let res.comment_regex = {'type': type(''), 'default': '\%(^\s*%%.*$\|<!--\%([^>]\|\n\)*-->\)'}
|
||||||
|
|
||||||
|
" Opening link with dot in the ref, see #1271 and ref and Brennen comment:
|
||||||
|
" -- https://github.com/vimwiki/vimwiki/issues/1271#issuecomment-1482207680
|
||||||
|
let res.open_link_add_ext = {'type': type(1), 'default': 1}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -857,7 +893,7 @@ function! vimwiki#vars#populate_syntax_vars(syntax) abort
|
|||||||
call s:extend_local(syntax_dic, default_dic, syntax_dic, g:vimwiki_syntax_list[a:syntax])
|
call s:extend_local(syntax_dic, default_dic, syntax_dic, g:vimwiki_syntax_list[a:syntax])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" TODO make that clean (i.e clearify what is local to syntax ot to buffer)
|
" TODO make that clean (i.e clarify what is local to syntax or to buffer)
|
||||||
" Get from local vars
|
" Get from local vars
|
||||||
let bullet_types = vimwiki#vars#get_wikilocal('bullet_types')
|
let bullet_types = vimwiki#vars#get_wikilocal('bullet_types')
|
||||||
if !empty(bullet_types)
|
if !empty(bullet_types)
|
||||||
@@ -927,7 +963,7 @@ function! vimwiki#vars#populate_syntax_vars(syntax) abort
|
|||||||
\ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*[^'.header_symbol.']\ze\1\s*$'
|
\ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*[^'.header_symbol.']\ze\1\s*$'
|
||||||
else
|
else
|
||||||
" asymmetric
|
" asymmetric
|
||||||
" Note: For markdown rxH=# and asymetric
|
" Note: For markdown rxH=# and asymmetric
|
||||||
for i in range(1,6)
|
for i in range(1,6)
|
||||||
let syntax_dic['rxH'.i.'_Template'] =
|
let syntax_dic['rxH'.i.'_Template'] =
|
||||||
\ repeat(header_symbol, i).' __Header__'
|
\ repeat(header_symbol, i).' __Header__'
|
||||||
@@ -941,7 +977,7 @@ function! vimwiki#vars#populate_syntax_vars(syntax) abort
|
|||||||
\ '^\s*'.header_symbol.'\{1,'.i.'}[^'.header_symbol.'].*$\|\%$'
|
\ '^\s*'.header_symbol.'\{1,'.i.'}[^'.header_symbol.'].*$\|\%$'
|
||||||
endfor
|
endfor
|
||||||
" Define header regex
|
" Define header regex
|
||||||
" -- ATX heading := preceed by #*
|
" -- ATX heading := preceded by #*
|
||||||
let atx_heading = '^\s*\%('.header_symbol.'\{1,6}\)'
|
let atx_heading = '^\s*\%('.header_symbol.'\{1,6}\)'
|
||||||
let atx_heading .= '\zs[^'.header_symbol.'].*\ze$'
|
let atx_heading .= '\zs[^'.header_symbol.'].*\ze$'
|
||||||
let syntax_dic.rxHeader = atx_heading
|
let syntax_dic.rxHeader = atx_heading
|
||||||
@@ -1106,6 +1142,22 @@ function! s:populate_list_vars(wiki) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:populate_blockquote_vars(wiki) abort
|
||||||
|
" Populate blockquote variable
|
||||||
|
" Start being more intelligent on blockquote line continuation
|
||||||
|
" See: issue #1274
|
||||||
|
|
||||||
|
" Start of line and spaces
|
||||||
|
let a:wiki.rxBlockquoteItem = '^\s*\('
|
||||||
|
|
||||||
|
" Content
|
||||||
|
let blockquote_markers = vimwiki#vars#get_syntaxlocal('blockquote_markers')
|
||||||
|
let a:wiki.rxBlockquoteItem .= join(blockquote_markers, '\|')
|
||||||
|
|
||||||
|
let a:wiki.rxBlockquoteItem .= '\)'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:populate_extra_markdown_vars() abort
|
function! s:populate_extra_markdown_vars() abort
|
||||||
" Populate markdown specific syntax variables
|
" Populate markdown specific syntax variables
|
||||||
let mkd_syntax = g:vimwiki_syntaxlocal_vars['markdown']
|
let mkd_syntax = g:vimwiki_syntaxlocal_vars['markdown']
|
||||||
@@ -1182,7 +1234,7 @@ function! s:populate_extra_markdown_vars() abort
|
|||||||
|
|
||||||
let mkd_syntax.rxWeblink1Prefix = '['
|
let mkd_syntax.rxWeblink1Prefix = '['
|
||||||
let mkd_syntax.rxWeblink1Suffix = ')'
|
let mkd_syntax.rxWeblink1Suffix = ')'
|
||||||
let mkd_syntax.rxWeblink1EscapeCharsSuffix = '\(\\\)\@<!\()\)'
|
let mkd_syntax.rxWeblink1EscapeCharsSuffix = '\(\\\)\@<!\(>\=)\)'
|
||||||
let mkd_syntax.rxWeblink1Separator = ']('
|
let mkd_syntax.rxWeblink1Separator = ']('
|
||||||
|
|
||||||
let rxWeblink1Ext = ''
|
let rxWeblink1Ext = ''
|
||||||
@@ -1207,7 +1259,7 @@ function! s:populate_extra_markdown_vars() abort
|
|||||||
let valid_chars_url = '[^[:cntrl:]]'
|
let valid_chars_url = '[^[:cntrl:]]'
|
||||||
|
|
||||||
let mkd_syntax.rxWeblink1Prefix = vimwiki#u#escape(mkd_syntax.rxWeblink1Prefix)
|
let mkd_syntax.rxWeblink1Prefix = vimwiki#u#escape(mkd_syntax.rxWeblink1Prefix)
|
||||||
let mkd_syntax.rxWeblink1Separator = vimwiki#u#escape(mkd_syntax.rxWeblink1Separator)
|
let mkd_syntax.rxWeblink1Separator = '\](<\='
|
||||||
let mkd_syntax.rxWeblink1Url = valid_chars_url.'\{-}'
|
let mkd_syntax.rxWeblink1Url = valid_chars_url.'\{-}'
|
||||||
let mkd_syntax.rxWeblink1Descr = valid_chars.'\{-}'
|
let mkd_syntax.rxWeblink1Descr = valid_chars.'\{-}'
|
||||||
let mkd_syntax.WikiLinkMatchUrlTemplate =
|
let mkd_syntax.WikiLinkMatchUrlTemplate =
|
||||||
@@ -1540,7 +1592,7 @@ endfunction
|
|||||||
|
|
||||||
function! vimwiki#vars#get_syntaxlocal(key, ...) abort
|
function! vimwiki#vars#get_syntaxlocal(key, ...) abort
|
||||||
" Get syntax variable
|
" Get syntax variable
|
||||||
" Param: 1: key (<string>)
|
" Param: 1: key (<string>)
|
||||||
" Param: (2): syntax name (<string> ex:'markdown')
|
" Param: (2): syntax name (<string> ex:'markdown')
|
||||||
" Retrieve desired syntax name
|
" Retrieve desired syntax name
|
||||||
if a:0
|
if a:0
|
||||||
@@ -1559,6 +1611,28 @@ function! vimwiki#vars#get_syntaxlocal(key, ...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#vars#set_syntaxlocal(key, value, ...) abort
|
||||||
|
" Set syntax variable
|
||||||
|
" Param: 1: key (<string>)
|
||||||
|
" Param: 2: value (<any type>)
|
||||||
|
" Param: (3): syntax name (<string> ex:'markdown')
|
||||||
|
" Set desired syntax variable to value
|
||||||
|
if a:0
|
||||||
|
let syntax = a:1
|
||||||
|
else
|
||||||
|
let syntax = vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Create syntax variable dict if not exists (lazy)
|
||||||
|
if !exists('g:vimwiki_syntaxlocal_vars') || !has_key(g:vimwiki_syntaxlocal_vars, syntax)
|
||||||
|
call vimwiki#vars#populate_syntax_vars(syntax)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Set d_syntax[a:key]
|
||||||
|
let g:vimwiki_syntaxlocal_vars[syntax][a:key] = a:value
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#vars#get_bufferlocal(key, ...) abort
|
function! vimwiki#vars#get_bufferlocal(key, ...) abort
|
||||||
" Return: buffer local variable
|
" Return: buffer local variable
|
||||||
" for the buffer we are currently in or for the given buffer (number or name).
|
" for the buffer we are currently in or for the given buffer (number or name).
|
||||||
@@ -1666,3 +1740,4 @@ function! vimwiki#vars#number_of_wikis() abort
|
|||||||
" Return: number of registered wikis + temporary
|
" Return: number of registered wikis + temporary
|
||||||
return len(g:vimwiki_wikilocal_vars) - 1
|
return len(g:vimwiki_wikilocal_vars) - 1
|
||||||
endfunction
|
endfunction
|
||||||
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||||
|
|||||||
+20
-5
@@ -53,7 +53,7 @@ random edit.
|
|||||||
|
|
||||||
The lowest row gets aligned when leaving the Insert mode. Let's copy _Data1_
|
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
|
(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).
|
the Insert mode).
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -123,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
|
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.
|
table.
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -178,8 +178,8 @@ 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
|
(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
|
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
|
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
|
algorithm differs from the older algorithm when starting editing a misaligned
|
||||||
table in an area where mis-aligned rows do not get into the viewport: in this
|
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
|
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
|
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
|
enough to trigger the older algorithm and the whole table gets aligned. When
|
||||||
@@ -245,9 +245,24 @@ reasons for such a complex system is:
|
|||||||
TODO currently the typeface delimiters are customized that way:
|
TODO currently the typeface delimiters are customized that way:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Typeface: -> u.vim
|
|
||||||
|
" 1/ Redraw: Typeface: -> u.vim
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
|
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
|
||||||
call vimwiki#u#hi_typeface(s:typeface_dic)
|
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)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+147
-34
@@ -479,13 +479,13 @@ glp Decrease the "done" status.
|
|||||||
gll n Increase the level of a list item.
|
gll n Increase the level of a list item.
|
||||||
Remap command: `<Plug>VimwikiIncreaseLvlSingleItem`
|
Remap command: `<Plug>VimwikiIncreaseLvlSingleItem`
|
||||||
gLl Increase the level of a list item and all child items.
|
gLl Increase the level of a list item and all child items.
|
||||||
Remap command: `<Plug>VimwikiIncreaseLvlWholeItem`
|
or gLL Remap command: `<Plug>VimwikiIncreaseLvlWholeItem`
|
||||||
|
|
||||||
*vimwiki_glh* *vimwiki_gLh*
|
*vimwiki_glh* *vimwiki_gLh*
|
||||||
glh n Decrease the level of a list item.
|
glh n Decrease the level of a list item.
|
||||||
Remap command: `<Plug>VimwikiDecreaseLvlSingleItem`
|
Remap command: `<Plug>VimwikiDecreaseLvlSingleItem`
|
||||||
gLh Decrease the level of a list item and all child items.
|
gLh Decrease the level of a list item and all child items.
|
||||||
Remap command: `<Plug>VimwikiDecreaseLvlWholeItem`
|
or gLH Remap command: `<Plug>VimwikiDecreaseLvlWholeItem`
|
||||||
|
|
||||||
*vimwiki_glr* *vimwiki_gLr*
|
*vimwiki_glr* *vimwiki_gLr*
|
||||||
glr n Renumber list items if the cursor is on a numbered
|
glr n Renumber list items if the cursor is on a numbered
|
||||||
@@ -516,6 +516,13 @@ gl- n Make a list item out of a normal line or change the
|
|||||||
gL- Change the symbol of the current list to -.
|
gL- Change the symbol of the current list to -.
|
||||||
Remap command: `:VimwikiChangeSymbolInListTo -<CR>`
|
Remap command: `:VimwikiChangeSymbolInListTo -<CR>`
|
||||||
|
|
||||||
|
*vimwiki_gl+* *vimwiki_gL+*
|
||||||
|
gl+ n Make a list item out of a normal line or change the
|
||||||
|
symbol of the current item to +.
|
||||||
|
Remap command: `:VimwikiChangeSymbolTo +<CR>`
|
||||||
|
gL+ Change the symbol of the current list to +.
|
||||||
|
Remap command: `:VimwikiChangeSymbolInListTo +<CR>`
|
||||||
|
|
||||||
*vimwiki_gl1* *vimwiki_gL1*
|
*vimwiki_gl1* *vimwiki_gL1*
|
||||||
gl1 n Make a list item out of a normal line or change the
|
gl1 n Make a list item out of a normal line or change the
|
||||||
symbol of the current item to 1., the numbering is
|
symbol of the current item to 1., the numbering is
|
||||||
@@ -964,9 +971,9 @@ Vimwiki file.
|
|||||||
and links to external files actually exist. Check also if all wiki files
|
and links to external files actually exist. Check also if all wiki files
|
||||||
are reachable from the index file. The results are shown in the quickfix
|
are reachable from the index file. The results are shown in the quickfix
|
||||||
window.
|
window.
|
||||||
|
|
||||||
This can be used to find "Orphaned" wiki files/pages.
|
This can be used to find "Orphaned" wiki files/pages.
|
||||||
|
|
||||||
With range: the wiki number, by default current wiki
|
With range: the wiki number, by default current wiki
|
||||||
|
|
||||||
|
|
||||||
@@ -1190,13 +1197,13 @@ in HTML: >
|
|||||||
alt="Vimwiki"/>
|
alt="Vimwiki"/>
|
||||||
|
|
||||||
Transclude image with alternate text and some style: >
|
Transclude image with alternate text and some style: >
|
||||||
{{http://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
|
{{https://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
||||||
alt="cool stuff" style="width:150px; height:120px"/>
|
alt="cool stuff" style="width:150px; height:120px"/>
|
||||||
|
|
||||||
Transclude image _without_ alternate text and with a CSS class: >
|
Transclude image _without_ alternate text and with a CSS class: >
|
||||||
{{http://.../vimwiki_logo.png||class="center flow blabla"}}
|
{{https://.../vimwiki_logo.png||class="center flow blabla"}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
||||||
alt="" class="center flow blabla"/>
|
alt="" class="center flow blabla"/>
|
||||||
@@ -1207,16 +1214,16 @@ See |VimwikiWikiIncludeHandler|.
|
|||||||
Thumbnail links~
|
Thumbnail links~
|
||||||
>
|
>
|
||||||
Thumbnail links are constructed like this: >
|
Thumbnail links are constructed like this: >
|
||||||
[[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]]
|
[[https://someaddr.com/bigpicture.jpg|{{https://someaddr.com/thumbnail.jpg}}]]
|
||||||
|
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<a href="http://someaddr.com/ ... /.jpg">
|
<a href="https://someaddr.com/ ... /.jpg">
|
||||||
<img src="http://../thumbnail.jpg /></a>
|
<img src="https://../thumbnail.jpg /></a>
|
||||||
|
|
||||||
Markdown Links~
|
Markdown Links~
|
||||||
|
|
||||||
These links are only available for Markdown syntax. See
|
These links are only available for Markdown syntax. See
|
||||||
http://daringfireball.net/projects/markdown/syntax#link.
|
https://daringfireball.net/projects/markdown/syntax#link.
|
||||||
|
|
||||||
Inline link: >
|
Inline link: >
|
||||||
[Looks like this](URL)
|
[Looks like this](URL)
|
||||||
@@ -1426,7 +1433,7 @@ Use {{{ and }}} to define a block of preformatted text:
|
|||||||
In what distant deeps or skies
|
In what distant deeps or skies
|
||||||
Burnt the fire of thine eyes?
|
Burnt the fire of thine eyes?
|
||||||
On what wings dare he aspire?
|
On what wings dare he aspire?
|
||||||
What the hand dare sieze the fire?
|
What the hand dare seize the fire?
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
|
||||||
@@ -1456,7 +1463,7 @@ See |vimwiki-option-nested_syntaxes| and
|
|||||||
5.8. Mathematical formulae *vimwiki-syntax-math*
|
5.8. Mathematical formulae *vimwiki-syntax-math*
|
||||||
|
|
||||||
Mathematical formulae are highlighted, and can be rendered in HTML using the
|
Mathematical formulae are highlighted, and can be rendered in HTML using the
|
||||||
powerful open source display engine MathJax (http://www.mathjax.org/).
|
powerful open source display engine MathJax (https://www.mathjax.org/).
|
||||||
|
|
||||||
There are three supported syntaxes, which are inline, block display and
|
There are three supported syntaxes, which are inline, block display and
|
||||||
block environment.
|
block environment.
|
||||||
@@ -1514,7 +1521,7 @@ In this case, <mathjax_folder> would be "../mathjax" (without quotes).
|
|||||||
2. Loading MathJax from a CDN-server (needs internet connection).
|
2. Loading MathJax from a CDN-server (needs internet connection).
|
||||||
Add to your HTML template the following lines:
|
Add to your HTML template the following lines:
|
||||||
|
|
||||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
|
||||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||||
|
|
||||||
|
|
||||||
@@ -2029,7 +2036,7 @@ If you have Calendar.vim installed you can use it to create diary notes.
|
|||||||
Just open calendar with :Calendar and tap <Enter> on the date. A wiki file
|
Just open calendar with :Calendar and tap <Enter> on the date. A wiki file
|
||||||
will be created in the default wiki's diary.
|
will be created in the default wiki's diary.
|
||||||
|
|
||||||
Get it from http://www.vim.org/scripts/script.php?script_id=52
|
Get it from https://www.vim.org/scripts/script.php?script_id=52
|
||||||
|
|
||||||
See |g:vimwiki_use_calendar| option to turn it off/on.
|
See |g:vimwiki_use_calendar| option to turn it off/on.
|
||||||
|
|
||||||
@@ -2695,7 +2702,7 @@ Key Default value~
|
|||||||
cycle_bullets 0
|
cycle_bullets 0
|
||||||
|
|
||||||
If set to 1 (true), cycle through |bullet_types| when changing list element
|
If set to 1 (true), cycle through |bullet_types| when changing list element
|
||||||
identation
|
indentation
|
||||||
|
|
||||||
|
|
||||||
*vimwiki-option-generated_links_caption*
|
*vimwiki-option-generated_links_caption*
|
||||||
@@ -2703,7 +2710,7 @@ identation
|
|||||||
Key Default value~
|
Key Default value~
|
||||||
generated_links_caption 0
|
generated_links_caption 0
|
||||||
|
|
||||||
Default syntax only. If set to 1 (true), use the [[URL|DESCRIPTIOM]] when
|
Default syntax only. If set to 1 (true), use the [[URL|DESCRIPTION]] when
|
||||||
calling |:VimwikiGenerateLinks|. DESCRIPTION will be the first header in the
|
calling |:VimwikiGenerateLinks|. DESCRIPTION will be the first header in the
|
||||||
corresbonding file found in the first n lines, where n is set by
|
corresbonding file found in the first n lines, where n is set by
|
||||||
|g:vimwiki_max_scan_for_caption| (Default 5). If no caption is found fallback
|
|g:vimwiki_max_scan_for_caption| (Default 5). If no caption is found fallback
|
||||||
@@ -2724,7 +2731,7 @@ The last is for 100% done items.
|
|||||||
|
|
||||||
You can set it to some more fancy symbols like this:
|
You can set it to some more fancy symbols like this:
|
||||||
>
|
>
|
||||||
let g:vimwiki_list = [{'path': '~/path/', 'listsyms' = '✗○◐●✓'}]
|
let g:vimwiki_list = [{'path': '~/path/', 'listsyms': '✗○◐●✓'}]
|
||||||
|
|
||||||
|
|
||||||
*vimwiki-option-listsym_rejected*
|
*vimwiki-option-listsym_rejected*
|
||||||
@@ -2938,7 +2945,9 @@ color. (See autoload/vimwiki/vars.vim)
|
|||||||
|
|
||||||
Syntax options are configured using the following pattern: >
|
Syntax options are configured using the following pattern: >
|
||||||
|
|
||||||
let g:vimwiki_syntax_list['markdown']['bullet_type'] = ['*', '-', '+']
|
let g:vimwiki_syntaxlocal_vars = {}
|
||||||
|
let g:vimwiki_syntaxlocal_vars['markdown'] = []
|
||||||
|
let g:vimwiki_syntaxlocal_vars['markdown']['bullet_type'] = ['*', '-', '+']
|
||||||
|
|
||||||
Where:
|
Where:
|
||||||
- `markdown` is the syntax name. It can be (`default`, `markdown` or `media`)
|
- `markdown` is the syntax name. It can be (`default`, `markdown` or `media`)
|
||||||
@@ -2946,6 +2955,24 @@ Where:
|
|||||||
- `['*', '-', '+']` is the option value
|
- `['*', '-', '+']` is the option value
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*blockquote_markers*
|
||||||
|
|
||||||
|
List of markers to define the blockquote regrion
|
||||||
|
|
||||||
|
Default: ['>']
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*yaml_metadata_block*
|
||||||
|
|
||||||
|
List of (start, end) regex region delimiters to define the YAML header
|
||||||
|
More information in #1287 and https://pandoc.org/MANUAL.html#extension-yaml_metadata_block
|
||||||
|
|
||||||
|
Default: [['^---$', '^\%(---\|\.\.\.$']]
|
||||||
|
or similar with stricter anchors
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
12.5 Global Options *vimwiki-global-options*
|
12.5 Global Options *vimwiki-global-options*
|
||||||
|
|
||||||
@@ -3255,7 +3282,7 @@ cannot otherwise convert the link. A customized handler might look like this: >
|
|||||||
let str = a:value
|
let str = a:value
|
||||||
|
|
||||||
" complete URL
|
" complete URL
|
||||||
let url_0 = matchstr(str, g:vimwiki_rxWikiInclMatchUrl)
|
let url_0 = matchstr(str, g:vimwiki_global_vars.rxWikiInclMatchUrl)
|
||||||
" URL parts
|
" URL parts
|
||||||
let link_infos = vimwiki#base#resolve_link(url_0)
|
let link_infos = vimwiki#base#resolve_link(url_0)
|
||||||
let arg1 = matchstr(str, VimwikiWikiInclMatchArg(1))
|
let arg1 = matchstr(str, VimwikiWikiInclMatchArg(1))
|
||||||
@@ -3291,8 +3318,8 @@ small screens. If |g:vimwiki_table_auto_fmt| is set to 0, this option has no
|
|||||||
effect.
|
effect.
|
||||||
|
|
||||||
Value Description~
|
Value Description~
|
||||||
0 Enable table auto formating for all columns.
|
0 Enable table auto formatting for all columns.
|
||||||
1 Disable table auto formating for the last column.
|
1 Disable table auto formatting for the last column.
|
||||||
|
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
@@ -3778,7 +3805,7 @@ The default is %%%s.
|
|||||||
|
|
||||||
Bitfield: Enable/disable emoji conceal and complete
|
Bitfield: Enable/disable emoji conceal and complete
|
||||||
Note that the |completefunc| is only set if it does not exists already to keep
|
Note that the |completefunc| is only set if it does not exists already to keep
|
||||||
other plugin works by default. It can be set it manualy with: >
|
other plugin works by default. It can be set it manually with: >
|
||||||
set completefunc=vimwiki#emoji#complete
|
set completefunc=vimwiki#emoji#complete
|
||||||
|
|
||||||
To replace emoji alias (like :cat:) by their value (like 🐱) in current file: >
|
To replace emoji alias (like :cat:) by their value (like 🐱) in current file: >
|
||||||
@@ -3805,7 +3832,7 @@ generate and follow_link
|
|||||||
----------------------------------------------------- ReGeX
|
----------------------------------------------------- ReGeX
|
||||||
| pre | '^\|\s' | Limitations to tag precedence
|
| pre | '^\|\s' | Limitations to tag precedence
|
||||||
| pre_mark | ':' | Tag list opener
|
| pre_mark | ':' | Tag list opener
|
||||||
| in | '[:space:]]\+' | Tag permitted characters
|
| in | '[[:space:]]\+' | Tag permitted characters
|
||||||
| sep | ':' | Tag separators in a tag list
|
| sep | ':' | Tag separators in a tag list
|
||||||
| post_mark | ':' | Tag list closer
|
| post_mark | ':' | Tag list closer
|
||||||
| post | '\s\|$' | Limitations to tag following
|
| post | '\s\|$' | Limitations to tag following
|
||||||
@@ -3849,15 +3876,15 @@ See CONTRIBUTING.md for info about how to file bugs etc.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
15. Development *vimwiki-development*
|
15. Development *vimwiki-development*
|
||||||
|
|
||||||
Homepage: http://vimwiki.github.io/
|
Homepage: https://vimwiki.github.io/
|
||||||
Github: https://github.com/vimwiki/vimwiki/
|
Github: https://github.com/vimwiki/vimwiki/
|
||||||
Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226
|
Vim plugins: https://www.vim.org/scripts/script.php?script_id=2226
|
||||||
Old homepage: http://code.google.com/p/vimwiki/
|
Old homepage: https://code.google.com/p/vimwiki/
|
||||||
|
|
||||||
Contributors and their Github usernames in roughly chronological order:
|
Contributors and their Github usernames in roughly chronological order:
|
||||||
|
|
||||||
- Maxim Kim (@habamax) <habamax@gmail.com> as original author
|
- Maxim Kim (@habamax) <habamax@gmail.com> as original author
|
||||||
- the people here: http://code.google.com/p/vimwiki/people/list
|
- the people here: https://code.google.com/p/vimwiki/people/list
|
||||||
- Stuart Andrews (@tub78)
|
- Stuart Andrews (@tub78)
|
||||||
- Tomas Pospichal
|
- Tomas Pospichal
|
||||||
- Daniel Schemala (@EinfachToll) as current maintainer
|
- Daniel Schemala (@EinfachToll) as current maintainer
|
||||||
@@ -3980,8 +4007,19 @@ Contributors and their Github usernames in roughly chronological order:
|
|||||||
- Jean-Luc Bastarache (@jlbas)
|
- Jean-Luc Bastarache (@jlbas)
|
||||||
- Youssof Taha (@ysftaha)
|
- Youssof Taha (@ysftaha)
|
||||||
- Thomas Leyh (@leyhline)
|
- Thomas Leyh (@leyhline)
|
||||||
|
- Charles Schimmelpfennig (@charlesschimmel)
|
||||||
- nebulaeandstars (@nebulaeandstars)
|
- nebulaeandstars (@nebulaeandstars)
|
||||||
- dmitry kim (@jsn)
|
- dmitry kim (@jsn)
|
||||||
|
- Julian Prein (@druckdev)
|
||||||
|
- Luke Atkinson (@LukeDAtkinson)
|
||||||
|
- Joe Planisky (@jplanisky)
|
||||||
|
- Bence Ferdinandy (@ferdinandyb)
|
||||||
|
- R. David Dunphy (@rdunphy)
|
||||||
|
- Aarón Fas (@aaronfc)
|
||||||
|
- @jiamingc
|
||||||
|
- Alex Claman (@claman)
|
||||||
|
- @qadzek
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
16. Changelog *vimwiki-changelog*
|
16. Changelog *vimwiki-changelog*
|
||||||
@@ -3989,7 +4027,7 @@ Contributors and their Github usernames in roughly chronological order:
|
|||||||
|
|
||||||
Issue numbers starting with '#' are issues from
|
Issue numbers starting with '#' are issues from
|
||||||
https://github.com/vimwiki/vimwiki/issues/, all others from
|
https://github.com/vimwiki/vimwiki/issues/, all others from
|
||||||
http://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
https://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
||||||
https://github.com/vimwiki-backup/vimwiki/issues.
|
https://github.com/vimwiki-backup/vimwiki/issues.
|
||||||
|
|
||||||
From version 2022.12.02, what would have been 2.6.0 under the prior versioning
|
From version 2022.12.02, what would have been 2.6.0 under the prior versioning
|
||||||
@@ -3999,6 +4037,80 @@ master is retained as a legacy mirror of the dev branch.
|
|||||||
|
|
||||||
This is somewhat experimental, and will probably be refined over time.
|
This is somewhat experimental, and will probably be refined over time.
|
||||||
|
|
||||||
|
|
||||||
|
2024.01.24~
|
||||||
|
|
||||||
|
New:~
|
||||||
|
* PR #1389: Document gLH, gl+, and gL+ mappings
|
||||||
|
* Tidy some aspects of README.md, remove pointers to defunct Matrix
|
||||||
|
channel and Google Group, add wikis.world Mastodon account.
|
||||||
|
|
||||||
|
|
||||||
|
2024.01.22~
|
||||||
|
|
||||||
|
New:~
|
||||||
|
* Issue #1279: Fix/Improvement: When re-wrap a long line in a definition
|
||||||
|
by 'gq' it should insert ':: ' at the new line
|
||||||
|
* Issue #1211: Support angle bracket escaped markdown urls
|
||||||
|
* Make auto_tags preserve existing tag section structure
|
||||||
|
* Issue #1315: GTD-style token highlighting
|
||||||
|
* Issue #1279: gqq autowrap leading :: definition as &l:comments
|
||||||
|
* Issue #1332: message URLs on Mac
|
||||||
|
* Util: add vimwiki#vars#set_syntaxlocal function for consistency
|
||||||
|
|
||||||
|
Fixed:~
|
||||||
|
* Issue #1365: Fix: count ignored when looking up diary frequency Issue
|
||||||
|
* Issue #1323: Folding code blocks using markdown syntax folds the entire rest of
|
||||||
|
the file
|
||||||
|
* Issue #1365: Jumping to nested anchor with markdown
|
||||||
|
* Issue #1297: Handle multibyte chars properly in table separators
|
||||||
|
* Issue #1311: Newlines in HTML conversion of codeblocks
|
||||||
|
* Issue #1326: Duplicate tag generation
|
||||||
|
* Issue #1324: File name prompt fixes
|
||||||
|
* Fix vimwiki#diary#calendar_sign when g:vimwiki_list is not set
|
||||||
|
* Use fnameescape() instead of escape() in edit_file()
|
||||||
|
* Admit trailing spaces for YAML delimiters
|
||||||
|
* Minor documentation fixes and CI improvements
|
||||||
|
|
||||||
|
|
||||||
|
2023.04.04~
|
||||||
|
|
||||||
|
Fixed:~
|
||||||
|
* Issue #1229: VimwikiGoto completion with file with space
|
||||||
|
Must complete file unescaped as argument is then quoted
|
||||||
|
* PR #1324: Fix pressing escape in VimwikiGoto prompt (rddunphy)
|
||||||
|
* Issue #1336: vimwiki#diary#calendar_sign throws an error
|
||||||
|
when g:vimwiki_list is not set
|
||||||
|
|
||||||
|
|
||||||
|
2023.04.04~
|
||||||
|
|
||||||
|
New:~
|
||||||
|
* Issue #1261: Feature: Support for <mark> in Markdown
|
||||||
|
highlighting with yellow background and back foreground
|
||||||
|
* Issue #1274: Feature: Continue blockquote when <CR>
|
||||||
|
is pressed in insert mode
|
||||||
|
Also add the |blockquote_markers| variable
|
||||||
|
|
||||||
|
Fixed:~
|
||||||
|
* Issue #1267: Improve performance on link creation by speeding up
|
||||||
|
is_diary_file()
|
||||||
|
* Issue #1229: Bug: VimwikiGoto without argument creates empty page
|
||||||
|
* Issue #1316: Permit tags in heading
|
||||||
|
and improve |VimwikiSearchTags| and |VimwikiRebuildTags|
|
||||||
|
* Issue #1270: |VimwikiAddHeaderLevel| map (3=) was broken by a previous
|
||||||
|
refactoring commit
|
||||||
|
|
||||||
|
|
||||||
|
2023.03.15~
|
||||||
|
|
||||||
|
New:~
|
||||||
|
* Issue #150 Fix Math border cases
|
||||||
|
according to https://pandoc.org/MANUAL.html#math
|
||||||
|
* Issue #1287 Highlight YAML header with |yaml_metadata_block|
|
||||||
|
configuration variable holding region delimiters
|
||||||
|
|
||||||
|
|
||||||
2022.12.02~
|
2022.12.02~
|
||||||
|
|
||||||
New:~
|
New:~
|
||||||
@@ -4054,6 +4166,7 @@ New:~
|
|||||||
current file
|
current file
|
||||||
* Feature: Add |VimwikiBaddLink| to add links to the buffer list, without
|
* Feature: Add |VimwikiBaddLink| to add links to the buffer list, without
|
||||||
loading, if they weren't listed yet
|
loading, if they weren't listed yet
|
||||||
|
* PR 1211: Enable parsing Markdown links escaped with angle brackets
|
||||||
|
|
||||||
Changed:~
|
Changed:~
|
||||||
* PR #1047: Allow to replace default mapping of VimwikiToggleListItem
|
* PR #1047: Allow to replace default mapping of VimwikiToggleListItem
|
||||||
@@ -4090,10 +4203,10 @@ Fixed:~
|
|||||||
* Issue #894: Make all appropriate settings wikilocal (many commits)
|
* Issue #894: Make all appropriate settings wikilocal (many commits)
|
||||||
* PR #902: Doc: Darken logo text
|
* PR #902: Doc: Darken logo text
|
||||||
* PR #895: Fix: File extension for markdown -> syntax wide
|
* PR #895: Fix: File extension for markdown -> syntax wide
|
||||||
__FileExtention__ keyword appears
|
__FileExtension__ keyword appears
|
||||||
* PR #963: Doc: Replace VimwikiListChangeLevel references in doc with
|
* PR #963: Doc: Replace VimwikiListChangeLevel references in doc with
|
||||||
VimwikiListChangeLvl as defined by command
|
VimwikiListChangeLvl as defined by command
|
||||||
* PR #900: conceallevel is now setted locally for vimwiki buffers
|
* PR #900: conceallevel is now set locally for vimwiki buffers
|
||||||
* Issue #942: Fixing wrong html link conversion in windows
|
* Issue #942: Fixing wrong html link conversion in windows
|
||||||
* PR #919: Fix duplicate helptag
|
* PR #919: Fix duplicate helptag
|
||||||
* PR #959: Fix :VimwikiNextTask
|
* PR #959: Fix :VimwikiNextTask
|
||||||
@@ -4151,7 +4264,7 @@ New:~
|
|||||||
sections. New option |g:vimwiki_links_header_level| and
|
sections. New option |g:vimwiki_links_header_level| and
|
||||||
|g:vimwiki_tags_header_level| which allow the header level (1-6) of the
|
|g:vimwiki_tags_header_level| which allow the header level (1-6) of the
|
||||||
generated links to be set. New option |g:vimwiki_markdown_header_style|
|
generated links to be set. New option |g:vimwiki_markdown_header_style|
|
||||||
which specifies the nuber of newlines after the created header for
|
which specifies the number of newlines after the created header for
|
||||||
generated sections.
|
generated sections.
|
||||||
* PR #635: Wiki local options |vimwiki-option-auto_generate_links| and
|
* PR #635: Wiki local options |vimwiki-option-auto_generate_links| and
|
||||||
|vimwiki-option-auto_generate_tags|.
|
|vimwiki-option-auto_generate_tags|.
|
||||||
@@ -4198,7 +4311,7 @@ Fixed:~
|
|||||||
* Issue #90: |:VimwikiRenameFile| doesn't update links in diary.
|
* Issue #90: |:VimwikiRenameFile| doesn't update links in diary.
|
||||||
* Issue #790: Allow tags before a header with markdown syntax.
|
* Issue #790: Allow tags before a header with markdown syntax.
|
||||||
* Issue #779: Vimwiki tags file meets ctags standard.
|
* Issue #779: Vimwiki tags file meets ctags standard.
|
||||||
* Issue #781: Compatablity fixes for older versions of Vim.
|
* Issue #781: Compatibility fixes for older versions of Vim.
|
||||||
* Issue #691: Allow |:VimwikiGoBackLink| to go back multiple times.
|
* Issue #691: Allow |:VimwikiGoBackLink| to go back multiple times.
|
||||||
* Update MathJax CDN loading instructions.
|
* Update MathJax CDN loading instructions.
|
||||||
* Issue #212: Don't treat comment characters within code blocks as
|
* Issue #212: Don't treat comment characters within code blocks as
|
||||||
@@ -4457,7 +4570,7 @@ Summary ~
|
|||||||
* Option to disable table mappings. See |g:vimwiki_table_mappings|.
|
* Option to disable table mappings. See |g:vimwiki_table_mappings|.
|
||||||
|
|
||||||
For detailed information see issues list on
|
For detailed information see issues list on
|
||||||
http://code.google.com/p/vimwiki/issues/list
|
https://code.google.com/p/vimwiki/issues/list
|
||||||
|
|
||||||
|
|
||||||
1.2~
|
1.2~
|
||||||
@@ -4536,7 +4649,7 @@ http://code.google.com/p/vimwiki/issues/list
|
|||||||
17. License *vimwiki-license*
|
17. License *vimwiki-license*
|
||||||
|
|
||||||
The MIT License
|
The MIT License
|
||||||
http://www.opensource.org/licenses/mit-license.php
|
https://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
||||||
Copyright (c) 2008-2010 Maxim Kim
|
Copyright (c) 2008-2010 Maxim Kim
|
||||||
2013-2017 Daniel Schemala
|
2013-2017 Daniel Schemala
|
||||||
|
|||||||
+25
-13
@@ -3,7 +3,7 @@
|
|||||||
" Home: https://github.com/vimwiki/vimwiki/
|
" Home: https://github.com/vimwiki/vimwiki/
|
||||||
|
|
||||||
|
|
||||||
" Clause: load only onces per buffer
|
" Clause: load only once per buffer
|
||||||
if exists('b:did_ftplugin')
|
if exists('b:did_ftplugin')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
@@ -149,6 +149,10 @@ for bullet in vimwiki#vars#get_syntaxlocal('bullet_types')
|
|||||||
" list
|
" list
|
||||||
let comments .= ',fb:' . bullet
|
let comments .= ',fb:' . bullet
|
||||||
endfor
|
endfor
|
||||||
|
" Add :: for vimwiki default syntax (#1279)
|
||||||
|
if 'default' ==# vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
let comments .= ',b:::'
|
||||||
|
endif
|
||||||
let &l:comments = comments
|
let &l:comments = comments
|
||||||
|
|
||||||
" Set Format Options: (:h fo-table)
|
" Set Format Options: (:h fo-table)
|
||||||
@@ -160,7 +164,7 @@ setlocal formatoptions-=2
|
|||||||
setlocal formatoptions+=c
|
setlocal formatoptions+=c
|
||||||
" Do not wrap if line was already long
|
" Do not wrap if line was already long
|
||||||
setlocal formatoptions+=l
|
setlocal formatoptions+=l
|
||||||
" AutoWrap inteligent with lists
|
" AutoWrap intelligent with lists
|
||||||
setlocal formatoptions+=n
|
setlocal formatoptions+=n
|
||||||
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')
|
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')
|
||||||
" Used to join 'commented' lines (blockquote, list) (see: #915)
|
" Used to join 'commented' lines (blockquote, list) (see: #915)
|
||||||
@@ -189,14 +193,22 @@ function! VimwikiFoldLevel(lnum) abort
|
|||||||
" Header/section folding...
|
" Header/section folding...
|
||||||
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader') && !vimwiki#u#is_codeblock(a:lnum)
|
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader') && !vimwiki#u#is_codeblock(a:lnum)
|
||||||
return '>'.vimwiki#u#count_first_sym(line)
|
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
|
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
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@@ -222,7 +234,7 @@ endfunction
|
|||||||
" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
|
" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
|
||||||
" Return: [string, spare]
|
" Return: [string, spare]
|
||||||
function! s:shorten_text(text, len) abort
|
function! s:shorten_text(text, len) abort
|
||||||
" 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
|
" trick here -- replace all non-spaces with dot, calculate lengths and
|
||||||
" indexes on it, then use original string to break at selected index.
|
" indexes on it, then use original string to break at selected index.
|
||||||
let text_pattern = substitute(a:text, '\m\S', '.', 'g')
|
let text_pattern = substitute(a:text, '\m\S', '.', 'g')
|
||||||
@@ -322,7 +334,7 @@ command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
|
|||||||
command! -buffer -nargs=* VimwikiSearch call vimwiki#base#search(<q-args>)
|
command! -buffer -nargs=* VimwikiSearch call vimwiki#base#search(<q-args>)
|
||||||
command! -buffer -nargs=* VWS 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
|
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_raw
|
||||||
\ VimwikiGoto call vimwiki#base#goto(<q-args>)
|
\ VimwikiGoto call vimwiki#base#goto(<q-args>)
|
||||||
|
|
||||||
command! -buffer -range VimwikiCheckLinks call vimwiki#base#check_links(<range>, <line1>, <line2>)
|
command! -buffer -range VimwikiCheckLinks call vimwiki#base#check_links(<range>, <line1>, <line2>)
|
||||||
@@ -363,7 +375,7 @@ command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
|
|||||||
" tags commands
|
" tags commands
|
||||||
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
|
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
|
||||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
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
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
||||||
\ VimwikiGenerateTagLinks call vimwiki#tags#generate_tags(1, <f-args>)
|
\ VimwikiGenerateTagLinks call vimwiki#tags#generate_tags(1, <f-args>)
|
||||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
||||||
@@ -568,7 +580,7 @@ if str2nr(vimwiki#vars#get_global('key_mappings').lists)
|
|||||||
inoremap <expr><silent><buffer> <S-CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 2 2<CR>'
|
inoremap <expr><silent><buffer> <S-CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 2 2<CR>'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" change symbol for bulleted lists
|
" change symbol for bulleted lists
|
||||||
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
|
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
|
||||||
if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')
|
if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')
|
||||||
|
|||||||
+7
-7
@@ -4,14 +4,14 @@
|
|||||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
||||||
|
|
||||||
|
|
||||||
" Clause: load only onces
|
" Clause: load only once
|
||||||
if exists('g:loaded_vimwiki') || &compatible
|
if exists('g:loaded_vimwiki') || &compatible
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_vimwiki = 1
|
let g:loaded_vimwiki = 1
|
||||||
|
|
||||||
" Set to version number for release:
|
" Set to version number for release:
|
||||||
let g:vimwiki_version = '2022.12.02'
|
let g:vimwiki_version = '2024.01.24'
|
||||||
|
|
||||||
" Get the directory the script is installed in
|
" Get the directory the script is installed in
|
||||||
let s:plugin_dir = expand('<sfile>:p:h:h')
|
let s:plugin_dir = expand('<sfile>:p:h:h')
|
||||||
@@ -20,7 +20,7 @@ let s:plugin_dir = expand('<sfile>:p:h:h')
|
|||||||
let s:old_cpo = &cpoptions
|
let s:old_cpo = &cpoptions
|
||||||
set cpoptions&vim
|
set cpoptions&vim
|
||||||
|
|
||||||
" Save autowriteall varaible state
|
" Save autowriteall variable state
|
||||||
if exists('g:vimwiki_autowriteall')
|
if exists('g:vimwiki_autowriteall')
|
||||||
let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
|
let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
|
||||||
else
|
else
|
||||||
@@ -366,11 +366,11 @@ command! -count=0 VimwikiTabMakeDiaryNote
|
|||||||
|
|
||||||
command! -count=0 VimwikiMakeYesterdayDiaryNote
|
command! -count=0 VimwikiMakeYesterdayDiaryNote
|
||||||
\ call vimwiki#diary#make_note(<count>, 0,
|
\ call vimwiki#diary#make_note(<count>, 0,
|
||||||
\ vimwiki#diary#diary_date_link(localtime(), -1))
|
\ vimwiki#diary#diary_date_link(localtime(), -1, <count>))
|
||||||
|
|
||||||
command! -count=0 VimwikiMakeTomorrowDiaryNote
|
command! -count=0 VimwikiMakeTomorrowDiaryNote
|
||||||
\ call vimwiki#diary#make_note(<count>, 0,
|
\ call vimwiki#diary#make_note(<count>, 0,
|
||||||
\ vimwiki#diary#diary_date_link(localtime(), 1))
|
\ vimwiki#diary#diary_date_link(localtime(), 1, <count>))
|
||||||
|
|
||||||
command! VimwikiDiaryGenerateLinks
|
command! VimwikiDiaryGenerateLinks
|
||||||
\ call vimwiki#diary#generate_diary_section()
|
\ call vimwiki#diary#generate_diary_section()
|
||||||
@@ -399,10 +399,10 @@ nnoremap <silent><script> <Plug>VimwikiTabMakeDiaryNote
|
|||||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 1)<CR>
|
\ :<C-U>call vimwiki#diary#make_note(v:count, 1)<CR>
|
||||||
nnoremap <silent><script> <Plug>VimwikiMakeYesterdayDiaryNote
|
nnoremap <silent><script> <Plug>VimwikiMakeYesterdayDiaryNote
|
||||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
|
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
|
||||||
\ vimwiki#diary#diary_date_link(localtime(), -1))<CR>
|
\ vimwiki#diary#diary_date_link(localtime(), -1, v:count))<CR>
|
||||||
nnoremap <silent><script> <Plug>VimwikiMakeTomorrowDiaryNote
|
nnoremap <silent><script> <Plug>VimwikiMakeTomorrowDiaryNote
|
||||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
|
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
|
||||||
\ vimwiki#diary#diary_date_link(localtime(), 1))<CR>
|
\ vimwiki#diary#diary_date_link(localtime(), 1, v:count))<CR>
|
||||||
|
|
||||||
|
|
||||||
" Set default global key mappings
|
" Set default global key mappings
|
||||||
|
|||||||
+54
-21
@@ -24,7 +24,7 @@ call vimwiki#vars#populate_syntax_vars(s:current_syntax)
|
|||||||
let syntax_dic = g:vimwiki_syntaxlocal_vars[s:current_syntax]
|
let syntax_dic = g:vimwiki_syntaxlocal_vars[s:current_syntax]
|
||||||
|
|
||||||
" Declare nesting capabilities
|
" Declare nesting capabilities
|
||||||
" -- to be embeded in standard: bold, italic, underline
|
" -- to be embedded in standard: bold, italic, underline
|
||||||
|
|
||||||
" text: `code` or ``code`` only inline
|
" text: `code` or ``code`` only inline
|
||||||
" Note: `\%(^\|[^`]\)\@<=` means after a new line or a non `
|
" Note: `\%(^\|[^`]\)\@<=` means after a new line or a non `
|
||||||
@@ -150,6 +150,31 @@ let s:target = vimwiki#base#apply_template(
|
|||||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
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').'/'
|
||||||
|
|
||||||
|
" 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
|
" Header Level: 1..6
|
||||||
for s:i in range(1,6)
|
for s:i in range(1,6)
|
||||||
" WebLink are for markdown but putting them here avoidcode duplication
|
" WebLink are for markdown but putting them here avoidcode duplication
|
||||||
@@ -236,24 +261,6 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
|||||||
|
|
||||||
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||||
|
|
||||||
" List:
|
|
||||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
|
|
||||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
|
||||||
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
|
|
||||||
|
|
||||||
" Task List Done:
|
|
||||||
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
|
||||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
|
||||||
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
|
||||||
\ . vimwiki#vars#get_global('listsym_rejected')
|
|
||||||
\ . ']\]\s\(.*\)$/ '
|
|
||||||
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
|
||||||
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
|
||||||
execute 'syntax match VimwikiCheckBoxDone /'
|
|
||||||
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
|
|
||||||
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" Horizontal Rule: <hr>
|
" Horizontal Rule: <hr>
|
||||||
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
|
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
|
||||||
@@ -316,7 +323,7 @@ for [color_key, color_value] in items(color_dic)
|
|||||||
\ . ' ' . b:vimwiki_syntax_concealends
|
\ . ' ' . b:vimwiki_syntax_concealends
|
||||||
execute cmd
|
execute cmd
|
||||||
|
|
||||||
" Build hightlight command
|
" Build highlight command
|
||||||
let cmd = 'hi Vimwiki' . color_key
|
let cmd = 'hi Vimwiki' . color_key
|
||||||
if fg !=# ''
|
if fg !=# ''
|
||||||
let cmd .= ' guifg=' . fg
|
let cmd .= ' guifg=' . fg
|
||||||
@@ -327,6 +334,13 @@ for [color_key, color_value] in items(color_dic)
|
|||||||
execute cmd
|
execute cmd
|
||||||
endfor
|
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
|
" Comment: home made
|
||||||
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex').
|
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex').
|
||||||
@@ -416,6 +430,8 @@ hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
|
|||||||
hi def link VimwikiCode PreProc
|
hi def link VimwikiCode PreProc
|
||||||
hi def link VimwikiCodeT VimwikiCode
|
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 VimwikiPre PreProc
|
||||||
hi def link VimwikiPreT VimwikiPre
|
hi def link VimwikiPreT VimwikiPre
|
||||||
hi def link VimwikiPreDelim VimwikiPre
|
hi def link VimwikiPreDelim VimwikiPre
|
||||||
@@ -471,7 +487,7 @@ hi def link VimwikiSubScriptChar VimwikiMarkers
|
|||||||
hi def link VimwikiCodeChar VimwikiMarkers
|
hi def link VimwikiCodeChar VimwikiMarkers
|
||||||
hi def link VimwikiHeaderChar VimwikiMarkers
|
hi def link VimwikiHeaderChar VimwikiMarkers
|
||||||
|
|
||||||
" TODO remove unsued due to region refactoring
|
" TODO remove unused due to region refactoring
|
||||||
hi def link VimwikiEqInCharT VimwikiMarkers
|
hi def link VimwikiEqInCharT VimwikiMarkers
|
||||||
hi def link VimwikiBoldCharT VimwikiMarkers
|
hi def link VimwikiBoldCharT VimwikiMarkers
|
||||||
hi def link VimwikiItalicCharT VimwikiMarkers
|
hi def link VimwikiItalicCharT VimwikiMarkers
|
||||||
@@ -485,6 +501,12 @@ hi def link VimwikiHeaderCharT VimwikiMarkers
|
|||||||
hi def link VimwikiLinkCharT VimwikiLinkT
|
hi def link VimwikiLinkCharT VimwikiLinkT
|
||||||
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
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
|
" Load syntax-specific functionality
|
||||||
call vimwiki#u#reload_regexes_custom()
|
call vimwiki#u#reload_regexes_custom()
|
||||||
@@ -508,6 +530,17 @@ if !empty(s:nested)
|
|||||||
endfor
|
endfor
|
||||||
endif
|
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: Load
|
" LaTex: Load
|
||||||
if !empty(globpath(&runtimepath, 'syntax/tex.vim'))
|
if !empty(globpath(&runtimepath, 'syntax/tex.vim'))
|
||||||
execute 'syntax include @textGrouptex syntax/tex.vim'
|
execute 'syntax include @textGrouptex syntax/tex.vim'
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -40,7 +40,7 @@ Do (,wn buzz_bo + Completion(input()) && Assert):
|
|||||||
Execute (:VimwikiGoto + Completion (API)):
|
Execute (:VimwikiGoto + Completion (API)):
|
||||||
VimwikiIndex 2
|
VimwikiIndex 2
|
||||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
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')
|
Assert -1 != stridx(s_complete, 'buzz_bozz')
|
||||||
|
|
||||||
Execute (Create dir1/dir2/test_goto_file.md):
|
Execute (Create dir1/dir2/test_goto_file.md):
|
||||||
@@ -55,23 +55,23 @@ Execute (:VimwikiGoto + Completion in directory):
|
|||||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||||
|
|
||||||
" Complete without argment
|
" 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')
|
Assert -1 != stridx(s_complete1, 'test_goto_file')
|
||||||
|
|
||||||
" Complete with file argument
|
" 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')
|
Assert -1 != stridx(s_complete2, 'test_goto_file')
|
||||||
|
|
||||||
" Complete with start of file argument
|
" 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')
|
Assert -1 != stridx(s_complete3, 'test_goto_file')
|
||||||
|
|
||||||
" Complete with (nested) dir2 argument
|
" 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')
|
Assert -1 != stridx(s_complete4, 'test_goto_file')
|
||||||
|
|
||||||
" Complete with bad argument
|
" 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)
|
let s_complete5=string(l_complete5)
|
||||||
Assert -1 == stridx(s_complete5, 'test_goto_file')
|
Assert -1 == stridx(s_complete5, 'test_goto_file')
|
||||||
AssertEqual 0, len(l_complete5)
|
AssertEqual 0, len(l_complete5)
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ Given (Void for Accessing other files within vimwiki #979 {{{1):
|
|||||||
Do (At Index: Create and goto pythonfile):
|
Do (At Index: Create and goto pythonfile):
|
||||||
:VimwikiIndex 2\<Cr>
|
:VimwikiIndex 2\<Cr>
|
||||||
Opyfile.py\<Esc>\<Cr>\<Cr>
|
Opyfile.py\<Esc>\<Cr>\<Cr>
|
||||||
:AssertEqual 'pyfile.py', expand('%:t')\<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>
|
:AssertEqual 'python', &ft\<CR>
|
||||||
:Log "Clean pyfile"\<Cr>
|
:Log "Clean pyfile"\<Cr>
|
||||||
dd
|
dd
|
||||||
:VimwikiIndex 2\<Cr>
|
:VimwikiIndex 2\<Cr>
|
||||||
:call DeleteFile('pyfile.py')\<Cr>
|
" :call DeleteFile('pyfile.py')\<Cr>
|
||||||
|
|
||||||
|
|
||||||
Do (At Index: Create and goto markdownfile):
|
Do (At Index: Create and goto markdownfile):
|
||||||
@@ -22,6 +23,6 @@ Do (At Index: Create and goto markdownfile):
|
|||||||
:Log "Clean mdfile"\<Cr>
|
:Log "Clean mdfile"\<Cr>
|
||||||
:VimwikiIndex 2\<Cr>
|
:VimwikiIndex 2\<Cr>
|
||||||
dd
|
dd
|
||||||
:call DeleteFile('mdfile.md')\<Cr>
|
" :call DeleteFile('mdfile.md')\<Cr>
|
||||||
|
|
||||||
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
|
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
>
|
||||||
@@ -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
|
||||||
|
::
|
||||||
@@ -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))
|
||||||
@@ -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
|
||||||
@@ -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)
|
||||||
@@ -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
|
||||||
@@ -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")
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -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 won’t parse as math. If for some reason you need to enclose text in literal $ characters, backslash-escape them and they won’t 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
|
||||||
@@ -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
|
||||||
+95
-49
@@ -36,13 +36,22 @@ Given vimwiki (VimwikiTOC with link and number {{{1):
|
|||||||
Execute (Set syntax markdown):
|
Execute (Set syntax markdown):
|
||||||
call SetSyntax('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):
|
Do (Enter link):
|
||||||
gg\<Cr>
|
gg\<Cr>
|
||||||
A__HERE1__\<Esc>
|
A__HERE1__\<Esc>
|
||||||
ggj\<Cr>
|
ggj\<Cr>
|
||||||
A__HERE2__\<Esc>
|
A__HERE2__\<Esc>
|
||||||
|
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
|
||||||
|
|
||||||
Expect():
|
Expect(Some suffix added after headings):
|
||||||
[link1](#i-v-p-741528)
|
[link1](#i-v-p-741528)
|
||||||
[link2](#i-v-p-741528-2)
|
[link2](#i-v-p-741528-2)
|
||||||
|
|
||||||
@@ -192,6 +201,9 @@ Given vimwiki (Internal links + one link to filenew):
|
|||||||
Execute (Set filename wiki_test.md):
|
Execute (Set filename wiki_test.md):
|
||||||
call SetSyntax('markdown')
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Set filename wiki_test.md):
|
||||||
|
file wiki_test.md
|
||||||
|
|
||||||
Do (Navigate with <Tab>):
|
Do (Navigate with <Tab>):
|
||||||
A more Contents\<Esc>
|
A more Contents\<Esc>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
@@ -201,6 +213,7 @@ Do (Navigate with <Tab>):
|
|||||||
\<Tab>
|
\<Tab>
|
||||||
\<Enter>
|
\<Enter>
|
||||||
A more Test2\<Esc>
|
A more Test2\<Esc>
|
||||||
|
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
|
||||||
|
|
||||||
Expect (Content added to titles):
|
Expect (Content added to titles):
|
||||||
# Contents more Contents
|
# Contents more Contents
|
||||||
@@ -231,9 +244,23 @@ Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
|
|||||||
\<Tab>
|
\<Tab>
|
||||||
\<Tab>
|
\<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
|
# Cursor at Test2/filenew
|
||||||
A not yet\<Esc>
|
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>
|
\<Bs>
|
||||||
|
:Log 'Debugging 2, cursor position list'\<Cr>
|
||||||
|
:Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
|
||||||
# Cursor at Test1/test2
|
# Cursor at Test1/test2
|
||||||
A near Test1/test2
|
A near Test1/test2
|
||||||
\<Esc>
|
\<Esc>
|
||||||
@@ -260,51 +287,70 @@ Expect (Vimwiki links):
|
|||||||
- [Test2](#Test2)
|
- [Test2](#Test2)
|
||||||
- [filenew](filenew) not yet
|
- [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
|
###################################
|
||||||
|
###################################
|
||||||
|
###################################
|
||||||
|
# Commented out as butsetvar of the var prev_links is removing the list info at change of file for old Vim
|
||||||
|
|
||||||
- [Test1](#Test1) first shot second shot
|
|
||||||
- [Test2](#Test2)
|
|
||||||
|
|
||||||
# Test1
|
|
||||||
|
|
||||||
- [Test1](#Test1)
|
|
||||||
- [Test2](#Test2) first shot
|
|
||||||
- [filenew](filenew)
|
|
||||||
|
|
||||||
# Test2
|
#Do (Navigate with <Tab> comeback with <Bs> from filenew):
|
||||||
|
# \<Tab>
|
||||||
- [Test1](#Test1)
|
# A first shot\<Esc>
|
||||||
- [Test2](#Test2)
|
# 0\<Tab>
|
||||||
- [filenew](filenew) first shot
|
## 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):
|
Execute (Delete filenew buffer):
|
||||||
call DeleteFile('/testplugin/filenew.md')
|
call DeleteFile('/testplugin/filenew.md')
|
||||||
@@ -312,22 +358,22 @@ Execute (Delete filenew buffer):
|
|||||||
Do (Navigate with <Tab> comeback with <Bs> too far):
|
Do (Navigate with <Tab> comeback with <Bs> too far):
|
||||||
\<Tab>
|
\<Tab>
|
||||||
# Cursor at Contents/test1
|
# Cursor at Contents/test1
|
||||||
\<Enter>
|
\<Cr>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
# Cursor at Test1/test2
|
# Cursor at Test1/test2
|
||||||
\<Enter>
|
\<Cr>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
# Cursor at Test2/test1
|
# Cursor at Test2/test1
|
||||||
\<Enter>
|
\<Cr>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
# Cursor at Test1/test2
|
# Cursor at Test1/test2
|
||||||
\<Enter>
|
\<Cr>
|
||||||
A first test2\<Esc>
|
A first test2\<Esc>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
# Cursor at Test2/test1
|
# Cursor at Test2/test1
|
||||||
\<Enter>
|
\<Cr>
|
||||||
A first test1\<Esc>
|
A first test1\<Esc>
|
||||||
# Back
|
# Back
|
||||||
\<Bs>
|
\<Bs>
|
||||||
@@ -355,7 +401,7 @@ Do (Navigate with <Tab> comeback with <Bs> too far):
|
|||||||
\<Bs>
|
\<Bs>
|
||||||
A 4\<Esc>
|
A 4\<Esc>
|
||||||
|
|
||||||
Expect (After too many <Bs>, cursor stays at the first <Enter> spot in first file: Contents/test1):
|
Expect (After too many <Bs>, cursor stays at the first <Cr> spot in first file: Contents/test1):
|
||||||
# Contents
|
# Contents
|
||||||
|
|
||||||
- [Test1](#Test1) 1 2 3 4
|
- [Test1](#Test1) 1 2 3 4
|
||||||
@@ -382,7 +428,7 @@ Given vimwiki (link to self):
|
|||||||
Do (Follow link to self and append chars):
|
Do (Follow link to self and append chars):
|
||||||
\<Tab>
|
\<Tab>
|
||||||
\<Tab>
|
\<Tab>
|
||||||
\<Enter>
|
\<Cr>
|
||||||
a this_is_18_chars \<Esc>
|
a this_is_18_chars \<Esc>
|
||||||
|
|
||||||
Expect (Some chars appended at self link):
|
Expect (Some chars appended at self link):
|
||||||
|
|||||||
@@ -38,19 +38,19 @@ Given vimwiki (filename filename.dot):
|
|||||||
filename
|
filename
|
||||||
filename.dot
|
filename.dot
|
||||||
|
|
||||||
Do():
|
Do (Press filename):
|
||||||
:call SetSyntax('default')\<CR>
|
:call SetSyntax('default')\<CR>
|
||||||
\<CR>\<CR>
|
\<CR>\<CR>
|
||||||
:AssertEqual 'filename.wiki', expand('%:t')\<CR>
|
:AssertEqual 'filename.wiki', expand('%:t')\<CR>
|
||||||
:call DeleteFile('%')\<CR>
|
:call DeleteFile('%')\<CR>
|
||||||
|
|
||||||
Do():
|
Do (Press filename.dot):
|
||||||
j
|
j
|
||||||
\<CR>\<CR>
|
\<CR>\<CR>
|
||||||
:AssertEqual 'filename.dot', expand('%:t')\<CR>
|
:AssertEqual 'filename.dot.wiki', expand('%:t')\<CR>
|
||||||
:call DeleteFile('%')\<CR>
|
:call DeleteFile('%')\<CR>
|
||||||
|
|
||||||
Expect(Nothing left):
|
Expect (Nothing left):
|
||||||
|
|
||||||
|
|
||||||
# Linkify function {{{1
|
# Linkify function {{{1
|
||||||
@@ -331,13 +331,14 @@ Given vimwiki (filnames with dots):
|
|||||||
part1.part2.part3.md
|
part1.part2.part3.md
|
||||||
noext
|
noext
|
||||||
|
|
||||||
Do (Fllow link witout markdown):
|
Do (Follow link witout markdown):
|
||||||
\<Cr>\<Cr>
|
\<Cr>\<Cr>
|
||||||
:AssertEqual expand('%:t'), 'part1.part2.part3'\<Cr>
|
" See issue #950 always adding the extension
|
||||||
|
:AssertEqual 'part1.part2.part3.md', expand('%:t')\<Cr>
|
||||||
|
|
||||||
Do (j<Cr><Cr>):
|
Do (Follow link with .md extension):
|
||||||
j\<Cr>\<Cr>
|
j\<Cr>\<Cr>
|
||||||
:AssertEqual expand('%:t'), 'part1.part2.part3.md'\<Cr>
|
:AssertEqual 'part1.part2.part3.md', expand('%:t')\<Cr>
|
||||||
|
|
||||||
|
|
||||||
# Rest {{{1
|
# Rest {{{1
|
||||||
|
|||||||
@@ -161,9 +161,14 @@ Do (Create in_root):
|
|||||||
0\<CR>\<CR>
|
0\<CR>\<CR>
|
||||||
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<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):
|
Do (Create dir_11 -> dir_11):
|
||||||
|
|||||||
@@ -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"
|
||||||
+396
-343
@@ -1,375 +1,428 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC2155 # Declare and assign separately to avoid masking return values
|
||||||
|
|
||||||
# credit to https://github.com/w0rp/ale for script ideas and the color vader
|
: '
|
||||||
# output function.
|
Vimwiki vader test script
|
||||||
|
|
||||||
# Say Hi
|
Credit: https://github.com/w0rp/ale for script ideas and the color vader output function.
|
||||||
echo -en "Starting $(basename "$0") for VimWiki\n"
|
'
|
||||||
start_time=$(date +%s)
|
|
||||||
|
# Capture start time now
|
||||||
|
declare -g start_time=$(date +%s)
|
||||||
|
|
||||||
# For windows: Cmder bash is appending busybox to the path and
|
|
||||||
# and a smlll vim is included, so that override the windows path vim
|
|
||||||
if [[ -v OLD_PATH ]]; then
|
|
||||||
echo "Setting path from OLD_PATH : $OLD_PATH"
|
|
||||||
export PATH="$OLD_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printHelp() {
|
printHelp() {
|
||||||
cat << ' EOF' | sed -e 's/^ //'
|
: 'Print usage to stdout'
|
||||||
Usage: bash run_tests.sh [OPTIONS]
|
cat << ' EOF' | sed -e 's/^ //'
|
||||||
|
Usage: bash run_tests.sh [OPTIONS]
|
||||||
|
|
||||||
Runs Vimwiki Vader tests or Vint in a Docker container
|
Runs Vimwiki Vader tests or Vint in a Docker container
|
||||||
|
|
||||||
-h (Help) Print help message
|
-h (Help) Print help message
|
||||||
|
|
||||||
-n (versioN) Specify vim/nvim version to run tests for.
|
-n (versioN) Specify vim/nvim version to run tests for.
|
||||||
Specify "local" to run on your current vim install
|
Specify "local" to run on your current vim install
|
||||||
for example on Windows.
|
for example on Windows.
|
||||||
Multiple versions can be specified by quoting the value and
|
Multiple versions can be specified by quoting the value and
|
||||||
separating versions with a space. E.g. -n "vim1 vim2".
|
separating versions with a space. E.g. -n "vim1 vim2".
|
||||||
Default is all available versions.
|
Default is all available versions.
|
||||||
|
|
||||||
-f (File) Space separated list of tests to run.
|
-f (File) Space separated list of tests to run.
|
||||||
E.g. -o "list_* z_success"
|
E.g. -o "list_* z_success"
|
||||||
|
|
||||||
-l (List) list available versions that can be used with the '-n' option
|
-l (List) list available versions that can be used with the '-n' option
|
||||||
|
|
||||||
-t (Type) Select test type: 'vader', 'vint', or 'all'
|
-t (Type) Select test type: 'vader', 'vint', or 'all'
|
||||||
|
|
||||||
-v (Verbose) Turn on verbose output.
|
-v (Verbose) Turn on verbose output.
|
||||||
|
|
||||||
E.g. On Linux
|
E.g. On Linux without with local Vim
|
||||||
bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader issue_markdown.vader
|
bash run_tests.sh -v -t vader -n local -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
|
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
|
||||||
|
|
||||||
printVersions() {
|
E.g. On Windows
|
||||||
# Print the names of all vim/nvim versions
|
bash run_tests.sh -v -t vader -n local -f z_success.vader | cat
|
||||||
getVers
|
EOF
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
runVader() {
|
exit 0
|
||||||
# Run Vader tests
|
|
||||||
echo -e "\nStarting Vader tests."
|
|
||||||
local err=0
|
|
||||||
|
|
||||||
# Parse tests files to execute
|
|
||||||
if [[ -z $file_test ]]; then
|
|
||||||
res="test/*"
|
|
||||||
else
|
|
||||||
read -ra TEST <<< "$file_test"
|
|
||||||
for i in "${TEST[@]}"; do
|
|
||||||
if [[ "$i" == *"*"* ]]; then
|
|
||||||
res="$res test/${i}"
|
|
||||||
elif [[ -f "$i" ]]; then
|
|
||||||
res="$res test/${i}"
|
|
||||||
elif [[ -f "${i}.vader" ]]; then
|
|
||||||
res="$res test/${i}.vader"
|
|
||||||
else
|
|
||||||
printf "WARNING: Test \"%s\" not found.\n", "$i"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run tests for each specified version
|
|
||||||
for v in $vers; do
|
|
||||||
echo -e "\n\nRunning version: $v"
|
|
||||||
echo -e "============================="
|
|
||||||
|
|
||||||
# Set local environment variables
|
|
||||||
if [[ "$v" == "local" ]]; then
|
|
||||||
# Save HOME var
|
|
||||||
home_save="$HOME"
|
|
||||||
|
|
||||||
# Create temporary root
|
|
||||||
mkdir -p "$tmp_dir/vader_wiki"
|
|
||||||
mkdir -p "$tmp_dir/vader_wiki/home"
|
|
||||||
mkdir -p "$tmp_dir/vader_wiki/home/test"
|
|
||||||
mkdir -p "$tmp_dir/vader_wiki/testplugin"
|
|
||||||
|
|
||||||
# Set vars
|
|
||||||
export ROOT="$tmp_dir/vader_wiki/"
|
|
||||||
export HOME="$tmp_dir/vader_wiki/home"
|
|
||||||
vim="vim"
|
|
||||||
vim_opt="-u ~/test/vimrc"
|
|
||||||
else
|
|
||||||
# Only set dockerized vars
|
|
||||||
export ROOT="/" # So no if in vimrc
|
|
||||||
vim="/vim-build/bin/$v"
|
|
||||||
vim_opt="-u test/vimrc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Too talkative TODO make a verbose level 1..10 an 1 is not taking vim
|
|
||||||
#if [[ "$verbose" != 0 ]]; then
|
|
||||||
# vim_opt+=' -V1'
|
|
||||||
#fi
|
|
||||||
# IDK why vim with -Es is returning ! and make fail:
|
|
||||||
# -- tabnext profiling
|
|
||||||
# -- map.vim
|
|
||||||
vim_opt+=' -i NONE -Es '
|
|
||||||
|
|
||||||
# set -o pipefail
|
|
||||||
|
|
||||||
# Copy the resources to temporary directory
|
|
||||||
if [[ "$v" == "local" ]]; then
|
|
||||||
# flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
|
||||||
echo -e "\nCopying resources to $ROOT"
|
|
||||||
# Copy testplugin
|
|
||||||
cp -rf "$wiki_path/"* "$ROOT/testplugin/"
|
|
||||||
# Copy home
|
|
||||||
cp -rf "$script_path/"* "$HOME/test/"
|
|
||||||
# Copy rtp.vim
|
|
||||||
cp -rf "$script_path/resources/rtp_local.vim" "$ROOT/rtp.vim"
|
|
||||||
# Copy vader <- internet
|
|
||||||
echo 'Cloning Vader (git, do not care the fatal)'
|
|
||||||
git clone --depth 10 https://github.com/junegunn/vader.vim /tmp/vader_wiki/vader 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run batch of tests
|
|
||||||
# shellcheck disable=SC2086,SC2206
|
|
||||||
if [[ "$res" != "" ]]; then
|
|
||||||
if [[ "$v" == "local" ]]; then
|
|
||||||
pushd "$tmp_dir/vader_wiki/testplugin" \
|
|
||||||
|| echo 'Warning pushd testplugin failed'
|
|
||||||
|
|
||||||
# Run the tests
|
|
||||||
fcmd(){
|
|
||||||
$vim $vim_opt "+Vader! ${res}" 2>&1
|
|
||||||
return ${PIPESTATUS[1]}
|
|
||||||
}
|
|
||||||
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
|
|
||||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
|
||||||
fcmd; ret=$?
|
|
||||||
err=$(( err + ret ))
|
|
||||||
echo -e "\nReturned Batch Vim/Vader -> $ret"
|
|
||||||
|
|
||||||
popd \
|
|
||||||
|| echo 'Warning popd also failed'
|
|
||||||
else
|
|
||||||
# In docker
|
|
||||||
fcmd() {
|
|
||||||
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
|
|
||||||
"${flags[@]}" "$v" $vim_opt "+Vader! ${res}" 2>&1 \
|
|
||||||
| vader_filter | vader_color
|
|
||||||
return ${PIPESTATUS[1]}
|
|
||||||
}
|
|
||||||
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
|
|
||||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
|
||||||
fcmd; ret=$?
|
|
||||||
err=$(( err + ret ))
|
|
||||||
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#set +o pipefail
|
|
||||||
|
|
||||||
# Restore what must (I know it should be refactored in a while)
|
|
||||||
if [[ "$v" == "local" ]]; then
|
|
||||||
export HOME=$home_save
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return $err
|
|
||||||
}
|
|
||||||
|
|
||||||
runVint() {
|
|
||||||
local err=0
|
|
||||||
cmd="vint -s . && vint -s test/vimrc"
|
|
||||||
if echo "$vers" | grep "local" > /dev/null; then
|
|
||||||
echo -e "\nRunning Vint: $cmd : in $wiki_path"
|
|
||||||
pushd "$wiki_path" > /dev/null \
|
|
||||||
|| echo 'Warning pushd wiki_path failed'
|
|
||||||
$cmd
|
|
||||||
err=$(( err | $? ))
|
|
||||||
popd > /dev/null \
|
|
||||||
|| echo 'Warning popd also failed'
|
|
||||||
else
|
|
||||||
echo -e "\nStarting Docker container and running Vint: $cmd"
|
|
||||||
docker run -a stdout "${flags[@]}" bash -c "$cmd"
|
|
||||||
err=$(( err | $? ))
|
|
||||||
fi
|
|
||||||
return $err
|
|
||||||
}
|
|
||||||
|
|
||||||
getVers() {
|
|
||||||
# Get all possible version <- Dockerfile
|
|
||||||
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
|
|
||||||
}
|
|
||||||
|
|
||||||
vader_filter() {
|
|
||||||
# Filter Vader Stdout
|
|
||||||
local err=0
|
|
||||||
# Keep indentation
|
|
||||||
local IFS=''
|
|
||||||
while read -r REPLY; do
|
|
||||||
# Print only possible error cases
|
|
||||||
if [[ "$REPLY" = *'docker:'* ]] || \
|
|
||||||
[[ "$REPLY" = *'Starting Vader:'* ]] || \
|
|
||||||
[[ "$REPLY" = *'Vader error:'* ]] || \
|
|
||||||
[[ "$REPLY" = *'Vim: Error '* ]]; then
|
|
||||||
echo "$REPLY"
|
|
||||||
elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
|
|
||||||
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
|
|
||||||
echo "$REPLY"
|
|
||||||
err=1
|
|
||||||
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
|
|
||||||
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
|
|
||||||
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
|
|
||||||
if [ "$success" -lt "$total" ]; then
|
|
||||||
err=1
|
|
||||||
fi
|
|
||||||
echo "$REPLY"
|
|
||||||
elif [[ "$verbose" != 0 ]]; then
|
|
||||||
# just print everything
|
|
||||||
echo "$REPLY"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ "$err" == 1 ]]; then
|
|
||||||
echo -e "\033[0;31m"
|
|
||||||
echo -e "!---------Failed tests detected---------!"
|
|
||||||
echo -e "Run with the '-v' flag for verbose output"
|
|
||||||
echo -e "\033[0m"
|
|
||||||
fi
|
|
||||||
return $err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
red='\033[0;31m'
|
run_test(){
|
||||||
green='\033[0;32m'
|
: 'Main function'
|
||||||
nc='\033[0m'
|
local -i res=0
|
||||||
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
|
# Hi
|
||||||
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
|
echo -en "Starting $(basename "$0") for VimWiki\n"
|
||||||
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
|
|
||||||
|
|
||||||
if [ "$success" -lt "$total" ]; then
|
# Hook ctrl-c or ctrl-z to stop tests
|
||||||
echo -en "$red"
|
trap exit 1 SIGINT SIGTERM
|
||||||
else
|
|
||||||
echo -en "$green"
|
# For windows: Cmder bash is appending busybox to the path and
|
||||||
fi
|
# 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 |= $?))
|
||||||
|
|
||||||
echo "$REPLY"
|
# Print ellapsed time (after calculate it)
|
||||||
echo -en "$nc"
|
end_time=$(date +%s)
|
||||||
else
|
sec_time=$((end_time - start_time))
|
||||||
echo "$REPLY"
|
printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
|
||||||
fi
|
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $res\n\n"
|
||||||
done
|
|
||||||
|
return "$res"
|
||||||
echo -en "$nc"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# path of the script, supposing no spaces
|
|
||||||
script_file="$(dirname "$0")"
|
|
||||||
script_path="$( realpath "$script_file" )"
|
|
||||||
wiki_path="$( realpath "$script_path/.." )"
|
|
||||||
tmp_dir="$(dirname "$(mktemp -u)")"
|
|
||||||
|
|
||||||
# list of vim/nvim versions
|
parse_argument(){
|
||||||
vers="$(getVers)"
|
: 'Parse user argument'
|
||||||
|
# Declare color helper
|
||||||
|
declare -g red='\033[0;31m'
|
||||||
|
declare -g green='\033[0;32m'
|
||||||
|
declare -g nc='\033[0m'
|
||||||
|
|
||||||
# type of tests to run - vader/vint/all
|
# Declare: Path of the script, supposing no spaces
|
||||||
type="all"
|
declare -g g_script_file=$(dirname "$0")
|
||||||
|
declare -g g_script_path=$(realpath "$g_script_file")
|
||||||
# verbose output flag
|
declare -g g_wiki_path=$(realpath "$g_script_path/..")
|
||||||
verbose=0
|
declare -g g_tmp_dir=$(dirname "$(mktemp -u)")
|
||||||
|
|
||||||
# only run these tests
|
# Declare: list of vim/nvim versions
|
||||||
file_test=""
|
declare -g g_vers="$(print_versions)"
|
||||||
|
|
||||||
# docker flags
|
# Declare: type of tests to run - vader/vint/all
|
||||||
flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
declare -g g_type="all"
|
||||||
|
|
||||||
while getopts ":hvn:lt:f:" opt; do
|
# 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
|
case ${opt} in
|
||||||
h )
|
h)
|
||||||
printHelp
|
printHelp
|
||||||
;;
|
;;
|
||||||
n )
|
n)
|
||||||
vers="$OPTARG"
|
g_vers="$OPTARG"
|
||||||
;;
|
;;
|
||||||
v )
|
v)
|
||||||
verbose=1
|
g_verbose=1
|
||||||
;;
|
;;
|
||||||
l )
|
l)
|
||||||
printVersions
|
print_versions
|
||||||
;;
|
;;
|
||||||
t )
|
t)
|
||||||
type="$OPTARG"
|
g_type="$OPTARG"
|
||||||
;;
|
;;
|
||||||
f )
|
f)
|
||||||
file_test="$OPTARG"
|
g_file_test="$OPTARG"
|
||||||
;;
|
;;
|
||||||
\? )
|
\?)
|
||||||
echo "Invalid option: $OPTARG" 1>&2
|
echo "Invalid option: $OPTARG" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
: )
|
:)
|
||||||
echo "Invalid option: $OPTARG requires an argument" 1>&2
|
echo "Invalid option: $OPTARG requires an argument" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# shift out processed parameters
|
# Shift out parameters already processed
|
||||||
shift $((OPTIND -1))
|
shift $((OPTIND -1))
|
||||||
|
|
||||||
# error handling for non-option arguments
|
# Handle error for non-option arguments
|
||||||
if [[ $# -ne 0 ]]; then
|
if [[ $# -ne 0 ]]; then
|
||||||
echo "Error: Got $# non-option arguments." 1>&2
|
echo "Error: Got $# non-option arguments." 1>&2
|
||||||
exit 1
|
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
|
fi
|
||||||
|
|
||||||
# stop tests on ctrl-c or ctrl-z
|
|
||||||
trap exit 1 SIGINT SIGTERM
|
|
||||||
|
|
||||||
# Global error return of the script
|
|
||||||
o_error=0
|
|
||||||
|
|
||||||
# Select which tests should run
|
|
||||||
case $type in
|
|
||||||
"vader" )
|
|
||||||
runVader ; err=$?
|
|
||||||
echo "Main Vader: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
;;
|
|
||||||
"vint" )
|
|
||||||
runVint ; err=$?
|
|
||||||
echo "Main Vint: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
;;
|
|
||||||
"all" )
|
|
||||||
runVint ; err=$?
|
|
||||||
echo "Main Vint: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
runVader ; err=$?
|
|
||||||
echo "Main Vader: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
echo "Error: invalid type - '$type'" 1>&2
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Calcultate time
|
|
||||||
end_time=$(date +%s)
|
|
||||||
sec_time=$((end_time - start_time))
|
|
||||||
printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
|
|
||||||
|
|
||||||
# Exit
|
|
||||||
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $o_error\n\n"
|
|
||||||
exit $o_error
|
|
||||||
|
|||||||
+6
-1
@@ -7,10 +7,16 @@ Execute (Setup search testing wrapper):
|
|||||||
Log 'Cheating for old vim version, do not want to reverse bug'
|
Log 'Cheating for old vim version, do not want to reverse bug'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Execute command and grab output
|
||||||
redir => output
|
redir => output
|
||||||
silent execute a:search_command
|
silent execute a:search_command
|
||||||
redir END
|
redir END
|
||||||
|
|
||||||
|
" The location list should not be empty
|
||||||
Assert !empty(getloclist(0)), a:test_name.": no location list result"
|
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"
|
Assert match(output, '\d of \d') > -1, a:test_name.": no result message"
|
||||||
|
|
||||||
" Tests that VimwikiSearch is quoting the pattern correctly.
|
" Tests that VimwikiSearch is quoting the pattern correctly.
|
||||||
@@ -30,7 +36,6 @@ Execute (Search test wiki):
|
|||||||
AssertEqual "= Test Wiki =", getline(1)
|
AssertEqual "= Test Wiki =", getline(1)
|
||||||
AssertEqual "vimwiki", &filetype
|
AssertEqual "vimwiki", &filetype
|
||||||
|
|
||||||
|
|
||||||
call TestSearch('VimwikiSearch foo', 'pattern with no spaces')
|
call TestSearch('VimwikiSearch foo', 'pattern with no spaces')
|
||||||
call TestSearch('VimwikiSearch foo bar', 'pattern with spaces')
|
call TestSearch('VimwikiSearch foo bar', 'pattern with spaces')
|
||||||
call TestSearch('VimwikiSearch foo\bar', 'pattern with ''\''')
|
call TestSearch('VimwikiSearch foo\bar', 'pattern with ''\''')
|
||||||
|
|||||||
+47
-18
@@ -4,18 +4,40 @@
|
|||||||
# 0 Escape {{{1
|
# 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):
|
Given vimwiki (Markdown typeface with escape sequence #1044: _ __ * ** {{{2):
|
||||||
This is 14 | 1
|
This is 14 | 1
|
||||||
__bold from begining__ 2
|
__bold from begining__ 2
|
||||||
\__not bold even from begin \__ 3
|
\__not bold even from begin \__ 3
|
||||||
and __t \__ is still bold__ Bold 4
|
and __t __isss still bold__ Bold 4
|
||||||
and _ita\_ alic continues and end_ Italic 5
|
and _itaaa_licccontinues and end_ Italic 5
|
||||||
*this\* \* is italic also* Italic 6
|
*this aa is italic also* Italic 6
|
||||||
a ^t\^ is supperscrit^ Sup 7
|
a ^taa is supperscrit^ Sup 7
|
||||||
,,sub\,, subscript end,, Sub 8
|
,,subaaa subscript end,, Sub 8
|
||||||
a ~~st\~~ill deleted~~ Del 9
|
a ~~staaill deleted~~ Del 9
|
||||||
$$Eq\$$ uation follows$ Math 10
|
$$Eq\$$ uation follows$ Math 10
|
||||||
`code \` not finished inline` Code 11
|
`code \` not finished inline` Code 11
|
||||||
|
012345678901234567890
|
||||||
|
|
||||||
Execute (Set syntax markdown):
|
Execute (Set syntax markdown):
|
||||||
call SetSyntax('markdown')
|
call SetSyntax('markdown')
|
||||||
@@ -25,7 +47,10 @@ Execute (Assert Syntax of escape typeface):
|
|||||||
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 14) . 2
|
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 14) . 2
|
||||||
AssertEqual '3' , SyntaxAt(3, 14) . 3
|
AssertEqual '3' , SyntaxAt(3, 14) . 3
|
||||||
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
|
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
|
||||||
AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
|
" 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 'VimwikiItalic6' , SyntaxAt(6, 14) . 6
|
||||||
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 14) . 7
|
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 14) . 7
|
||||||
AssertEqual 'VimwikiSubScript8' , SyntaxAt(8, 14) . 8
|
AssertEqual 'VimwikiSubScript8' , SyntaxAt(8, 14) . 8
|
||||||
@@ -67,8 +92,8 @@ Given vimwiki (Markdown bad __this_not_it__ {{{2):
|
|||||||
n4rmal_aaaaaaaaaaaaaaaaaaaa_text_ 4
|
n4rmal_aaaaaaaaaaaaaaaaaaaa_text_ 4
|
||||||
n5t_italiccccccccccccccccccccc_no 5
|
n5t_italiccccccccccccccccccccc_no 5
|
||||||
n6t_italiccccccccccccccccccccccno 6
|
n6t_italiccccccccccccccccccccccno 6
|
||||||
n7t*italiccccccccccccccccccccc_no 7
|
n7t*italiccccccccccccccccccccc*si 7
|
||||||
n8t*italiccccccccccccccccccccc*no 8
|
n8taitalicccccccccccccccccccccasi 8
|
||||||
__not_italicccccccccc_but_boldd__ 9
|
__not_italicccccccccc_but_boldd__ 9
|
||||||
_a_asdasda_asdas_asdas_asdasda_a_ 10
|
_a_asdasda_asdas_asdas_asdasda_a_ 10
|
||||||
_jitaliccccccccccccccccccccccccc_ 11
|
_jitaliccccccccccccccccccccccccc_ 11
|
||||||
@@ -83,16 +108,20 @@ Execute (Set syntax markdown):
|
|||||||
|
|
||||||
Execute (Assert Syntax (bravo)):
|
Execute (Assert Syntax (bravo)):
|
||||||
AssertEqual 'VimwikiError2' , SyntaxAt(2, 4) . 2
|
AssertEqual 'VimwikiError2' , SyntaxAt(2, 4) . 2
|
||||||
AssertEqual 'VimwikiError3' , SyntaxAt(3, 4) . 3
|
" 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 '4' , SyntaxAt(4, 14) . 4
|
||||||
AssertEqual '5' , SyntaxAt(5, 14) . 5
|
AssertEqual '5' , SyntaxAt(5, 14) . 5
|
||||||
AssertEqual '6' , SyntaxAt(6, 14) . 6
|
AssertEqual '6' , SyntaxAt(6, 14) . 6
|
||||||
AssertEqual '7' , SyntaxAt(7, 14) . 7
|
AssertEqual 'VimwikiItalic7' , SyntaxAt(7, 14) . 7
|
||||||
AssertEqual '8' , SyntaxAt(8, 14) . 8
|
AssertEqual '8' , SyntaxAt(8, 14) . 8
|
||||||
AssertEqual 'VimwikiBold9' , SyntaxAt(9, 14) . 9
|
AssertEqual 'VimwikiBold9' , SyntaxAt(9, 14) . 9
|
||||||
AssertEqual 'VimwikiItalic10' , SyntaxAt(10, 14) . 10
|
AssertEqual '10' , SyntaxAt(10, 14) . 10
|
||||||
AssertEqual 'VimwikiItalic11' , SyntaxAt(11, 14) . 11
|
AssertEqual 'VimwikiItalic11' , SyntaxAt(11, 14) . 11
|
||||||
AssertEqual '12' , SyntaxAt(12, 14) . 12
|
AssertEqual '12' , SyntaxAt(12, 14) . 12
|
||||||
|
AssertEqual 'VimwikiItalic13' , SyntaxAt(13, 14) . 13
|
||||||
|
|
||||||
Given vimwiki (bold and pre {{{2):
|
Given vimwiki (bold and pre {{{2):
|
||||||
__startbold
|
__startbold
|
||||||
@@ -167,7 +196,7 @@ Execute (Assert Done Syntax 2):
|
|||||||
Given vimwiki (Extended Types mono):
|
Given vimwiki (Extended Types mono):
|
||||||
`code `
|
`code `
|
||||||
~~ strike ~~
|
~~ strike ~~
|
||||||
$ equation $
|
$equation$
|
||||||
^superscript ^
|
^superscript ^
|
||||||
,, subscript ,,
|
,, subscript ,,
|
||||||
|
|
||||||
@@ -185,7 +214,7 @@ Execute (Assert Syntax extended types x 1):
|
|||||||
Given vimwiki (Extended Types nested in basic):
|
Given vimwiki (Extended Types nested in basic):
|
||||||
From __bold `code in bold ` end of bold__ morF
|
From __bold `code in bold ` end of bold__ morF
|
||||||
From _it and ~~ strieout in i~~ end of it_ morF
|
From _it and ~~ strieout in i~~ end of it_ morF
|
||||||
From __bold $ equation $ end bold __
|
From __bold $equation$ end bold __
|
||||||
**bold ^superscript ^ end of bold morF**
|
**bold ^superscript ^ end of bold morF**
|
||||||
From normal ,, subscript ,, still normal morF
|
From normal ,, subscript ,, still normal morF
|
||||||
|
|
||||||
@@ -202,7 +231,7 @@ Execute (Assert Syntax extended types x 2):
|
|||||||
Given vimwiki (Extended Types nested in extended):
|
Given vimwiki (Extended Types nested in extended):
|
||||||
From ^super to`code this ` is crazy but^ morF
|
From ^super to`code this ` is crazy but^ morF
|
||||||
From ,,sub to~~ strike ~~why not,, morF
|
From ,,sub to~~ strike ~~why not,, morF
|
||||||
From ~~strike $ equation $ end of strike~~morF
|
From ~~strike $eequationeeeee$ end of strike~~morF
|
||||||
From $eq to ^super ^ Just inline morF$
|
From $eq to ^super ^ Just inline morF$
|
||||||
From ^super t,,sub ,, end super eol ^
|
From ^super t,,sub ,, end super eol ^
|
||||||
|
|
||||||
@@ -219,7 +248,7 @@ Execute (Assert Syntax extended types nested in extended):
|
|||||||
Given vimwiki (Basic Types nested in extended):
|
Given vimwiki (Basic Types nested in extended):
|
||||||
From ^super __bold __ is crazy but^ morF
|
From ^super __bold __ is crazy but^ morF
|
||||||
From ,,sub _italic with en_ aaaaaaa,, morF
|
From ,,sub _italic with en_ aaaaaaa,, morF
|
||||||
From $eq to **boldboldboldbo** aaaaaaaaa $
|
From $eq to **boldboldboldbo** aaaaaaaaa$ $
|
||||||
From ^super *italic aaaaaaa*aaaaaaaaaaaaaaaaaaaaa
|
From ^super *italic aaaaaaa*aaaaaaaaaaaaaaaaaaaaa
|
||||||
From ~~strik __bbbbbbbbbbbbb__ssssssssssssssssss~~
|
From ~~strik __bbbbbbbbbbbbb__ssssssssssssssssss~~
|
||||||
|
|
||||||
@@ -716,7 +745,7 @@ Execute (Assert Code syntax):
|
|||||||
#######################
|
#######################
|
||||||
|
|
||||||
Given vimwiki (Math markdown):
|
Given vimwiki (Math markdown):
|
||||||
math inline: $ aaaaaaaaaaaaaa \sum_i a_i^2 = 1 $
|
math inline: $aaaaaaaaaaaaaaa \sum_i a_i^2 = 1 end$
|
||||||
|
|
||||||
math block:
|
math block:
|
||||||
$$
|
$$
|
||||||
@@ -746,7 +775,7 @@ Execute (Assert math syntax 1):
|
|||||||
##############################
|
##############################
|
||||||
|
|
||||||
Given vimwiki (Math wiki):
|
Given vimwiki (Math wiki):
|
||||||
math inline: $aaaaaaaaaaaaaaaaaaaaaaaaaa \sum_i a_i^2 = 1 $
|
math inline: $aaaaaaaaaaaaaaaaaaaaaaaaaa \sum_i a_i^2 = 1$
|
||||||
|
|
||||||
math block:
|
math block:
|
||||||
{{$
|
{{$
|
||||||
|
|||||||
@@ -0,0 +1,883 @@
|
|||||||
|
# Github Favor Markdown Typeface
|
||||||
|
# https://github.github.com/gfm
|
||||||
|
# 6.4 Emphasis and strong emphasis
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 1 {{{1
|
||||||
|
# A single * character can open emphasis iff (if and only if) it is part of a left-flanking delimiter run.'
|
||||||
|
#################
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-360):
|
||||||
|
*foo bar*
|
||||||
|
|
||||||
|
Execute (Log rule):
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Italic'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-361):
|
||||||
|
a * foo bar*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, because the opening * is followed by whitespace, and hence not part of a left-flanking delimiter'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-362):
|
||||||
|
todo TODO
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-363):
|
||||||
|
* a *
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Unicode nonbreaking spaces count as whitespace, too'
|
||||||
|
AssertEqual '', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-364):
|
||||||
|
foo*bar*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword emphasis with * is permitted:'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-365):
|
||||||
|
5*6*78
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 2 {{{1
|
||||||
|
# A single _ character can open emphasis iff it is part of a left-flanking delimiter run and either (a) not part of a right-flanking delimiter run or (b) part of a right-flanking delimiter run preceded by punctuation.
|
||||||
|
#################
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-366):
|
||||||
|
_foo bar_
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Italic'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-367):
|
||||||
|
_ foo bar_
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, because the opening _ is followed by whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-368):
|
||||||
|
a_"foo"_
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Italic'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-369):
|
||||||
|
foo_bar_
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis with _ is not allowed inside words'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-370):
|
||||||
|
* 5_6_78
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual '', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-371):
|
||||||
|
CommentLine 'Not emphasis in middle even if unicode alphanumeric before left delimiter'
|
||||||
|
пристаням_стремятся_
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual '', SyntaxAt(1, 22)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-372):
|
||||||
|
* aa_"bb"_cc
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Here _ does not generate emphasis, because the first delimiter run is right-flanking and the second left-flanking'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-373):
|
||||||
|
foo-_(bar)_
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 3 {{{1
|
||||||
|
# A single * character can close emphasis iff it is part of a right-flanking delimiter run.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-374):
|
||||||
|
_foo*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, in theory (1), IDEA change that'
|
||||||
|
Log 'But Vim reion implementation is highlitghing it anyway, it would be nice to change that'
|
||||||
|
Log 'Note: The decision to start a region is only based on a matching start pattern. There is no check for a matching end pattern.'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-375):
|
||||||
|
*foo bar *
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, in theory (2), IDEA change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-376):
|
||||||
|
*foo bar
|
||||||
|
*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, in theory (2), IDEA change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-377):
|
||||||
|
*(*foo)
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, because the second * is preceded by punctuation and followed by an alphanumeric (hence it is not part of a right-flanking delimiter, in theory, IDEA Change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-378):
|
||||||
|
*(*foo*)*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'The point of this restriction is more easily appreciated with this example, IDEA Change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-379):
|
||||||
|
*foo*bar
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword emphasis with * is allowed'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 4 {{{1
|
||||||
|
# A single _ character can close emphasis iff it is part of a right-flanking delimiter run and either (a) not part of a left-flanking delimiter run or (b) part of a left-flanking delimiter run followed by punctuation.
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 5 {{{1
|
||||||
|
# A double ** can open strong emphasis iff it is part of a left-flanking delimiter run.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-387):
|
||||||
|
**foo bar**
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Easy bold'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-388):
|
||||||
|
** foo bar**
|
||||||
|
12345
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening delimiter is followed by whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-389):
|
||||||
|
a**"foo"**
|
||||||
|
123456
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening ** is preceded by an alphanumeric and followed by punctuation, and hence not part of a left-flanking delimiter'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-390):
|
||||||
|
foo**bar**
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis with ** is permitted'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 7)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 6 {{{1
|
||||||
|
# A double __ can open strong emphasis iff it is part of a left-flanking delimiter run and either (a) not part of a right-flanking delimiter run or (b) part of a right-flanking delimiter run preceded by punctuation.
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-391):
|
||||||
|
__foo bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Bold with __'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-392):
|
||||||
|
__ foo bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening delimiter is followed by whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-393):
|
||||||
|
__
|
||||||
|
foo bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'A newline counts as whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(2, 4)
|
||||||
|
AssertEqual '', SyntaxAt(3, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-394):
|
||||||
|
a__"foo"__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening __ is preceded by an alphanumeric and followed by punctuation'
|
||||||
|
AssertEqual '', SyntaxAt(1, 6)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-395):
|
||||||
|
foo__bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis is forbidden with __'
|
||||||
|
AssertEqual '', SyntaxAt(1, 7)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-395):
|
||||||
|
5__6__78
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis is forbidden with __ (2)'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-397):
|
||||||
|
пристаням__стремятся__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis is forbidden with __ (3)'
|
||||||
|
AssertEqual '', SyntaxAt(1, 13)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-398):
|
||||||
|
__foo, __bar__, baz__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-399):
|
||||||
|
foo-__(bar)__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is strong emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 9)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 7 {{{1
|
||||||
|
# A double ** can close strong emphasis iff it is part of a right-flanking delimiter run.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-400):
|
||||||
|
**foo bar **
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Rule 7: Passed: IDEA improve that'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 8 {{{1
|
||||||
|
# A double __ can close strong emphasis iff it is part of a right-flanking delimiter run and either (a) not part of a left-flanking delimiter run or (b) part of a left-flanking delimiter run followed by punctuation.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-406):
|
||||||
|
__foo bar __
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Rule 8: Passed: IDEA improve that'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 9 {{{1
|
||||||
|
# Emphasis begins with a delimiter that can open emphasis and ends with a delimiter that can close emphasis, and that uses the same character (_ or *) as the opening delimiter. The opening and closing delimiters must belong to separate delimiter runs. If one of the delimiters can both open and close emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-413):
|
||||||
|
*foo [bar](/url)*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Any nonempty sequence of inline elements can be the contents of an emphasized span'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 9)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-414):
|
||||||
|
*foo
|
||||||
|
bar*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Any nonempty sequence of inline elements can be the contents of an emphasized span (2)'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(2, 3)
|
||||||
|
AssertEqual '', SyntaxAt(3, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-415):
|
||||||
|
_foo __bar__ baz_
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'In particular, emphasis and strong emphasis can be nested inside emphasis'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
AssertEqual 'VimwikiItalicBold', SyntaxAt(1, 9)
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 14)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-416):
|
||||||
|
_foo _bar_ baz_
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO not implemented nested Italic, as the close of one region closes the other'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-425):
|
||||||
|
foo***bar***baz
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Italic Bold'
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 10 {{{1
|
||||||
|
# Strong emphasis begins with a delimiter that can open strong emphasis and ends with a delimiter that can close strong emphasis, and that uses the same character (_ or *) as the opening delimiter. The opening and closing delimiters must belong to separate delimiter runs. If one of the delimiters can both open and close strong emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-431):
|
||||||
|
**foo [bar](/url)**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Any nonempty sequence of inline elements can be the contents of an strongly emphasized span'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-432):
|
||||||
|
**foo
|
||||||
|
bar**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 3)
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(2, 3)
|
||||||
|
AssertEqual '', SyntaxAt(3, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-433):
|
||||||
|
__foo _bar_ baz__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'In particular, emphasis and strong emphasis can be nested inside strong emphasis'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 9)
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 14)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-434):
|
||||||
|
__foo __bar__ baz__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO passed as nested bold is hard'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-437):
|
||||||
|
**foo *bar* baz**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Same as 433 but with *'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 9)
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 14)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-443):
|
||||||
|
__ is not an empty emphasis
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'There can be no empty emphasis or strong emphasis:'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-444):
|
||||||
|
____ is not an empty strong emphasis
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO: There can be no empty emphasis or strong emphasis (2)'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 11 {{{1
|
||||||
|
# A literal * character cannot occur at the beginning or end of *-delimited emphasis or **-delimited strong emphasis, unless it is backslash-escaped.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-445):
|
||||||
|
foo ***
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Empty emphasis'
|
||||||
|
AssertEqual '1', SyntaxAt(1, 1) . 1
|
||||||
|
AssertEqual '2', SyntaxAt(2, 1) . 2
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-446):
|
||||||
|
foo *\**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis an escaped *'
|
||||||
|
AssertEqual '', SyntaxAt(1, 1)
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 7)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-447):
|
||||||
|
foo *_*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis a lonely _'
|
||||||
|
Log 'TODO, this is bold italic for now as we got it as special case'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# AssertEqual 'VimwikiItalic', SyntaxAt(1, 6)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-448):
|
||||||
|
foo *****
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Nothing happen'
|
||||||
|
let var = SyntaxAt(1, 7)
|
||||||
|
AssertEqual 1, var == '' || var == 'VimwikiDelimiter'
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-449):
|
||||||
|
foo **\***
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis a lonely *'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-450):
|
||||||
|
foo **_**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# CommentLine 'Bold a single _ between **'
|
||||||
|
# AssertEqual 'VimwikiBold', SyntaxAt(1, 7)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-451):
|
||||||
|
**foo*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'IDEA: the rest is for haskell or yacc more than vim'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 12 {{{1
|
||||||
|
# A literal _ character cannot occur at the beginning or end of _-delimited emphasis or __-delimited strong emphasis, unless it is backslash-escaped.
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 13 {{{1
|
||||||
|
# The number of nestings should be minimized. Thus, for example, an interpretation <strong>...</strong> is always preferred to <em><em>...</em></em>.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-469):
|
||||||
|
**foo**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Basic bold'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-470):
|
||||||
|
*_foo_*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO Change that'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# CommentLine 'Double italic'
|
||||||
|
# AssertEqual 'VimwikiItalic', SyntaxAt(1, 4)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-471):
|
||||||
|
__foo__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Basic bold (2)'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-472):
|
||||||
|
_*foo*_
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Double italic (2)'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 4)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-473):
|
||||||
|
****foo****
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Double bold with ****'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 6)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-474):
|
||||||
|
____foo____
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Double bold with ____'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 6)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-475):
|
||||||
|
******foo******
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Triple bold with ******'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 14 {{{1
|
||||||
|
# An interpretation <em><strong>...</strong></em> is always preferred to <strong><em>...</em></strong>.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-476):
|
||||||
|
***foo***
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Bold Italic normal, with 3 *'
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 5)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-477):
|
||||||
|
_____foo_____
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Bold Italic with 5 _'
|
||||||
|
CommentLine 'TODO Passed'
|
||||||
|
# AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 7)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 15 {{{1
|
||||||
|
# When two potential emphasis or strong emphasis spans overlap, so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, *foo _bar* baz_ is parsed as <em>foo _bar</em> baz_ rather than *foo <em>bar* baz</em>.
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 16 {{{1
|
||||||
|
# When there are two potential emphasis or strong emphasis spans with the same closing delimiter, the shorter one (the one that opens later) takes precedence. Thus, for example, **foo **bar baz** is parsed as **foo <strong>bar baz</strong> rather than <strong>foo **bar baz</strong>.
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-480):
|
||||||
|
**foo **bar baz**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'All bold as the ** inside is not closing, Passed as vimwiki do not follow the spec'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# CommentLine 'Double bold (2)'
|
||||||
|
# AssertEqual 'VimwikiBold', SyntaxAt(1, 6)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
# Rule 17 {{{1
|
||||||
|
# Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, *[foo*](bar) is parsed as *<a href="bar">foo*</a> rather than as <em>[foo</em>](bar).
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-485):
|
||||||
|
*a `*` b*
|
||||||
|
*a `a a*a a` b*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO with a * as unique code, a nice trap'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# vim: foldmethod=marker foldlevel=30 sw=2
|
||||||
+329
-1
@@ -4,6 +4,95 @@
|
|||||||
Execute (Setup):
|
Execute (Setup):
|
||||||
set sw=4
|
set sw=4
|
||||||
AssertEqual 4, &sw
|
AssertEqual 4, &sw
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
Do (Create File Content with default tags {{{1):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-default.md\<CR>
|
||||||
|
I
|
||||||
|
:tag1:tag2:\<CR>
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
:VimwikiGenerateTagLinks\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Generate tags for default):
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-default.md
|
||||||
|
AssertEqual 'VimwikiTag', SyntaxAt(1, 2)
|
||||||
|
1
|
||||||
|
VimwikiGenerateTagLinks
|
||||||
|
write
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Tags default):
|
||||||
|
:tag1:tag2:
|
||||||
|
|
||||||
|
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## tag1
|
||||||
|
|
||||||
|
- [Test-Tag-default](Test-Tag-default)
|
||||||
|
|
||||||
|
## tag2
|
||||||
|
|
||||||
|
- [Test-Tag-default](Test-Tag-default)
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean tag file for default):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create File Content with default tags):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-default.md\<CR>
|
||||||
|
ggdG
|
||||||
|
I
|
||||||
|
# Generated Tags\<Cr>
|
||||||
|
\<Cr>
|
||||||
|
# Heading with my tags\<Cr>
|
||||||
|
\<Cr>
|
||||||
|
:tag1:tag2:\<CR>
|
||||||
|
\<Cr>
|
||||||
|
Dummy content 1
|
||||||
|
\<Cr>
|
||||||
|
# Another heading\<Cr>
|
||||||
|
\<Cr>
|
||||||
|
Dummy content 2
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
:VimwikiGenerateTagLinks\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Tags default with Generated Tags heading):
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## tag1
|
||||||
|
|
||||||
|
- [Heading with my tags](Test-Tag-default#heading-with-my-tags)
|
||||||
|
|
||||||
|
## tag2
|
||||||
|
|
||||||
|
- [Heading with my tags](Test-Tag-default#heading-with-my-tags)
|
||||||
|
|
||||||
|
# Heading with my tags
|
||||||
|
|
||||||
|
:tag1:tag2:
|
||||||
|
|
||||||
|
Dummy content 1
|
||||||
|
# Another heading
|
||||||
|
|
||||||
|
Dummy content 2
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean file for tag default):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-default.md")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -16,6 +105,7 @@ Execute (Change delimiter <tag1|tag2> {{{1):
|
|||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
Do (Create File Content with <>):
|
Do (Create File Content with <>):
|
||||||
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
|
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
|
||||||
I
|
I
|
||||||
@@ -40,6 +130,7 @@ Execute (Generate tags):
|
|||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
set tw=200
|
set tw=200
|
||||||
|
|
||||||
|
|
||||||
Expect (Correctly generated tags section {{{3):
|
Expect (Correctly generated tags section {{{3):
|
||||||
<tag-bar-1>
|
<tag-bar-1>
|
||||||
|
|
||||||
@@ -77,12 +168,14 @@ Do (Write a quick tag for a quick jump):
|
|||||||
ggl\<Cr>A __HERE1__\<Esc>
|
ggl\<Cr>A __HERE1__\<Esc>
|
||||||
ggjl\<Cr>A __HERE2__\<Esc>
|
ggjl\<Cr>A __HERE2__\<Esc>
|
||||||
|
|
||||||
|
|
||||||
Expect (Good jump {{{3):
|
Expect (Good jump {{{3):
|
||||||
[go1](Test-Tag#tag-bar-1)
|
[go1](Test-Tag#tag-bar-1)
|
||||||
[go2](#tag-bar-1)
|
[go2](#tag-bar-1)
|
||||||
bla
|
bla
|
||||||
<tag-bar-1> __HERE1__ __HERE2__
|
<tag-bar-1> __HERE1__ __HERE2__
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean Test-Tag and .vimwiki_tags -2):
|
Execute (Clean Test-Tag and .vimwiki_tags -2):
|
||||||
let g:vimwiki_tag_format = {}
|
let g:vimwiki_tag_format = {}
|
||||||
unlet g:vimwiki_syntaxlocal_vars
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
@@ -101,6 +194,7 @@ Execute (Default tag generation {{{1):
|
|||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
set tw=200
|
set tw=200
|
||||||
|
|
||||||
|
|
||||||
Do (Single file Part1):
|
Do (Single file Part1):
|
||||||
:edit $HOME/testmarkdown/Test-Tag.md\<Cr>
|
:edit $HOME/testmarkdown/Test-Tag.md\<Cr>
|
||||||
ggdGO
|
ggdGO
|
||||||
@@ -108,12 +202,14 @@ Do (Single file Part1):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:VimwikiRebuildTags!\<Cr>
|
:VimwikiRebuildTags!\<Cr>
|
||||||
|
|
||||||
|
|
||||||
Execute (Generate tags):
|
Execute (Generate tags):
|
||||||
edit $HOME/testmarkdown/Test-Tag.md
|
edit $HOME/testmarkdown/Test-Tag.md
|
||||||
AssertEqual 'VimwikiTag', SyntaxAt(1, 1)
|
AssertEqual 'VimwikiTag', SyntaxAt(1, 1)
|
||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
write
|
write
|
||||||
|
|
||||||
|
|
||||||
Expect (Single tags toc):
|
Expect (Single tags toc):
|
||||||
:single-tag:
|
:single-tag:
|
||||||
|
|
||||||
@@ -145,12 +241,14 @@ Do (Create File Content):
|
|||||||
:write\<CR>
|
:write\<CR>
|
||||||
:VimwikiRebuildTags\<CR>
|
:VimwikiRebuildTags\<CR>
|
||||||
|
|
||||||
|
|
||||||
Execute (Edit tags file):
|
Execute (Edit tags file):
|
||||||
edit $HOME/testmarkdown/.vimwiki_tags
|
edit $HOME/testmarkdown/.vimwiki_tags
|
||||||
AssertEqual $HOME . '/testmarkdown/.vimwiki_tags', expand('%')
|
AssertEqual $HOME . '/testmarkdown/.vimwiki_tags', expand('%')
|
||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
# Note: tags file uses tabs
|
# Note: tags file uses tabs
|
||||||
Expect (Correctly formatted tags file):
|
Expect (Correctly formatted tags file):
|
||||||
!_TAG_FILE_FORMAT 2
|
!_TAG_FILE_FORMAT 2
|
||||||
@@ -159,15 +257,17 @@ Expect (Correctly formatted tags file):
|
|||||||
!_TAG_PROGRAM_AUTHOR Vimwiki
|
!_TAG_PROGRAM_AUTHOR Vimwiki
|
||||||
!_TAG_PROGRAM_NAME Vimwiki Tags
|
!_TAG_PROGRAM_NAME Vimwiki Tags
|
||||||
!_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki
|
!_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki
|
||||||
!_TAG_PROGRAM_VERSION 2022.12.02
|
!_TAG_PROGRAM_VERSION 2024.01.24
|
||||||
second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag\tTest-Tag#second-tag
|
second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag\tTest-Tag#second-tag
|
||||||
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
|
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
|
||||||
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
|
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
|
||||||
|
|
||||||
|
|
||||||
Execute (Generate tags):
|
Execute (Generate tags):
|
||||||
edit $HOME/testmarkdown/Test-Tag.md
|
edit $HOME/testmarkdown/Test-Tag.md
|
||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
|
|
||||||
|
|
||||||
Expect (Correctly generated tags section):
|
Expect (Correctly generated tags section):
|
||||||
:top-tag:
|
:top-tag:
|
||||||
|
|
||||||
@@ -198,6 +298,7 @@ Expect (Correctly generated tags section):
|
|||||||
|
|
||||||
- [Test-Tag](Test-Tag)
|
- [Test-Tag](Test-Tag)
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean Test-Tag and .vimwiki_tags -1 ):
|
Execute (Clean Test-Tag and .vimwiki_tags -1 ):
|
||||||
call system("rm $HOME/testmarkdown/Test.md")
|
call system("rm $HOME/testmarkdown/Test.md")
|
||||||
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
@@ -214,6 +315,7 @@ Execute (Check first tags file):
|
|||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
Do (Build first tags file):
|
Do (Build first tags file):
|
||||||
:edit $HOME/testmarkdown/Test-Tag-1.md\<Cr>
|
:edit $HOME/testmarkdown/Test-Tag-1.md\<Cr>
|
||||||
ggI
|
ggI
|
||||||
@@ -228,12 +330,14 @@ Do (Build first tags file):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:VimwikiRebuildTags!\<CR>
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
|
||||||
|
|
||||||
Execute (Check second tags file):
|
Execute (Check second tags file):
|
||||||
edit $HOME/testmarkdown/subdir1/Test-Tag-2.md
|
edit $HOME/testmarkdown/subdir1/Test-Tag-2.md
|
||||||
AssertEqual $HOME . '/testmarkdown/subdir1/Test-Tag-2.md', expand('%')
|
AssertEqual $HOME . '/testmarkdown/subdir1/Test-Tag-2.md', expand('%')
|
||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
Do (Build second tags file):
|
Do (Build second tags file):
|
||||||
:edit $HOME/testmarkdown/subdir1/Test-Tag-2.md\<Cr>
|
:edit $HOME/testmarkdown/subdir1/Test-Tag-2.md\<Cr>
|
||||||
ggI
|
ggI
|
||||||
@@ -248,6 +352,7 @@ Do (Build second tags file):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:VimwikiRebuildTags!\<CR>
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
|
||||||
|
|
||||||
Execute (Build tag links in third file):
|
Execute (Build tag links in third file):
|
||||||
edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md
|
edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md
|
||||||
AssertEqual $HOME . '/testmarkdown/subdir1/subdir11/Test-Tag-Links.md', expand('%')
|
AssertEqual $HOME . '/testmarkdown/subdir1/subdir11/Test-Tag-Links.md', expand('%')
|
||||||
@@ -256,6 +361,7 @@ Execute (Build tag links in third file):
|
|||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
write
|
write
|
||||||
|
|
||||||
|
|
||||||
Expect (Tag links relative to current file):
|
Expect (Tag links relative to current file):
|
||||||
|
|
||||||
|
|
||||||
@@ -276,6 +382,7 @@ Expect (Tag links relative to current file):
|
|||||||
- [standalone-tag-1](../../Test-Tag-1#standalone-tag-1)
|
- [standalone-tag-1](../../Test-Tag-1#standalone-tag-1)
|
||||||
- [standalone-tag-1](../Test-Tag-2#standalone-tag-1)
|
- [standalone-tag-1](../Test-Tag-2#standalone-tag-1)
|
||||||
|
|
||||||
|
|
||||||
Do (Delete some existing links to test updating generated tag links):
|
Do (Delete some existing links to test updating generated tag links):
|
||||||
:edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md\<Cr>
|
:edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md\<Cr>
|
||||||
7G
|
7G
|
||||||
@@ -285,6 +392,7 @@ Do (Delete some existing links to test updating generated tag links):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:call vimwiki#tags#generate_tags(0)\<Cr>
|
:call vimwiki#tags#generate_tags(0)\<Cr>
|
||||||
|
|
||||||
|
|
||||||
Expect (Only update generated tag links for tags already existing in the file):
|
Expect (Only update generated tag links for tags already existing in the file):
|
||||||
|
|
||||||
|
|
||||||
@@ -300,6 +408,226 @@ Expect (Only update generated tag links for tags already existing in the file):
|
|||||||
- [Another Header](../../Test-Tag-1#another-header)
|
- [Another Header](../../Test-Tag-1#another-header)
|
||||||
- [Another Header](../Test-Tag-2#another-header)
|
- [Another Header](../Test-Tag-2#another-header)
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean relative tag setup):
|
Execute (Clean relative tag setup):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
call system("rm -rf $HOME/testmarkdown/subdir1")
|
call system("rm -rf $HOME/testmarkdown/subdir1")
|
||||||
call system("rm $HOME/testmarkdown/Test-Tag-1.md")
|
call system("rm $HOME/testmarkdown/Test-Tag-1.md")
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
Execute (Change delimiter #tag1content1|content2#tag2 as for issue #1316 {{{1):
|
||||||
|
let g:vimwiki_tag_format = {'pre_mark': '#tag1', 'post_mark': '#tag2', 'sep': '|'}
|
||||||
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
|
call vimwiki#vars#init()
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-1316.md
|
||||||
|
AssertEqual $HOME . '/testmarkdown/Test-Tag-1316.md', expand('%')
|
||||||
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create File Content with #tag1 #tag2 as for issue #1316):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316.md\<CR>
|
||||||
|
I
|
||||||
|
# Line1: Heading
|
||||||
|
# A header\<CR>
|
||||||
|
# Line2: Tag not in header
|
||||||
|
bla #tag1content01|content02#tag2\<CR>
|
||||||
|
# Line3: Tag in header
|
||||||
|
#tag1content11|content12#tag2\<CR>
|
||||||
|
# Line4: empty
|
||||||
|
\<CR>
|
||||||
|
# Line5: dummy content
|
||||||
|
Words here.
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Generate tags for issue #1316):
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-issue-1316.md
|
||||||
|
AssertEqual 'VimwikiTag', SyntaxAt(2, 5)
|
||||||
|
1
|
||||||
|
VimwikiGenerateTagLinks
|
||||||
|
write
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Single tags toc):
|
||||||
|
# A header
|
||||||
|
bla #tag1content01|content02#tag2
|
||||||
|
#tag1content11|content12#tag2
|
||||||
|
|
||||||
|
Words here.
|
||||||
|
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## content01
|
||||||
|
|
||||||
|
- [A header](Test-Tag-issue-1316#a-header)
|
||||||
|
|
||||||
|
## content02
|
||||||
|
|
||||||
|
- [A header](Test-Tag-issue-1316#a-header)
|
||||||
|
|
||||||
|
## content11
|
||||||
|
|
||||||
|
- [tag2](Test-Tag-issue-1316#tag1content11content12tag2)
|
||||||
|
|
||||||
|
## content12
|
||||||
|
|
||||||
|
- [tag2](Test-Tag-issue-1316#tag1content11content12tag2)
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean file for tag #1316):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-issue-1316.md")
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Change delimiter #first_tag #vim #mo as for issue #1316 (2) {{{1):
|
||||||
|
let g:vimwiki_tag_format = {'pre_mark': '#\w\@=', 'post_mark': '', 'sep': '[#[:space:]]\+', 'in': '[^#:[:space:]]\+' }
|
||||||
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
|
call vimwiki#vars#init()
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md
|
||||||
|
AssertEqual $HOME . '/testmarkdown/Test-Tag-issue-1316-bis.md', expand('%')
|
||||||
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create File Content with #tag1 #tag2 as for issue #1316):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md\<CR>
|
||||||
|
I
|
||||||
|
# Line1: Heading
|
||||||
|
# A header\<CR>
|
||||||
|
# Line2: Tag not in header
|
||||||
|
bla #first_tag\<Cr>
|
||||||
|
# Line3: Tag in header
|
||||||
|
#vim #mono\<Cr>
|
||||||
|
# Line4: empty
|
||||||
|
\<CR>
|
||||||
|
# Line5: dummy content
|
||||||
|
Words here.
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Assert some file info for #1316):
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md
|
||||||
|
AssertEqual $HOME . '/testmarkdown/Test-Tag-issue-1316-bis.md', expand('%')
|
||||||
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
AssertEqual 'VimwikiTag', SyntaxAt(2, 6)
|
||||||
|
|
||||||
|
|
||||||
|
Do (Append something at first_tag):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md\<CR>
|
||||||
|
# Some bug with loclist for vim7.3 and vim8.0
|
||||||
|
:if v:version > 810\<Cr>
|
||||||
|
VimwikiSearchTags first_tag\<Cr>
|
||||||
|
else\<Cr>
|
||||||
|
2\<Cr>
|
||||||
|
endif\<Cr>
|
||||||
|
A Content1\<Esc>
|
||||||
|
|
||||||
|
|
||||||
|
Do (Append something at mono tag):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md\<CR>
|
||||||
|
:if v:version > 810\<Cr>
|
||||||
|
VimwikiSearchTags mono\<Cr>
|
||||||
|
else\<Cr>
|
||||||
|
3\<Cr>
|
||||||
|
endif\<Cr>
|
||||||
|
A Content2\<Esc>
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Content appended at tags):
|
||||||
|
# A header
|
||||||
|
bla #first_tag Content1
|
||||||
|
#vim #mono Content2
|
||||||
|
|
||||||
|
Words here.
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean file for tag #1316):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-issue-1316-bis.md")
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
unlet g:vimwiki_tag_format
|
||||||
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
|
call vimwiki#vars#init()
|
||||||
|
|
||||||
|
|
||||||
|
Do (Md: #1034: Create File with tag in code for issue #1034):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1034.md\<CR>
|
||||||
|
I
|
||||||
|
# Line1: Heading
|
||||||
|
Some line\<Cr>
|
||||||
|
# Line2: Tag not in header
|
||||||
|
```bash\<Cr>
|
||||||
|
# Line3: Tag in header
|
||||||
|
this is bash code with :tag1:\<Cr>
|
||||||
|
# Line4: empty
|
||||||
|
```\<Cr>
|
||||||
|
# Line5: tag2
|
||||||
|
and :tag2:\<Cr>
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
|
||||||
|
|
||||||
|
Do (Md: #1034: Append something at mono tag):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1034.md\<CR>
|
||||||
|
ggdG
|
||||||
|
:read $HOME/testmarkdown/.vimwiki_tags\<CR>
|
||||||
|
G
|
||||||
|
:g/^!/d\<CR>
|
||||||
|
oContent\<Esc>
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Md: #1034: Can see tag2 but not tag1 as in code):
|
||||||
|
tag2 Test-Tag-issue-1034.md 5;" vimwiki:Test-Tag-issue-1034\tTest-Tag-issue-1034#tag2\tTest-Tag-issue-1034#tag2
|
||||||
|
Content
|
||||||
|
|
||||||
|
|
||||||
|
Do (Wiki: #1034: Create File with tag in code for issue #1034):
|
||||||
|
:edit $HOME/testwiki/Test-Tag-issue-1034.wiki\<CR>
|
||||||
|
I
|
||||||
|
# Line1: Heading
|
||||||
|
Some line\<Cr>
|
||||||
|
# Line2: Tag not in header
|
||||||
|
{{{bash\<Cr>
|
||||||
|
# Line3: Tag in header
|
||||||
|
this is bash code with :tag1:\<Cr>
|
||||||
|
# Line4: empty
|
||||||
|
}}}\<Cr>
|
||||||
|
# Line5: tag2
|
||||||
|
and :tag2:\<Cr>
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
|
||||||
|
|
||||||
|
Do (Wiki: #1034: Append something at mono tag):
|
||||||
|
:edit $HOME/testwiki/Test-Tag-issue-1034.wiki\<CR>
|
||||||
|
ggdG
|
||||||
|
:read $HOME/testwiki/.vimwiki_tags\<CR>
|
||||||
|
G
|
||||||
|
:g/^!/d\<CR>
|
||||||
|
oContent\<Esc>
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Wiki: #1034: Can see tag2 but not tag1 as in code):
|
||||||
|
tag2 Test-Tag-issue-1034.wiki 5;" vimwiki:Test-Tag-issue-1034\tTest-Tag-issue-1034#tag2\tTest-Tag-issue-1034#tag2
|
||||||
|
Content
|
||||||
|
|
||||||
|
|
||||||
|
Execute (#1034: Clean file for tag #1034):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testwiki/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-issue-1013.md")
|
||||||
|
call system("rm $HOME/testwiki/Test-Tag-issue-1013.wiki")
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
# Test how vimwiki#tags#generate_tags behaves when updating existing tag link sections
|
||||||
|
|
||||||
|
Before (Setup test wiki files):
|
||||||
|
call writefile([":usedtag:", ":othertag:"], expand("~/testmarkdown/Test-Tag-tagged.md"))
|
||||||
|
edit ~/testmarkdown/Test-Tag-links.md
|
||||||
|
|
||||||
|
After (Cleanup files):
|
||||||
|
%delete
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-tagged.md")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-links.md")
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create preexisting tag links with unused tag):
|
||||||
|
I
|
||||||
|
# Generated Tags\<CR>
|
||||||
|
\<CR>
|
||||||
|
## unusedtag\<CR>
|
||||||
|
\<CR>
|
||||||
|
## usedtag\<CR>
|
||||||
|
\<ESC>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
:call vimwiki#tags#generate_tags(0)\<CR>
|
||||||
|
|
||||||
|
Expect (Keeps unused tag header):
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## unusedtag
|
||||||
|
|
||||||
|
|
||||||
|
## usedtag
|
||||||
|
|
||||||
|
- [Test-Tag-tagged](Test-Tag-tagged)
|
||||||
|
|
||||||
|
Do (Create preexisting tag subheadings out of alphabetical order):
|
||||||
|
I
|
||||||
|
# Generated Tags\<CR>
|
||||||
|
\<CR>
|
||||||
|
## z\<CR>
|
||||||
|
\<CR>
|
||||||
|
## usedtag\<CR>
|
||||||
|
\<CR>
|
||||||
|
## a\<CR>
|
||||||
|
\<CR>
|
||||||
|
# Other Stuff
|
||||||
|
\<ESC>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
:call vimwiki#tags#generate_tags(0)\<CR>
|
||||||
|
|
||||||
|
Expect (Existing tag subheading order is preserved):
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## z
|
||||||
|
|
||||||
|
|
||||||
|
## usedtag
|
||||||
|
|
||||||
|
- [Test-Tag-tagged](Test-Tag-tagged)
|
||||||
|
|
||||||
|
## a
|
||||||
|
|
||||||
|
|
||||||
|
# Other Stuff
|
||||||
+48
-13
@@ -1,7 +1,6 @@
|
|||||||
" TODO treat if local (see $HOME in all tests)
|
" TODO treat if local (see $HOME in all tests)
|
||||||
" TODO mutualise (to prettify output) mode(1) to check if in -Es or not
|
" TODO mutualise (to prettify output) mode(1) to check if in -Es or not
|
||||||
" TODO test tabnext in at least one travis job (without -Es)
|
" TODO test tabnext in at least one travis job (without -Es)
|
||||||
" IDEA fasten travis difefrent job with the same vimwiki git (-8s)
|
|
||||||
|
|
||||||
" Declare tipical Vim preambule
|
" Declare tipical Vim preambule
|
||||||
" vint: -ProhibitSetNoCompatible
|
" vint: -ProhibitSetNoCompatible
|
||||||
@@ -14,12 +13,14 @@
|
|||||||
let $THOME = $HOME
|
let $THOME = $HOME
|
||||||
|
|
||||||
" Set chrooted virtual runtime path
|
" Set chrooted virtual runtime path
|
||||||
let rtp=$ROOT.'/rtp.vim'
|
let rtp = $ROOT . '/rtp.vim'
|
||||||
exe 'source '.rtp
|
if filereadable(rtp)
|
||||||
|
execute 'source ' . rtp
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
" Load Vader
|
" Load Vader
|
||||||
let vader=$ROOT.'/vader'
|
let vader = $ROOT.'/vader'
|
||||||
exe 'set runtimepath+='.vader
|
exe 'set runtimepath+='.vader
|
||||||
|
|
||||||
|
|
||||||
@@ -114,6 +115,14 @@
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Define functions
|
" Define functions
|
||||||
|
function! CommentLine(msg)
|
||||||
|
" Log current line and argument message
|
||||||
|
" Called: in GFM copying like: https://github.github.com/gfm/#example-360 in syntax_markdown_gfm_typeface.vader
|
||||||
|
Log 'Content: `' . getline('.') . '`'
|
||||||
|
Log 'Comment: ' . a:msg
|
||||||
|
endfunction
|
||||||
|
command! -nargs=1 CommentLine call CommentLine(<args>)
|
||||||
|
|
||||||
function! SetSyntax(vw_syn)
|
function! SetSyntax(vw_syn)
|
||||||
" Change the syntax using a temporary wiki
|
" Change the syntax using a temporary wiki
|
||||||
" Change extension and wiki_nr
|
" Change extension and wiki_nr
|
||||||
@@ -334,21 +343,45 @@
|
|||||||
0d
|
0d
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetSyntaxGroup(line, col)
|
function! GetSyntaxVimwiki(line, col)
|
||||||
|
let res = GetSyntaxStack(a:line, a:col)
|
||||||
|
if empty(res)
|
||||||
|
return 'normal'
|
||||||
|
endif
|
||||||
|
return res[0]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! GetSyntaxGroup(...)
|
||||||
" Get normalized syntax group: usefull for boldItalic Vs italicBold
|
" Get normalized syntax group: usefull for boldItalic Vs italicBold
|
||||||
|
" Arg1: line
|
||||||
|
" Arg2: column
|
||||||
" -- Here, Vader's SyntaxAt is not enough
|
" -- Here, Vader's SyntaxAt is not enough
|
||||||
" From: https://stackoverflow.com/questions/9464844
|
" From: https://stackoverflow.com/questions/9464844
|
||||||
let l:s = synID(a:line, a:col, 1)
|
let line = a:0 >= 1 ? a:1 : '.'
|
||||||
|
let col = a:0 >= 2 ? a:2 : '.'
|
||||||
|
|
||||||
|
let l:s = synID(line, col, 1)
|
||||||
return synIDattr(synIDtrans(l:s), 'name')
|
return synIDattr(synIDtrans(l:s), 'name')
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
function! GetSyntaxStack()
|
function! GetSyntaxStack(...)
|
||||||
" Debug helper
|
" Debug helper
|
||||||
|
" Arg1: line
|
||||||
|
" Arg2: column
|
||||||
|
let line = a:0 >= 1 ? a:1 : '.'
|
||||||
|
let col = a:0 >= 2 ? a:2 : '.'
|
||||||
if !exists('*synstack')
|
if !exists('*synstack')
|
||||||
return
|
return []
|
||||||
endif
|
endif
|
||||||
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
let res = map(synstack(line, col), 'synIDattr(v:val, "name")')
|
||||||
endfunc
|
|
||||||
|
" For old vim version returning 0
|
||||||
|
if type(res) == type(0) && res == 0
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
return res
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! AssertIfVersion(version, one, two)
|
function! AssertIfVersion(version, one, two)
|
||||||
" Run Assert only if vim version is high enough
|
" Run Assert only if vim version is high enough
|
||||||
@@ -366,7 +399,9 @@
|
|||||||
" Or rather: If execute() exists - it's not available for all 7.4
|
" Or rather: If execute() exists - it's not available for all 7.4
|
||||||
" versions.
|
" versions.
|
||||||
" https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
|
" https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
|
||||||
if has('patch-7.4-2008') != 1 | return [] | endif
|
|
||||||
|
" Clause: Dot not work if not able
|
||||||
|
if v:version < 800 && has('patch-7.4-2008') != 1 | return [] | endif
|
||||||
|
|
||||||
" Store output of group to variable
|
" Store output of group to variable
|
||||||
let out = execute('hi ' . a:group)
|
let out = execute('hi ' . a:group)
|
||||||
@@ -378,8 +413,8 @@
|
|||||||
return GetHighlightTerm(parent, a:term)
|
return GetHighlightTerm(parent, a:term)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Return the unique term we are looking for
|
" Return the unique term we are looking for
|
||||||
let stg = matchstr(out, a:term.'=\zs[^ \t\n\r]*')
|
let stg = matchstr(out, a:term . '=\zs[^[:space:]]*')
|
||||||
return split(stg, ',')
|
return split(stg, ',')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Contents more Contents
|
||||||
|
|
||||||
|
- [Test1](#Test1)
|
||||||
|
- [Test2](#Test2)
|
||||||
|
|
||||||
|
# Test1
|
||||||
|
|
||||||
|
- [Test1](#Test1)
|
||||||
|
- [Test2](#Test2)
|
||||||
|
- [filenew](filenew)
|
||||||
|
|
||||||
|
# Test2
|
||||||
|
|
||||||
|
- [Test1](#Test1)
|
||||||
|
- [Test2](#Test2)
|
||||||
|
- [filenew](filenew)
|
||||||
Reference in New Issue
Block a user