Compare commits
521 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fdf73f61d | |||
| 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 | |||
| 0629b39815 | |||
| 221377f4fa | |||
| 487eb21385 | |||
| 584f073a28 | |||
| c21c939b06 | |||
| fc2e9f0dba | |||
| bd65f7dd7c | |||
| d7ec12645a | |||
| 7cfc3eee22 | |||
| 8e4202847f | |||
| 3ac8e1ae14 | |||
| 2a8775c21d | |||
| 61c513d8d0 | |||
| 4a0901a811 | |||
| 7ab9983ddd | |||
| a905ee71e0 | |||
| 0690d8ad51 | |||
| 63af6e72dd | |||
| 4d7a4da2e8 | |||
| c19e63b1e9 | |||
| ee31d45553 | |||
| ecce184493 | |||
| 1bea2ce40a | |||
| 2141fde8b8 | |||
| 064a8f7ade | |||
| 95dd2e0d2c | |||
| 5148f5f601 | |||
| a3a3fbf95f | |||
| f28fe1ae43 | |||
| 8b53bd4c73 | |||
| 174eca3f06 | |||
| 22dcb36618 | |||
| 7d937615c1 | |||
| 1aa417fbd8 | |||
| 212a66fcd6 | |||
| 369130edd7 | |||
| c4e78fe310 | |||
| 45c89ebca4 | |||
| d43fdd14d2 | |||
| a182f7db8f | |||
| 70682fc52f | |||
| 7eb6fed581 | |||
| 4cc6edf3eb | |||
| 9706f5eee8 | |||
| b4f7c7ba3d | |||
| 114ead874c | |||
| 1fbe1bc6a8 | |||
| 62baafe259 | |||
| 0181009dba | |||
| 573e3d1952 | |||
| eedc26bfe6 | |||
| 760cab232d | |||
| 725709ba80 | |||
| 8a73cd8668 | |||
| 7cea1cfb3c | |||
| 8fef79bcbd | |||
| 1f77b7e6f6 | |||
| 84e9422c7c | |||
| f6c419fb87 | |||
| 4c7ab73c51 | |||
| f396e8a494 | |||
| 618893be00 | |||
| db85dc54c9 | |||
| 61a6ce6686 | |||
| d34abf9fa5 | |||
| a9d157fa0f | |||
| 8f92aaffe4 | |||
| 0a9488f3f1 | |||
| e91711eb79 | |||
| 850aace465 | |||
| e7124290a2 | |||
| 788a961052 | |||
| 5996fdf26a | |||
| 29fa4b028b | |||
| ffc4e41208 | |||
| 036a7d24f9 | |||
| 8c7937c765 | |||
| bb4f5f85e8 | |||
| 84928f7ace | |||
| dbe332a095 | |||
| e4fc0ca0e5 | |||
| 237f67db4e | |||
| 4f0df71d84 | |||
| 1b2f34f5e0 | |||
| 9753bcbcde | |||
| c3eff1dd0e | |||
| 333b44a238 | |||
| 2c10045004 | |||
| 8d4cb7f11d | |||
| e922f7302f | |||
| 96713548cc | |||
| 609fc5f509 | |||
| 523986df4b | |||
| 48baa1f4cd | |||
| dc2b16a587 | |||
| c34b37e195 | |||
| 2a31984369 | |||
| f794f1e284 | |||
| a040c42264 | |||
| e2a6b825de | |||
| 527ca1b7a1 | |||
| ea4a5e3bb2 | |||
| a6878015e6 | |||
| 78216de25e | |||
| 842f842100 | |||
| 990b25ce37 | |||
| 1ea97303fd | |||
| a7f34cd8cf | |||
| dbbadc8035 | |||
| dc63a5dacc | |||
| 8e5274b1a2 | |||
| 817641e551 | |||
| d1b3fe34c9 | |||
| a51052cbe6 | |||
| ee2d67751e | |||
| 5c64ced22d | |||
| d93858509d | |||
| 0b85dd1a7b | |||
| 22d9d012ba | |||
| 212cd8e09b | |||
| 4431caf7ff | |||
| 11337f5b34 | |||
| 39407014c8 | |||
| a241d458ab | |||
| a1f1b9c290 | |||
| 21c5a7f796 | |||
| 7144df6b96 | |||
| 4b041a606a | |||
| 188ead55db | |||
| dede5a1eea | |||
| 659ca62b29 | |||
| 4aa3ca5c16 | |||
| dd239c58fb | |||
| f18bf3dafb | |||
| 348b014957 | |||
| aa628f8a12 | |||
| 0693e41132 | |||
| 8a50d022b1 | |||
| 69ead3bf3c | |||
| e4186adc3d | |||
| 8cc99c00c2 | |||
| b1de908f0e | |||
| 708fde781a | |||
| 825870ec1b | |||
| fc056cfeca | |||
| 40f02293bf | |||
| 94a78859d7 | |||
| fb178f8e3c | |||
| 22bb7d9570 | |||
| 428c60a45e | |||
| a27940a394 | |||
| 1b16720b7b | |||
| 5408d74b35 | |||
| 6dff2c60a5 | |||
| 321e518fdb | |||
| 7f8c4b5669 | |||
| 97e02897f4 | |||
| 787e95b910 | |||
| 5651e744a6 | |||
| 0a5a33af19 | |||
| 66a294d76f | |||
| 355c1f76b0 | |||
| 2332dc1514 | |||
| 96232c0340 | |||
| f107557463 | |||
| 7a4ad2ed95 | |||
| 369a64cdc8 | |||
| e785c6f5b4 | |||
| b124c9b1d8 | |||
| af08e34000 | |||
| d9d14cc3f7 | |||
| 4672deb44e | |||
| d5964f0c84 | |||
| 536184c59b | |||
| 8e2eab2e55 | |||
| 0a9b11fb0f | |||
| c9ba53e204 | |||
| 81c67f97e4 | |||
| ac38bb2f09 | |||
| edf562fab0 | |||
| 446776e00b | |||
| f21245a843 | |||
| ca84701c83 | |||
| e3501dcdd0 | |||
| 0543b46ffd | |||
| e006da5aa0 | |||
| 36e5455723 | |||
| be86b54914 | |||
| 12327c6f90 | |||
| e3e841f335 | |||
| 8cf2789840 | |||
| 068a26acec | |||
| 667929d3f9 | |||
| dfc5344d0c | |||
| 19bfe93ef3 | |||
| 1072f2a14e | |||
| a3be479d5a | |||
| 45b7515b88 | |||
| 75a9232fd5 | |||
| 2f20c617d6 | |||
| ed3f1ad215 | |||
| 975a29ebf0 | |||
| da9ef92948 | |||
| e1826702b7 | |||
| 865b402c06 | |||
| 43951e5851 | |||
| a9f21c6d4a | |||
| 61093f4f2a | |||
| 1617d4b654 | |||
| 5e564bb10d | |||
| c70e1dea54 | |||
| ac4d0a1d46 | |||
| afc868929d | |||
| d8e7e40fcd | |||
| df8bfcba23 | |||
| 762bb7f124 | |||
| 1448dc3a7b | |||
| 5b17cfc076 | |||
| 285f1628c2 | |||
| 619f04f898 | |||
| 96b139253d | |||
| c9e6afe856 | |||
| 36fa81c059 | |||
| 1eb74dcf2f | |||
| 57dc48d686 | |||
| 306efbcdf3 | |||
| f54b94a38f | |||
| e83173c7c8 | |||
| 972594829e | |||
| b4cb7f7ab6 | |||
| f49a91501b | |||
| 077467877d | |||
| f4c983b6b5 | |||
| 3b5537f15a | |||
| c6564119b0 | |||
| ee38764480 | |||
| e850cb8562 | |||
| 0850ce13ad | |||
| d86685f350 | |||
| 1852c6c542 | |||
| 39812e5c96 | |||
| 76af17a872 | |||
| 46025fb0fb | |||
| ab301801b0 | |||
| 73527d3f14 | |||
| b96e82d6cc | |||
| 1020ac51bf | |||
| c73107dc10 | |||
| 35af13c1ef | |||
| f9b9b5a768 | |||
| 867d81a50c | |||
| 6a0210c644 | |||
| a4738f31d6 | |||
| 614287a42b | |||
| dee6a88929 | |||
| 7ae02bb4e6 | |||
| 78a41b79c6 | |||
| ca28174dcc | |||
| 53301fdf4d | |||
| 64c9f3d36d | |||
| 75c557bcbc | |||
| d9412218e3 | |||
| b90e6f2e33 | |||
| c7aa3cc122 | |||
| 8ccfeb4fdb | |||
| 87c13f570a | |||
| 270f542292 | |||
| 3ec0c9cd91 | |||
| 59e1229da6 | |||
| 5126967d09 | |||
| 5cdeb9a682 | |||
| 2c50f710b8 | |||
| cf072ebdf2 | |||
| b4e0f738a3 | |||
| b9eec79cc6 | |||
| 719036b011 | |||
| 19f913429f | |||
| 3cc6fa71f6 | |||
| e66464cda0 | |||
| f18bb6bc57 | |||
| 7ad0ad36dc | |||
| cd3e3d238b | |||
| 1a4e1ed1ae | |||
| 68e33e37e5 | |||
| 7c892e2516 | |||
| b6ea14d3f8 | |||
| 2526547db2 | |||
| 6a047cb067 | |||
| 8db9d4b387 | |||
| 80013f457d | |||
| 64eea36b1e | |||
| 2a51d83397 | |||
| 36faec1de9 | |||
| 58331993c7 | |||
| c58d5da049 | |||
| fb5d2f3f82 | |||
| 4f648b6567 | |||
| eb26a66be5 | |||
| 460fcb692e | |||
| c48637fd99 | |||
| c8bb658360 | |||
| ce4074aeb9 | |||
| 241126631d | |||
| 16998af36d | |||
| c4a40e7fc7 | |||
| 53ba047a18 | |||
| 839a5bf608 | |||
| 85b220bae1 | |||
| 141d1aa081 | |||
| 4bc6ff4547 | |||
| a42cd58636 | |||
| 1f85a3c855 | |||
| ad95e3463f | |||
| ba84981b5a | |||
| f6a99569bd | |||
| 0ce3c87a2e | |||
| 3cf10e8ddc | |||
| 515155038f | |||
| 4458216760 | |||
| a17a9826bd | |||
| e814c6ad93 | |||
| 4f674f68b4 | |||
| 5ce7c14a3d | |||
| b5d808b440 | |||
| 152a7bfdf1 | |||
| 28d78b0d39 | |||
| 57d23fa763 | |||
| 45025fa4f0 | |||
| dcd68a6781 | |||
| 0c561e5341 | |||
| 594ac7dbe1 | |||
| fcb5850c28 | |||
| 0678df38e9 | |||
| 3180209c6f | |||
| 0d0b9a7492 | |||
| 0c145c7604 | |||
| fbec80b7d9 | |||
| e68592b8ef | |||
| 86cad979e5 | |||
| 86926b7212 | |||
| 8ec1cccb36 | |||
| 585a9fd16b | |||
| d536fa1117 | |||
| fb7d2881d7 | |||
| 94d62ad7f2 | |||
| 0441be5e34 | |||
| 466bdcd4e8 | |||
| af12065e92 | |||
| c58268df3f | |||
| b997e687c3 | |||
| 8914b14e24 | |||
| 6ec85cd0e8 | |||
| d045ad4db0 | |||
| 42a1f08ffa | |||
| 68233c51eb | |||
| 6755068152 | |||
| 70a4852f3c | |||
| 8bfdf54d10 | |||
| 12df0bddb2 | |||
| ddf7e5e0ff | |||
| efe5f648de | |||
| 3ba65a671f | |||
| b1c009c1df | |||
| cf8a16c5c7 | |||
| 8c6bc81756 | |||
| c05037a490 | |||
| cde4703354 | |||
| 0d8fbebcb8 | |||
| 61a6862f8e | |||
| fd8832cfa1 | |||
| 61d93fde7f | |||
| 50a3c78c87 | |||
| bb15cd1aff | |||
| ad4d43abfe | |||
| 4106cb7bc7 | |||
| e84dcbfa25 | |||
| 6787e0fb7e | |||
| 1e5c93ea91 | |||
| 2b6fa274a8 | |||
| 510c149512 | |||
| 37f020d21a | |||
| 13adbe3510 | |||
| be793e28be | |||
| 79d6a1a4e2 | |||
| f105819c48 | |||
| 3d076f01c8 | |||
| d1cc873809 | |||
| 9d10610c4a | |||
| aff0258d03 | |||
| 750b3171b3 | |||
| 5f01182468 | |||
| 1e74443b5a | |||
| ae67790ad5 | |||
| 4a9f81c54b | |||
| d3aade7349 | |||
| 62d71b832a | |||
| b90fbc70d9 | |||
| 048f2eb34a | |||
| 63985a52e8 | |||
| 08dcae9630 | |||
| b172db23d3 | |||
| 8fbe51d614 | |||
| a5bda652d0 | |||
| 82ba1e99bf | |||
| 3bf389bf99 | |||
| 848feb43e1 | |||
| b77473960a | |||
| e7f5ce6046 | |||
| d040a4bd7d | |||
| 0303021abd | |||
| ae3db7a079 | |||
| 3c0ae2ff97 | |||
| 4928132e5f | |||
| 80a94cd8c7 | |||
| c21de17a34 | |||
| e0fffb470a | |||
| e91150478e | |||
| 308e2056f6 | |||
| 4f5d4c9400 | |||
| 41aa647aba | |||
| 3396e87dbe | |||
| 1ba99ae135 | |||
| c9229244a8 | |||
| 3b9aa6b162 | |||
| 047947cbbe | |||
| 14c5302697 | |||
| 0e664a6230 | |||
| d089a2c65a | |||
| 3f7f85cfc6 | |||
| b849a411e3 | |||
| fc158ba744 | |||
| e56c26c7ba | |||
| f5cf991115 | |||
| 6c2f9f999d | |||
| cdc9940887 | |||
| a013e8b1b5 | |||
| 6766c37ce0 | |||
| dfccfb1951 | |||
| 32c7f289b7 | |||
| ae365a8b8f | |||
| 8f5d38365b | |||
| 7d82c7541d | |||
| 9964026586 | |||
| eb00d30d9b | |||
| c8d09d7c9e | |||
| e0f4ab8c5e | |||
| ad8e1d30bf | |||
| c4b21b498e | |||
| bdcfca1e5c | |||
| ad6a3bceb6 | |||
| 1f4fb8ca58 | |||
| 0c82d9dcb8 | |||
| efcc3f1fa5 | |||
| e6d6830db7 | |||
| da52523710 | |||
| 2f87f92060 | |||
| 6f687aff52 | |||
| 8941508e35 | |||
| b4c9a4f028 | |||
| 88a6820e9e | |||
| fa6342c454 | |||
| 5e4a89c898 | |||
| f40f054441 | |||
| 1f1966a4f6 | |||
| abd12d4479 | |||
| 6b29b6604c | |||
| e26d9fdb8e | |||
| bb40826def | |||
| 07ba7339f1 | |||
| 30c0bdffaa | |||
| 7e176c659b | |||
| bfbfa2783e | |||
| af8cdc4d62 | |||
| a74e0821b0 | |||
| 08ec02a755 | |||
| 21f5069e48 | |||
| 6f7e40ff78 | |||
| 28727b3971 | |||
| 10f502a698 | |||
| 23d273d547 | |||
| 7730fa28b5 | |||
| f384aa6d1e | |||
| 920f41b318 | |||
| 72ad6d1b16 | |||
| 4d1bb91dbe | |||
| cd25233cc8 | |||
| b79977d6b8 | |||
| 411d8da0a4 | |||
| 0559bf8aed |
@@ -1,11 +1,6 @@
|
||||
# Issue Checks
|
||||
|
||||
Prior to submitting a new issue make sure to complete these steps:
|
||||
|
||||
1. Checkout the `dev` branch and confirm the issue is present there as well.
|
||||
The `dev` branch contains fixes that may not have been merged to `master` yet.
|
||||
2. Post the syntax you are using (default/mediawiki/markdown) **and** your vimwiki settings from your `.vimrc`
|
||||
3. Provide a detailed description of the problem including **steps to reproduce the issue**.
|
||||
4. Include the output of `:VimwikiShowVersion`.
|
||||
|
||||
**DELETE THIS TEMPLATE TEXT PRIOR TO SUBMITTING THE ISSUE**
|
||||
- [ ] Include the VimWiki settings from your `.vimrc`
|
||||
- [ ] Include the syntax you are using (default / Markdown / MediaWiki)
|
||||
- [ ] Provide a detailed description of the problem including **steps to reproduce the issue**.
|
||||
- [ ] Include the output of `:VimwikiShowVersion`.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Pull Request Checks
|
||||
Steps for submitting a pull request:
|
||||
|
||||
1. **ALL** pull requests should be made against the `dev` branch!
|
||||
2. Take a look at [CONTRIBUTING.MD](https://github.com/vimwiki/vimwiki/blob/dev/CONTRIBUTING.md)
|
||||
3. Reference any related issues.
|
||||
4. Provide a description of the proposed changes and any testing that was done.
|
||||
5. Make sure to update the documentation in `doc/vimwiki.txt` if applicable.
|
||||
|
||||
**DELETE THIS TEMPLATE TEXT PRIOR TO SUBMITTING YOUR PULL REQUEST**
|
||||
- [ ] **ALL** pull requests should be made against the `dev` branch!
|
||||
- [ ] Take a look at [CONTRIBUTING.MD](https://github.com/vimwiki/vimwiki/blob/dev/CONTRIBUTING.md)
|
||||
- [ ] Reference any related issues.
|
||||
- [ ] Provide a description of the proposed changes.
|
||||
- [ ] PRs must pass Vint tests and add new Vader tests as applicable.
|
||||
- [ ] Make sure to update the documentation in `doc/vimwiki.txt` if applicable,
|
||||
including the Changelog and Contributors sections.
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
# 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.3.429",
|
||||
"-n vim_8.1.0519",
|
||||
# TODO add me when test works on Vim, 9.0
|
||||
# -- Currently I experienced some surprised due to defaults
|
||||
# -- tinmarino 2023-03-10
|
||||
# "-n v9.0.1396",
|
||||
|
||||
"-n nvim_0.3.8",
|
||||
|
||||
# Cannot quote as it is expanded from $OPT after quote removal
|
||||
# So I decided to escape the *
|
||||
"-n vim_7.4.1099 -f '[a-k]*.vader'",
|
||||
"-n vim_7.4.1546 -f 'l*.vader'",
|
||||
"-n vim_8.0.0027 -f '[m-z]*.vader'",
|
||||
]
|
||||
steps:
|
||||
# This action is required to fetch the code to test
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# This action is crafting the docker image from the root Docker file
|
||||
# or will use it is exists in cache
|
||||
# It caches in GHA for GitHub Actions with 10 Gb
|
||||
# See: https://github.com/moby/buildkit#github-actions-cache-experimental
|
||||
# Examples at: https://github.com/docker/build-push-action/blob/
|
||||
# e27bcee4eb9e7b4bc168418e3364c4482120393a/docs/advanced/cache.md
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: vimwiki:latest
|
||||
load: true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
- name: Check
|
||||
run: |
|
||||
pushd test
|
||||
if [[ "$OPT" == 'vint' ]]; then
|
||||
bash run_tests.sh -v -t vint;
|
||||
else
|
||||
bash run_tests.sh -v -t vader $OPT;
|
||||
fi
|
||||
popd
|
||||
env:
|
||||
OPT: ${{ matrix.opt }}
|
||||
@@ -2,6 +2,7 @@
|
||||
# This section is devoted to this project
|
||||
##############################
|
||||
doc/tags
|
||||
.tags
|
||||
|
||||
# Vim stuff
|
||||
##############################
|
||||
@@ -20,3 +21,4 @@ Session.vim
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
vimtest
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# No language: we download vim and compile it oursselves
|
||||
# WARNING: This file is OBSOLETE since travis CI is making us pay
|
||||
# to get execution.
|
||||
# See Github Actions at .github/workflows/test-vader-action.yml
|
||||
|
||||
|
||||
language: generic
|
||||
|
||||
cache:
|
||||
# Enable cache folder
|
||||
bundler: true
|
||||
directories:
|
||||
- $HOME/docker_images
|
||||
|
||||
before_cache:
|
||||
# Save tagged docker images. Info at https://github.com/travis-ci/travis-ci/issues/5358#issuecomment-248915326
|
||||
- >
|
||||
mkdir -p $HOME/docker_images && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
|
||||
| xargs -n 2 -t sh -c 'test -e $HOME/docker_images/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker_images/$1.tar.gz'
|
||||
|
||||
before_install:
|
||||
# Install docker
|
||||
- n_image=$(ls -1 $HOME/docker_images/*.tar.gz | wc -l)
|
||||
- if (( $n_image )); then ls $HOME/docker_images/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load";
|
||||
else docker build --tag vimwiki .;
|
||||
fi
|
||||
|
||||
env:
|
||||
# Define jobs <- vim version <- hard copied from Dockerfile
|
||||
# First to be launched
|
||||
- VIM_VERSION=vint
|
||||
- VIM_VERSION=vim_7.3.429
|
||||
- VIM_VERSION=nvim_0.3.8
|
||||
- VIM_VERSION=vim_8.1.0519
|
||||
# More
|
||||
- VIM_VERSION=vim_7.4.1099 PATTERN='[a-k]*.vader'
|
||||
- VIM_VERSION=vim_7.4.1546 PATTERN='l*.vader'
|
||||
- VIM_VERSION=vim_8.0.0027 PATTERN='[m-z]*.vader'
|
||||
|
||||
script:
|
||||
# Run All tests
|
||||
- pushd test
|
||||
- if [[ "$VIM_VERSION" == 'vint' ]]; then bash run_tests.sh -v -t vint;
|
||||
elif [[ ! -z "$PATTERN" ]]; then bash run_tests.sh -v -t vader -n "$VIM_VERSION" -f "$PATTERN";
|
||||
else bash run_tests.sh -v -t vader -n "$VIM_VERSION";
|
||||
fi
|
||||
- popd
|
||||
|
||||
|
||||
# vim:sw=2:
|
||||
@@ -1,55 +1,68 @@
|
||||
# Contributing to VimWiki
|
||||
|
||||
# Filing a bug
|
||||
|
||||
Before filing a bug or starting to write a patch, check the latest development version from
|
||||
https://github.com/vimwiki/vimwiki/tree/dev to see if your problem is already fixed.
|
||||
Before filing a bug or starting to write a patch, check the latest development
|
||||
version from https://github.com/vimwiki/vimwiki/tree/dev to see if your problem
|
||||
is already fixed.
|
||||
|
||||
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/ .
|
||||
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/
|
||||
|
||||
# Git branching model
|
||||
|
||||
As of v2022.12.02, VimWiki has adopted a rolling release model, along with
|
||||
[calendar versioning][calver]. A release should be
|
||||
[prepared][#preparing-a-release] for every change or set of changes which merge
|
||||
to `dev`.
|
||||
|
||||
[calver]: https://calver.org/
|
||||
|
||||
There are two permanent branches:
|
||||
1. `dev`: This is the default branch, and where changes are released. Tasks
|
||||
which are done in one or only a few commits go here directly. Always
|
||||
keep this branch in a working state. If the task you work on requires
|
||||
multiple commits, make sure intermediate commits don't make VimWiki
|
||||
unusable.
|
||||
2. `master`: This is a legacy branch, retained to avoid breaking existing
|
||||
checkouts of the plugin. It should be kept in sync with `dev`.
|
||||
|
||||
Large changes which require multiple commits may be authored in feature
|
||||
branches, and merged into `dev` when the work is done.
|
||||
|
||||
# Creating a pull request
|
||||
If you want to provide a pull request on GitHub, please start from the `dev` branch, not from the
|
||||
`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.)
|
||||
|
||||
If you want to provide a pull request on GitHub, start from the `dev` branch,
|
||||
not from the `master` branch.
|
||||
|
||||
# More info and advice for (aspiring) core developers
|
||||
- Before implementing a non-trivial feature, think twice what it means for the user. We should
|
||||
always try to keep backward compatiblility. If you are not sure, discuss it on GitHub.
|
||||
- Also, when thinking about adding a new feature, it should be something which fits into the
|
||||
overall design of Vimwiki and which a significant portion of the users may like. Keep in mind
|
||||
that everybody has their own way to use Vimwiki.
|
||||
- Keep the coding style consistent.
|
||||
- Test your changes. Keep in mind that Vim has a ton of options and the users tons of different
|
||||
setups. Take a little time to think about under which circumstances your changes could break.
|
||||
Version bureaucracy:
|
||||
|
||||
## Git branching model
|
||||
- there are two branches with eternal lifetime:
|
||||
- `dev`: This is where the main development happens. Tasks which are done in one or only a few
|
||||
commits go here directly. Always try to keep this branch in a working state, that is, if the
|
||||
task you work on requires multiple commits, make sure intermediate commits don't make Vimwiki
|
||||
unusable (or at least push these commits at one go).
|
||||
- `master`: This branch is for released states only. Whenever a reasonable set of changes has
|
||||
piled up in the `dev` branch, a [release is done](#Preparing a release). After a release,
|
||||
`dev` has been merged into `master` and `master` got exactly one additional commit in which
|
||||
the version number in `plugin/vimwiki.vim` is updated. Apart from these commits and the merge
|
||||
commit from `dev`, nothing happens on `master`. Never should `master` merge into `dev`. When
|
||||
the users ask, we should recommend this branch for them to use.
|
||||
- Larger changes which require multiple commits are done in feature branches. They are based on
|
||||
`dev` and merge into `dev` when the work is done.
|
||||
1. Pick a new version number according to the current date:
|
||||
`YYYY.MM.DD` (if releasing a second version for the
|
||||
current date, append a `_MICRO` version such as `_1`, `_2`, etc.
|
||||
- Examples: `2022.12.22`, `2022.12.22_1`
|
||||
2. Update the version number at the top of `plugin/vimwiki.vim`
|
||||
3. Update the `!_TAG_PROGRAM_VERSION` expected in `test/tag.vader`
|
||||
(this is a bit silly, will have to figure out how to get rid of it)
|
||||
|
||||
## Preparing a release
|
||||
Update `doc/vimwiki.txt` with the following information:
|
||||
|
||||
1. `git checkout dev`
|
||||
2. Update the changelog in the doc, nicely grouped, with a new version number and release date.
|
||||
3. Update the list of contributors.
|
||||
4. Update the version number at the top of the doc file.
|
||||
5. If necessary, update the Readme and the home page.
|
||||
6. `git checkout master && git merge dev`
|
||||
7. Update the version number at the top of plugin/vimwiki.vim.
|
||||
8. Set a tag with the version number in Git: `git tag vX.Y`
|
||||
9. `git push --tags`
|
||||
10. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag, convert the changelog from the
|
||||
doc to markdown and post it there. Make plans to build an automatic converter and immediately
|
||||
forget this plan.
|
||||
11. Tell the world.
|
||||
1. Update the changelog to include, at the top of it, information on the new
|
||||
feature the PR introduces or the bug it is fixing as well as the PR number
|
||||
and related issue number if possible.
|
||||
2. Add a help section to describe any new features or options.
|
||||
3. If you are a first time contributor add your name to the list of
|
||||
contributors.
|
||||
|
||||
# Preparing a release
|
||||
|
||||
%% vim:tw=99
|
||||
This section is primarily for maintainers.
|
||||
|
||||
1. Set a tag with the version number in Git: `git tag -a v2022.12.02 -m 'Release v2022.12.02'`
|
||||
2. `git push --tags`
|
||||
3. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag,
|
||||
convert the changelog from the doc to Markdown and post it there. Make
|
||||
plans to build an automatic converter and immediately forget this plan.
|
||||
4. If necessary, update `README.md` and the home page.
|
||||
5. For major changes: Tell the world.
|
||||
|
||||
[semver]: https://semver.org/
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
FROM testbed/vim:latest
|
||||
|
||||
# Add packages
|
||||
RUN apk --no-cache add bash
|
||||
RUN apk --no-cache add git
|
||||
RUN apk --no-cache add python3
|
||||
RUN apk --no-cache add py3-pip
|
||||
|
||||
# Get vint for linting
|
||||
RUN pip3 install vim-vint
|
||||
|
||||
# Get vader for unit tests
|
||||
RUN git clone -n https://github.com/junegunn/vader.vim /vader
|
||||
WORKDIR /vader
|
||||
RUN git checkout de8a976f1eae2c2b680604205c3e8b5c8882493c
|
||||
|
||||
# Build vim and neovim versions we want to test
|
||||
WORKDIR /
|
||||
|
||||
RUN install_vim -tag v7.3.429 -name vim_7.3.429 -build
|
||||
RUN install_vim -tag v7.4.1099 -name vim_7.4.1099 -build
|
||||
RUN install_vim -tag v7.4.1546 -name vim_7.4.1546 -build
|
||||
RUN install_vim -tag v8.0.0027 -name vim_8.0.0027 -build
|
||||
RUN install_vim -tag v8.1.0519 -name vim_8.1.0519 -build
|
||||
RUN install_vim -tag v9.0.1396 -name v9.0.1396 -build
|
||||
RUN install_vim -tag neovim:v0.3.8 -name nvim_0.3.8 -build
|
||||
@@ -1,188 +1,294 @@
|
||||
A Personal Wiki For Vim
|
||||
==============================================================================
|
||||

|
||||
|
||||
[中文](README-cn.md)
|
||||
|
||||

|
||||
 *
|
||||
- [Intro](#introduction)
|
||||
- [Screenshots](#screenshots)
|
||||
- [Installation](#installation)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [VIM Packages](#installation-using-vim-packages-since-vim-741528)
|
||||
- [Pathogen](#installation-using-pathogen)
|
||||
- [Vim-Plug](#installation-using-vim-plug)
|
||||
- [Vundle](#installation-using-vundle)
|
||||
- [Basic Markup](#basic-markup)
|
||||
- [Lists](#lists)
|
||||
- [Key Bindings](#key-bindings)
|
||||
- [Commands](#commands)
|
||||
- [Changing Wiki Syntax](#changing-wiki-syntax)
|
||||
- [Getting Help](#getting-help)
|
||||
- [Helping VimWiki](#helping-vimwiki)
|
||||
- [Wiki](https://github.com/vimwiki/vimwiki/wiki)
|
||||
- [License](#license)
|
||||
|
||||
Intro
|
||||
------------------------------------------------------------------------------
|
||||
----
|
||||
|
||||
Vimwiki is a personal wiki for Vim -- a number of linked text files that have
|
||||
their own syntax highlighting.
|
||||
## Introduction
|
||||
|
||||
With Vimwiki you can:
|
||||
VimWiki is a personal wiki for Vim -- a number of linked text files that have
|
||||
their own syntax highlighting. See the [VimWiki Wiki](https://vimwiki.github.io/vimwikiwiki/)
|
||||
for an example website built with VimWiki!
|
||||
|
||||
* organize notes and ideas
|
||||
* manage todo-lists
|
||||
* write documentation
|
||||
* maintain a diary
|
||||
* export everything to HTML
|
||||
For the latest features and fixes checkout the [dev branch](https://github.com/vimwiki/vimwiki/tree/dev).
|
||||
If you are interested in contributing see [this section](#helping-vimwiki).
|
||||
|
||||
To do a quick start press `<Leader>ww` (this is usually `\ww`) to go to your index
|
||||
wiki file. By default it is located in `~/vimwiki/index.wiki`.
|
||||
With VimWiki, you can:
|
||||
|
||||
- Organize notes and ideas
|
||||
- Manage to-do lists
|
||||
- Write documentation
|
||||
- Maintain a diary
|
||||
- Export everything to HTML
|
||||
|
||||
To do a quick start, press `<Leader>ww` (default is `\ww`) to go to your index
|
||||
wiki file. By default, it is located in `~/vimwiki/index.wiki`. See `:h vimwiki_list`
|
||||
for registering a different path/wiki.
|
||||
|
||||
Feed it with the following example:
|
||||
|
||||
= My knowledge base =
|
||||
* Tasks -- things to be done _yesterday_!!!
|
||||
* Project Gutenberg -- good books are power.
|
||||
* Scratchpad -- various temporary stuff.
|
||||
```text
|
||||
= My knowledge base =
|
||||
* Tasks -- things to be done _yesterday_!!!
|
||||
* Project Gutenberg -- good books are power.
|
||||
* Scratchpad -- various temporary stuff.
|
||||
```
|
||||
|
||||
Place your cursor on `Tasks` and press Enter to create a link. Once pressed,
|
||||
`Tasks` will become `[[Tasks]]` -- a Vimwiki link. Press Enter again to
|
||||
open it. Edit the file, save it, and then press Backspace to jump back to your
|
||||
Place your cursor on `Tasks` and press Enter to create a link. Once pressed,
|
||||
`Tasks` will become `[[Tasks]]` -- a VimWiki link. Press Enter again to
|
||||
open it. Edit the file, save it, and then press Backspace to jump back to your
|
||||
index.
|
||||
|
||||
A Vimwiki link can be constructed from more than one word. Just visually
|
||||
select the words to be linked and press Enter. Try it with `Project Gutenberg`.
|
||||
A VimWiki link can be constructed from more than one word. Just visually
|
||||
select the words to be linked and press Enter. Try it, with `Project Gutenberg`.
|
||||
The result should look something like:
|
||||
|
||||
= My knowledge base =
|
||||
* [[Tasks]] -- things to be done _yesterday_!!!
|
||||
* [[Project Gutenberg]] -- good books are power.
|
||||
* Scratchpad -- various temporary stuff.
|
||||
```text
|
||||
= My knowledge base =
|
||||
* [[Tasks]] -- things to be done _yesterday_!!!
|
||||
* [[Project Gutenberg]] -- good books are power.
|
||||
* Scratchpad -- various temporary stuff.
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
|
||||
Basic Markup
|
||||
------------------------------------------------------------------------------
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
= Header1 =
|
||||
== Header2 ==
|
||||
=== Header3 ===
|
||||
## Installation
|
||||
|
||||
VimWiki has been tested on **Vim >= 7.3**. It will likely work on older
|
||||
versions but will not be officially supported.
|
||||
|
||||
*bold* -- bold text
|
||||
_italic_ -- italic text
|
||||
|
||||
[[wiki link]] -- wiki link
|
||||
[[wiki link|description]] -- wiki link with description
|
||||
|
||||
|
||||
Lists:
|
||||
|
||||
* bullet list item 1
|
||||
- bullet list item 2
|
||||
- bullet list item 3
|
||||
* bullet list item 4
|
||||
* bullet list item 5
|
||||
* bullet list item 6
|
||||
* bullet list item 7
|
||||
- bullet list item 8
|
||||
- bullet list item 9
|
||||
|
||||
1. numbered list item 1
|
||||
2. numbered list item 2
|
||||
a) numbered list item 3
|
||||
b) numbered list item 4
|
||||
|
||||
|
||||
For other syntax elements, see `:h vimwiki-syntax`
|
||||
|
||||
|
||||
Key bindings
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
normal mode:
|
||||
|
||||
* `<Leader>ww` -- Open default wiki index file.
|
||||
* `<Leader>wt` -- Open default wiki index file in a new tab.
|
||||
* `<Leader>ws` -- Select and open wiki index file.
|
||||
* `<Leader>wd` -- Delete wiki file you are in.
|
||||
* `<Leader>wr` -- Rename wiki file you are in.
|
||||
* `<Enter>` -- Follow/Create wiki link
|
||||
* `<Shift-Enter>` -- Split and follow/create wiki link
|
||||
* `<Ctrl-Enter>` -- Vertical split and follow/create wiki link
|
||||
* `<Backspace>` -- Go back to parent(previous) wiki link
|
||||
* `<Tab>` -- Find next wiki link
|
||||
* `<Shift-Tab>` -- Find previous wiki link
|
||||
|
||||
For more keys, see `:h vimwiki-mappings`
|
||||
|
||||
|
||||
Commands
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
* `:Vimwiki2HTML` -- Convert current wiki link to HTML
|
||||
* `:VimwikiAll2HTML` -- Convert all your wiki links to HTML
|
||||
* `:help vimwiki-commands` -- list all commands
|
||||
* `:help vimwiki` -- General vimwiki help docs
|
||||
|
||||
|
||||
Changing Wiki Syntax
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Vimwiki currently ships with 3 syntaxes: Vimwiki (default), Markdown (markdown), and MediaWiki (media)
|
||||
|
||||
If you would prefer to use either Markdown or MediaWiki syntaxes, set the following option in your .vimrc:
|
||||
```
|
||||
let g:vimwiki_list = [{'path': '~/vimwiki/',
|
||||
\ 'syntax': 'markdown', 'ext': '.md'}]
|
||||
```
|
||||
|
||||
|
||||
Installation
|
||||
==============================================================================
|
||||
|
||||
Prerequisites
|
||||
------------------------------------------------------------------------------
|
||||
### Prerequisites
|
||||
|
||||
Make sure you have these settings in your vimrc file:
|
||||
|
||||
set nocompatible
|
||||
filetype plugin on
|
||||
syntax on
|
||||
```vim
|
||||
set nocompatible
|
||||
filetype plugin on
|
||||
syntax on
|
||||
```
|
||||
|
||||
Without them Vimwiki will not work properly.
|
||||
Without them, VimWiki will not work properly.
|
||||
|
||||
#### Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
|
||||
|
||||
Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
|
||||
------------------------------------------------------------------------------
|
||||
```sh
|
||||
|
||||
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
|
||||
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
|
||||
|
||||
Installation using [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332)
|
||||
------------------------------------------------------------------------------
|
||||
# to generate documentation i.e. ':h vimwiki'
|
||||
vim -c 'helptags ~/.vim/pack/plugins/start/vimwiki/doc' -c quit
|
||||
|
||||
cd ~/.vim
|
||||
mkdir bundle
|
||||
cd bundle
|
||||
git clone https://github.com/vimwiki/vimwiki.git
|
||||
```
|
||||
|
||||
Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
|
||||
------------------------------------------------------------------------------
|
||||
Notes:
|
||||
|
||||
- See `:h helptags` for issues with installing the documentation.
|
||||
- For general information on vim packages see `:h packages`.
|
||||
|
||||
#### Installation using [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
```sh
|
||||
|
||||
cd ~/.vim
|
||||
mkdir bundle
|
||||
cd bundle
|
||||
git clone https://github.com/vimwiki/vimwiki.git
|
||||
|
||||
```
|
||||
|
||||
#### Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
|
||||
|
||||
Add the following to the plugin-configuration in your vimrc:
|
||||
|
||||
Plug 'vimwiki/vimwiki'
|
||||
```vim
|
||||
|
||||
Plug 'vimwiki/vimwiki'
|
||||
|
||||
```
|
||||
|
||||
Then run `:PlugInstall`.
|
||||
|
||||
Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
------------------------------------------------------------------------------
|
||||
#### Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
|
||||
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run
|
||||
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run:
|
||||
|
||||
vim +PluginInstall +qall
|
||||
```sh
|
||||
|
||||
Or download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip) and extract it in `~/.vim/bundle/`
|
||||
vim +PluginInstall +qall
|
||||
|
||||
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was installed.
|
||||
```
|
||||
|
||||
#### Manual Install
|
||||
|
||||
Download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip)
|
||||
and extract it in `~/.vim/bundle/`
|
||||
|
||||
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was
|
||||
installed.
|
||||
|
||||
## Basic Markup
|
||||
|
||||
```text
|
||||
= Header1 =
|
||||
== Header2 ==
|
||||
=== Header3 ===
|
||||
|
||||
|
||||
Getting help
|
||||
==============================================================================
|
||||
*bold* -- bold text
|
||||
_italic_ -- italic text
|
||||
|
||||
Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki), also synced to Matrix/Riot: `#freenode_#vimwiki:matrix.org`) or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
|
||||
[[wiki link]] -- wiki link
|
||||
[[wiki link|description]] -- wiki link with description
|
||||
```
|
||||
|
||||
Helping Vimwiki
|
||||
==============================================================================
|
||||
### Lists
|
||||
|
||||
Vimwiki has a lot of users but only very few recurring developers or people helping the community. Your help is therefore appreciated. Everyone can help! See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how you can help.
|
||||
```text
|
||||
* bullet list item 1
|
||||
- bullet list item 2
|
||||
- bullet list item 3
|
||||
* bullet list item 4
|
||||
* bullet list item 5
|
||||
* bullet list item 6
|
||||
* bullet list item 7
|
||||
- bullet list item 8
|
||||
- bullet list item 9
|
||||
|
||||
1. numbered list item 1
|
||||
2. numbered list item 2
|
||||
a) numbered list item 3
|
||||
b) numbered list item 4
|
||||
```
|
||||
|
||||
For other syntax elements, see `:h vimwiki-syntax`
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Normal mode
|
||||
|
||||
**Note:** your terminal may prevent capturing some of the default bindings
|
||||
listed below. See `:h vimwiki-local-mappings` for suggestions for alternative
|
||||
bindings if you encounter a problem.
|
||||
|
||||
#### Basic key bindings
|
||||
|
||||
- `<Leader>ww` -- Open default wiki index file.
|
||||
- `<Leader>wt` -- Open default wiki index file in a new tab.
|
||||
- `<Leader>ws` -- Select and open wiki index file.
|
||||
- `<Leader>wd` -- Delete wiki file you are in.
|
||||
- `<Leader>wr` -- Rename wiki file you are in.
|
||||
- `<Enter>` -- Follow/Create wiki link.
|
||||
- `<Shift-Enter>` -- Split and follow/create wiki link.
|
||||
- `<Ctrl-Enter>` -- Vertical split and follow/create wiki link.
|
||||
- `<Backspace>` -- Go back to parent(previous) wiki link.
|
||||
- `<Tab>` -- Find next wiki link.
|
||||
- `<Shift-Tab>` -- Find previous wiki link.
|
||||
|
||||
#### Advanced key bindings
|
||||
|
||||
Refer to the complete documentation at `:h vimwiki-mappings` to see many
|
||||
more bindings.
|
||||
|
||||
## Commands
|
||||
|
||||
- `:Vimwiki2HTML` -- Convert current wiki link to HTML.
|
||||
- `:VimwikiAll2HTML` -- Convert all your wiki links to HTML.
|
||||
- `:help vimwiki-commands` -- List all commands.
|
||||
- `:help vimwiki` -- General vimwiki help docs.
|
||||
|
||||
## Changing Wiki Syntax
|
||||
|
||||
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown
|
||||
(markdown), and MediaWiki (media).
|
||||
|
||||
**NOTE:** Only the default syntax ships with a built-in HTML converter. For
|
||||
Markdown or MediaWiki see `:h vimwiki-option-custom_wiki2html`. Some examples
|
||||
and 3rd party tools are available [here](https://vimwiki.github.io/vimwikiwiki/Related%20Tools.html#Related%20Tools-External%20Tools).
|
||||
|
||||
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
|
||||
following option in your `.vimrc`:
|
||||
|
||||
```vim
|
||||
|
||||
let g:vimwiki_list = [{'path': '~/vimwiki/',
|
||||
\ 'syntax': 'markdown', 'ext': '.md'}]
|
||||
|
||||
```
|
||||
|
||||
This option will treat all markdown files in your system as part of vimwiki (check `set filetype?`). Add
|
||||
```vim
|
||||
let g:vimwiki_global_ext = 0
|
||||
```
|
||||
to your `.vimrc` to restrict Vimwiki's operation to only those paths listed in `g:vimwiki_list`.
|
||||
Other markdown files wouldn't be treated as wiki pages.
|
||||
See [g:vimwiki_global_ext](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L2631).
|
||||
|
||||
## Getting help
|
||||
|
||||
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
|
||||
method for raising bug reports or feature requests.
|
||||
|
||||
Additional resources:
|
||||
|
||||
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on irc.libera.chat
|
||||
- [Connect via webchat](https://web.libera.chat/?channels=#vimwiki)
|
||||
- Connect via Matrix/Element: [#vimwiki:libera.chat](https://matrix.to/#/#vimwiki:libera.chat)
|
||||
- Post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
|
||||
|
||||
## Helping VimWiki
|
||||
|
||||
VimWiki has a lot of users but only very few recurring developers or people
|
||||
helping the community. Your help is therefore appreciated. Everyone can help!
|
||||
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how you can help.
|
||||
|
||||
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md) and [design_notes.md](doc/design_notes.md)
|
||||
|
||||
----
|
||||
\* Screenshots made with the [solarized colorscheme](https://github.com/altercation/vim-colors-solarized)
|
||||
and [lightline](https://github.com/itchyny/lightline.vim)
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2008-2010 Maxim Kim
|
||||
2013-2017 Daniel Schemala
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This script converts markdown into html, to be used with vimwiki's
|
||||
# "customwiki2html" option. Experiment with the two proposed methods by
|
||||
# "customwiki2html" option. Experiment with the two proposed methods by
|
||||
# commenting / uncommenting the relevant lines below.
|
||||
#
|
||||
# NEW! An alternative converter was developed by Jason6Anderson, and can
|
||||
@@ -13,23 +13,23 @@
|
||||
#
|
||||
# http://www.pell.portland.or.us/~orc/Code/discount/
|
||||
#
|
||||
# To verify your installation, check that the commands markdown and mkd2text,
|
||||
# To verify your installation, check that the commands markdown and mkd2html,
|
||||
# are on your path.
|
||||
#
|
||||
# Also verify that this file is executable.
|
||||
#
|
||||
# Then, in your .vimrc file, set:
|
||||
#
|
||||
# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
|
||||
# g:vimwiki_custom_wiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
|
||||
#
|
||||
# On your next restart, Vimwiki will run this script instead of using the
|
||||
# internal wiki2html converter.
|
||||
#
|
||||
|
||||
MARKDOWN=markdown
|
||||
MKD2HTML=mkd2html
|
||||
|
||||
|
||||
# shellcheck disable=SC2034 # FORCE appears unused
|
||||
FORCE="$1"
|
||||
SYNTAX="$2"
|
||||
EXTENSION="$3"
|
||||
@@ -37,16 +37,18 @@ OUTPUTDIR="$4"
|
||||
INPUT="$5"
|
||||
CSSFILE="$6"
|
||||
|
||||
FORCEFLAG=
|
||||
|
||||
[ $FORCE -eq 0 ] || { FORCEFLAG="-f"; };
|
||||
[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; };
|
||||
[[ "$SYNTAX" == "markdown" ]] || { echo "Error: Unsupported syntax"; exit 2; };
|
||||
|
||||
OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
|
||||
OUTPUT="$OUTPUTDIR/$(basename "$INPUT" ."$EXTENSION").html"
|
||||
|
||||
# # Method 1:
|
||||
# FORCEFLAG=
|
||||
# (( "$FORCE" == 0 )) || { FORCEFLAG="-f"; };
|
||||
# MARKDOWN=markdown
|
||||
#
|
||||
# # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile]
|
||||
#
|
||||
#
|
||||
# URLBASE=http://example.com
|
||||
# $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT
|
||||
|
||||
@@ -57,6 +59,3 @@ OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
|
||||
$MKD2HTML -css "$CSSFILE" "$INPUT"
|
||||
OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html
|
||||
mv -f "$OUTPUTTMP" "$OUTPUT"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="Stylesheet" type="text/css" href="%root_path%%css%">
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="%root_path%%rss%">
|
||||
<title>%title%</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
%content%
|
||||
|
||||
@@ -4,16 +4,15 @@
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
if exists("g:loaded_vimwiki_diary_auto") || &cp
|
||||
" Clause: load only once
|
||||
if exists('g:loaded_vimwiki_diary_auto') || &compatible
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_diary_auto = 1
|
||||
|
||||
|
||||
let s:vimwiki_max_scan_for_caption = 5
|
||||
|
||||
|
||||
function! s:prefix_zero(num)
|
||||
function! s:prefix_zero(num) abort
|
||||
" Add zero prefix to a number
|
||||
if a:num < 10
|
||||
return '0'.a:num
|
||||
endif
|
||||
@@ -21,33 +20,94 @@ function! s:prefix_zero(num)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:diary_path(...)
|
||||
function! s:diary_path(...) abort
|
||||
" Return: diary directory path <String>
|
||||
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
|
||||
return vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:diary_index(...)
|
||||
function! s:diary_index(...) abort
|
||||
" Return: diary index file path <String>
|
||||
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
|
||||
return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).
|
||||
\ vimwiki#vars#get_wikilocal('ext', idx)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#diary#diary_date_link(...)
|
||||
if a:0
|
||||
return strftime('%Y-%m-%d', a:1)
|
||||
else
|
||||
return strftime('%Y-%m-%d')
|
||||
function! vimwiki#diary#diary_date_link(...) abort
|
||||
" Return: <String> date
|
||||
|
||||
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
if wiki_nr < 0 " this happens when called outside a wiki buffer
|
||||
let wiki_nr = 0
|
||||
endif
|
||||
|
||||
if wiki_nr >= vimwiki#vars#number_of_wikis()
|
||||
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!')
|
||||
return
|
||||
endif
|
||||
|
||||
if a:0
|
||||
let l:timestamp = a:1
|
||||
else
|
||||
let l:timestamp = localtime()
|
||||
endif
|
||||
|
||||
let l:delta_periods = 0
|
||||
if a:0 > 1
|
||||
let l:delta_periods = a:2
|
||||
endif
|
||||
|
||||
let l:day_s = 60*60*24
|
||||
|
||||
let l:weekday_number = {
|
||||
\ 'monday': 1, 'tuesday': 2,
|
||||
\ 'wednesday': 3, 'thursday': 4,
|
||||
\ 'friday': 5, 'saturday': 6,
|
||||
\ 'sunday': 0}
|
||||
|
||||
let l:frequency = vimwiki#vars#get_wikilocal('diary_frequency', wiki_nr)
|
||||
|
||||
if l:frequency ==? 'weekly'
|
||||
let l:start_week_day = vimwiki#vars#get_wikilocal('diary_start_week_day', wiki_nr)
|
||||
let l:weekday_num = str2nr(strftime('%w', l:timestamp))
|
||||
let l:days_to_end_of_week = (7-l:weekday_number[l:start_week_day]+weekday_num) % 7
|
||||
let l:computed_timestamp = l:timestamp
|
||||
\ + 7*l:day_s*l:delta_periods
|
||||
\ - l:day_s*l:days_to_end_of_week
|
||||
|
||||
elseif l:frequency ==? 'monthly'
|
||||
let l:day_of_month = str2nr(strftime('%d', l:timestamp))
|
||||
let l:beginning_of_month = l:timestamp - (l:day_of_month - 1)*l:day_s
|
||||
let l:middle_of_month = l:beginning_of_month + 15*l:day_s
|
||||
let l:middle_of_computed_month = l:middle_of_month + float2nr(30.5*l:day_s*l:delta_periods)
|
||||
let l:day_of_computed_month = str2nr(strftime('%d', l:middle_of_computed_month)) - 1
|
||||
let l:computed_timestamp = l:middle_of_computed_month - l:day_of_computed_month*l:day_s
|
||||
|
||||
elseif l:frequency ==? 'yearly'
|
||||
let l:day_of_year = str2nr(strftime('%j', l:timestamp))
|
||||
let l:beginning_of_year = l:timestamp - (l:day_of_year - 1)*l:day_s
|
||||
let l:middle_of_year = l:beginning_of_year + float2nr(365.25/2*l:day_s)
|
||||
let l:middle_of_computed_year = l:middle_of_year + float2nr(365.25*l:day_s*l:delta_periods)
|
||||
let l:day_of_computed_year = str2nr(strftime('%j', l:middle_of_computed_year)) - 1
|
||||
let l:computed_timestamp = l:middle_of_computed_year - l:day_of_computed_year*l:day_s
|
||||
|
||||
else "daily
|
||||
let l:computed_timestamp = localtime() + l:delta_periods*l:day_s
|
||||
endif
|
||||
|
||||
return strftime('%Y-%m-%d', l:computed_timestamp)
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_position_links(link)
|
||||
function! s:get_position_links(link) abort
|
||||
" Return: <int:index, list:links>
|
||||
let idx = -1
|
||||
let links = []
|
||||
if a:link =~# '^\d\{4}-\d\d-\d\d'
|
||||
let links = map(s:get_diary_files(), 'fnamemodify(v:val, ":t:r")')
|
||||
let links = map(vimwiki#diary#get_diary_files(), 'fnamemodify(v:val, ":t:r")')
|
||||
" include 'today' into links
|
||||
if index(links, vimwiki#diary#diary_date_link()) == -1
|
||||
call add(links, vimwiki#diary#diary_date_link())
|
||||
@@ -59,36 +119,115 @@ function! s:get_position_links(link)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_month_name(month)
|
||||
function! s:get_month_name(month) abort
|
||||
" Convert month: number -> name
|
||||
return vimwiki#vars#get_global('diary_months')[str2nr(a:month)]
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:read_captions(files)
|
||||
function! s:get_first_header(fl) abort
|
||||
" Get the first header in the file within the first s:vimwiki_max_scan_for_caption lines.
|
||||
let header_rx = vimwiki#vars#get_syntaxlocal('rxHeader')
|
||||
|
||||
for line in readfile(a:fl, '', g:vimwiki_max_scan_for_caption)
|
||||
if line =~# header_rx
|
||||
return vimwiki#u#trim(matchstr(line, header_rx))
|
||||
endif
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_all_headers(fl, maxlevel) abort
|
||||
" Get a list of all headers in a file up to a given level.
|
||||
" Return: list whose elements are pairs [level, title]
|
||||
let headers_rx = {}
|
||||
for i in range(1, a:maxlevel)
|
||||
let headers_rx[i] = vimwiki#vars#get_syntaxlocal('rxH'.i.'_Text')
|
||||
endfor
|
||||
|
||||
let headers = []
|
||||
for line in readfile(a:fl, '')
|
||||
for [i, header_rx] in items(headers_rx)
|
||||
if line =~# header_rx
|
||||
call add(headers, [i, vimwiki#u#trim(matchstr(line, header_rx))])
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
return headers
|
||||
endfunction
|
||||
|
||||
function! s:count_headers_level_less_equal(headers, maxlevel) abort
|
||||
" Count headers with level <= maxlevel in a list of [level, title] pairs.
|
||||
let l:count = 0
|
||||
for [header_level, _] in a:headers
|
||||
if header_level <= a:maxlevel
|
||||
let l:count += 1
|
||||
endif
|
||||
endfor
|
||||
return l:count
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_min_header_level(headers) abort
|
||||
" Get the minimum level of any header in a list of [level, title] pairs.
|
||||
if len(a:headers) == 0
|
||||
return 0
|
||||
endif
|
||||
let minlevel = a:headers[0][0]
|
||||
for [level, _] in a:headers
|
||||
let minlevel = min([minlevel, level])
|
||||
endfor
|
||||
return minlevel
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:read_captions(files) abort
|
||||
" Read all caption in 1. <List>files
|
||||
" Return: <Dic>: key -> caption
|
||||
let result = {}
|
||||
let rx_header = vimwiki#vars#get_syntaxlocal('rxHeader')
|
||||
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level')
|
||||
|
||||
for fl in a:files
|
||||
" remove paths and extensions
|
||||
let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
|
||||
" Remove paths and extensions
|
||||
let fl_captions = {}
|
||||
|
||||
if filereadable(fl)
|
||||
for line in readfile(fl, '', s:vimwiki_max_scan_for_caption)
|
||||
if line =~# rx_header && !has_key(result, fl_key)
|
||||
let result[fl_key] = vimwiki#u#trim(matchstr(line, rx_header))
|
||||
" Default; no captions from the file.
|
||||
let fl_captions['top'] = ''
|
||||
let fl_captions['rest'] = []
|
||||
|
||||
if caption_level >= 0 && filereadable(fl)
|
||||
if caption_level == 0
|
||||
" Take first header of any level as the top caption.
|
||||
let fl_captions['top'] = s:get_first_header(fl)
|
||||
else
|
||||
let headers = s:get_all_headers(fl, caption_level)
|
||||
if len(headers) > 0
|
||||
" If first header is the only one at its level or less, then make it the top caption.
|
||||
let [first_level, first_header] = headers[0]
|
||||
if s:count_headers_level_less_equal(headers, first_level) == 1
|
||||
let fl_captions['top'] = first_header
|
||||
call remove(headers, 0)
|
||||
endif
|
||||
|
||||
let min_header_level = s:get_min_header_level(headers)
|
||||
for [level, header] in headers
|
||||
call add(fl_captions['rest'], [level - min_header_level, header])
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !has_key(result, fl_key)
|
||||
let result[fl_key] = ''
|
||||
endif
|
||||
endif
|
||||
|
||||
let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
|
||||
let result[fl_key] = fl_captions
|
||||
endfor
|
||||
return result
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_diary_files()
|
||||
function! vimwiki#diary#get_diary_files() abort
|
||||
" Return: <list> diary file names
|
||||
let rx = '^\d\{4}-\d\d-\d\d'
|
||||
let s_files = glob(vimwiki#vars#get_wikilocal('path').
|
||||
\ vimwiki#vars#get_wikilocal('diary_rel_path').'*'.vimwiki#vars#get_wikilocal('ext'))
|
||||
@@ -102,7 +241,8 @@ function! s:get_diary_files()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:group_links(links)
|
||||
function! s:group_links(links) abort
|
||||
" Return: <dic> nested -> links
|
||||
let result = {}
|
||||
let p_year = 0
|
||||
let p_month = 0
|
||||
@@ -124,7 +264,8 @@ function! s:group_links(links)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:sort(lst)
|
||||
function! s:sort(lst) abort
|
||||
" Sort list
|
||||
if vimwiki#vars#get_wikilocal('diary_sort') ==? 'desc'
|
||||
return reverse(sort(a:lst))
|
||||
else
|
||||
@@ -132,52 +273,15 @@ function! s:sort(lst)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:format_diary()
|
||||
let result = []
|
||||
|
||||
let links_with_captions = s:read_captions(s:get_diary_files())
|
||||
let g_files = s:group_links(links_with_captions)
|
||||
|
||||
for year in s:sort(keys(g_files))
|
||||
call add(result, '')
|
||||
call add(result,
|
||||
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', year , ''))
|
||||
|
||||
for month in s:sort(keys(g_files[year]))
|
||||
call add(result, '')
|
||||
call add(result, substitute(vimwiki#vars#get_syntaxlocal('rxH3_Template'),
|
||||
\ '__Header__', s:get_month_name(month), ''))
|
||||
|
||||
for [fl, cap] in s:sort(items(g_files[year][month]))
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||
|
||||
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||
|
||||
if empty(cap) " When using markdown syntax, we should ensure we always have a link description.
|
||||
let cap = fl
|
||||
endif
|
||||
elseif empty(cap)
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
|
||||
endif
|
||||
|
||||
let entry = substitute(link_tpl, '__LinkUrl__', fl, '')
|
||||
let entry = substitute(entry, '__LinkDescription__', cap, '')
|
||||
call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry)
|
||||
endfor
|
||||
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return result
|
||||
function! vimwiki#diary#diary_sort(lst) abort
|
||||
return s:sort(a:lst)
|
||||
endfunction
|
||||
|
||||
|
||||
" The given wiki number a:wnum is 1 for the first wiki, 2 for the second and so on. This is in
|
||||
" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki
|
||||
" is used.
|
||||
function! vimwiki#diary#make_note(wnum, ...)
|
||||
function! vimwiki#diary#make_note(wnum, ...) abort
|
||||
" Create note
|
||||
" The given wiki number a:wnum is 1 for the first wiki, 2 for the second and so on. This is in
|
||||
" contrast to most other places, where counting starts with 0. When a:wnum is 0, the current wiki
|
||||
" is used.
|
||||
if a:wnum == 0
|
||||
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
if wiki_nr < 0 " this happens when e.g. VimwikiMakeDiaryNote was called outside a wiki buffer
|
||||
@@ -188,23 +292,31 @@ function! vimwiki#diary#make_note(wnum, ...)
|
||||
endif
|
||||
|
||||
if wiki_nr >= vimwiki#vars#number_of_wikis()
|
||||
echomsg 'Vimwiki Error: Wiki '.wiki_nr.' is not registered in g:vimwiki_list!'
|
||||
call vimwiki#u#error('Wiki '.wiki_nr.' is not registered in g:vimwiki_list!')
|
||||
return
|
||||
endif
|
||||
|
||||
" TODO: refactor it. base#goto_index uses the same
|
||||
|
||||
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
|
||||
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
|
||||
|
||||
let cmd = 'edit'
|
||||
let cmd = ':edit'
|
||||
if a:0
|
||||
if a:1 == 1
|
||||
let cmd = 'tabedit'
|
||||
let cmd = ':tabedit'
|
||||
elseif a:1 == 2
|
||||
let cmd = 'split'
|
||||
let cmd = ':split'
|
||||
elseif a:1 == 3
|
||||
let cmd = 'vsplit'
|
||||
let cmd = ':vsplit'
|
||||
elseif a:1 == 4
|
||||
let cmd = ':tab edit'
|
||||
if exists(':drop') == 2
|
||||
let cmd = ':tab drop'
|
||||
endif
|
||||
elseif a:1 == 5
|
||||
let cmd = ':edit'
|
||||
if exists(':drop') == 2
|
||||
let cmd = ':drop'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if a:0>1
|
||||
@@ -217,17 +329,21 @@ function! vimwiki#diary#make_note(wnum, ...)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#diary#goto_diary_index(wnum)
|
||||
if a:wnum > vimwiki#vars#number_of_wikis()
|
||||
echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
|
||||
return
|
||||
function! vimwiki#diary#goto_diary_index(wnum) abort
|
||||
" Jump to diary index of 1. <Int> wikinumber
|
||||
" if wnum = 0 the current wiki is used
|
||||
if a:wnum == 0
|
||||
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
if idx < 0 " not in a wiki
|
||||
let idx = 0
|
||||
endif
|
||||
else
|
||||
let idx = a:wnum - 1 " convert to 0 based counting
|
||||
endif
|
||||
|
||||
" TODO: refactor it. base#goto_index uses the same
|
||||
if a:wnum > 0
|
||||
let idx = a:wnum - 1
|
||||
else
|
||||
let idx = 0
|
||||
if a:wnum > vimwiki#vars#number_of_wikis()
|
||||
call vimwiki#u#error('Wiki '.a:wnum.' is not registered in g:vimwiki_list!')
|
||||
return
|
||||
endif
|
||||
|
||||
call vimwiki#base#edit_file('e', s:diary_index(idx), '')
|
||||
@@ -239,7 +355,8 @@ function! vimwiki#diary#goto_diary_index(wnum)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#diary#goto_next_day()
|
||||
function! vimwiki#diary#goto_next_day() abort
|
||||
" Jump to next day
|
||||
let link = ''
|
||||
let [idx, links] = s:get_position_links(expand('%:t:r'))
|
||||
|
||||
@@ -260,7 +377,8 @@ function! vimwiki#diary#goto_next_day()
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#diary#goto_prev_day()
|
||||
function! vimwiki#diary#goto_prev_day() abort
|
||||
" Jump to previous day
|
||||
let link = ''
|
||||
let [idx, links] = s:get_position_links(expand('%:t:r'))
|
||||
|
||||
@@ -281,21 +399,106 @@ function! vimwiki#diary#goto_prev_day()
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#diary#generate_diary_section()
|
||||
let current_file = vimwiki#path#path_norm(expand("%:p"))
|
||||
function! vimwiki#diary#generate_diary_section() abort
|
||||
" Create diary index content
|
||||
let GeneratorDiary = copy(l:)
|
||||
function! GeneratorDiary.f() abort
|
||||
let lines = []
|
||||
|
||||
let links_with_captions = s:read_captions(vimwiki#diary#get_diary_files())
|
||||
let g_files = s:group_links(links_with_captions)
|
||||
let g_keys = s:sort(keys(g_files))
|
||||
|
||||
for year in g_keys
|
||||
if len(lines) > 0
|
||||
call add(lines, '')
|
||||
endif
|
||||
|
||||
call add(lines, substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', year , ''))
|
||||
|
||||
for month in s:sort(keys(g_files[year]))
|
||||
call add(lines, '')
|
||||
call add(lines, substitute(vimwiki#vars#get_syntaxlocal('rxH3_Template'),
|
||||
\ '__Header__', s:get_month_name(month), ''))
|
||||
|
||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
|
||||
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
|
||||
call add(lines, '')
|
||||
endfor
|
||||
endif
|
||||
|
||||
for [fl, captions] in s:sort(items(g_files[year][month]))
|
||||
let topcap = captions['top']
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||
|
||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||
|
||||
if empty(topcap) " When using markdown syntax, we should ensure we always have a link description.
|
||||
let topcap = fl
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(topcap)
|
||||
let top_link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
|
||||
else
|
||||
let top_link_tpl = link_tpl
|
||||
endif
|
||||
|
||||
let bullet = vimwiki#lst#default_symbol().' '
|
||||
let entry = substitute(top_link_tpl, '__LinkUrl__', fl, '')
|
||||
let entry = substitute(entry, '__LinkDescription__', topcap, '')
|
||||
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
let extension = vimwiki#vars#get_wikilocal('ext', wiki_nr)
|
||||
let entry = substitute(entry, '__FileExtension__', extension, 'g')
|
||||
" If single H1 then that will be used as the description for the link to the file
|
||||
" if multiple H1 then the filename will be used as the description for the link to the
|
||||
" file and multiple H1 headers will be indented by shiftwidth
|
||||
call add(lines, repeat(' ', vimwiki#lst#get_list_margin()).bullet.entry)
|
||||
|
||||
let startindent = repeat(' ', vimwiki#lst#get_list_margin())
|
||||
let indentstring = repeat(' ', vimwiki#u#sw())
|
||||
|
||||
for [depth, subcap] in captions['rest']
|
||||
if empty(subcap)
|
||||
continue
|
||||
endif
|
||||
let entry = substitute(link_tpl, '__LinkUrl__', fl.'#'.subcap, '')
|
||||
let entry = substitute(entry, '__LinkDescription__', subcap, '')
|
||||
" if single H1 then depth H2=0, H3=1, H4=2, H5=3, H6=4
|
||||
" if multiple H1 then depth H1= 0, H2=1, H3=2, H4=3, H5=4, H6=5
|
||||
" indent subsequent headers levels by shiftwidth
|
||||
call add(lines, startindent.repeat(indentstring, depth+1).bullet.entry)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return lines
|
||||
endfunction
|
||||
|
||||
let current_file = vimwiki#path#path_norm(expand('%:p'))
|
||||
let diary_file = vimwiki#path#path_norm(s:diary_index())
|
||||
if vimwiki#path#is_equal(current_file, diary_file)
|
||||
let content_rx = '^\%(\s*\* \)\|\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)'
|
||||
call vimwiki#base#update_listing_in_buffer(s:format_diary(),
|
||||
\ vimwiki#vars#get_wikilocal('diary_header'), content_rx, line('$')+1, 1)
|
||||
let content_rx = '^\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)\|'.
|
||||
\ '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
|
||||
|
||||
call vimwiki#base#update_listing_in_buffer(
|
||||
\ GeneratorDiary,
|
||||
\ vimwiki#vars#get_wikilocal('diary_header'),
|
||||
\ content_rx,
|
||||
\ 1,
|
||||
\ 1,
|
||||
\ 1)
|
||||
else
|
||||
echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
|
||||
call vimwiki#u#error('You can generate diary links only in a diary index page!')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" Callback function for Calendar.vim
|
||||
function! vimwiki#diary#calendar_action(day, month, year, week, dir)
|
||||
function! vimwiki#diary#calendar_action(day, month, year, week, dir) abort
|
||||
" Callback function for Calendar.vim
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
|
||||
@@ -317,11 +520,19 @@ function! vimwiki#diary#calendar_action(day, month, year, week, dir)
|
||||
endfunction
|
||||
|
||||
|
||||
function vimwiki#diary#calendar_sign(day, month, year)
|
||||
function! vimwiki#diary#calendar_sign(day, month, year) abort
|
||||
" Callback function for Calendar.vim
|
||||
" Clause: no wiki no sign #290
|
||||
if len(g:vimwiki_list) <= 0
|
||||
return
|
||||
endif
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
let sfile = vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path').
|
||||
\ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
|
||||
let sfile = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
|
||||
\ . a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
|
||||
return filereadable(expand(sfile))
|
||||
endfunction
|
||||
|
||||
function! vimwiki#diary#diary_file_captions() abort
|
||||
return s:read_captions(vimwiki#diary#get_diary_files())
|
||||
endfunction
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
function! s:safesubstitute(text, search, replace, mode)
|
||||
function! s:safesubstitute(text, search, replace, mode) abort
|
||||
" Substitute regexp but do not interpret replace
|
||||
let escaped = escape(a:replace, '\&')
|
||||
return substitute(a:text, a:search, escaped, a:mode)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#markdown_base#scan_reflinks()
|
||||
function! vimwiki#markdown_base#scan_reflinks() abort
|
||||
let mkd_refs = {}
|
||||
" construct list of references using vimgrep
|
||||
try
|
||||
@@ -25,7 +25,7 @@ function! vimwiki#markdown_base#scan_reflinks()
|
||||
let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ')
|
||||
let descr = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchDescr'))
|
||||
let url = matchstr(matchline, vimwiki#vars#get_syntaxlocal('rxMkdRefMatchUrl'))
|
||||
if descr != '' && url != ''
|
||||
if descr !=? '' && url !=? ''
|
||||
let mkd_refs[descr] = url
|
||||
endif
|
||||
endfor
|
||||
@@ -34,9 +34,8 @@ function! vimwiki#markdown_base#scan_reflinks()
|
||||
endfunction
|
||||
|
||||
|
||||
" try markdown reference links
|
||||
function! vimwiki#markdown_base#open_reflink(link)
|
||||
" echom "vimwiki#markdown_base#open_reflink"
|
||||
function! vimwiki#markdown_base#open_reflink(link) abort
|
||||
" try markdown reference links
|
||||
let link = a:link
|
||||
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
|
||||
if has_key(mkd_refs, link)
|
||||
@@ -49,7 +48,7 @@ function! vimwiki#markdown_base#open_reflink(link)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:normalize_link_syntax_n()
|
||||
function! s:normalize_link_syntax_n() abort
|
||||
let lnum = line('.')
|
||||
|
||||
" try WikiIncl
|
||||
@@ -97,54 +96,20 @@ function! s:normalize_link_syntax_n()
|
||||
" normalize_link_syntax_v
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWord'))
|
||||
if !empty(lnk)
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ vimwiki#vars#get_global('rxWord'), '',
|
||||
\ vimwiki#vars#get_syntaxlocal('Weblink1Template'))
|
||||
if vimwiki#base#is_diary_file(expand('%:p'))
|
||||
let sub = vimwiki#base#normalize_link_in_diary(lnk)
|
||||
else
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ vimwiki#vars#get_global('rxWord'), '',
|
||||
\ vimwiki#vars#get_syntaxlocal('Link1'))
|
||||
endif
|
||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
||||
return
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:normalize_link_syntax_v()
|
||||
let lnum = line('.')
|
||||
let sel_save = &selection
|
||||
let &selection = "old"
|
||||
let rv = @"
|
||||
let rt = getregtype('"')
|
||||
let done = 0
|
||||
|
||||
try
|
||||
norm! gvy
|
||||
let visual_selection = @"
|
||||
let link = s:safesubstitute(vimwiki#vars#get_syntaxlocal('Weblink1Template'),
|
||||
\ '__LinkUrl__', visual_selection, '')
|
||||
let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '')
|
||||
|
||||
call setreg('"', substitute(link, '\n', '', ''), visualmode())
|
||||
|
||||
" paste result
|
||||
norm! `>""pgvd
|
||||
|
||||
finally
|
||||
call setreg('"', rv, rt)
|
||||
let &selection = sel_save
|
||||
endtry
|
||||
|
||||
function! vimwiki#markdown_base#normalize_link() abort
|
||||
" TODO mutualize with base
|
||||
call s:normalize_link_syntax_n()
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#markdown_base#normalize_link(is_visual_mode)
|
||||
if 0
|
||||
" Syntax-specific links
|
||||
else
|
||||
if !a:is_visual_mode
|
||||
call s:normalize_link_syntax_n()
|
||||
elseif line("'<") == line("'>")
|
||||
" action undefined for multi-line visual mode selections
|
||||
call s:normalize_link_syntax_v()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -4,28 +4,55 @@
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
function! vimwiki#path#chomp_slash(str)
|
||||
|
||||
function! s:unixify(path) abort
|
||||
" Unixify Path:
|
||||
return substitute(a:path, '\', '/', 'g')
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:windowsify(path) abort
|
||||
" Windowsify Path:
|
||||
return substitute(a:path, '/', '\', 'g')
|
||||
endfunction
|
||||
|
||||
|
||||
" Define: os specific path conversion
|
||||
if vimwiki#u#is_windows()
|
||||
function! s:osxify(path) abort
|
||||
return s:windowsify(a:path)
|
||||
endfunction
|
||||
else
|
||||
function! s:osxify(path) abort
|
||||
return s:unixify(a:path)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
function! vimwiki#path#chomp_slash(str) abort
|
||||
" Remove Delimiter: of last path (slash or backslash)
|
||||
return substitute(a:str, '[/\\]\+$', '', '')
|
||||
endfunction
|
||||
|
||||
|
||||
" Define path-compare function, either case-sensitive or not, depending on OS.
|
||||
" Define: path-compare function, either case-sensitive or not, depending on OS.
|
||||
if vimwiki#u#is_windows()
|
||||
function! vimwiki#path#is_equal(p1, p2)
|
||||
function! vimwiki#path#is_equal(p1, p2) abort
|
||||
return a:p1 ==? a:p2
|
||||
endfunction
|
||||
else
|
||||
function! vimwiki#path#is_equal(p1, p2)
|
||||
function! vimwiki#path#is_equal(p1, p2) abort
|
||||
return a:p1 ==# a:p2
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
" collapse sections like /a/b/../c to /a/c
|
||||
function! vimwiki#path#normalize(path)
|
||||
function! vimwiki#path#normalize(path) abort
|
||||
" Collapse Sections: like /a/b/../c to /a/c and /a/b/./c to /a/b/c
|
||||
let path = a:path
|
||||
while 1
|
||||
let result = substitute(path, '/[^/]\+/\.\.', '', '')
|
||||
let intermediateResult = substitute(path, '/[^/]\+/\.\.', '', '')
|
||||
let result = substitute(intermediateResult, '/\./', '/', '')
|
||||
if result ==# path
|
||||
break
|
||||
endif
|
||||
@@ -35,35 +62,35 @@ function! vimwiki#path#normalize(path)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#path#path_norm(path)
|
||||
" /-slashes
|
||||
if a:path !~# '^scp:'
|
||||
let path = substitute(a:path, '\', '/', 'g')
|
||||
" treat multiple consecutive slashes as one path separator
|
||||
let path = substitute(path, '/\+', '/', 'g')
|
||||
" ensure that we are not fooled by a symbolic link
|
||||
return resolve(path)
|
||||
else
|
||||
return a:path
|
||||
endif
|
||||
function! vimwiki#path#path_norm(path) abort
|
||||
" Normalize Path: \ -> / && /// -> / && resolve(symlinks)
|
||||
" return if scp
|
||||
if a:path =~# '^scp:' | return a:path | endif
|
||||
" convert backslash to slash
|
||||
let path = substitute(a:path, '\', '/', 'g')
|
||||
" treat multiple consecutive slashes as one path separator
|
||||
let path = substitute(path, '/\+', '/', 'g')
|
||||
" ensure that we are not fooled by a symbolic link
|
||||
return resolve(path)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#path#is_link_to_dir(link)
|
||||
" Check if link is to a directory.
|
||||
function! vimwiki#path#is_link_to_dir(link) abort
|
||||
" Check: if link is to a directory
|
||||
" It should be ended with \ or /.
|
||||
return a:link =~# '\m[/\\]$'
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#path#abs_path_of_link(link)
|
||||
return vimwiki#path#normalize(expand("%:p:h").'/'.a:link)
|
||||
function! vimwiki#path#abs_path_of_link(link) abort
|
||||
" Get: absolute path <- path relative to current file
|
||||
return vimwiki#path#normalize(expand('%:p:h').'/'.a:link)
|
||||
endfunction
|
||||
|
||||
|
||||
" return longest common path prefix of 2 given paths.
|
||||
" '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
|
||||
function! vimwiki#path#path_common_pfx(path1, path2)
|
||||
function! vimwiki#path#path_common_pfx(path1, path2) abort
|
||||
" Returns: longest common path prefix of 2 given paths.
|
||||
" Ex: '~/home/usrname/wiki', '~/home/usrname/wiki/shmiki' => '~/home/usrname/wiki'
|
||||
let p1 = split(a:path1, '[/\\]', 1)
|
||||
let p2 = split(a:path2, '[/\\]', 1)
|
||||
|
||||
@@ -80,7 +107,8 @@ function! vimwiki#path#path_common_pfx(path1, path2)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#path#wikify_path(path)
|
||||
function! vimwiki#path#wikify_path(path) abort
|
||||
" Convert: path -> full resolved slashed path
|
||||
let result = resolve(fnamemodify(a:path, ':p'))
|
||||
if vimwiki#u#is_windows()
|
||||
let result = substitute(result, '\\', '/', 'g')
|
||||
@@ -90,41 +118,61 @@ function! vimwiki#path#wikify_path(path)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#path#current_wiki_file()
|
||||
function! vimwiki#path#current_wiki_file() abort
|
||||
" Return: Current file path relative
|
||||
return vimwiki#path#wikify_path(expand('%:p'))
|
||||
endfunction
|
||||
|
||||
|
||||
" Returns: the relative path from a:dir to a:file
|
||||
function! vimwiki#path#relpath(dir, file)
|
||||
let result = []
|
||||
let dir = split(a:dir, '/')
|
||||
let file = split(a:file, '/')
|
||||
function! vimwiki#path#relpath(dir, file) abort
|
||||
" Return: the relative path from a:dir to a:file
|
||||
" Check if dir here ('.') -> return file
|
||||
if empty(a:dir) || a:dir =~# '^\.[/\\]\?$'
|
||||
return a:file
|
||||
endif
|
||||
" Unixify && Expand in
|
||||
let s_dir = s:unixify(expand(a:dir))
|
||||
let s_file = s:unixify(expand(a:file))
|
||||
|
||||
" Split path
|
||||
let dir = split(s_dir, '/')
|
||||
let file = split(s_file, '/')
|
||||
|
||||
" Shorten loop till equality
|
||||
while (len(dir) > 0 && len(file) > 0) && vimwiki#path#is_equal(dir[0], file[0])
|
||||
call remove(dir, 0)
|
||||
call remove(file, 0)
|
||||
endwhile
|
||||
|
||||
" Return './' if nothing left
|
||||
if empty(dir) && empty(file)
|
||||
return './'
|
||||
return s:osxify('./')
|
||||
endif
|
||||
|
||||
" Build path segment
|
||||
let segments = []
|
||||
for segment in dir
|
||||
let result += ['..']
|
||||
let segments += ['..']
|
||||
endfor
|
||||
for segment in file
|
||||
let result += [segment]
|
||||
let segments += [segment]
|
||||
endfor
|
||||
let result_path = join(result, '/')
|
||||
if a:file =~ '\m/$'
|
||||
|
||||
" Join segments
|
||||
let result_path = join(segments, '/')
|
||||
if a:file =~# '\m/$'
|
||||
let result_path .= '/'
|
||||
endif
|
||||
|
||||
return result_path
|
||||
endfunction
|
||||
|
||||
|
||||
" If the optional argument provided and nonzero,
|
||||
" it will ask before creating a directory
|
||||
" Returns: 1 iff directory exists or successfully created
|
||||
function! vimwiki#path#mkdir(path, ...)
|
||||
function! vimwiki#path#mkdir(path, ...) abort
|
||||
" Mkdir:
|
||||
" if the optional argument provided and nonzero,
|
||||
" it will ask before creating a directory
|
||||
" returns: 1 iff directory exists or successfully created
|
||||
let path = expand(a:path)
|
||||
|
||||
if path =~# '^scp:'
|
||||
@@ -135,49 +183,69 @@ function! vimwiki#path#mkdir(path, ...)
|
||||
if isdirectory(path)
|
||||
return 1
|
||||
else
|
||||
if !exists("*mkdir")
|
||||
if !exists('*mkdir')
|
||||
return 0
|
||||
endif
|
||||
|
||||
let path = vimwiki#path#chomp_slash(path)
|
||||
if vimwiki#u#is_windows() && !empty(vimwiki#vars#get_global('w32_dir_enc'))
|
||||
let path = iconv(path, &enc, vimwiki#vars#get_global('w32_dir_enc'))
|
||||
let path = iconv(path, &encoding, vimwiki#vars#get_global('w32_dir_enc'))
|
||||
endif
|
||||
|
||||
if a:0 && a:1 && input("Vimwiki: Make new directory: ".path."\n [y]es/[N]o? ") !~? '^y'
|
||||
if a:0 && a:1 && input('Vimwiki: Make new directory: '.path."\n [y]es/[N]o? ") !~? '^y'
|
||||
return 0
|
||||
endif
|
||||
|
||||
call mkdir(path, "p")
|
||||
call mkdir(path, 'p')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#path#is_absolute(path)
|
||||
function! vimwiki#path#is_absolute(path) abort
|
||||
" Check: if path is absolute
|
||||
let res=0
|
||||
|
||||
" Match 'C:' or '/' or '~'
|
||||
if vimwiki#u#is_windows()
|
||||
return a:path =~? '\m^\a:'
|
||||
let res += a:path =~? '\m^\a:'
|
||||
else
|
||||
return a:path =~# '\m^/\|\~/'
|
||||
let res += a:path =~# '\m^/\|\~/'
|
||||
endif
|
||||
|
||||
" Do not prepend root_path to scp files
|
||||
" See: https://vim.fandom.com/wiki/Editing_remote_files_via_scp_in_vim
|
||||
let res += a:path =~# '\m^scp:'
|
||||
|
||||
return res
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
function! s:get_wikifile_link(wikifile) abort
|
||||
return vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), a:wikifile).
|
||||
\ fnamemodify(a:wikifile, ':t:r')
|
||||
endfunction
|
||||
|
||||
function! vimwiki#path#PasteLink(wikifile) abort
|
||||
call append(line('.'), '[[/'.s:get_wikifile_link(a:wikifile).']]')
|
||||
endfunction
|
||||
|
||||
|
||||
" Combine a directory and a file into one path, doesn't generate duplicate
|
||||
" path separator in case the directory is also having an ending / or \. This
|
||||
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
|
||||
" valid path.
|
||||
if vimwiki#u#is_windows()
|
||||
function! vimwiki#path#join_path(directory, file)
|
||||
" Combine: a directory and a file into one path, doesn't generate duplicate
|
||||
" path separator in case the directory is also having an ending / or \. This
|
||||
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
|
||||
" valid path.
|
||||
function! vimwiki#path#join_path(directory, file) abort
|
||||
let directory = vimwiki#path#chomp_slash(a:directory)
|
||||
let file = substitute(a:file, '\m^[\\/]\+', '', '')
|
||||
return directory . '/' . file
|
||||
endfunction
|
||||
else
|
||||
function! vimwiki#path#join_path(directory, file)
|
||||
function! vimwiki#path#join_path(directory, file) abort
|
||||
let directory = substitute(a:directory, '\m/\+$', '', '')
|
||||
let file = substitute(a:file, '\m^/\+', '', '')
|
||||
return directory . '/' . file
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,83 +1,187 @@
|
||||
body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}
|
||||
h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
|
||||
h1 {font-size: 2.6em; color: #000000;}
|
||||
h2 {font-size: 2.2em; color: #404040;}
|
||||
h3 {font-size: 1.8em; color: #707070;}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;;
|
||||
margin: 2em 4em 2em 4em;
|
||||
font-size: 120%;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-weight: bold;
|
||||
line-height:100%;
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
h1 {font-size: 2em; color: #000000;}
|
||||
h2 {font-size: 1.8em; color: #404040;}
|
||||
h3 {font-size: 1.6em; color: #707070;}
|
||||
h4 {font-size: 1.4em; color: #909090;}
|
||||
h5 {font-size: 1.3em; color: #989898;}
|
||||
h6 {font-size: 1.2em; color: #9c9c9c;}
|
||||
p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
|
||||
ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
|
||||
li {margin: 0.3em auto;}
|
||||
ul {margin-left: 2em; padding-left: 0.5em;}
|
||||
dt {font-weight: bold;}
|
||||
img {border: none;}
|
||||
pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
|
||||
blockquote {padding: 0.4em; background-color: #f6f5eb;}
|
||||
th, td {border: 1px solid #ccc; padding: 0.3em;}
|
||||
th {background-color: #f0f0f0;}
|
||||
hr {border: none; border-top: 1px solid #ccc; width: 100%;}
|
||||
del {text-decoration: line-through; color: #777777;}
|
||||
.toc li {list-style-type: none;}
|
||||
.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
|
||||
.justleft {text-align: left;}
|
||||
.justright {text-align: right;}
|
||||
.justcenter {text-align: center;}
|
||||
.center {margin-left: auto; margin-right: auto;}
|
||||
.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
|
||||
.header a {text-decoration: none; color: inherit;}
|
||||
h5 {font-size: 1.2em; color: #989898;}
|
||||
h6 {font-size: 1em; color: #9c9c9c;}
|
||||
|
||||
p, pre, blockquote, table, ul, ol, dl {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
ul ul, ul ol, ol ol, ol ul {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
li { margin: 0.3em auto; }
|
||||
|
||||
ul {
|
||||
margin-left: 2em;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
dt { font-weight: bold; }
|
||||
|
||||
img { border: none; }
|
||||
|
||||
pre {
|
||||
border-left: 5px solid #dcdcdc;
|
||||
background-color: #f5f5f5;
|
||||
padding-left: 1em;
|
||||
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
|
||||
font-size: 0.8em;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
p > a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-size: 0.7em;
|
||||
padding: 3px 6px;
|
||||
border-radius: 3px;
|
||||
background-color: #1e90ff;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
p > a:hover {
|
||||
color: #dcdcdc;
|
||||
background-color: #484848;
|
||||
}
|
||||
|
||||
li > a {
|
||||
color: #1e90ff;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li > a:hover { color: #ff4500; }
|
||||
|
||||
blockquote {
|
||||
color: #686868;
|
||||
font-size: 0.8em;
|
||||
line-height: 120%;
|
||||
padding: 0.8em;
|
||||
border-left: 5px solid #dcdcdc;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
th { background-color: #f0f0f0; }
|
||||
|
||||
hr {
|
||||
border: none;
|
||||
border-top: 1px solid #ccc;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
color: #777777;
|
||||
}
|
||||
|
||||
.toc li { list-style-type: none; }
|
||||
|
||||
.todo {
|
||||
font-weight: bold;
|
||||
background-color: #ff4500 ;
|
||||
color: white;
|
||||
font-size: 0.8em;
|
||||
padding: 3px 6px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.justleft { text-align: left; }
|
||||
.justright { text-align: right; }
|
||||
.justcenter { text-align: center; }
|
||||
|
||||
.center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.tag {
|
||||
background-color: #eeeeee;
|
||||
font-family: monospace;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.header a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* classes for items of todo lists */
|
||||
|
||||
.rejected {
|
||||
/* list-style: none; */
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAACXBIWXMAAADFAAAAxQEdzbqoAAAAB3RJTUUH4QgEFhAtuWgv9wAAAPZQTFRFmpqam5iYnJaWnJeXnpSUn5OTopCQpoqKpouLp4iIqIiIrYCAt3V1vW1tv2xsmZmZmpeXnpKS/x4e/x8f/yAg/yIi/yQk/yUl/yYm/ygo/ykp/yws/zAw/zIy/zMz/zQ0/zU1/zY2/zw8/0BA/0ZG/0pK/1FR/1JS/1NT/1RU/1VV/1ZW/1dX/1pa/15e/19f/2Zm/2lp/21t/25u/3R0/3p6/4CA/4GB/4SE/4iI/46O/4+P/52d/6am/6ur/66u/7Oz/7S0/7e3/87O/9fX/9zc/93d/+Dg/+vr/+3t/+/v//Dw//Ly//X1//f3//n5//z8////gzaKowAAAA90Uk5T/Pz8/Pz8/Pz8/Pz8/f39ppQKWQAAAAFiS0dEEnu8bAAAAACuSURBVAhbPY9ZF4FQFEZPSKbIMmWep4gMGTKLkIv6/3/GPbfF97b3w17rA0kQOPgvAeHW6uJ6+5h7HqLdwowgOzejXRXBdx6UdSru216xuOMBHHNU0clTzeSUA6EhF8V8kqroluMiU6HKcuf4phGPr1o2q9kYZWwNq1qfRRmTaXpqsyjj17KkWCxKBUBgXWueHIyiAIg18gsse4KHkLF5IKIY10WQgv7fOy4ST34BRiopZ8WLNrgAAAAASUVORK5CYII=);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .2em;
|
||||
padding-left: 1.5em;
|
||||
/* list-style: none; */
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAACXBIWXMAAADFAAAAxQEdzbqoAAAAB3RJTUUH4QgEFhAtuWgv9wAAAPZQTFRFmpqam5iYnJaWnJeXnpSUn5OTopCQpoqKpouLp4iIqIiIrYCAt3V1vW1tv2xsmZmZmpeXnpKS/x4e/x8f/yAg/yIi/yQk/yUl/yYm/ygo/ykp/yws/zAw/zIy/zMz/zQ0/zU1/zY2/zw8/0BA/0ZG/0pK/1FR/1JS/1NT/1RU/1VV/1ZW/1dX/1pa/15e/19f/2Zm/2lp/21t/25u/3R0/3p6/4CA/4GB/4SE/4iI/46O/4+P/52d/6am/6ur/66u/7Oz/7S0/7e3/87O/9fX/9zc/93d/+Dg/+vr/+3t/+/v//Dw//Ly//X1//f3//n5//z8////gzaKowAAAA90Uk5T/Pz8/Pz8/Pz8/Pz8/f39ppQKWQAAAAFiS0dEEnu8bAAAAACuSURBVAhbPY9ZF4FQFEZPSKbIMmWep4gMGTKLkIv6/3/GPbfF97b3w17rA0kQOPgvAeHW6uJ6+5h7HqLdwowgOzejXRXBdx6UdSru216xuOMBHHNU0clTzeSUA6EhF8V8kqroluMiU6HKcuf4phGPr1o2q9kYZWwNq1qfRRmTaXpqsyjj17KkWCxKBUBgXWueHIyiAIg18gsse4KHkLF5IKIY10WQgv7fOy4ST34BRiopZ8WLNrgAAAAASUVORK5CYII=);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done0 {
|
||||
/* list-style: none; */
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .2em;
|
||||
padding-left: 1.5em;
|
||||
/* list-style: none; */
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .2em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done1 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done2 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done3 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
.done4 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 .15em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;
|
||||
-webkit-border-radius: 1px;
|
||||
-moz-border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
-moz-background-clip: padding;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
padding: 0px 3px;
|
||||
display: inline-block;
|
||||
color: #52595d;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
|
||||
-webkit-border-radius: 1px;
|
||||
-moz-border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
-moz-background-clip: padding;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
padding: 0px 3px;
|
||||
display: inline-block;
|
||||
color: #52595d;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||
" Vimwiki autoload plugin file
|
||||
|
||||
|
||||
let s:TAGS_METADATA_FILE_NAME = '.tags'
|
||||
|
||||
|
||||
|
||||
" Description: Tag manipulation functions
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
"
|
||||
" Tags metadata in-memory format:
|
||||
" metadata := { 'pagename': [entries, ...] }
|
||||
" entry := { 'tagname':..., 'lineno':..., 'link':... }
|
||||
|
||||
" Tags metadata in-file format:
|
||||
"
|
||||
" Is based on CTags format (see |tags-file-format|).
|
||||
" Is based on CTags format (see |tags-file-format|) and
|
||||
" https://ctags.sourceforge.net/FORMAT
|
||||
"
|
||||
" {tagaddress} is set to lineno. We'll let vim search by exact line number; we
|
||||
" can afford that, we assume metadata file is always updated before use.
|
||||
@@ -22,13 +20,15 @@ let s:TAGS_METADATA_FILE_NAME = '.tags'
|
||||
" of missing parameters -- "pagename" and "link".
|
||||
|
||||
|
||||
let s:TAGS_METADATA_FILE_NAME = '.vimwiki_tags'
|
||||
|
||||
" Update tags metadata.
|
||||
" a:full_rebuild == 1: re-scan entire wiki
|
||||
" a:full_rebuild == 0: only re-scan current page
|
||||
" a:all_files == '': only if the file is newer than .tags
|
||||
function! vimwiki#tags#update_tags(full_rebuild, all_files)
|
||||
let all_files = a:all_files != ''
|
||||
|
||||
function! vimwiki#tags#update_tags(full_rebuild, all_files) abort
|
||||
" Update tags metadata.
|
||||
" Param: a:full_rebuild == 1: re-scan entire wiki
|
||||
" Param: a:full_rebuild == 0: only re-scan current page
|
||||
" a:all_files == '': only if the file is newer than .tags
|
||||
let all_files = a:all_files !=? ''
|
||||
if !a:full_rebuild
|
||||
" Updating for one page (current)
|
||||
let page_name = vimwiki#vars#get_bufferlocal('subdir') . expand('%:t:r')
|
||||
@@ -61,16 +61,25 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files)
|
||||
endfunction
|
||||
|
||||
|
||||
" Scans the list of text lines (argument) and produces tags metadata as a list of tag entries.
|
||||
function! s:scan_tags(lines, page_name)
|
||||
function! s:safesubstitute(text, search, replace, mode) abort
|
||||
" Substitute regexp but do not interpret replace
|
||||
" TODO mutualize with same function in base
|
||||
let escaped = escape(a:replace, '\&')
|
||||
return substitute(a:text, a:search, escaped, a:mode)
|
||||
endfunction
|
||||
|
||||
let entries = []
|
||||
|
||||
function! s:scan_tags(lines, page_name) abort
|
||||
" Scan the list of text lines (argument) and produces tags metadata as a list of tag entries.
|
||||
" Code wireframe to scan for headers -- borrowed from
|
||||
" vimwiki#base#get_anchors(), with minor modifications.
|
||||
|
||||
let entries = []
|
||||
|
||||
" Get syntax wide regex
|
||||
let rxheader = vimwiki#vars#get_syntaxlocal('header_search')
|
||||
let rxtag = vimwiki#vars#get_syntaxlocal('tag_search')
|
||||
let tag_search_rx = vimwiki#vars#get_syntaxlocal('tag_search')
|
||||
let tag_format = vimwiki#vars#get_syntaxlocal('tag_format')
|
||||
|
||||
let anchor_level = ['', '', '', '', '', '', '']
|
||||
let current_complete_anchor = ''
|
||||
@@ -81,11 +90,17 @@ function! s:scan_tags(lines, page_name)
|
||||
for line_nr in range(1, len(a:lines))
|
||||
let line = a:lines[line_nr - 1]
|
||||
|
||||
" ignore verbatim blocks
|
||||
if vimwiki#u#is_codeblock(line_nr)
|
||||
continue
|
||||
endif
|
||||
|
||||
" process headers
|
||||
let h_match = matchlist(line, rxheader)
|
||||
if !empty(h_match) " got a header
|
||||
let header_line_nr = line_nr
|
||||
let header = vimwiki#u#trim(h_match[2])
|
||||
let header = vimwiki#base#normalize_anchor(h_match[2])
|
||||
let current_header_description = vimwiki#u#trim(h_match[2])
|
||||
let level = len(h_match[1])
|
||||
let anchor_level[level-1] = header
|
||||
for l in range(level, 6)
|
||||
@@ -96,42 +111,48 @@ function! s:scan_tags(lines, page_name)
|
||||
else
|
||||
let current_complete_anchor = ''
|
||||
for l in range(level-1)
|
||||
if anchor_level[l] != ''
|
||||
if anchor_level[l] !=? ''
|
||||
let current_complete_anchor .= anchor_level[l].'#'
|
||||
endif
|
||||
endfor
|
||||
let current_complete_anchor .= header
|
||||
endif
|
||||
continue " tags are not allowed in headers
|
||||
" See: issue #1316 to allow tags in header
|
||||
" continue " tags are not allowed in headers
|
||||
endif
|
||||
|
||||
" TODO ignore verbatim blocks
|
||||
|
||||
" Scan line for tags. There can be many of them.
|
||||
let str = line
|
||||
while 1
|
||||
let tag_group = matchstr(str, rxtag)
|
||||
if tag_group == ''
|
||||
" Get all matches
|
||||
let tag_groups = []
|
||||
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
|
||||
if tag_groups == []
|
||||
break
|
||||
endif
|
||||
let tagend = matchend(str, rxtag)
|
||||
let tagend = matchend(str, tag_search_rx)
|
||||
let str = str[(tagend):]
|
||||
for tag in split(tag_group, ':')
|
||||
" Create metadata entry
|
||||
let entry = {}
|
||||
let entry.tagname = tag
|
||||
let entry.lineno = line_nr
|
||||
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
|
||||
" Tag appeared at the top of the file
|
||||
let entry.link = a:page_name
|
||||
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
|
||||
" Tag appeared right below a header
|
||||
let entry.link = a:page_name . '#' . current_complete_anchor
|
||||
else
|
||||
" Tag stands on its own
|
||||
let entry.link = a:page_name . '#' . tag
|
||||
endif
|
||||
call add(entries, entry)
|
||||
for tag_group in tag_groups
|
||||
for tag in split(tag_group, tag_format.sep)
|
||||
" Create metadata entry
|
||||
let entry = {}
|
||||
let entry.tagname = tag
|
||||
let entry.lineno = line_nr
|
||||
if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0
|
||||
" Tag appeared at the top of the file
|
||||
let entry.link = a:page_name
|
||||
let entry.description = entry.link
|
||||
elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
|
||||
" Tag appeared right below a header
|
||||
let entry.link = a:page_name . '#' . current_complete_anchor
|
||||
let entry.description = current_header_description
|
||||
else
|
||||
" Tag stands on its own
|
||||
let entry.link = a:page_name . '#' . tag
|
||||
let entry.description = entry.link
|
||||
endif
|
||||
call add(entries, entry)
|
||||
endfor
|
||||
endfor
|
||||
endwhile
|
||||
|
||||
@@ -140,26 +161,26 @@ function! s:scan_tags(lines, page_name)
|
||||
endfunction
|
||||
|
||||
|
||||
" Returns tags metadata file path
|
||||
function! vimwiki#tags#metadata_file_path() abort
|
||||
" Return: tags metadata file path
|
||||
return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'),
|
||||
\ s:TAGS_METADATA_FILE_NAME), ':p')
|
||||
endfunction
|
||||
|
||||
|
||||
" Loads tags metadata from file, returns a dictionary
|
||||
function! s:load_tags_metadata() abort
|
||||
" Load tags metadata from file, returns a dictionary
|
||||
let metadata_path = vimwiki#tags#metadata_file_path()
|
||||
if !filereadable(metadata_path)
|
||||
return {}
|
||||
endif
|
||||
let metadata = {}
|
||||
for line in readfile(metadata_path)
|
||||
if line =~ '^!_TAG_FILE_'
|
||||
if line =~# '^!_TAG_.*$'
|
||||
continue
|
||||
endif
|
||||
let parts = matchlist(line, '^\(.\{-}\);"\(.*\)$')
|
||||
if parts[0] == '' || parts[1] == '' || parts[2] == ''
|
||||
if parts[0] ==? '' || parts[1] ==? '' || parts[2] ==? ''
|
||||
throw 'VimwikiTags1: Metadata file corrupted'
|
||||
endif
|
||||
let std_fields = split(parts[1], '\t')
|
||||
@@ -167,11 +188,11 @@ function! s:load_tags_metadata() abort
|
||||
throw 'VimwikiTags2: Metadata file corrupted'
|
||||
endif
|
||||
let vw_part = parts[2]
|
||||
if vw_part[0] != "\t"
|
||||
if vw_part[0] !=? "\t"
|
||||
throw 'VimwikiTags3: Metadata file corrupted'
|
||||
endif
|
||||
let vw_fields = split(vw_part[1:], "\t")
|
||||
if len(vw_fields) != 1 || vw_fields[0] !~ '^vimwiki:'
|
||||
if len(vw_fields) != 1 || vw_fields[0] !~# '^vimwiki:'
|
||||
throw 'VimwikiTags4: Metadata file corrupted'
|
||||
endif
|
||||
let vw_data = substitute(vw_fields[0], '^vimwiki:', '', '')
|
||||
@@ -180,7 +201,7 @@ function! s:load_tags_metadata() abort
|
||||
let vw_data = substitute(vw_data, '\\t', "\t", 'g')
|
||||
let vw_data = substitute(vw_data, '\\\\', "\\", 'g')
|
||||
let vw_fields = split(vw_data, "\t")
|
||||
if len(vw_fields) != 2
|
||||
if len(vw_fields) != 3
|
||||
throw 'VimwikiTags5: Metadata file corrupted'
|
||||
endif
|
||||
let pagename = vw_fields[0]
|
||||
@@ -188,6 +209,7 @@ function! s:load_tags_metadata() abort
|
||||
let entry.tagname = std_fields[0]
|
||||
let entry.lineno = std_fields[2]
|
||||
let entry.link = vw_fields[1]
|
||||
let entry.description = vw_fields[2]
|
||||
if has_key(metadata, pagename)
|
||||
call add(metadata[pagename], entry)
|
||||
else
|
||||
@@ -198,9 +220,9 @@ function! s:load_tags_metadata() abort
|
||||
endfunction
|
||||
|
||||
|
||||
" Removes all entries for given page from metadata in-place. Returns updated
|
||||
" metadata (just in case).
|
||||
function! s:remove_page_from_tags(metadata, page_name)
|
||||
function! s:remove_page_from_tags(metadata, page_name) abort
|
||||
" Remove all entries for given page from metadata in-place. Returns updated
|
||||
" metadata (just in case).
|
||||
if has_key(a:metadata, a:page_name)
|
||||
call remove(a:metadata, a:page_name)
|
||||
return a:metadata
|
||||
@@ -210,24 +232,24 @@ function! s:remove_page_from_tags(metadata, page_name)
|
||||
endfunction
|
||||
|
||||
|
||||
" Merges metadata of one file into a:metadata
|
||||
function! s:merge_tags(metadata, pagename, file_metadata)
|
||||
function! s:merge_tags(metadata, pagename, file_metadata) abort
|
||||
" Merge metadata of one file into a:metadata
|
||||
let metadata = a:metadata
|
||||
let metadata[a:pagename] = a:file_metadata
|
||||
return metadata
|
||||
endfunction
|
||||
|
||||
|
||||
" Compares two actual lines from tags file. Return value is in strcmp style.
|
||||
" See help on sort() -- that's what this function is going to be used for.
|
||||
" See also s:write_tags_metadata below -- that's where we compose these tags
|
||||
" file lines.
|
||||
"
|
||||
" This function is needed for tags sorting, since plain sort() compares line
|
||||
" numbers as strings, not integers, and so, for example, tag at line 14
|
||||
" preceeds the same tag on the same page at line 9. (Because string "14" is
|
||||
" alphabetically 'less than' string "9".)
|
||||
function! s:tags_entry_cmp(i1, i2)
|
||||
function! s:tags_entry_cmp(i1, i2) abort
|
||||
" Compare two actual lines from tags file. Return value is in strcmp style.
|
||||
" See help on sort() -- that's what this function is going to be used for.
|
||||
" See also s:write_tags_metadata below -- that's where we compose these tags
|
||||
" file lines.
|
||||
"
|
||||
" This function is needed for tags sorting, since plain sort() compares line
|
||||
" numbers as strings, not integers, and so, for example, tag at line 14
|
||||
" precedes the same tags on the same page at line 9. (Because string "14" is
|
||||
" alphabetically 'less than' string "9".)
|
||||
let items = []
|
||||
for orig_item in [a:i1, a:i2]
|
||||
let fields = split(orig_item, "\t")
|
||||
@@ -250,13 +272,13 @@ function! s:tags_entry_cmp(i1, i2)
|
||||
endfunction
|
||||
|
||||
|
||||
" Saves metadata object into a file. Throws exceptions in case of problems.
|
||||
function! s:write_tags_metadata(metadata)
|
||||
function! s:write_tags_metadata(metadata) abort
|
||||
" Save metadata object into a file. Throws exceptions in case of problems.
|
||||
let metadata_path = vimwiki#tags#metadata_file_path()
|
||||
let tags = []
|
||||
for pagename in keys(a:metadata)
|
||||
for entry in a:metadata[pagename]
|
||||
let entry_data = pagename . "\t" . entry.link
|
||||
let entry_data = pagename . "\t" . entry.link . "\t" . entry.description
|
||||
let entry_data = substitute(entry_data, "\\", '\\\\', 'g')
|
||||
let entry_data = substitute(entry_data, "\t", '\\t', 'g')
|
||||
let entry_data = substitute(entry_data, "\r", '\\r', 'g')
|
||||
@@ -266,18 +288,29 @@ function! s:write_tags_metadata(metadata)
|
||||
\ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t"
|
||||
\ . entry.lineno
|
||||
\ . ';"'
|
||||
\ . "\t" . "vimwiki:" . entry_data
|
||||
\ . "\t" . 'vimwiki:' . entry_data
|
||||
\)
|
||||
endfor
|
||||
endfor
|
||||
call sort(tags, "s:tags_entry_cmp")
|
||||
call insert(tags, "!_TAG_FILE_SORTED\t1\t")
|
||||
call sort(tags, 's:tags_entry_cmp')
|
||||
let tag_comments = [
|
||||
\ "!_TAG_PROGRAM_VERSION\t" . g:vimwiki_version,
|
||||
\ "!_TAG_PROGRAM_URL\thttps://github.com/vimwiki/vimwiki",
|
||||
\ "!_TAG_PROGRAM_NAME\tVimwiki Tags",
|
||||
\ "!_TAG_PROGRAM_AUTHOR\tVimwiki",
|
||||
\ "!_TAG_OUTPUT_MODE\tvimwiki-tags",
|
||||
\ "!_TAG_FILE_SORTED\t1",
|
||||
\ "!_TAG_FILE_FORMAT\t2",
|
||||
\ ]
|
||||
for c in tag_comments
|
||||
call insert(tags, c)
|
||||
endfor
|
||||
call writefile(tags, metadata_path)
|
||||
endfunction
|
||||
|
||||
|
||||
" Returns list of unique tags found in the .tags file
|
||||
function! vimwiki#tags#get_tags()
|
||||
function! vimwiki#tags#get_tags() abort
|
||||
" Return: list of unique tags found in the .tags file
|
||||
let metadata = s:load_tags_metadata()
|
||||
let tags = {}
|
||||
for entries in values(metadata)
|
||||
@@ -289,54 +322,148 @@ function! vimwiki#tags#get_tags()
|
||||
endfunction
|
||||
|
||||
|
||||
" Similar to vimwiki#base#generate_links. In the current buffer, appends
|
||||
" tags and references to all their instances. If no arguments (tags) are
|
||||
" specified, outputs all tags.
|
||||
function! vimwiki#tags#generate_tags(...) abort
|
||||
let need_all_tags = (a:0 == 0)
|
||||
let specific_tags = a:000
|
||||
function! vimwiki#tags#generate_tags(create, ...) abort
|
||||
" Generate tags in current buffer
|
||||
" Similar to vimwiki#base#generate_links. In the current buffer, appends
|
||||
" tags and references to all their instances. If no arguments (tags) are
|
||||
" specified, outputs all tags.
|
||||
let header_level = vimwiki#vars#get_global('tags_header_level')
|
||||
let tags_header_text = vimwiki#vars#get_global('tags_header')
|
||||
|
||||
let metadata = s:load_tags_metadata()
|
||||
" If tag headers should only be updated, search for already present tag headers
|
||||
if !a:create
|
||||
let headers = vimwiki#base#collect_headers()
|
||||
let specific_tags = []
|
||||
let inside_tag_headers = 0
|
||||
for header in headers
|
||||
" If we ran out of the headers containing the tags, stop
|
||||
if inside_tag_headers && header[1] <= header_level
|
||||
break
|
||||
endif
|
||||
|
||||
" make a dictionary { tag_name: [tag_links, ...] }
|
||||
let tags_entries = {}
|
||||
for entries in values(metadata)
|
||||
for entry in entries
|
||||
if has_key(tags_entries, entry.tagname)
|
||||
call add(tags_entries[entry.tagname], entry.link)
|
||||
else
|
||||
let tags_entries[entry.tagname] = [entry.link]
|
||||
" All headers in the tag headers section correspond to tag names. Collect all of them in a list.
|
||||
if inside_tag_headers
|
||||
call add(specific_tags, header[2])
|
||||
endif
|
||||
|
||||
" If we found the start of the tag headers section, remember that the following headers are now inside of it
|
||||
if header[1] == header_level && header[2] ==# tags_header_text
|
||||
let inside_tag_headers = 1
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
else
|
||||
let specific_tags = a:000
|
||||
endif
|
||||
|
||||
let lines = []
|
||||
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
|
||||
for tagname in sort(keys(tags_entries))
|
||||
if need_all_tags || index(specific_tags, tagname) != -1
|
||||
call extend(lines, [
|
||||
\ '',
|
||||
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', tagname, ''),
|
||||
\ '' ])
|
||||
for taglink in sort(tags_entries[tagname])
|
||||
call add(lines, bullet . substitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
|
||||
\ '__LinkUrl__', taglink, ''))
|
||||
" use a dictionary function for closure like capability
|
||||
" copy all local variables into dict (add a: if arguments are needed)
|
||||
let GeneratorTags = copy(l:)
|
||||
function! GeneratorTags.f() abort
|
||||
let need_all_tags = empty(self.specific_tags)
|
||||
let metadata = s:load_tags_metadata()
|
||||
|
||||
" make a dictionary { tag_name: [tag_links, ...] }
|
||||
let tags_entries = {}
|
||||
for entries in values(metadata)
|
||||
for entry in entries
|
||||
if has_key(tags_entries, entry.tagname)
|
||||
call add(tags_entries[entry.tagname], [entry.link, entry.description])
|
||||
else
|
||||
let tags_entries[entry.tagname] = [[entry.link, entry.description]]
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
unlet entry " needed for older vims with sticky type checking since name is reused
|
||||
endfor
|
||||
|
||||
let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*'
|
||||
\ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
|
||||
\ .vimwiki#vars#get_syntaxlocal('rxWikiLink').'$\)'
|
||||
let lines = []
|
||||
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
|
||||
let current_dir = vimwiki#base#current_subdir()
|
||||
for tagname in sort(keys(tags_entries))
|
||||
if need_all_tags || index(self.specific_tags, tagname) != -1
|
||||
if len(lines) > 0
|
||||
call add(lines, '')
|
||||
endif
|
||||
|
||||
call vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx, line('$')+1, 1)
|
||||
let tag_tpl = printf('rxH%d_Template', self.header_level + 1)
|
||||
call add(lines, s:safesubstitute(vimwiki#vars#get_syntaxlocal(tag_tpl), '__Header__', tagname, ''))
|
||||
|
||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
|
||||
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
|
||||
call add(lines, '')
|
||||
endfor
|
||||
endif
|
||||
|
||||
for [taglink, tagdescription] in sort(tags_entries[tagname])
|
||||
let taglink = vimwiki#path#relpath(current_dir, taglink)
|
||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown'
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink3Template')
|
||||
let link_infos = vimwiki#base#resolve_link(taglink)
|
||||
if empty(link_infos.anchor)
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
|
||||
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', taglink, '')
|
||||
let entry = s:safesubstitute(entry, '__LinkDescription__', tagdescription, '')
|
||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
let entry = s:safesubstitute(entry, '__FileExtension__', file_extension , '')
|
||||
else
|
||||
let link_caption = split(tagdescription, '#', 0)[-1]
|
||||
let link_text = split(taglink, '#', 1)[0]
|
||||
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', link_text, '')
|
||||
let entry = s:safesubstitute(entry, '__LinkAnchor__', link_infos.anchor, '')
|
||||
let entry = s:safesubstitute(entry, '__LinkDescription__', link_caption, '')
|
||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
let entry = s:safesubstitute(entry, '__FileExtension__', file_extension , '')
|
||||
endif
|
||||
|
||||
call add(lines, bullet . entry)
|
||||
else
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
|
||||
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
let link_tpl = s:safesubstitute(link_tpl, '__FileExtension__', file_extension , '')
|
||||
call add(lines, bullet . substitute(link_tpl, '__LinkUrl__', taglink, ''))
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
|
||||
return lines
|
||||
endfunction
|
||||
|
||||
let tag_match = printf('rxH%d', header_level + 1)
|
||||
let links_rx = '^\%('.vimwiki#vars#get_syntaxlocal(tag_match).'\)\|'.
|
||||
\ '\%(^\s*$\)\|^\s*\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
|
||||
|
||||
call vimwiki#base#update_listing_in_buffer(
|
||||
\ GeneratorTags,
|
||||
\ tags_header_text,
|
||||
\ links_rx,
|
||||
\ line('$')+1,
|
||||
\ header_level,
|
||||
\ a:create)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
|
||||
" Complete tags
|
||||
" We can safely ignore args if we use -custom=complete option, Vim engine
|
||||
" will do the job of filtering.
|
||||
let taglist = vimwiki#tags#get_tags()
|
||||
return join(taglist, "\n")
|
||||
endfunction
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -8,24 +8,29 @@
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
|
||||
if exists("g:loaded_vimwiki_tbl_auto") || &cp
|
||||
" Clause: Load only once
|
||||
if exists('g:loaded_vimwiki_tbl_auto') || &compatible
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_tbl_auto = 1
|
||||
|
||||
|
||||
let s:textwidth = &tw
|
||||
|
||||
|
||||
function! s:rxSep()
|
||||
function! s:s_sep() abort
|
||||
" Return string column separator
|
||||
return vimwiki#vars#get_syntaxlocal('rxTableSep')
|
||||
endfunction
|
||||
|
||||
function! s:r_sep() abort
|
||||
" Return regex column separator
|
||||
" Not prefixed with \
|
||||
let res = '\(^\|[^\\]\)\@<='
|
||||
let res .= vimwiki#vars#get_syntaxlocal('rxTableSep')
|
||||
return res
|
||||
endfunction
|
||||
|
||||
function! s:wide_len(str)
|
||||
function! s:wide_len(str) abort
|
||||
" vim73 has new function that gives correct string width.
|
||||
if exists("*strdisplaywidth")
|
||||
if exists('*strdisplaywidth')
|
||||
return strdisplaywidth(a:str)
|
||||
endif
|
||||
|
||||
@@ -36,8 +41,8 @@ function! s:wide_len(str)
|
||||
let savemodified = &modified
|
||||
let save_cursor = getpos('.')
|
||||
exe "norm! o\<esc>"
|
||||
call setline(line("."), a:str)
|
||||
let ret = virtcol("$") - 1
|
||||
call setline(line('.'), a:str)
|
||||
let ret = virtcol('$') - 1
|
||||
d
|
||||
call setpos('.', save_cursor)
|
||||
let &modified = savemodified
|
||||
@@ -46,46 +51,48 @@ function! s:wide_len(str)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:cell_splitter()
|
||||
return '\s*'.s:rxSep().'\s*'
|
||||
function! s:cell_splitter() abort
|
||||
return '\s*'.s:r_sep().'\s*'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:sep_splitter()
|
||||
return '-'.s:rxSep().'-'
|
||||
function! s:sep_splitter() abort
|
||||
return '-'.s:r_sep().'-'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:is_table(line)
|
||||
function! s:is_table(line) abort
|
||||
" Check if param:line is in a table
|
||||
return s:is_separator(a:line) ||
|
||||
\ (a:line !~# s:rxSep().s:rxSep() && a:line =~# '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
|
||||
\ (a:line !~# s:r_sep().s:r_sep() && a:line =~# '^\s*'.s:r_sep().'.\+'.s:r_sep().'\s*$')
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:is_separator(line)
|
||||
return a:line =~# '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
|
||||
function! s:is_separator(line) abort
|
||||
" Check if param:line is a separator (ex: | --- | --- |)
|
||||
return a:line =~# '^\s*'.s:r_sep().'\(:\=--\+:\='.s:r_sep().'\)\+\s*$'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:is_separator_tail(line)
|
||||
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
|
||||
function! s:is_separator_tail(line) abort
|
||||
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:r_sep().'-\+\)\+'.s:r_sep().'\s*$'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:is_last_column(lnum, cnum)
|
||||
function! s:is_last_column(lnum, cnum) abort
|
||||
let line = strpart(getline(a:lnum), a:cnum - 1)
|
||||
return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
|
||||
return line =~# s:r_sep().'\s*$' && line !~# s:r_sep().'.*'.s:r_sep().'\s*$'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:is_first_column(lnum, cnum)
|
||||
function! s:is_first_column(lnum, cnum) abort
|
||||
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
|
||||
return line =~# '^\s*$' ||
|
||||
\ (line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
|
||||
\ (line =~# '^\s*'.s:r_sep() && line !~# '^\s*'.s:r_sep().'.*'.s:r_sep())
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:count_separators_up(lnum)
|
||||
function! s:count_separators_up(lnum) abort
|
||||
let lnum = a:lnum - 1
|
||||
while lnum > 1
|
||||
if !s:is_separator(getline(lnum))
|
||||
@@ -98,7 +105,7 @@ function! s:count_separators_up(lnum)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:count_separators_down(lnum)
|
||||
function! s:count_separators_down(lnum) abort
|
||||
let lnum = a:lnum + 1
|
||||
while lnum < line('$')
|
||||
if !s:is_separator(getline(lnum))
|
||||
@@ -111,9 +118,10 @@ function! s:count_separators_down(lnum)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:create_empty_row(cols)
|
||||
let row = s:rxSep()
|
||||
let cell = " ".s:rxSep()
|
||||
function! s:create_empty_row(cols) abort
|
||||
" Create an empty row of a:cols columns
|
||||
let row = s:s_sep()
|
||||
let cell = ' '.s:s_sep()
|
||||
|
||||
for c in range(a:cols)
|
||||
let row .= cell
|
||||
@@ -123,9 +131,10 @@ function! s:create_empty_row(cols)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:create_row_sep(cols)
|
||||
let row = s:rxSep()
|
||||
let cell = "---".s:rxSep()
|
||||
function! s:create_row_sep(cols) abort
|
||||
" Create an empty separator row of a:cols columns
|
||||
let row = s:s_sep()
|
||||
let cell = '---'.s:s_sep()
|
||||
|
||||
for c in range(a:cols)
|
||||
let row .= cell
|
||||
@@ -135,66 +144,72 @@ function! s:create_row_sep(cols)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#get_cells(line)
|
||||
function! vimwiki#tbl#get_cells(line, ...) abort
|
||||
let result = []
|
||||
let cell = ''
|
||||
let quote = ''
|
||||
let state = 'NONE'
|
||||
let cell_start = 0
|
||||
let quote_start = 0
|
||||
let len = strlen(a:line) - 1
|
||||
|
||||
" 'Simple' FSM
|
||||
for idx in range(strlen(a:line))
|
||||
" The only way I know Vim can do Unicode...
|
||||
let ch = a:line[idx]
|
||||
if state ==# 'NONE'
|
||||
if ch == '|'
|
||||
let state = 'CELL'
|
||||
endif
|
||||
elseif state ==# 'CELL'
|
||||
if ch == '[' || ch == '{'
|
||||
let state = 'BEFORE_QUOTE_START'
|
||||
let quote = ch
|
||||
elseif ch == '|'
|
||||
call add(result, vimwiki#u#trim(cell))
|
||||
let cell = ""
|
||||
else
|
||||
let cell .= ch
|
||||
endif
|
||||
elseif state ==# 'BEFORE_QUOTE_START'
|
||||
if ch == '[' || ch == '{'
|
||||
let state = 'QUOTE'
|
||||
let quote .= ch
|
||||
else
|
||||
let state = 'CELL'
|
||||
let cell .= quote.ch
|
||||
let quote = ''
|
||||
endif
|
||||
elseif state ==# 'QUOTE'
|
||||
if ch == ']' || ch == '}'
|
||||
let state = 'BEFORE_QUOTE_END'
|
||||
endif
|
||||
let quote .= ch
|
||||
elseif state ==# 'BEFORE_QUOTE_END'
|
||||
if ch == ']' || ch == '}'
|
||||
let state = 'CELL'
|
||||
endif
|
||||
let cell .= quote.ch
|
||||
let quote = ''
|
||||
while state !=# 'CELL'
|
||||
if quote_start != 0 && state !=# 'CELL'
|
||||
let state = 'CELL'
|
||||
endif
|
||||
endfor
|
||||
for idx in range(quote_start, len)
|
||||
" The only way I know Vim can do Unicode...
|
||||
let ch = a:line[idx]
|
||||
if state ==# 'NONE'
|
||||
if ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
|
||||
let cell_start = idx + 1
|
||||
let state = 'CELL'
|
||||
endif
|
||||
elseif state ==# 'CELL'
|
||||
if ch ==# '[' || ch ==# '{'
|
||||
let state = 'BEFORE_QUOTE_START'
|
||||
let quote_start = idx
|
||||
elseif ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
|
||||
let cell = strpart(a:line, cell_start, idx - cell_start)
|
||||
if a:0 && a:1
|
||||
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
|
||||
else
|
||||
let cell = vimwiki#u#trim(cell)
|
||||
endif
|
||||
call add(result, cell)
|
||||
let cell_start = idx + 1
|
||||
endif
|
||||
elseif state ==# 'BEFORE_QUOTE_START'
|
||||
if ch ==# '[' || ch ==# '{'
|
||||
let state = 'QUOTE'
|
||||
let quote_start = idx
|
||||
else
|
||||
let state = 'CELL'
|
||||
endif
|
||||
elseif state ==# 'QUOTE'
|
||||
if ch ==# ']' || ch ==# '}'
|
||||
let state = 'BEFORE_QUOTE_END'
|
||||
endif
|
||||
elseif state ==# 'BEFORE_QUOTE_END'
|
||||
if ch ==# ']' || ch ==# '}'
|
||||
let state = 'CELL'
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if state ==# 'NONE'
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
if cell.quote != ''
|
||||
call add(result, vimwiki#u#trim(cell.quote, '|'))
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:col_count(lnum)
|
||||
function! s:col_count(lnum) abort
|
||||
return len(vimwiki#tbl#get_cells(getline(a:lnum)))
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_indent(lnum)
|
||||
function! s:get_indent(lnum, depth) abort
|
||||
if !s:is_table(getline(a:lnum))
|
||||
return
|
||||
endif
|
||||
@@ -209,50 +224,123 @@ function! s:get_indent(lnum)
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
if a:depth > 0 && lnum < a:lnum - a:depth
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return indent
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_rows(lnum)
|
||||
function! s:get_rows(lnum, ...) abort
|
||||
let rows = []
|
||||
|
||||
if !s:is_table(getline(a:lnum))
|
||||
return
|
||||
return rows
|
||||
endif
|
||||
|
||||
let upper_rows = []
|
||||
let lower_rows = []
|
||||
|
||||
let lnum = a:lnum - 1
|
||||
while lnum >= 1
|
||||
let depth = a:0 > 0 ? a:1 : 0
|
||||
let ldepth = 0
|
||||
while lnum >= 1 && (depth == 0 || ldepth < depth)
|
||||
let line = getline(lnum)
|
||||
if s:is_table(line)
|
||||
call add(upper_rows, [lnum, line])
|
||||
call insert(rows, [lnum, line])
|
||||
else
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
let ldepth += 1
|
||||
endwhile
|
||||
call reverse(upper_rows)
|
||||
|
||||
let lnum = a:lnum
|
||||
while lnum <= line('$')
|
||||
let line = getline(lnum)
|
||||
if s:is_table(line)
|
||||
call add(lower_rows, [lnum, line])
|
||||
call add(rows, [lnum, line])
|
||||
else
|
||||
break
|
||||
endif
|
||||
if depth > 0
|
||||
break
|
||||
endif
|
||||
let lnum += 1
|
||||
endwhile
|
||||
|
||||
return upper_rows + lower_rows
|
||||
return rows
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_cell_max_lens(lnum, ...)
|
||||
function! s:get_cell_aligns(lnum, ...) abort
|
||||
let aligns = {}
|
||||
let depth = a:0 > 0 ? a:1 : 0
|
||||
for [lnum, row] in s:get_rows(a:lnum, depth)
|
||||
if s:is_separator(row)
|
||||
let cells = vimwiki#tbl#get_cells(row)
|
||||
for idx in range(len(cells))
|
||||
let cell = cells[idx]
|
||||
if cell =~# '^--\+:'
|
||||
let aligns[idx] = 'right'
|
||||
elseif cell =~# '^:--\+:'
|
||||
let aligns[idx] = 'center'
|
||||
else
|
||||
let aligns[idx] = 'left'
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
let cells = vimwiki#tbl#get_cells(row)
|
||||
for idx in range(len(cells))
|
||||
if !has_key(aligns, idx)
|
||||
let aligns[idx] = 'left'
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
return aligns
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_cell_aligns_fast(rows) abort
|
||||
let aligns = {}
|
||||
let clen = 0
|
||||
for [lnum, row] in a:rows
|
||||
if s:is_separator(row)
|
||||
return s:get_cell_aligns(lnum, 1)
|
||||
endif
|
||||
let cells = vimwiki#tbl#get_cells(row, 1)
|
||||
let clen = len(cells)
|
||||
for idx in range(clen)
|
||||
let cell = cells[idx]
|
||||
if !has_key(aligns, idx)
|
||||
let cs = matchlist(cell, '^\(\s*\)[^[:space:]].\{-}\(\s*\)$')
|
||||
if !empty(cs)
|
||||
let lstart = len(cs[1])
|
||||
let lend = len(cs[2])
|
||||
if lstart > 0 && lend > 0
|
||||
let aligns[idx] = 'center'
|
||||
elseif lend > 0
|
||||
let aligns[idx] = 'left'
|
||||
elseif lstart > 0
|
||||
let aligns[idx] = 'right'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
for idx in range(clen)
|
||||
if !has_key(aligns, idx)
|
||||
return {}
|
||||
endif
|
||||
endfor
|
||||
return aligns
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_cell_max_lens(lnum, ...) abort
|
||||
let max_lens = {}
|
||||
for [lnum, row] in s:get_rows(a:lnum)
|
||||
let rows = a:0 > 2 ? a:3 : s:get_rows(a:lnum)
|
||||
for [lnum, row] in rows
|
||||
if s:is_separator(row)
|
||||
continue
|
||||
endif
|
||||
@@ -270,20 +358,67 @@ function! s:get_cell_max_lens(lnum, ...)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_aligned_rows(lnum, col1, col2)
|
||||
let rows = s:get_rows(a:lnum)
|
||||
let startlnum = rows[0][0]
|
||||
function! s:get_aligned_rows(lnum, col1, col2, depth) abort
|
||||
let rows = []
|
||||
let aligns = {}
|
||||
let startlnum = 0
|
||||
let cells = []
|
||||
for [lnum, row] in rows
|
||||
call add(cells, vimwiki#tbl#get_cells(row))
|
||||
endfor
|
||||
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum)
|
||||
let max_lens = {}
|
||||
let check_all = 1
|
||||
if a:depth > 0
|
||||
let rows = s:get_rows(a:lnum, a:depth)
|
||||
let startlnum = len(rows) > 0 ? rows[0][0] : 0
|
||||
let lrows = len(rows)
|
||||
if lrows == a:depth + 1
|
||||
let line = rows[-1][1]
|
||||
if !s:is_separator(line)
|
||||
let lcells = vimwiki#tbl#get_cells(line)
|
||||
let lclen = len(lcells)
|
||||
let lmax_lens = repeat([0], lclen)
|
||||
let laligns = repeat(['left'], lclen)
|
||||
let rows[-1][1] = s:fmt_row(lcells, lmax_lens, laligns, 0, 0)
|
||||
endif
|
||||
let i = 1
|
||||
for [lnum, row] in rows
|
||||
call add(cells, vimwiki#tbl#get_cells(row, i != lrows - 1))
|
||||
let i += 1
|
||||
endfor
|
||||
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
|
||||
" user option not to expand last call
|
||||
if vimwiki#vars#get_global('table_reduce_last_col')
|
||||
let last_index = keys(max_lens)[-1]
|
||||
let max_lens[last_index] = 1
|
||||
endif
|
||||
let fst_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows[0:0])
|
||||
let check_all = max_lens != fst_lens
|
||||
let aligns = s:get_cell_aligns_fast(rows[0:-2])
|
||||
let rows[-1][1] = line
|
||||
endif
|
||||
endif
|
||||
if check_all
|
||||
" all the table must be re-formatted
|
||||
let rows = s:get_rows(a:lnum)
|
||||
let startlnum = len(rows) > 0 ? rows[0][0] : 0
|
||||
let cells = []
|
||||
for [lnum, row] in rows
|
||||
call add(cells, vimwiki#tbl#get_cells(row))
|
||||
endfor
|
||||
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
|
||||
" user option not to expand last call
|
||||
if vimwiki#vars#get_global('table_reduce_last_col')
|
||||
let last_index = keys(max_lens)[-1]
|
||||
let max_lens[last_index] = 1
|
||||
endif
|
||||
endif
|
||||
if empty(aligns)
|
||||
let aligns = s:get_cell_aligns(a:lnum)
|
||||
endif
|
||||
let result = []
|
||||
for [lnum, row] in rows
|
||||
if s:is_separator(row)
|
||||
let new_row = s:fmt_sep(max_lens, a:col1, a:col2)
|
||||
let new_row = s:fmt_sep(max_lens, aligns, a:col1, a:col2)
|
||||
else
|
||||
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, a:col1, a:col2)
|
||||
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, aligns, a:col1, a:col2)
|
||||
endif
|
||||
call add(result, [lnum, new_row])
|
||||
endfor
|
||||
@@ -291,8 +426,8 @@ function! s:get_aligned_rows(lnum, col1, col2)
|
||||
endfunction
|
||||
|
||||
|
||||
" Number of the current column. Starts from 0.
|
||||
function! s:cur_column()
|
||||
function! s:cur_column() abort
|
||||
" Number of the current column. Starts from 0.
|
||||
let line = getline('.')
|
||||
if !s:is_table(line)
|
||||
return -1
|
||||
@@ -300,10 +435,10 @@ function! s:cur_column()
|
||||
" TODO: do we need conditional: if s:is_separator(line)
|
||||
|
||||
let curs_pos = col('.')
|
||||
let mpos = match(line, s:rxSep(), 0)
|
||||
let mpos = match(line, s:r_sep(), 0)
|
||||
let col = -1
|
||||
while mpos < curs_pos && mpos != -1
|
||||
let mpos = match(line, s:rxSep(), mpos+1)
|
||||
let mpos = match(line, s:r_sep(), mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
endif
|
||||
@@ -312,21 +447,26 @@ function! s:cur_column()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:fmt_cell(cell, max_len)
|
||||
function! s:fmt_cell(cell, max_len, align) abort
|
||||
let cell = ' '.a:cell.' '
|
||||
|
||||
let diff = a:max_len - s:wide_len(a:cell)
|
||||
if diff == 0 && empty(a:cell)
|
||||
let diff = 1
|
||||
endif
|
||||
|
||||
let cell .= repeat(' ', diff)
|
||||
if a:align ==# 'left'
|
||||
let cell .= repeat(' ', diff)
|
||||
elseif a:align ==# 'right'
|
||||
let cell = repeat(' ',diff).cell
|
||||
else
|
||||
let cell = repeat(' ',diff/2).cell.repeat(' ',diff-diff/2)
|
||||
endif
|
||||
return cell
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:fmt_row(cells, max_lens, col1, col2)
|
||||
let new_line = s:rxSep()
|
||||
function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort
|
||||
let new_line = s:s_sep()
|
||||
for idx in range(len(a:cells))
|
||||
if idx == a:col1
|
||||
let idx = a:col2
|
||||
@@ -334,81 +474,96 @@ function! s:fmt_row(cells, max_lens, col1, col2)
|
||||
let idx = a:col1
|
||||
endif
|
||||
let value = a:cells[idx]
|
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep()
|
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:s_sep()
|
||||
endfor
|
||||
|
||||
let idx = len(a:cells)
|
||||
while idx < len(a:max_lens)
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep()
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:s_sep()
|
||||
let idx += 1
|
||||
endwhile
|
||||
return new_line
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:fmt_cell_sep(max_len)
|
||||
function! s:fmt_cell_sep(max_len, align) abort
|
||||
let cell = ''
|
||||
if a:max_len == 0
|
||||
return repeat('-', 3)
|
||||
let cell .= '-'
|
||||
else
|
||||
return repeat('-', a:max_len+2)
|
||||
let cell .= repeat('-', a:max_len)
|
||||
endif
|
||||
if a:align ==# 'right'
|
||||
return cell.'-:'
|
||||
elseif a:align ==# 'left'
|
||||
return cell.'--'
|
||||
else
|
||||
return ':'.cell.':'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:fmt_sep(max_lens, col1, col2)
|
||||
let new_line = s:rxSep()
|
||||
function! s:fmt_sep(max_lens, aligns, col1, col2) abort
|
||||
let new_line = s:s_sep()
|
||||
for idx in range(len(a:max_lens))
|
||||
if idx == a:col1
|
||||
let idx = a:col2
|
||||
elseif idx == a:col2
|
||||
let idx = a:col1
|
||||
endif
|
||||
let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep()
|
||||
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:s_sep()
|
||||
endfor
|
||||
return new_line
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:kbd_create_new_row(cols, goto_first)
|
||||
function! s:kbd_create_new_row(cols, goto_first) abort
|
||||
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
|
||||
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
|
||||
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'), 2)\<CR>"
|
||||
let cmd .= "\<ESC>0"
|
||||
if a:goto_first
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'c', line('.'))\<CR>"
|
||||
else
|
||||
let cmd .= (col('.')-1)."l"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= (col('.')-1).'l'
|
||||
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
endif
|
||||
let cmd .= "a"
|
||||
let cmd .= 'a'
|
||||
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:kbd_goto_next_row()
|
||||
function! s:kbd_goto_next_row() abort
|
||||
let cmd = "\<ESC>j"
|
||||
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= "a"
|
||||
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= 'a'
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:kbd_goto_prev_row()
|
||||
function! s:kbd_goto_prev_row() abort
|
||||
let cmd = "\<ESC>k"
|
||||
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= "a"
|
||||
let cmd .= ":call search('.\\(".s:r_sep()."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= 'a'
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
|
||||
" Used in s:kbd_goto_next_col
|
||||
function! vimwiki#tbl#goto_next_col()
|
||||
function! vimwiki#tbl#goto_next_col() abort
|
||||
" Used in s:kbd_goto_next_col
|
||||
let curcol = virtcol('.')
|
||||
let lnum = line('.')
|
||||
let newcol = s:get_indent(lnum)
|
||||
let max_lens = s:get_cell_max_lens(lnum)
|
||||
let depth = 2
|
||||
let newcol = s:get_indent(lnum, depth)
|
||||
let rows = s:get_rows(lnum, depth)
|
||||
let startlnum = len(rows) > 0 ? rows[0][0] : 0
|
||||
let cells = []
|
||||
for [lnum, row] in rows
|
||||
call add(cells, vimwiki#tbl#get_cells(row, 1))
|
||||
endfor
|
||||
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
|
||||
for cell_len in values(max_lens)
|
||||
if newcol >= curcol-1
|
||||
break
|
||||
@@ -420,23 +575,30 @@ function! vimwiki#tbl#goto_next_col()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:kbd_goto_next_col(jumpdown)
|
||||
function! s:kbd_goto_next_col(jumpdown) abort
|
||||
let cmd = "\<ESC>"
|
||||
if a:jumpdown
|
||||
let seps = s:count_separators_down(line('.'))
|
||||
let cmd .= seps."j0"
|
||||
let cmd .= seps.'j0'
|
||||
endif
|
||||
let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a"
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
|
||||
" Used in s:kbd_goto_prev_col
|
||||
function! vimwiki#tbl#goto_prev_col()
|
||||
function! vimwiki#tbl#goto_prev_col() abort
|
||||
" Used in s:kbd_goto_prev_col
|
||||
let curcol = virtcol('.')
|
||||
let lnum = line('.')
|
||||
let newcol = s:get_indent(lnum)
|
||||
let max_lens = s:get_cell_max_lens(lnum)
|
||||
let depth = 2
|
||||
let newcol = s:get_indent(lnum, depth)
|
||||
let rows = s:get_rows(lnum, depth)
|
||||
let startlnum = len(rows) > 0 ? rows[0][0] : 0
|
||||
let cells = []
|
||||
for [lnum, row] in rows
|
||||
call add(cells, vimwiki#tbl#get_cells(row, 1))
|
||||
endfor
|
||||
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
|
||||
let prev_cell_len = 0
|
||||
for cell_len in values(max_lens)
|
||||
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
|
||||
@@ -454,25 +616,24 @@ function! vimwiki#tbl#goto_prev_col()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:kbd_goto_prev_col(jumpup)
|
||||
function! s:kbd_goto_prev_col(jumpup) abort
|
||||
let cmd = "\<ESC>"
|
||||
if a:jumpup
|
||||
let seps = s:count_separators_up(line('.'))
|
||||
let cmd .= seps."k"
|
||||
let cmd .= "$"
|
||||
let cmd .= seps.'k'
|
||||
let cmd .= '$'
|
||||
endif
|
||||
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
|
||||
" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'b', line('.'))\<CR>"
|
||||
" let cmd .= ":call search('\\(".s:r_sep()."\\)\\zs', 'b', line('.'))\<CR>"
|
||||
" let cmd .= "a"
|
||||
"echomsg "DEBUG kbd_goto_prev_col> ".cmd
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#kbd_cr()
|
||||
function! vimwiki#tbl#kbd_cr() abort
|
||||
let lnum = line('.')
|
||||
if !s:is_table(getline(lnum))
|
||||
return ""
|
||||
return ''
|
||||
endif
|
||||
|
||||
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
|
||||
@@ -484,7 +645,7 @@ function! vimwiki#tbl#kbd_cr()
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#kbd_tab()
|
||||
function! vimwiki#tbl#kbd_tab() abort
|
||||
let lnum = line('.')
|
||||
if !s:is_table(getline(lnum))
|
||||
return "\<Tab>"
|
||||
@@ -492,7 +653,7 @@ function! vimwiki#tbl#kbd_tab()
|
||||
|
||||
let last = s:is_last_column(lnum, col('.'))
|
||||
let is_sep = s:is_separator_tail(getline(lnum))
|
||||
"echomsg "DEBUG kbd_tab> last=".last.", is_sep=".is_sep
|
||||
"vimwiki#u#debug("DEBUG kbd_tab> last=".last.", is_sep=".is_sep)
|
||||
if (is_sep || last) && !s:is_table(getline(lnum+1))
|
||||
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
|
||||
return s:kbd_create_new_row(cols, 1)
|
||||
@@ -501,7 +662,7 @@ function! vimwiki#tbl#kbd_tab()
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#kbd_shift_tab()
|
||||
function! vimwiki#tbl#kbd_shift_tab() abort
|
||||
let lnum = line('.')
|
||||
if !s:is_table(getline(lnum))
|
||||
return "\<S-Tab>"
|
||||
@@ -509,16 +670,17 @@ function! vimwiki#tbl#kbd_shift_tab()
|
||||
|
||||
let first = s:is_first_column(lnum, col('.'))
|
||||
let is_sep = s:is_separator_tail(getline(lnum))
|
||||
"echomsg "DEBUG kbd_tab> ".first
|
||||
"vimwiki#u#debug("kbd_tab> ".first)
|
||||
if (is_sep || first) && !s:is_table(getline(lnum-1))
|
||||
return ""
|
||||
return ''
|
||||
endif
|
||||
return s:kbd_goto_prev_col(is_sep || first)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#format(lnum, ...)
|
||||
if !(&filetype ==? 'vimwiki')
|
||||
function! vimwiki#tbl#format(lnum, ...) abort
|
||||
" Clause in
|
||||
if !vimwiki#u#ft_is_vw()
|
||||
return
|
||||
endif
|
||||
let line = getline(a:lnum)
|
||||
@@ -526,6 +688,11 @@ function! vimwiki#tbl#format(lnum, ...)
|
||||
return
|
||||
endif
|
||||
|
||||
" Backup textwidth
|
||||
let textwidth = &textwidth
|
||||
|
||||
let depth = a:0 == 1 ? a:1 : 0
|
||||
|
||||
if a:0 == 2
|
||||
let col1 = a:1
|
||||
let col2 = a:2
|
||||
@@ -534,23 +701,27 @@ function! vimwiki#tbl#format(lnum, ...)
|
||||
let col2 = 0
|
||||
endif
|
||||
|
||||
let indent = s:get_indent(a:lnum)
|
||||
let indent = s:get_indent(a:lnum, depth)
|
||||
if &expandtab
|
||||
let indentstring = repeat(' ', indent)
|
||||
else
|
||||
let indentstring = repeat(' ', indent / &tabstop) . repeat(' ', indent % &tabstop)
|
||||
execute "let indentstring = repeat('\<TAB>', indent / &tabstop) . repeat(' ', indent % &tabstop)"
|
||||
endif
|
||||
|
||||
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2)
|
||||
" getting N = depth last rows is enough for having been formatted tables
|
||||
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2, depth)
|
||||
let row = indentstring.row
|
||||
call setline(lnum, row)
|
||||
if getline(lnum) != row
|
||||
call setline(lnum, row)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let &tw = s:textwidth
|
||||
" Restore user textwidth
|
||||
let &textwidth = textwidth
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#create(...)
|
||||
function! vimwiki#tbl#create(...) abort
|
||||
if a:0 > 1
|
||||
let cols = a:1
|
||||
let rows = a:2
|
||||
@@ -586,118 +757,100 @@ function! vimwiki#tbl#create(...)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#align_or_cmd(cmd)
|
||||
function! vimwiki#tbl#align_or_cmd(cmd, ...) abort
|
||||
if s:is_table(getline('.'))
|
||||
call vimwiki#tbl#format(line('.'))
|
||||
call call('vimwiki#tbl#format', [line('.')] + a:000)
|
||||
else
|
||||
exe 'normal! '.a:cmd
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#reset_tw(lnum)
|
||||
if !(&filetype ==? 'vimwiki')
|
||||
return
|
||||
endif
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
let s:textwidth = &tw
|
||||
let &tw = 0
|
||||
endfunction
|
||||
|
||||
|
||||
" TODO: move_column_left and move_column_right are good candidates to be refactored.
|
||||
function! vimwiki#tbl#move_column_left()
|
||||
|
||||
"echomsg "DEBUG move_column_left: "
|
||||
|
||||
function! vimwiki#tbl#move_column_left() abort
|
||||
" TODO: move_column_left and move_column_right are good candidates to be refactored.
|
||||
" Clause in
|
||||
let line = getline('.')
|
||||
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
let cur_col = s:cur_column()
|
||||
if cur_col == -1
|
||||
return
|
||||
endif
|
||||
|
||||
if cur_col > 0
|
||||
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
|
||||
call cursor(line('.'), 1)
|
||||
|
||||
let sep = '\('.s:rxSep().'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col-1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#move_column_right()
|
||||
|
||||
let line = getline('.')
|
||||
|
||||
if !s:is_table(line)
|
||||
if cur_col <= 0
|
||||
return
|
||||
endif
|
||||
|
||||
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
|
||||
call cursor(line('.'), 1)
|
||||
|
||||
let sep = '\('.s:r_sep().'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col-1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#move_column_right() abort
|
||||
" Clause in
|
||||
let line = getline('.')
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
let cur_col = s:cur_column()
|
||||
if cur_col == -1
|
||||
return
|
||||
endif
|
||||
|
||||
if cur_col < s:col_count(line('.'))-1
|
||||
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
|
||||
call cursor(line('.'), 1)
|
||||
|
||||
let sep = '\('.s:rxSep().'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col+1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
if cur_col >= s:col_count(line('.'))-1
|
||||
return
|
||||
endif
|
||||
|
||||
" Format table && Put cursor on first col
|
||||
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
|
||||
call cursor(line('.'), 1)
|
||||
|
||||
" Change add one to all col
|
||||
let sep = '\('.s:r_sep().'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col+1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#get_rows(lnum)
|
||||
function! vimwiki#tbl#get_rows(lnum) abort
|
||||
return s:get_rows(a:lnum)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#is_table(line)
|
||||
function! vimwiki#tbl#is_table(line) abort
|
||||
return s:is_table(a:line)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#is_separator(line)
|
||||
function! vimwiki#tbl#is_separator(line) abort
|
||||
return s:is_separator(a:line)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#cell_splitter()
|
||||
function! vimwiki#tbl#cell_splitter() abort
|
||||
return s:cell_splitter()
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#sep_splitter()
|
||||
function! vimwiki#tbl#sep_splitter() abort
|
||||
return s:sep_splitter()
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -3,7 +3,127 @@
|
||||
" Description: Utility functions
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
function! vimwiki#u#trim(string, ...)
|
||||
function! vimwiki#u#echo(msg, ...) abort
|
||||
" Echo: msg
|
||||
" :param: (1) <string> highlighting group
|
||||
" :param: (2) <string> echo suffix (ex: 'n', 'm')
|
||||
" :param: (3) <string> message prefix, default Vimwiki
|
||||
let hl_group = a:0 > 0 ? a:1 : ''
|
||||
let echo_suffix = a:0 > 1 ? a:2 : ''
|
||||
let msg_prefix = a:0 > 2 ? a:3 : 'Vimwiki: '
|
||||
" Start highlighting
|
||||
if hl_group !=# ''
|
||||
exe 'echohl ' . hl_group
|
||||
endif
|
||||
|
||||
" Escape
|
||||
let msg = substitute(a:msg, "'", "''", 'g')
|
||||
" Print
|
||||
exe 'echo'.echo_suffix . " '" . msg_prefix . msg . "'"
|
||||
|
||||
" Stop highlighting
|
||||
if hl_group !=# ''
|
||||
echohl None
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#debug(msg) abort
|
||||
" Debug: msg
|
||||
" let b:vimwiki_debug to trigger
|
||||
if !exists('b:vimwiki_debug') || b:vimwiki_debug == 0
|
||||
return
|
||||
endif
|
||||
echomsg 'DEBUG: ' . a:msg
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#warn(msg) abort
|
||||
" Warn: msg
|
||||
call vimwiki#u#echo('Warning: ' . a:msg, 'WarningMsg', '')
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#error(msg) abort
|
||||
" Error: msg
|
||||
call vimwiki#u#echo('Error: ' . a:msg, 'Error', 'msg')
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#deprecate(old, new) abort
|
||||
" Warn: deprecated feature: old -> new
|
||||
call vimwiki#u#warn('Deprecated: ' . a:old . ' is deprecated and '
|
||||
\ . 'will be removed in future versions. Use ' . a:new . ' instead.')
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#get_selection(...) abort
|
||||
" Get visual selection text content, optionally replace its content
|
||||
" :param: Text to replace selection
|
||||
" Copied from DarkWiiPlayer at stackoverflow
|
||||
" https://stackoverflow.com/a/47051271/2544873
|
||||
" Get selection extremity position,
|
||||
" Discriminate selection mode
|
||||
if mode() ==? 'v'
|
||||
let [line_start, column_start] = getpos('v')[1:2]
|
||||
let [line_end, column_end] = getpos('.')[1:2]
|
||||
else
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
end
|
||||
|
||||
" Guard
|
||||
if (line2byte(line_start)+column_start) > (line2byte(line_end)+column_end)
|
||||
let [line_start, column_start, line_end, column_end] =
|
||||
\ [line_end, column_end, line_start, column_start]
|
||||
end
|
||||
let lines = getline(line_start, line_end)
|
||||
if len(lines) == 0
|
||||
return ''
|
||||
endif
|
||||
|
||||
" If want to modify selection
|
||||
if a:0 > 0
|
||||
" Grab new content
|
||||
let line_link = a:1
|
||||
|
||||
" Grab the content of line around the link: pre and post
|
||||
let start_link = max([column_start - 2, 0])
|
||||
let line_pre = ''
|
||||
if start_link > 0
|
||||
let line_pre .= lines[0][ : start_link]
|
||||
endif
|
||||
let line_post = lines[0][column_end - (&selection ==# 'inclusive' ? 0 : 1) : ]
|
||||
|
||||
" Set the only single selected line
|
||||
call setline(line_start, line_pre . line_link . line_post)
|
||||
endif
|
||||
|
||||
" Get selection extremity position, take into account selection option
|
||||
let lines[-1] = lines[-1][: column_end - (&selection ==# 'inclusive' ? 1 : 2)]
|
||||
let lines[0] = lines[0][column_start - 1:]
|
||||
return join(lines, "\n")
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#count_exe(cmd) abort
|
||||
" Execute: string v:count times
|
||||
" Called: prefixable mapping
|
||||
for i in range( max([1, v:count]) )
|
||||
exe a:cmd
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#sort_len(list) abort
|
||||
function! s:len_compare(s1, s2) abort
|
||||
let i1 = len(a:s1)
|
||||
let i2 = len(a:s2)
|
||||
return i1 == i2 ? 0 : i1 > i2 ? 1 : -1
|
||||
endfunction
|
||||
return sort(a:list, 's:len_compare')
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#trim(string, ...) abort
|
||||
" Trim spaces: leading and trailing
|
||||
" :param: string in
|
||||
" :param: (1) <string> optional list of character to trim
|
||||
let chars = ''
|
||||
if a:0 > 0
|
||||
let chars = a:1
|
||||
@@ -14,59 +134,363 @@ function! vimwiki#u#trim(string, ...)
|
||||
endfunction
|
||||
|
||||
|
||||
" Builtin cursor doesn't work right with unicode characters.
|
||||
function! vimwiki#u#cursor(lnum, cnum)
|
||||
function! vimwiki#u#cursor(lnum, cnum) abort
|
||||
" Builtin cursor doesn't work right with unicode characters.
|
||||
exe a:lnum
|
||||
exe 'normal! 0'.a:cnum.'|'
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_windows()
|
||||
return has("win32") || has("win64") || has("win95") || has("win16")
|
||||
function! vimwiki#u#os_name() abort
|
||||
" Returns: OS name, human readable
|
||||
if vimwiki#u#is_windows()
|
||||
return 'Windows'
|
||||
elseif vimwiki#u#is_macos()
|
||||
return 'Mac'
|
||||
else
|
||||
return 'Linux'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_macos()
|
||||
if has("mac") || has("macunix") || has("gui_mac")
|
||||
function! vimwiki#u#is_windows() abort
|
||||
" Check if OS is windows
|
||||
return has('win32') || has('win64') || has('win95') || has('win16')
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_macos() abort
|
||||
" Check if OS is mac
|
||||
if has('mac') || has('macunix') || has('gui_mac')
|
||||
return 1
|
||||
endif
|
||||
" that still doesn't mean we are not on Mac OS
|
||||
let os = substitute(system('uname'), '\n', '', '')
|
||||
return os == 'Darwin' || os == 'Mac'
|
||||
return os ==? 'Darwin' || os ==? 'Mac'
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#count_first_sym(line)
|
||||
function! vimwiki#u#count_first_sym(line) abort
|
||||
let first_sym = matchstr(a:line, '\S')
|
||||
return len(matchstr(a:line, first_sym.'\+'))
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#escape(string)
|
||||
function! vimwiki#u#escape(string) abort
|
||||
" Escape string for literal magic regex match
|
||||
return escape(a:string, '~.*[]\^$')
|
||||
endfunction
|
||||
|
||||
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
function vimwiki#u#reload_regexes()
|
||||
function! vimwiki#u#reload_regexes() abort
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
|
||||
endfunction
|
||||
|
||||
|
||||
" Load syntax-specific functionality
|
||||
function vimwiki#u#reload_regexes_custom()
|
||||
function! vimwiki#u#reload_regexes_custom() abort
|
||||
" Load syntax-specific functionality
|
||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
|
||||
endfunction
|
||||
|
||||
|
||||
" Backward compatible version of the built-in function shiftwidth()
|
||||
if exists('*shiftwidth')
|
||||
func vimwiki#u#sw()
|
||||
function! vimwiki#u#sw() abort
|
||||
" Backward compatible version of the built-in function shiftwidth()
|
||||
if exists('*shiftwidth')
|
||||
return shiftwidth()
|
||||
endfunc
|
||||
else
|
||||
func vimwiki#u#sw()
|
||||
return &sw
|
||||
endfunc
|
||||
endif
|
||||
else
|
||||
return &shiftwidth
|
||||
endif
|
||||
endfunc
|
||||
|
||||
function! vimwiki#u#map_key(mode, key, plug, ...) abort
|
||||
" a:mode single character indicating the mode as defined by :h maparg
|
||||
" a:key the key sequence to map
|
||||
" a:plug the plug command the key sequence should be mapped to
|
||||
" a:1 optional argument with the following functionality:
|
||||
" if a:1==1 then the hasmapto(<Plug>) check is skipped.
|
||||
" this can be used to map different keys to the same <Plug> definition
|
||||
" if a:1==2 then the mapping is not <buffer> specific i.e. it is global
|
||||
if a:0 && a:1 == 2
|
||||
" global mappings
|
||||
if !hasmapto(a:plug, a:mode) && maparg(a:key, a:mode) ==# ''
|
||||
exe a:mode . 'map ' . a:key . ' ' . a:plug
|
||||
endif
|
||||
elseif a:0 && a:1 == 1
|
||||
" vimwiki buffer mappings, repeat mapping to the same <Plug> definition
|
||||
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
|
||||
else
|
||||
" vimwiki buffer mappings
|
||||
if !hasmapto(a:plug, a:mode)
|
||||
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_codeblock(lnum) abort
|
||||
" Returns: 1 if line is a code block or math block
|
||||
"
|
||||
" The last two conditions are needed for this to correctly
|
||||
" detect nested syntaxes within code blocks
|
||||
let syn_g = synIDattr(synID(a:lnum,1,1),'name')
|
||||
if syn_g =~# 'Vimwiki\(Pre.*\|IndentedCodeBlock\|Math.*\)'
|
||||
\ || (syn_g !~# 'Vimwiki.*' && syn_g !=? '')
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#ft_set() abort
|
||||
" Sets the filetype to vimwiki
|
||||
" If g:vimwiki_filetypes variable is set
|
||||
" the filetype will be vimwiki.<ft1>.<ft2> etc.
|
||||
let ftypelist = vimwiki#vars#get_global('filetypes')
|
||||
let ftype = 'vimwiki'
|
||||
for ftypeadd in ftypelist
|
||||
let ftype = ftype . '.' . ftypeadd
|
||||
endfor
|
||||
let &filetype = ftype
|
||||
endfunction
|
||||
|
||||
function! vimwiki#u#ft_is_vw() abort
|
||||
" Returns: 1 if filetype is vimwiki, 0 else
|
||||
" If multiple fileytpes are in use 1 is returned only if the
|
||||
" first ft is vimwiki which should always be the case unless
|
||||
" the user manually changes it to something else
|
||||
" Clause: is filetype defined
|
||||
if &filetype ==# '' | return 0 | endif
|
||||
if split(&filetype, '\.')[0] ==? 'vimwiki'
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#get_syntax_dic(...) abort
|
||||
" Helper: Getter
|
||||
" :param: syntax <string> to retrieve, default to current
|
||||
let syntax = a:0 ? a:1 : vimwiki#vars#get_wikilocal('syntax')
|
||||
return g:vimwiki_syntaxlocal_vars[syntax]
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#get_punctuation_regex() abort
|
||||
" Helper: to mutualize
|
||||
" Called: normalize and unnormalize anchor
|
||||
" From: https://gist.github.com/asabaylus/3071099#gistcomment-2563127
|
||||
" Faster
|
||||
" Unused now
|
||||
if v:version <= 703
|
||||
" Retrocompatibility: Get invalid range for vim 7.03
|
||||
return '[^0-9a-zA-Z_ \-]'
|
||||
else
|
||||
return '[^0-9a-zA-Z\u4e00-\u9fff_ \-]'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#get_punctuation_string() abort
|
||||
" Faster
|
||||
" See: https://github.github.com/gfm/#ascii-punctuation-character
|
||||
" res = '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
|
||||
" But I removed the * as it is treated as a special case
|
||||
return '!"#$%&''()+,-./:;<=>?@\[\\\]^`{}|~'
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#hi_expand_regex(lst) abort
|
||||
" Helper: Expand regex from reduced typeface delimiters
|
||||
" :param: list<list,delimiters>> with reduced regex
|
||||
" 1: Left delimiter
|
||||
" 2: right delimiter
|
||||
" 3: possible characters to ignore (default '$^' => never match)
|
||||
" 4: can multiply delimiter (boolean) (default 0 => do not repeat)
|
||||
" Return: list with extended regex delimiters (not inside a word)
|
||||
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
|
||||
" Note: For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.
|
||||
" See: https://github.github.com/gfm/#left-flanking-delimiter-run
|
||||
let res = []
|
||||
let punctuation = vimwiki#u#get_punctuation_string()
|
||||
|
||||
" Iterate on (left delimiter, right delimiter pair)
|
||||
for a_delimiter in a:lst
|
||||
let r_left_del = a_delimiter[0]
|
||||
let r_right_del = a_delimiter[1]
|
||||
let r_repeat_del = len(a_delimiter) >= 3 ? a_delimiter[2] : '$^'
|
||||
let b_can_mult = len(a_delimiter) >= 4 ? a_delimiter[3] : 0
|
||||
|
||||
" Craft the repeatable middle
|
||||
let r_mult = b_can_mult ? '\+' : ''
|
||||
let r_left_repeat = '\%(\%(' . r_left_del . '\)' . r_mult . '\)'
|
||||
let r_right_repeat = '\%(\%(' . r_right_del . '\)' . r_mult . '\)'
|
||||
let r_unescaped_repeat = '\%(\\\|\\\@<!' . r_repeat_del . '\)'
|
||||
|
||||
" Regex Start:
|
||||
" Left-Flanking is not followed by space (or need of line)
|
||||
|
||||
" Left Case1: not followed by punctuation, start with blacklist
|
||||
" -- Can escape the leftflank
|
||||
let r_left_prefix1 = '\%(^\|' . r_unescaped_repeat . '\@<!\)'
|
||||
let r_left_suffix1 = '\%(\%([[:space:]\n' . punctuation . ']\|' . r_unescaped_repeat . '\)\@!\)'
|
||||
|
||||
" Left Case2: followed by punctuation so must be preceded by whitelisted Unicode whitespace or start of line or a punctuation character.
|
||||
let r_left_prefix2 = '\%(\%(^\|[[:space:]\n' . punctuation . ']\)\@<=\)'
|
||||
let r_left_suffix2 = '\%([' . punctuation . ']\@=\)'
|
||||
|
||||
" Left Concatenate
|
||||
let r_start = '\%(' . r_left_prefix1 . '\zs' . r_left_repeat . '\ze' . r_left_suffix1
|
||||
let r_start .= '\|' . r_left_prefix2 . '\zs' . r_left_repeat . '\ze' . r_left_suffix2 . '\)'
|
||||
|
||||
" Regex End:
|
||||
" not preceded by Unicode whitespace
|
||||
let r_right_prefix = '\(^\|[^[:space:]]\@<=\)'
|
||||
|
||||
" Right Case1: not preceded by a punctuation character (or start of line)
|
||||
let r_right_prefix1 = '\%(^\|\%([[:space:]\n' . punctuation . ']\|' . r_unescaped_repeat . '\)\@<!\)'
|
||||
let r_right_suffix1 = '\%($\|' . r_unescaped_repeat . '\@!\)'
|
||||
|
||||
" Right Case2: preceded by a punctuation character and followed by Unicode whitespace or end of line or a punctuation character
|
||||
let r_right_prefix2 = '\%([' . punctuation . ']\@<=\)'
|
||||
let r_right_suffix2 = '\%(\%($\|[[:space:]' . punctuation . ']\)\@<=\)'
|
||||
|
||||
" Right Concatenate
|
||||
let r_end = '\%(' . r_right_prefix1 . r_right_repeat . r_right_suffix1
|
||||
let r_end .= '\|' . r_right_prefix2 . r_right_repeat . r_right_suffix2 . '\)'
|
||||
|
||||
call add(res, [r_start, r_end])
|
||||
endfor
|
||||
|
||||
return res
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
|
||||
" Helper: Create highlight region between two tags
|
||||
" :param: tag_pre <string>: opening tag example '<b>'
|
||||
" :param: tag_post <string>: closing tag example '</b>'
|
||||
" :param: syntax_group <string> example: VimwikiBold
|
||||
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
|
||||
" :param: (1) <boolean> is contained
|
||||
" :param: (2) <string> more param ex:oneline
|
||||
|
||||
" Discriminate parameters
|
||||
let opt_is_contained = a:0 > 0 && a:1 > 0 ? 'contained ' : ''
|
||||
let opt_more = a:0 > 1 ? ' ' . a:2 : ''
|
||||
let opt_contains = ''
|
||||
if a:contains !=# ''
|
||||
let opt_contains = 'contains=' . a:contains . ' '
|
||||
endif
|
||||
|
||||
" Craft command
|
||||
" \ 'skip="\\' . a:tag_pre . '" ' .
|
||||
let cmd = 'syn region ' . a:syntax_group . ' matchgroup=VimwikiDelimiter ' .
|
||||
\ opt_is_contained .
|
||||
\ 'start="' . a:tag_pre . '" ' .
|
||||
\ 'end="' . a:tag_post . '" ' .
|
||||
\ 'keepend ' .
|
||||
\ opt_contains .
|
||||
\ b:vimwiki_syntax_concealends .
|
||||
\ opt_more
|
||||
exe cmd
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#hi_typeface(dic) abort
|
||||
" Highight typeface: see $VIMRUNTIME/syntax/html.vim
|
||||
" -- Basically allow nesting with multiple definition contained
|
||||
" :param: dic <dic:list:list> must contain: bold, italic and underline, even if underline is often void,
|
||||
" -- see here for underline not defined: https://stackoverflow.com/questions/3003476
|
||||
" Italic must go before, otherwise single * takes precedence over ** and ** is considered as
|
||||
" -- a void italic.
|
||||
" Note:
|
||||
" The last syntax defined take precedence so that user can change at runtime (:h :syn-define)
|
||||
" Some cases are contained by default:
|
||||
" -- ex: VimwikiCodeBoldUnderline is not defined in colorschemes -> VimwikiCode
|
||||
" -- see: #709 asking for concealing quotes in bold, so it must be highlighted differently
|
||||
" -- -- for the user to understand what is concealed around
|
||||
" VimwikiCheckBoxDone and VimwikiDelText are as their are even when nested in bold or italic
|
||||
" -- This is because it would add a lot of code (as n**2) at startup and is not often used
|
||||
" -- Here n=3 (bold, italic, underline)
|
||||
" Bold > Italic > Underline
|
||||
|
||||
let nested = vimwiki#u#get_syntax_dic().nested
|
||||
|
||||
" Bold Italic
|
||||
if has_key(a:dic, 'bold_italic')
|
||||
for bi in a:dic['bold_italic']
|
||||
call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline')
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Italic
|
||||
for i in a:dic['italic']
|
||||
" -- Italic 1
|
||||
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiItalic ', nested .',VimwikiItalicBold,VimwikiItalicUnderline')
|
||||
" -- Bold 2
|
||||
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline', 1)
|
||||
" -- Bold 3
|
||||
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiBoldUnderlineItalic', nested, 2)
|
||||
" -- Underline 2
|
||||
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiUnderlineItalic', nested . ',VimwikiUnderlineItalicBold', 1)
|
||||
" -- Underline 3
|
||||
call vimwiki#u#hi_tag(i[0], i[1], 'VimwikiUnderlineBoldItalic', nested, 2)
|
||||
endfor
|
||||
|
||||
" Bold
|
||||
for b in a:dic['bold']
|
||||
" -- Bold 1
|
||||
call vimwiki#u#hi_tag(b[0],b[1], 'VimwikiBold', nested . ',VimwikiBoldUnderline,VimwikiBoldItalic')
|
||||
" -- Italic 2
|
||||
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiItalicBold', nested . ',VimwikiItalicBoldUnderline', 1)
|
||||
" -- Italic 3
|
||||
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiItalicUnderlineBold', nested, 2)
|
||||
" -- Underline 2
|
||||
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineBold', nested . ',VimwikiUnderlineBoldItalic', 1)
|
||||
" -- Underline 3
|
||||
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2)
|
||||
endfor
|
||||
|
||||
" Underline
|
||||
for u in a:dic['underline']
|
||||
" -- Underline 1
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiUnderline', nested . ',VimwikiUnderlineBold,VimwikiUnderlineItalic')
|
||||
" -- Italic 2
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiItalicUnderline', nested . ',VimwikiItalicUnderlineBold', 1)
|
||||
" -- Italic 3
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiBoldItalicUnderline', nested, 2)
|
||||
" -- Underline 2
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiBoldUnderline', nested . ',VimwikiBoldUnderlineItalic', 1)
|
||||
" -- Underline 3
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiItalicBoldUnderline', nested, 2)
|
||||
endfor
|
||||
|
||||
" Strikethrough
|
||||
" Note: VimwikiBoldDelText Not Implemented (see above)
|
||||
for u in a:dic['del']
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiDelText', nested)
|
||||
endfor
|
||||
|
||||
"" Code do not contain anything but can be contained very nested
|
||||
for u in a:dic['code']
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiCode', '')
|
||||
endfor
|
||||
|
||||
" Superscript
|
||||
for u in a:dic['sup']
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiSuperScript', nested, 0, 'oneline')
|
||||
endfor
|
||||
|
||||
" Subscript
|
||||
for u in a:dic['sub']
|
||||
call vimwiki#u#hi_tag(u[0], u[1], 'VimwikiSubScript', nested, 0, 'oneline')
|
||||
endfor
|
||||
|
||||
" Prevent var_with_underscore to trigger italic text
|
||||
" -- See $VIMRUNTIME/syntax/markdown.vim
|
||||
" But leave
|
||||
" -- See https://github.github.com/gfm/#example-364
|
||||
syn match VimwikiError "\w\@<=_\w\@="
|
||||
endfunction
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
= Contents =
|
||||
- [[#VimWiki file link resolution]]
|
||||
- [[#context]]
|
||||
- [[#possible solutions]]
|
||||
- [[#revert to original behavior]]
|
||||
- [[#check if a file exists on disk when following link]]
|
||||
- [[#add a link scheme that means "open in vim"]]
|
||||
- [[#add a configuration toggle for opening file: links in vim]]
|
||||
- [[#add configuration for a set of filetypes to open in vim]]
|
||||
- [[#open questions]]
|
||||
|
||||
= VimWiki file link resolution =
|
||||
|
||||
A decision document started by Brennen Bearnes on 2023-03-23.
|
||||
|
||||
== context ==
|
||||
|
||||
https://github.com/vimwiki/vimwiki/issues/950
|
||||
|
||||
https://github.com/vimwiki/vimwiki/commit/d7ec12645a0460a7d200279c52915e6e080e9869
|
||||
|
||||
Commit d7ec126 applies the wiki extension to files containing a `.`, thus
|
||||
allowing page names to contain a literal period. This is correct behavior,
|
||||
insofar as pages like `Franklin D. Roosevelt` should be able to exist and get
|
||||
mapped to e.g. `Franklin D. Roosevelt.wiki`.
|
||||
|
||||
Unfortunately, this broke behavior that a number of users rely on:
|
||||
|
||||
https://github.com/vimwiki/vimwiki/issues/1271
|
||||
|
||||
I have some latex files stored and linked to in my wiki.
|
||||
|
||||
Before d7ec126 I could omit the file: part of a link to have vim open the file
|
||||
directly.
|
||||
|
||||
After d7ec126 vimwiki adds a `md` extension when opening any file which
|
||||
results in a `filename.tex.md` being created alongside the original tex
|
||||
file. Using `file:` is not a solution since this can only be configured to
|
||||
open a second instance of vim.
|
||||
|
||||
It makes sense that this is useful.
|
||||
|
||||
Sidebar: `file:` _can_ be configured to do just about anything with a custom
|
||||
handler, but that doesn't mean it's a very good user experience.
|
||||
|
||||
= possible solutions =
|
||||
|
||||
== revert to original behavior ==
|
||||
|
||||
As a default, I personally think this is a non-starter. Not being able to use
|
||||
`.` in page names is broken. I also suspect other things break if you treat
|
||||
those files as wiki pages.
|
||||
|
||||
We could make it configurable, though.
|
||||
|
||||
*Pro:*
|
||||
|
||||
- People can go back to their expected behavior by setting one config
|
||||
variable.
|
||||
|
||||
*Con:*
|
||||
|
||||
- Adds an extra branch to link handling code.
|
||||
- I haven't thought through the implications of treating it as fully
|
||||
supported behavior. What else will people expect to work right?
|
||||
|
||||
== check if a file exists on disk when following link ==
|
||||
|
||||
The idea is that if a link is `[[foo.txt]]` and `foo.txt` already exists, we
|
||||
should edit the existing file instead of creating a `foo.txt.md`.
|
||||
|
||||
*Pro:*
|
||||
|
||||
- Might be the closest to expectations of people who rely on the old
|
||||
behavior.
|
||||
- Doesn't expand the language itself.
|
||||
|
||||
*Con:*
|
||||
|
||||
- Complicates link handling code.
|
||||
- Parsing a page requires knowing about external files.
|
||||
- Might be surprising / confusing. You can write `foo.txt` and wind up with
|
||||
two different outcomes depending on whether `foo.txt` already exists.
|
||||
- It's very Do What I Mean, which isn't necessarily bad. But if I write a
|
||||
link to `foo.txt` and wind up at `foo.txt.md`, it's not obvious that's
|
||||
what I meant.
|
||||
|
||||
== add a link scheme that means "open in vim" ==
|
||||
|
||||
Something like `[[edit:foo.txt]]`.
|
||||
|
||||
I vaguely think there's prior art for this in some older browsers? I could
|
||||
swear Lynx had something like it, although I couldn't find anything under:
|
||||
|
||||
- [[https://en.wikipedia.org/wiki/List_of_URI_schemes|wp:List of URI schemes]]
|
||||
- [[https://lynx.invisible-island.net/lynx_help/lynx_url_support.html|list of Lynx URL schemes]].
|
||||
|
||||
I may just be thinking of `lynxexec:`.
|
||||
|
||||
*Pro:*
|
||||
|
||||
- People want this anyway, and a `VimwikiLinkHandler()` for using `file:` or
|
||||
some custom prefix to handle it is a common tweak to configurations which
|
||||
we already document.
|
||||
- It doesn't need a file existence check.
|
||||
|
||||
*Con:*
|
||||
|
||||
- Expands the language.
|
||||
- How is this converted to HTML?
|
||||
- What will Markdown parsers do with it?
|
||||
- Right now there are at least 3 high-level paths for opening a link:
|
||||
- Open in VimWiki
|
||||
- Hand off to custom link handler
|
||||
- Open with `vimwiki#base#system_open_link()`
|
||||
- ...this would introduce a 4th.
|
||||
- Unless there is prior art, this would be something that _looks_ like a
|
||||
URL/URI, but isn't recognized outside the wiki. That seems fine for
|
||||
custom prefixes, but is it ok to introduce here?
|
||||
|
||||
== add a configuration toggle for opening file: links in vim ==
|
||||
|
||||
Add a boolean that says "just open `file:` and `local:` links in the editor".
|
||||
|
||||
*Pro:*
|
||||
|
||||
- Probably a relatively simple change.
|
||||
- Might meet some users' needs.
|
||||
|
||||
*Con:*
|
||||
|
||||
- Loses the utility in linking to binary filetypes which are best opened via
|
||||
the system handler (images, PDFs, etc.).
|
||||
- Users are explicitly already relying on `file:` links to be distinct from
|
||||
`[[file.foo]]` links.
|
||||
|
||||
== add configuration for a set of filetypes to open in vim ==
|
||||
|
||||
A variation on the toggle for `file:` links would be to allow configuring a
|
||||
_list_ of file extensions which should be opened with Vim rather than passed on
|
||||
to the system handler.
|
||||
|
||||
Something like:
|
||||
|
||||
{{{vim
|
||||
let wiki.file_link_edit_ext = ['txt', 'csv']
|
||||
}}}
|
||||
|
||||
*Pro:*
|
||||
|
||||
- Doesn't expand the language.
|
||||
- Doesn't have any implications for HTML rendering.
|
||||
- A lot of `VimwikiLinkHandler()` boilerplate that is just used for making
|
||||
links open in Vim could go away.
|
||||
- I have this in my own config, so it's an appealing feature.
|
||||
|
||||
*Con:*
|
||||
|
||||
- Does require people to rewrite existing link collections, but that's
|
||||
true of other solutions as well.
|
||||
|
||||
*Unanswered:*
|
||||
|
||||
- Would there be any sensible default for this besides an empty list?
|
||||
My guess is not.
|
||||
|
||||
= open questions =
|
||||
|
||||
- What is the actual current behavior with Markdown?
|
||||
- Does it differ meaningfully from vimwiki syntax?
|
||||
- If so, why?
|
||||
@@ -0,0 +1,257 @@
|
||||
# Design Notes
|
||||
|
||||
This file is meant to document design decisions and algorithms inside Vimwiki
|
||||
which are too large for code comments, and not necessarily interesting to
|
||||
users. Please create a new section to document each behavior.
|
||||
|
||||
## Link resolution
|
||||
|
||||
See [VimWiki file link resolution](./2023-03-23-file-link-resolution.wiki).
|
||||
|
||||
## Formatting tables
|
||||
|
||||
In Vimwiki, formatting tables occurs dynamically, when navigating between cells
|
||||
and adding new rows in a table in the Insert mode, or statically, when pressing
|
||||
`gqq` or `gqw` (which are mappings for commands `VimwikiTableAlignQ` and
|
||||
`VimwikiTableAlignW` respectively) in the Normal mode. It also triggers when
|
||||
leaving Insert mode, provided variable `g:vimwiki_table_auto_fmt` is set. In
|
||||
this section, the original and the newer optimized algorithms of table
|
||||
formatting will be described and compared.
|
||||
|
||||
### The older table formatting algorithm and why this is not optimal
|
||||
|
||||
Let's consider a simple example. Open a new file, say _tmp.wiki_, and create a
|
||||
new table with command `VimwikiTable`. This should create a blank table.
|
||||
|
||||
```
|
||||
| | | | | |
|
||||
|---|---|---|---|---|
|
||||
| | | | | |
|
||||
```
|
||||
|
||||
Let's put the cursor in the first header column of the table, enter the Insert
|
||||
mode and type a name, say _Col1_. Then press _Tab_: the cursor will move to the
|
||||
second column of the header and the table will get aligned (in the context of
|
||||
the table formatting story, words _aligned_ and _formatted_ are considered as
|
||||
synonyms). Now the table looks as in the following snippet.
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|------|---|---|---|---|
|
||||
| | | | | |
|
||||
```
|
||||
|
||||
Then, when moving cursor to the first data row (i.e. to the third line of the
|
||||
table below the separator line) and typing anything here and there while
|
||||
navigating using _Tab_ or _Enter_ (pressing this creates a new row below the
|
||||
current row), the table shall keep formatting. Below is a result of such a
|
||||
random edit.
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|------|-------|---|-------|----------|
|
||||
| | Data1 | | Data2 | |
|
||||
| | | | | New data |
|
||||
```
|
||||
|
||||
The lowest row gets aligned when leaving the Insert mode. Let's copy _Data1_
|
||||
(using `viwy` or another keystroke) and paste it (using `p`) in the second data
|
||||
row of the first column. Now the table looks misaligned (as we did not enter
|
||||
the Insert mode).
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|------|-------|---|-------|----------|
|
||||
| | Data1 | | Data2 | |
|
||||
| Data1 | | | | New data |
|
||||
```
|
||||
|
||||
This is not a big problem though, because we can put the cursor at _any_ place
|
||||
in the table and press `gqq`: the table will get aligned.
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|-------|-------|---|-------|----------|
|
||||
| | Data1 | | Data2 | |
|
||||
| Data1 | | | | New data |
|
||||
```
|
||||
|
||||
Now let's make real problems! Move the cursor to the lowest row and copy it
|
||||
with `yy`. Then 500-fold paste it with `500p`. Now the table very long. Move
|
||||
the cursor to the lowest row (by pressing `G`), enter the Insert mode, and try
|
||||
a new random editing session by typing anything in cells with _Tab_ and _Enter_
|
||||
navigation interleaves. The editing got painfully slow, did not?
|
||||
|
||||
The reason of the slowing down is the older table formatting algorithm. Every
|
||||
time _Tab_ or _Enter_ get pressed down, all rows in the table get visited to
|
||||
calculate a new alignment. Moreover, by design it may happen even more than
|
||||
once per one press!
|
||||
|
||||
```vim
|
||||
function! s:kbd_create_new_row(cols, goto_first)
|
||||
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
|
||||
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
|
||||
let cmd .= "\<ESC>0"
|
||||
if a:goto_first
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
|
||||
else
|
||||
let cmd .= (col('.')-1)."l"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
endif
|
||||
let cmd .= "a"
|
||||
|
||||
return cmd
|
||||
endfunction
|
||||
```
|
||||
|
||||
Function `s:kbd_create_new_row()` is called when _Tab_ or _Enter_ get pressed.
|
||||
Formatting of the whole table happens in function `vimwiki#tbl#format()`. But
|
||||
remember that leaving the Insert mode triggers re-formatting of a table when
|
||||
variable `g:vimwiki_table_auto_fmt` is set. This means that formatting of the
|
||||
whole table is called on all those multiple interleaves between the Insert and
|
||||
the Normal mode in `s:kbd_create_new_row` (notice `\<ESC>`, `o`, etc.).
|
||||
|
||||
### The newer table formatting algorithm
|
||||
|
||||
The newer algorithm was introduced to struggle against performance issues when
|
||||
formatting large tables.
|
||||
|
||||
Let's take the table from the previous example in an intermediate state.
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|------|-------|---|-------|----------|
|
||||
| | Data1 | | Data2 | |
|
||||
| Data1 | | | | New data |
|
||||
```
|
||||
|
||||
Then move the cursor to the first data row, copy it with `yy`, go down to the
|
||||
misaligned line, and press `5p`. Now we have a slightly bigger misaligned
|
||||
table.
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|------|-------|---|-------|----------|
|
||||
| | Data1 | | Data2 | |
|
||||
| Data1 | | | | New data |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
```
|
||||
|
||||
Go down to the lowest, the 7th, data row and press `gq1`. Nothing happened.
|
||||
Let's go to the second or the third data row and press `gq1` once again. Now
|
||||
the table gets aligned. Let's undo formatting with `u`, go to the fourth row,
|
||||
and press `gq1`. Now the table should look like in the following snippet.
|
||||
|
||||
```
|
||||
| Col1 | | | | |
|
||||
|------|-------|---|-------|----------|
|
||||
| | Data1 | | Data2 | |
|
||||
| Data1 | | | | New data |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
| | Data1 | | Data2 | |
|
||||
```
|
||||
|
||||
What a peculiar command! Does using it make any sense? Not much, honestly.
|
||||
Except it shows how the newer optimized table formatting algorithm works in the
|
||||
Insert mode.
|
||||
|
||||
Indeed, the newer table formatting algorithm introduces a _viewport_ on a table.
|
||||
Now, when pressing _Tab_ or _Enter_ in the Insert mode, only a small part of
|
||||
rows are checked for possible formatting: two rows above the current line and
|
||||
the current line itself (the latter gets preliminary shrunk with function
|
||||
`s:fmt_row()`). If all three lines in the viewport are of the same length, then
|
||||
nothing happens (case 1 in the example). If the second or the shrunk current
|
||||
line is longer then the topmost line in the viewport, then the algorithm falls
|
||||
back to the older formatting algorithm and the whole table gets aligned
|
||||
(case 2). If the topmost line in the viewport is longer than the second
|
||||
and the shrunk current line, then the two lowest lines get aligned according to
|
||||
the topmost line (case 3).
|
||||
|
||||
Performance of the newer formatting algorithm should not depend on the height
|
||||
of the table. The newer algorithm should also be consistent with respect to
|
||||
user editing experience. Indeed, as soon as a table should normally be edited
|
||||
row by row from the top to the bottom, dynamic formatting should be both fast
|
||||
(watching only three rows in a table, re-formatting only when the shrunk
|
||||
current row gets longer than any of the two rows above) and eager (a table
|
||||
should look formatted on every press on _Tab_ and _Enter_). However, the newer
|
||||
algorithm differs from the older algorithm when starting editing a misaligned
|
||||
table in an area where misaligned rows do not get into the viewport: in this
|
||||
case the newer algorithm will format the table partly (in the rows of the
|
||||
viewport) until one of the being edited cells grows in length to a value big
|
||||
enough to trigger the older algorithm and the whole table gets aligned. When
|
||||
partial formatting is not desirable, the whole table can be formatted by
|
||||
pressing `gqq` in the Normal mode.
|
||||
|
||||
|
||||
## Scoped Variable
|
||||
|
||||
Vimwiki's variables have a scope. They can be:
|
||||
|
||||
1. Global [ex: `global_ext`]
|
||||
2. Wikilocal (1, 2, 3 ...) [ex: `path`]
|
||||
3. Syntaxlocal (default, markdown, media) [ex: `bullet_types`]
|
||||
4. Bufferlocal [ex: `b:vimwiki_wiki_nr`]
|
||||
|
||||
They all can be configured, changed by user
|
||||
|
||||
As a comparison, Vim's variables also have a scope (`:h variable-scope`) and
|
||||
can also be configured by users.
|
||||
|
||||
While features kept stacking, it became more and more difficult to maintain the
|
||||
coherence and configurability between these variables: a type of markers, say
|
||||
`bullet_types`, can affect folding, highlighting, keystrokes mapping, indentation.
|
||||
All of those aspects often requires internal variables that should be calculated
|
||||
only once's when user is changing the variable and affect only the scope in which
|
||||
they are defined: a `markdown` syntax configuration should affect all `markdown`
|
||||
wikis but not `default` ones. So it was decided (#894) to keep a 3 global
|
||||
dictionaries to hold internal variables (there is only one bufferlocal variable
|
||||
so a dictionary was clearly overkill) and 3 other dictionaries for user
|
||||
configuration. The internal dictionaries get updated at startup (`:h extend`)
|
||||
with the user content but do not modify it. They can also be updated later with
|
||||
`VimwikiVar` function.
|
||||
|
||||
Here, `key` is the variable name, `2` the wiki number and `markdown` the syntax
|
||||
|
||||
```vim
|
||||
" External -> Internal
|
||||
g:vimwiki_{key} -> g:vimwiki_global_vars[key]
|
||||
g:vimwiki_syntax_list['markdown'][key]
|
||||
-> g:vimwiki_syntaxlocal_vars['markdown'][key]
|
||||
g:vimwiki_list[2][key] -> g:vimwiki_wikilocal_vars[2][key]
|
||||
```
|
||||
|
||||
All are defined in `vars.vim` and in case of a conflict while executing it, the
|
||||
innermost scope if privileged (as usual for variable scoping conflicts). The
|
||||
reasons for such a complex system is:
|
||||
1. The diversity of variables and developers
|
||||
2. The nature of new (2020) issues asking for some deep customisation (ex: of
|
||||
the link format) or high functionality (ex: on demand wiki creation and
|
||||
configuration)
|
||||
3. Historical excuses that Vimwiki was not designed to be highly configurable at
|
||||
beginning and many temporary internal variables where created to "fix some
|
||||
holes"
|
||||
|
||||
|
||||
## Syntax and Highlight
|
||||
|
||||
* [Vimwiki syntax specification](./specification.wiki)
|
||||
* [Syntax region](../syntax/vimwiki.vim)
|
||||
* [Nesting manager]( ../autoload/vimwiki/u.vim): vimwiki#u#hi_typeface(dic)
|
||||
|
||||
TODO currently the typeface delimiters are customized that way:
|
||||
|
||||
```vim
|
||||
" Typeface: -> u.vim
|
||||
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
|
||||
call vimwiki#u#hi_typeface(s:typeface_dic)
|
||||
```
|
||||
|
||||
|
||||
<!-- vim: set tw=80: -->
|
||||
|
After Width: | Height: | Size: 333 KiB |
|
After Width: | Height: | Size: 420 KiB |
@@ -0,0 +1,10 @@
|
||||
<svg width="200" height="43" viewBox="0 0 372 80" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M45.592 20.804C48.4347 22.4987 49.856 24.3027 49.856 26.216C49.856 27.3093 49.3093 28.8127 48.216 30.726L31.242 59.836C30.6953 60.7653 29.8207 61.6127 28.618 62.378C27.4153 63.0887 26.2127 63.444 25.01 63.444C23.862 63.444 22.7413 63.1707 21.648 62.624C20.6093 62.0227 19.8713 61.4213 19.434 60.82L18.696 59.918L1.64 30.726C0.546667 28.922 0 27.446 0 26.298C0 24.33 1.42133 22.4987 4.264 20.804C6.34133 19.6013 7.98133 19 9.184 19C10.3867 19 11.316 19.3827 11.972 20.148C12.6827 20.8587 13.4207 21.952 14.186 23.428L24.928 44.092L35.67 23.428C36.2713 22.3893 36.7087 21.6513 36.982 21.214C37.31 20.722 37.802 20.2573 38.458 19.82C39.114 19.328 39.9887 19.082 41.082 19.082C42.1753 19.082 43.6787 19.656 45.592 20.804Z" fill="#000"/>
|
||||
<path d="M54.341 27.036C54.341 25.7787 54.3683 24.8493 54.423 24.248C54.5323 23.592 54.7783 22.854 55.161 22.034C55.9263 20.6127 58.0583 19.902 61.557 19.902C64.181 19.902 66.0397 20.3667 67.133 21.296C68.0623 22.0613 68.5544 23.2367 68.609 24.822C68.6637 25.3687 68.691 26.1613 68.691 27.2V55.9C68.691 57.1573 68.6363 58.114 68.527 58.77C68.4724 59.3713 68.2263 60.082 67.789 60.902C67.0784 62.3233 64.9737 63.034 61.475 63.034C58.031 63.034 55.9263 62.296 55.161 60.82C54.7783 60 54.5323 59.2893 54.423 58.688C54.3683 58.0867 54.341 57.13 54.341 55.818V27.036Z" fill="#000"/>
|
||||
<path d="M89.3454 25.56C91.9147 21.6787 95.0034 19.738 98.6114 19.738C104.187 19.738 108.342 22.116 111.075 26.872C111.677 26.052 112.387 25.2047 113.207 24.33C114.082 23.4007 115.449 22.4167 117.307 21.378C119.166 20.2847 121.079 19.738 123.047 19.738C127.421 19.738 131.083 21.4327 134.035 24.822C136.987 28.1567 138.463 33.7053 138.463 41.468V55.818C138.463 57.0753 138.409 58.032 138.299 58.688C138.245 59.2893 137.999 60 137.561 60.82C136.851 62.296 134.746 63.034 131.247 63.034C127.803 63.034 125.699 62.2687 124.933 60.738C124.551 59.918 124.305 59.2073 124.195 58.606C124.141 57.95 124.113 56.9933 124.113 55.736V41.386C124.113 36.63 122.419 34.252 119.029 34.252C117.116 34.252 115.804 34.8807 115.093 36.138C114.437 37.3953 114.109 39.172 114.109 41.468V55.818C114.109 57.13 114.055 58.0867 113.945 58.688C113.891 59.2893 113.645 60 113.207 60.82C112.442 62.296 110.31 63.034 106.811 63.034C103.367 63.034 101.263 62.2687 100.497 60.738C100.115 59.918 99.8687 59.2073 99.7594 58.606C99.7047 57.95 99.6774 56.9933 99.6774 55.736V41.386C99.6774 36.63 97.9827 34.252 94.5934 34.252C91.3134 34.252 89.6734 36.63 89.6734 41.386V55.9C89.6734 57.1573 89.6187 58.114 89.5094 58.77C89.4547 59.3713 89.2087 60.082 88.7714 60.902C87.9514 62.3233 85.8194 63.034 82.3754 63.034C78.9314 63.034 76.8267 62.296 76.0614 60.82C75.6787 60 75.4327 59.2893 75.3234 58.688C75.2687 58.0867 75.2414 57.13 75.2414 55.818V26.954C75.2414 25.6967 75.2687 24.7673 75.3234 24.166C75.4327 23.51 75.7061 22.7993 76.1434 22.034C76.9634 20.558 78.9041 19.82 81.9654 19.82C85.0267 19.82 87.0221 20.312 87.9514 21.296C88.8807 22.28 89.3454 23.7013 89.3454 25.56Z" fill="#000"/>
|
||||
<path d="M219.3 71.3359C216.999 70.2839 215.158 68.7386 213.777 66.7002C212.462 64.6618 211.147 62.3932 209.832 59.8945C209.634 59.5 209.437 59.1055 209.24 58.7109C209.042 58.3164 208.845 57.9548 208.648 57.626L207.267 55.0615L206.478 53.4834L205.294 54.5684L203.519 56.1465L202.533 57.1328C200.823 58.7109 199.081 60.2891 197.305 61.8672C195.596 63.3796 193.754 64.7604 191.782 66.0098C189.875 67.1934 187.836 68.1797 185.667 68.9688C183.562 69.6921 181.261 70.0866 178.762 70.1523L176.592 69.0674C175.343 68.4098 174.291 67.818 173.436 67.292C172.581 66.7659 171.595 65.944 170.477 64.8262C170.148 64.2344 169.852 63.6755 169.589 63.1494C169.392 62.6234 169.162 62.0973 168.899 61.5713C168.176 60.2562 167.584 59.0726 167.124 58.0205C166.663 56.9684 166.203 55.7848 165.743 54.4697C165.94 53.5492 166.236 52.0039 166.63 49.834C167.025 47.5983 167.485 45.1654 168.011 42.5352C168.603 39.9049 169.195 37.2747 169.787 34.6445C170.444 31.9486 171.102 29.6143 171.759 27.6416C172.351 25.932 173.009 24.1237 173.732 22.2168C174.521 20.3099 175.343 18.5674 176.198 16.9893C177.118 15.3454 178.105 13.9645 179.157 12.8467C180.209 11.6631 181.327 10.9727 182.51 10.7754C182.839 11.2357 183.201 11.5645 183.595 11.7617C183.99 11.959 184.351 12.1234 184.68 12.2549C185.601 13.57 186.488 14.6878 187.343 15.6084C188.264 16.529 189.316 17.4495 190.5 18.3701C190.171 20.014 189.678 21.8551 189.02 23.8936C188.428 25.8662 187.771 27.8717 187.047 29.9102C186.39 31.8828 185.732 33.8226 185.075 35.7295C184.417 37.6364 183.891 39.2803 183.497 40.6611C183.102 41.779 182.773 43.0283 182.51 44.4092C181.918 46.8421 181.36 50.1628 180.833 54.3711C181.623 54.1738 182.477 53.7464 183.398 53.0889C184.319 52.4313 185.206 51.7409 186.061 51.0176C187.047 50.2285 188.034 49.3408 189.02 48.3545C190.269 47.1051 191.321 45.9544 192.176 44.9023C193.031 43.8503 193.82 42.7653 194.543 41.6475C195.333 40.5296 196.122 39.3132 196.911 37.998C197.7 36.6172 198.653 35.0062 199.771 33.165C200.757 31.5869 201.777 29.9102 202.829 28.1348C203.946 26.2936 205.031 24.5511 206.083 22.9072C207.201 21.1976 208.286 19.6523 209.338 18.2715C210.39 16.8906 211.344 15.8057 212.199 15.0166C212.725 15.6742 213.382 16.2988 214.171 16.8906C215.026 17.4824 215.914 17.9427 216.834 18.2715C217.229 18.8633 217.591 19.4222 217.919 19.9482C218.314 20.4085 218.676 20.8359 219.004 21.2305C219.399 21.8223 219.761 22.3812 220.089 22.9072C220.484 23.4333 220.846 23.9593 221.174 24.4854C221.109 24.9456 221.01 25.5374 220.878 26.2607C220.747 26.984 220.583 27.7731 220.385 28.6279C220.254 29.4827 220.089 30.3704 219.892 31.291C219.695 32.1458 219.498 32.9678 219.3 33.7568C218.774 36.2555 218.38 38.1296 218.117 39.3789C217.854 40.6283 217.656 41.6146 217.525 42.3379C217.459 43.0612 217.393 43.6859 217.328 44.2119C217.328 44.6722 217.328 45.3298 217.328 46.1846C217.262 46.8421 217.295 47.4997 217.426 48.1572C217.492 48.749 217.624 49.3737 217.821 50.0312C218.018 50.6888 218.281 51.2806 218.61 51.8066L222.555 48.749C223.673 47.8942 224.725 46.7435 225.711 45.2969C226.764 43.7845 227.75 42.0749 228.67 40.168C229.657 38.1953 230.61 36.0583 231.531 33.7568C232.451 31.4554 233.372 29.1211 234.292 26.7539C235.673 23.2689 237.054 19.8825 238.435 16.5947C239.882 13.307 241.263 10.7754 242.578 9C244.024 9.92057 245.274 10.874 246.326 11.8604C247.444 12.7809 248.397 13.8001 249.186 14.918C249.975 16.0358 250.6 17.318 251.06 18.7646C251.586 20.2113 251.948 21.9209 252.145 23.8936C250.961 26.195 249.811 28.5622 248.693 30.9951C247.641 33.4281 246.622 35.861 245.635 38.2939C244.32 41.4502 242.939 44.6064 241.493 47.7627C240.112 50.9189 238.567 53.9437 236.857 56.8369C235.147 59.6644 233.24 62.2946 231.136 64.7275C229.032 67.0947 226.599 69.1003 223.837 70.7441C223.114 70.5469 222.489 70.4482 221.963 70.4482C220.911 70.4482 220.024 70.7441 219.3 71.3359Z" fill="#bbb"/>
|
||||
<path d="M268.025 63.1494C268.354 65.1221 268.222 66.6673 267.63 67.7852C267.104 68.903 266.315 69.7249 265.263 70.251C264.277 70.8428 263.126 71.1716 261.811 71.2373C260.496 71.3031 259.247 71.2373 258.063 71.04C257.405 70.1195 256.814 68.9688 256.288 67.5879C255.762 66.207 255.268 64.7933 254.808 63.3467C254.348 61.8343 253.92 60.3548 253.526 58.9082C253.197 57.4616 252.901 56.1794 252.638 55.0615C252.967 54.2725 253.164 53.3848 253.23 52.3984C253.361 51.3464 253.427 50.2943 253.427 49.2422C253.493 48.1901 253.526 47.138 253.526 46.0859C253.592 44.9681 253.69 43.916 253.822 42.9297C254.282 40.168 254.94 37.5378 255.794 35.0391C256.715 32.5404 257.438 29.943 257.964 27.2471C258.096 26.6553 258.03 26.0964 257.767 25.5703C257.57 25.0443 257.537 24.5511 257.668 24.0908C257.734 23.8278 257.931 23.6634 258.26 23.5977C258.589 23.4661 258.786 23.236 258.852 22.9072C259.049 22.1839 259.082 21.5921 258.951 21.1318C258.885 20.6715 259.016 20.1126 259.345 19.4551C259.674 18.929 260.069 18.1729 260.529 17.1865C261.055 16.1344 261.252 15.0495 261.121 13.9316C261.712 13.5371 262.271 13.0768 262.797 12.5508C263.323 12.0247 263.849 11.5645 264.375 11.1699C264.967 10.7096 265.592 10.3151 266.25 9.98633C266.973 9.65755 267.828 9.49316 268.814 9.49316C269.34 10.1507 269.669 10.874 269.8 11.6631C269.998 12.4521 270.162 13.2412 270.293 14.0303C270.491 14.8193 270.754 15.5755 271.083 16.2988C271.411 16.9564 271.97 17.4824 272.759 17.877C272.759 18.403 272.759 19.0605 272.759 19.8496C272.759 20.6387 272.792 21.4277 272.858 22.2168C272.924 22.9401 273.055 23.6305 273.252 24.2881C273.515 24.8799 273.91 25.2744 274.436 25.4717C273.252 28.6279 272.135 31.7513 271.083 34.8418C270.096 37.9323 269.274 41.0557 268.617 44.2119C267.959 47.3024 267.532 50.4258 267.334 53.582C267.203 56.7383 267.433 59.9274 268.025 63.1494Z" fill="#bbb"/>
|
||||
<path d="M338.942 66.5029C335.786 66.6344 332.991 66.5687 330.558 66.3057C328.191 66.0426 325.857 65.418 323.555 64.4316C323.424 64.3659 323.292 64.2015 323.161 63.9385C323.029 63.6755 322.898 63.4782 322.766 63.3467C322.372 63.1494 321.878 63.0837 321.287 63.1494C320.761 63.1494 320.3 63.0837 319.906 62.9521C319.38 62.6891 318.558 62.196 317.44 61.4727C316.322 60.6836 315.303 59.9603 314.382 59.3027C313.199 58.3822 312.081 57.4616 311.029 56.541C309.977 55.6204 309.056 54.6341 308.267 53.582C308.07 53.319 307.807 53.1875 307.478 53.1875C307.149 53.1217 306.853 53.0231 306.59 52.8916C304.683 54.0752 303.072 55.5547 301.757 57.3301C300.442 59.1055 299.193 60.9137 298.009 62.7549C296.826 64.596 295.576 66.3385 294.261 67.9824C292.946 69.6263 291.269 70.8757 289.231 71.7305C288.639 71.7305 288.113 71.6318 287.653 71.4346C287.193 71.2373 286.765 70.9743 286.371 70.6455C285.976 70.3825 285.582 70.1195 285.187 69.8564C284.792 69.5934 284.365 69.3962 283.905 69.2646C283.905 68.4756 283.74 67.7523 283.412 67.0947C283.149 66.4372 282.853 65.8125 282.524 65.2207C282.261 64.6289 282.064 64.07 281.932 63.5439C281.801 62.9521 281.932 62.3932 282.327 61.8672C281.932 61.4727 281.34 61.0452 280.551 60.585C280.946 60.1904 281.11 59.8288 281.044 59.5C281.044 59.1712 280.979 58.8424 280.847 58.5137C280.716 58.1849 280.584 57.8232 280.453 57.4287C280.387 57.0342 280.486 56.6396 280.749 56.2451C281.077 56.2451 281.472 56.1794 281.932 56.0479C281.538 55.5218 281.34 55.2259 281.34 55.1602C281.406 55.0286 281.34 54.8643 281.143 54.667C281.012 54.2725 281.077 54.0423 281.34 53.9766C281.603 53.8451 281.866 53.7135 282.129 53.582C282.392 50.36 282.951 47.3682 283.806 44.6064C284.661 41.8447 285.614 39.1816 286.667 36.6172C287.719 34.0527 288.738 31.4554 289.724 28.8252C290.776 26.195 291.631 23.3675 292.289 20.3428C293.012 19.6195 293.571 18.7646 293.965 17.7783C294.426 16.792 294.886 15.8057 295.346 14.8193C295.872 13.833 296.431 12.8796 297.023 11.959C297.68 10.9727 298.568 10.1836 299.686 9.5918C300.607 9.65755 301.429 9.92057 302.152 10.3809C302.875 10.7754 303.763 10.9398 304.815 10.874C305.012 11.2028 305.177 11.5316 305.308 11.8604C305.505 12.1891 305.736 12.5179 305.999 12.8467L307.478 12.5508C308.201 13.1426 308.826 13.8988 309.352 14.8193C309.944 15.6742 310.338 16.5947 310.536 17.5811C310.733 18.5674 310.7 19.5208 310.437 20.4414C310.174 21.2962 309.549 21.9867 308.563 22.5127C308.629 22.8415 308.629 23.1045 308.563 23.3018C308.563 23.4333 308.53 23.5648 308.464 23.6963C308.399 23.8278 308.366 23.9593 308.366 24.0908C308.366 24.2223 308.464 24.4196 308.662 24.6826C307.347 25.6689 306.36 27.0498 305.703 28.8252C305.045 30.6006 304.683 32.1787 304.618 33.5596C305.407 32.7705 306.262 32.0143 307.182 31.291C308.168 30.502 309.155 29.7458 310.141 29.0225C311.193 28.2992 312.18 27.6087 313.1 26.9512C314.086 26.2936 314.974 25.6361 315.763 24.9785C317.933 23.0059 320.004 21.4277 321.977 20.2441C324.015 18.9948 326.153 17.6139 328.388 16.1016C328.914 15.9701 329.309 15.9701 329.572 16.1016C329.901 16.1673 330.229 16.266 330.558 16.3975C330.558 16.0029 330.427 15.7728 330.164 15.707C329.966 15.6413 329.901 15.3783 329.966 14.918C330.953 14.6549 331.807 14.359 332.531 14.0303C333.254 13.6357 334.043 13.2741 334.898 12.9453C335.49 13.5371 336.049 14.1618 336.575 14.8193C337.101 15.4111 337.824 15.7728 338.745 15.9043C339.073 16.6276 339.468 17.1865 339.928 17.5811C340.389 17.9098 340.849 18.2386 341.309 18.5674C341.769 18.8962 342.164 19.2907 342.493 19.751C342.887 20.2113 343.117 20.9346 343.183 21.9209C342.92 22.3812 342.624 22.8743 342.295 23.4004C342.032 23.9264 341.769 24.5511 341.506 25.2744C340.191 26.458 338.843 27.5101 337.462 28.4307C336.147 29.3512 334.799 30.2389 333.418 31.0938C332.038 31.9486 330.624 32.8034 329.177 33.6582C327.731 34.513 326.251 35.5322 324.739 36.7158C324.41 37.1761 323.983 37.6035 323.457 37.998C322.996 38.3268 322.503 38.6885 321.977 39.083C321.451 39.4118 320.958 39.7734 320.498 40.168C320.037 40.5625 319.676 41.0228 319.413 41.5488C319.215 41.6146 319.018 41.6475 318.821 41.6475C318.624 41.6475 318.426 41.6803 318.229 41.7461C318.032 42.2064 317.703 42.568 317.243 42.8311C316.848 43.0941 316.585 43.4557 316.454 43.916C317.44 46.0202 318.722 47.6312 320.3 48.749C321.878 49.8669 323.654 50.6888 325.626 51.2148C327.599 51.6751 329.736 51.9382 332.038 52.0039C334.339 52.0039 336.739 52.0039 339.238 52.0039C339.501 51.9382 339.599 51.8066 339.534 51.6094C339.534 51.3464 339.698 51.2477 340.027 51.3135C341.605 51.8395 342.821 52.5957 343.676 53.582C344.531 54.5026 345.55 55.4232 346.734 56.3438C346.602 58.8424 345.846 60.9137 344.465 62.5576C343.084 64.2015 341.243 65.5166 338.942 66.5029Z" fill="#bbb"/>
|
||||
<path d="M365.573 63.1494C365.902 65.1221 365.77 66.6673 365.178 67.7852C364.652 68.903 363.863 69.7249 362.811 70.251C361.825 70.8428 360.674 71.1716 359.359 71.2373C358.044 71.3031 356.794 71.2373 355.611 71.04C354.953 70.1195 354.361 68.9688 353.835 67.5879C353.309 66.207 352.816 64.7933 352.356 63.3467C351.896 61.8343 351.468 60.3548 351.074 58.9082C350.745 57.4616 350.449 56.1794 350.186 55.0615C350.515 54.2725 350.712 53.3848 350.778 52.3984C350.909 51.3464 350.975 50.2943 350.975 49.2422C351.041 48.1901 351.074 47.138 351.074 46.0859C351.139 44.9681 351.238 43.916 351.37 42.9297C351.83 40.168 352.487 37.5378 353.342 35.0391C354.263 32.5404 354.986 29.943 355.512 27.2471C355.644 26.6553 355.578 26.0964 355.315 25.5703C355.118 25.0443 355.085 24.5511 355.216 24.0908C355.282 23.8278 355.479 23.6634 355.808 23.5977C356.137 23.4661 356.334 23.236 356.4 22.9072C356.597 22.1839 356.63 21.5921 356.499 21.1318C356.433 20.6715 356.564 20.1126 356.893 19.4551C357.222 18.929 357.616 18.1729 358.077 17.1865C358.603 16.1344 358.8 15.0495 358.668 13.9316C359.26 13.5371 359.819 13.0768 360.345 12.5508C360.871 12.0247 361.397 11.5645 361.923 11.1699C362.515 10.7096 363.14 10.3151 363.797 9.98633C364.521 9.65755 365.375 9.49316 366.362 9.49316C366.888 10.1507 367.217 10.874 367.348 11.6631C367.545 12.4521 367.71 13.2412 367.841 14.0303C368.039 14.8193 368.302 15.5755 368.63 16.2988C368.959 16.9564 369.518 17.4824 370.307 17.877C370.307 18.403 370.307 19.0605 370.307 19.8496C370.307 20.6387 370.34 21.4277 370.406 22.2168C370.472 22.9401 370.603 23.6305 370.8 24.2881C371.063 24.8799 371.458 25.2744 371.984 25.4717C370.8 28.6279 369.682 31.7513 368.63 34.8418C367.644 37.9323 366.822 41.0557 366.165 44.2119C365.507 47.3024 365.08 50.4258 364.882 53.582C364.751 56.7383 364.981 59.9274 365.573 63.1494Z" fill="#bbb"/>
|
||||
<rect x="144.77" width="15" height="80" rx="4" fill="#00FFA3"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,898 @@
|
||||
= Specification =
|
||||
|
||||
The following is a draft specification for the *vimwiki* markup language. It is
|
||||
provided as a guideline for consistent parsing and rendering of vimwiki
|
||||
content.
|
||||
|
||||
Similar to the approach taken with [[https://www.commonmark.org/|commonmark]],
|
||||
this document attempts to specify *vimwiki* syntax unambiguously. It contains
|
||||
examples of the language and describes the specifics of the language in a way
|
||||
that tooling can more easily define parsers and generators.
|
||||
|
||||
== Version ==
|
||||
|
||||
Current: *0.1.0*
|
||||
|
||||
This specification is versioned in order to provide a stable point of reference
|
||||
for external tools. [[https://semver.org/|Semantic versioning]] is used to keep
|
||||
track of the current state of the specification. *MAJOR.MINOR.PATCH* is the
|
||||
format.
|
||||
|
||||
While the specification remains with a zero major version, the contents of this
|
||||
specification can change without any requirement to maintain compatibility.
|
||||
Once a non-zero major version is released, new vimwiki language elements may
|
||||
only be added in minor releases and any breaking change must be reflected by a
|
||||
major release. Tweaks in language that do not add, alter, or remove elements of
|
||||
vimwiki (such as typos, clarifications, etc) may be made with patch releases.
|
||||
|
||||
The specification will continue to remain in a development mode (zero major
|
||||
mode) until the language has become relatively stable.
|
||||
|
||||
== Language ==
|
||||
|
||||
The following will describe the individual elements of the vimwiki language.
|
||||
It will cover each element's purpose and a clear description of the syntax.
|
||||
|
||||
For details on parsing prescedence, see the [[#Specification#Parser Details|companion section]].
|
||||
|
||||
=== Primitives ===
|
||||
|
||||
In order to define the vimwiki language, we first need to present several
|
||||
definitions for primitive building blocks used to shape up higher-level
|
||||
elements. Relevant definitions are borrowed from
|
||||
[[https://spec.commonmark.org/0.29/#characters-and-lines|commonmark characters and lines]].
|
||||
|
||||
A *character* in vimwiki is a valid UTF-8 code point. For the purposes of
|
||||
this document, we further restrict a character to not include any
|
||||
[[https://en.wikipedia.org/wiki/Control_character|control character]] as those will be referenced separately.
|
||||
|
||||
An *alphanumeric character* is a [[#character|character]] that can only be in
|
||||
the range of a-z, A-Z, or 0-9 where these represent alphabet characters
|
||||
(abcdef...z) of lower and upper case as well as digits (0, 1, 2, ..., 9).
|
||||
|
||||
A *line* is a sequence of zero or more [[#Specification#Language#Primitives#character|characters]] other than a
|
||||
newline (`U+000A` aka `\n`) or carriage return (`U+000D` aka `\r`), followed by
|
||||
a [[#Specification#Language#Primitives#line ending|line ending]] or by the end of a file.
|
||||
|
||||
A *line ending* is a newline (`U+000A` aka `\n`), a carriage return (`U+000D`
|
||||
aka `\r`) not followed by a newline, or a carriage return and a following
|
||||
newline (`\r\n`).
|
||||
|
||||
A line with no [[#character|characters]], or a line containing only spaces (`U+0020`) or tabs
|
||||
(`U+0009`), is called a *blank line*.
|
||||
|
||||
A *whitespace character* is a space (`U+0020`) or tab (`U+0009`).
|
||||
|
||||
*All characters until end of line* is any sequence of [[#character|characters]]
|
||||
leading up to but not including a [[#line ending|line ending]].
|
||||
|
||||
A *user-defined content* is an arbitrary series of [[#character|characters]] or a function
|
||||
that yields those characters. Its purpose is to enable users of vimwiki to
|
||||
interject their own configuration into aspects of the vimwiki language.
|
||||
|
||||
*User-definable* represents any language definition that can be altered to
|
||||
instead be represented by one or more [[#user-defined content|user-defined content]].
|
||||
|
||||
=== Block Elements ===
|
||||
|
||||
The vimwiki language has a variety of syntax that represent elements within
|
||||
a page. In this section, we discuss block-level elements, which are vimwiki
|
||||
syntax that are standalone and can comprise one or more entire lines within
|
||||
a file.
|
||||
|
||||
==== Blockquote ====
|
||||
|
||||
A blockquote has two different forms available: indented text or text prefixed
|
||||
with a right angle bracket or chevron `>`. Its purpose is to convey an extended
|
||||
quotation.
|
||||
|
||||
*Form 1*:
|
||||
|
||||
{{{vimwiki
|
||||
This is a blockquote
|
||||
that exists on more than one line
|
||||
}}}
|
||||
|
||||
*Form 2*:
|
||||
|
||||
{{{vimwiki
|
||||
> This is a blockquote
|
||||
> that exists on more than one line
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
*Form 1*:
|
||||
|
||||
A blockquote is made of *one* or more [[#indented blockquote line|indented blockquote lines]]
|
||||
|
||||
An *indented blockquote line* is made of the following:
|
||||
1. Four or more [[#whitespace character|whitespace characters]]
|
||||
2. All [[#character|characters]] up until a [[#line ending|line ending]]
|
||||
3. A [[#line ending|line ending]] or end of input
|
||||
|
||||
*Form 2*:
|
||||
|
||||
A blockquote is made of *one* or more [[#chevron blockquote line|chevron blockquote lines]], which may be
|
||||
separated by zero or more [[#blank line|blank lines]]
|
||||
|
||||
A *chevron blockquote line* is made of the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. A prefix right angle bracket or chevron (`U+003E` aka `>`)
|
||||
3. A [[#whitespace character|whitespace character]] such as ' ' or '\t'
|
||||
4. All characters up until a [[#line ending|line ending]]
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
*Extra Notes*: Each line of a blockquote, minus the indentation or chevron, is
|
||||
trimmed to remove all leading and trailing [[#whitespace character|whitespace characters]].
|
||||
|
||||
==== Definition List ====
|
||||
|
||||
A definition list is composed of a series of terms and associated definitions.
|
||||
It mirrors the functionality available in an [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl|HTML Description List]].
|
||||
|
||||
{{{vimwiki
|
||||
Term 1:: Some definition
|
||||
Term 2:: First def
|
||||
:: Second def with [[link]]
|
||||
Term3::
|
||||
:: Some *bold* definition
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *definition list* is composed of one or more [[#term and definitions|term and definitions]]
|
||||
|
||||
A *term and definitions* is composed of one [[#term line|term line]] and
|
||||
zero or more [[#definition line|definition lines]]
|
||||
|
||||
A *term line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. One or more [[#inline elements|inline elements]] (except [[#tags|tags]]) before the sequence `::`
|
||||
3. The sequence `::`
|
||||
4. An optional one or more [[#inline elements|inline elements]] before [[#line ending|line ending]]
|
||||
to be the first definition
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *definition line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. The sequence `::`
|
||||
3. One or more [[#inline elements|inline elements]] before [[#line ending|line ending]]
|
||||
4. A [[#line ending|line ending]] or end of input
|
||||
|
||||
*Extra Notes*: Each term and definition is trimmed to remove all leading and
|
||||
trailing [[#whitespace character|whitespace characters]].
|
||||
|
||||
==== Divider ====
|
||||
|
||||
A divider is composed of a sequence of dashes (`U+002D`). It mirrors the
|
||||
functionality of the [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr|HTML Horizontal Rule]].
|
||||
|
||||
{{{vimwiki
|
||||
----
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *divider* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Four or more dashes (`U+002D`)
|
||||
3. A [[#line ending|line ending]] or end of input
|
||||
|
||||
==== Header ====
|
||||
|
||||
A header is composed of some content surrounded by equals sign (`U+003D` aka
|
||||
`=`) of equal length. It mirrors the functionality of the [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements|HTML Heading]].
|
||||
|
||||
{{{vimwiki
|
||||
= Some Header =
|
||||
== Some Sub Header ==
|
||||
= *Bold* Header with [[link]] =
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *header* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]] (implying
|
||||
whether or not a header is centered)
|
||||
3. One or more equal sign (`U+003D`) characters
|
||||
4. One or more [[#inline elements|inline elements]]
|
||||
5. An equivalent number of equal sign characters as in step #3
|
||||
6. A [[#line ending|line ending]] or end of input
|
||||
|
||||
*Extra Notes*: Each header's content, minus the equals signs, is trimmed to
|
||||
remove all leading and trailing [[#whitespace character|whitespace characters]].
|
||||
For example, `= header =` is equal to `=header=`.
|
||||
|
||||
==== List ====
|
||||
|
||||
A list is composed of a series list items, each being comprised
|
||||
of [[#inline elements|inline elements]] and [[#list|sub lists]]. It mirrors the
|
||||
functionality available in an [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul|HTML Unordered List]]
|
||||
and [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol|HTML Ordered List]].
|
||||
|
||||
{{{vimwiki
|
||||
- List item 1 has *bold* and [[links]]
|
||||
- List item 2 has content
|
||||
1. Ordered sublist
|
||||
2. within list item 2
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *list* is composed of one or more [[#list item|list items]].
|
||||
|
||||
A *list item* is composed of a [[#starting list item line|starting list item line]]
|
||||
and zero or more [[#companion list item line|companion list item lines]].
|
||||
|
||||
A *starting list item line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]] that signify
|
||||
the level of indentation to use when understanding if later content is
|
||||
still associated with this list item, if a new list item is the beginning
|
||||
of a sublist, if a new list item is a sibling, or if a new list item
|
||||
is the sibling of a parent
|
||||
3. One of the following default prefixes (this is also [[#user-definable|user definable]])
|
||||
that determines the type of list item:
|
||||
* Hyphen (`U+002D` aka `-`) is for an unordered list
|
||||
* Asterisk (`U+002A` aka `*`) is for an unordered list
|
||||
* Pound (`U+0023` aka `#`) is for an ordered list
|
||||
* One or more digits followed by a period (`U+002E` aka `.`) or
|
||||
a right parenthesis (`U+0029` aka `)`) is for an ordered list
|
||||
* One or more lowercase alphabetic (`a-z`) followed by a period
|
||||
(`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is for an
|
||||
ordered list
|
||||
* One or more uppercase alphabetic (`A-Z`) followed by a period
|
||||
(`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is for an
|
||||
ordered list
|
||||
* One or more lowercase Roman numerals (any of `ivxlcdm`) followed by a
|
||||
period (`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is
|
||||
for an ordered list
|
||||
* One or more uppercase Roman numerals (any of `IVXLCDM`) followed by a
|
||||
period (`U+002E` aka `.`) or a right parenthesis (`U+0029` aka `)`) is
|
||||
for an ordered list
|
||||
4. A [[#whitespace character|whitespace character]]
|
||||
5. An optional [[#todo attribute|todo attribute]] and additional [[#whitespace character|whitespace character]]
|
||||
6. Zero or more [[#inline elements|inline elements]]
|
||||
7. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *companion list item line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]] that total
|
||||
as many or more as the [[#starting list item line|starting list item line]] indentation
|
||||
3. One of the following:
|
||||
* The start of a new [[#list|list]] (to be treated as a sublist of the
|
||||
current list item)
|
||||
* A series of one or more [[#inline elements|inline elements]]
|
||||
(to be added to the content of the current list item) followed by
|
||||
a [[#line ending|line ending]] or end of input
|
||||
* A [[#blank line|blank line]] if there is guaranteed to still be some
|
||||
list item content in later lines
|
||||
|
||||
A *todo attribute* is composed of surrounding square brackets in the form
|
||||
of a left square bracket (`U+005B` aka `[`) and right square bracket
|
||||
(`U+005D` aka `]`). Inbetween the square brackets is a single character to
|
||||
denote the todo status and is by default one of the following or [[#user-definable|user-definable]]:
|
||||
* A space (`U+0020` aka ' ') meaning 0% or incomplete
|
||||
* A period (`U+002E` aka `.`) meaning 1-33% progress
|
||||
* A lowercase o (`U+006F` aka `o`) meaning 34-66% progress
|
||||
* An uppercase O (`U+004F` aka `O`) meaning 67-99% progress
|
||||
* An uppercase X (`U+0058` aka `X`) meaning 100% or completed
|
||||
* A hyphen (`U+002D` aka `-`) meaning rejected
|
||||
|
||||
*Extra Notes*: Because of the ambiguity of alphabetic list items and Roman
|
||||
numerals, which are composed of specific alphabetic characters in various
|
||||
arrangements, a list needs to be evaluated across all of its items to determine
|
||||
if a list item's type is Roman or alphabetic. If all list items begin with
|
||||
valid Roman numerals, then the types are Roman numerals. If any list item is
|
||||
not a valid Roman numeral, then all list item type's for those prefixes are
|
||||
considered to be alphabetic.
|
||||
|
||||
==== Math Block ====
|
||||
|
||||
A math block is composed of a series of lines representing a mathematical
|
||||
formula. It is rendered in HTML using the [[https://www.mathjax.org/|MathJax engine]].
|
||||
|
||||
{{{vimwiki
|
||||
{{$%align%
|
||||
\sum_i a_i^2 &= 1 + 1 \\
|
||||
&= 2.
|
||||
}}$
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *math block* is composed of a [[#beginning math block line|beginning math block line]],
|
||||
one or more [[#math block line|math block lines]], and an [[#ending math block line|ending math block line]].
|
||||
|
||||
A *beginning math block line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]]
|
||||
3. The sequence `{{$`
|
||||
4. An optional [[#math environment|math environment]]
|
||||
5. Zero or more [[#whitespace character|whitespace characters]]
|
||||
6. A [[#line ending|line ending]]
|
||||
|
||||
A *math environment* is represented by the following:
|
||||
1. The percent sign (`U+0025` aka `%`)
|
||||
2. One or more [[#character|characters]] that are not the percent sign or [[#line ending|line ending]]
|
||||
3. The percent sign (`U+0025` aka `%`)
|
||||
|
||||
A *math block line* is a line found after a [[#beginning math block line|beginning math block line]]
|
||||
and before an [[#ending math block line|ending math block line]] and is
|
||||
comprised of zero or more [[#character|characters]] representing [[https://en.wikipedia.org/wiki/TeX|TeX syntax]]
|
||||
followed by a [[#line ending|line ending]].
|
||||
|
||||
An *ending math block line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]]
|
||||
3. The sequence `}}$`
|
||||
4. Zero or more [[#whitespace character|whitespace characters]]
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
==== Paragraph ====
|
||||
|
||||
A paragraph is composed of a series of lines representing some content. It
|
||||
mirrors [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p|HTML Paragraph]].
|
||||
|
||||
{{{vimwiki
|
||||
Some paragraph containing
|
||||
multiple lines including
|
||||
*bold* and [[links]].
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *paragraph* is composed of one or more [[#paragraph line|paragraph lines]].
|
||||
|
||||
A *paragraph line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Has zero to three [[#whitespace character|whitespace]] characters for indentation
|
||||
3. Is not any of the following:
|
||||
* [[#header|header]]
|
||||
* [[#definition list|definition list]]
|
||||
* [[#list|list]]
|
||||
* [[#table|table]]
|
||||
* [[#preformatted text|preformatted text]]
|
||||
* [[#math block|math block]]
|
||||
* [[#blank link|blank line]]
|
||||
* [[#blockquote|blockquote]]
|
||||
* [[#divider|divider]]
|
||||
* [[#placeholder|placeholder]]
|
||||
4. One or more [[#inline elements|inline elements]]
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
==== Placeholder ====
|
||||
|
||||
A placeholder is composed of an identifier and some information. Its purpose
|
||||
is to provide metadata for use in rendering vimwiki to HTML and populating
|
||||
portions of the HTML template used with a vimwiki page.
|
||||
|
||||
{{{vimwiki
|
||||
%title Some title
|
||||
%nohtml
|
||||
%template my_template
|
||||
%date 2020-12-23
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
|
||||
A *placeholder* is represented by one of the following:
|
||||
* A [[#title placeholder|title placeholder]]
|
||||
* A [[#nohtml placeholder|nohtml placeholder]]
|
||||
* A [[#template placeholder|template placeholder]]
|
||||
* A [[#date placeholder|date placeholder]]
|
||||
|
||||
A *title placeholder* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. A percent sign (`U+0025` aka `%`)
|
||||
3. The sequence `title`
|
||||
4. One or more [[#whitespace character|whitespace characters]]
|
||||
5. [[#all characters until end of line|all characters until end of line]]
|
||||
6. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *nohtml placeholder* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. A percent sign (`U+0025` aka `%`)
|
||||
3. The sequence `nohtml`
|
||||
4. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *template placeholder* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. A percent sign (`U+0025` aka `%`)
|
||||
3. The sequence `template`
|
||||
4. One or more [[#whitespace character|whitespace characters]]
|
||||
5. [[#all characters until end of line|all characters until end of line]]
|
||||
6. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *date placeholder* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. A percent sign (`U+0025` aka `%`)
|
||||
3. The sequence `date`
|
||||
4. One or more [[#whitespace character|whitespace characters]]
|
||||
5. A date string in the format of [[https://en.wikipedia.org/wiki/ISO_8601|ISO 8601]] such as
|
||||
`YYYY-MM-DD` where `YYYY` symbolizes a four-digit year (e.g. `1990`),
|
||||
`MM` symbolizes a two-digit month (e.g. `04`),
|
||||
and `DD` symbolizes a two-digit day (e.g. `23`)
|
||||
6. A [[#line ending|line ending]] or end of input
|
||||
|
||||
==== Preformatted Text ====
|
||||
|
||||
A preformatted text block is composed of a series of lines representing some
|
||||
content, usually related to a programming language. It mirrors
|
||||
[[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre|HTML Preformatted Text]].
|
||||
|
||||
{{{vimwiki
|
||||
{{{rust
|
||||
fn my_func() -> u32 {
|
||||
1 + 2
|
||||
}
|
||||
\}}}
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *preformatted text* is composed of a [[#beginning preformatted text line|beginning preformatted text line]],
|
||||
one or more [[#preformatted text line|preformatted text lines]], and an [[#ending preformatted text line|ending preformatted text line]].
|
||||
|
||||
A *beginning preformatted text line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]]
|
||||
3. The sequence `{{{`
|
||||
4. An optional [[#preformatted language identifier|preformatted language identifier]]
|
||||
5. An optional [[#preformatted metadata list|preformatted metadata list]]
|
||||
6. Zero or more [[#whitespace character|whitespace characters]]
|
||||
7. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *preformatted language identifier* is represented by the following:
|
||||
1. One or more [[#character|characters]] leading up to a [[#whitespace character|whitespace characters]]
|
||||
2. Is comprised of a series of any character except equals sign (`U+003D` aka `=`)
|
||||
|
||||
A *preformatted metadata list* is composed of one or more
|
||||
[[#preformatted metadata list items|preformatted metadata list items]] separated by [[#whitespace character|whitespace characters]].
|
||||
|
||||
A *preformatted metadata list item* is represented by the following:
|
||||
1. One or more [[#character|characters]] leading up to an equals sign (`U+003D` aka `=`),
|
||||
not including a [[#line ending|line ending]]
|
||||
2. An equals sign (`U+003D` aka `=`)
|
||||
3. A quotation mark (`U+0022` aka `"`)
|
||||
4. One or more [[#character|characters]] leading up to a quotation mark (`U+0022` aka `"`)
|
||||
5. A quotation mark (`U+0022` aka `"`)
|
||||
|
||||
A *preformatted text line* is a line found after a [[#beginning preformatted text line|beginning preformatted text line]]
|
||||
and before an [[#ending preformatted text line|ending preformatted text line]] and is
|
||||
comprised of zero or more [[#character|characters]] followed by a [[#line ending|line ending]].
|
||||
|
||||
An *ending preformatted text line* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]]
|
||||
3. The sequence `}}}`
|
||||
4. Zero or more [[#whitespace character|whitespace characters]]
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
==== Table ====
|
||||
|
||||
A table is composed of a series of rows containing various other elements. It
|
||||
mirrors [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table|HTML Table]].
|
||||
|
||||
{{{vimwiki
|
||||
| Year | Temperature (low) | Temperature (high) | Temperature (avg) |
|
||||
|------|-------------------|:------------------------:|------------------:|
|
||||
| 1990 | *50* degrees | 90 according to [[link]] | 72 |
|
||||
| \/ | 45 degrees | > | 80 |
|
||||
| \/ | \/ | > | 60 |
|
||||
| 2000 | > | > | > |
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *table* is composed of one or more [[#row|rows]] with the indentation of
|
||||
the first row indicating whether the table is centered (is indented) or not.
|
||||
|
||||
A *row* is represented by one of the following:
|
||||
* A [[#divider row|divider row]]
|
||||
* A [[#content row|content row]]
|
||||
|
||||
A *divider row* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]]
|
||||
3. A sequence of pairs comprised of a [[#cell boundary|cell boundary]] and [[#divider column|divider column]]
|
||||
4. A final [[#cell boundary|cell boundary]]
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *divider column* is represented by the following:
|
||||
1. An optional colon (`U+003A` aka `:`)
|
||||
2. One or more hyphens (`U+002D` aka `-`)
|
||||
3. An optional colon (`U+003A` aka `:`)
|
||||
|
||||
A *content row* is represented by the following:
|
||||
1. Starts at the beginning of a line
|
||||
2. Zero or more [[#whitespace character|whitespace characters]]
|
||||
3. A sequence of pairs comprised of a [[#cell boundary|cell boundary]] and a [[#cell|cell]]
|
||||
4. A final [[#cell boundary|cell boundary]]
|
||||
5. A [[#line ending|line ending]] or end of input
|
||||
|
||||
A *cell* is represented by one of the following:
|
||||
* A [[#span above cell|span above cell]]
|
||||
* A [[#span left cell|span left cell]]
|
||||
* A [[#content cell|content cell]]
|
||||
|
||||
A *span above cell* is represented by the following:
|
||||
1. Zero or more [[#whitespace character|whitespace characters]]
|
||||
2. Sequence `\/`
|
||||
3. Zero or more [[#whitespace character|whitespace characters]]
|
||||
|
||||
A *span left cell* is represented by the following:
|
||||
1. Zero or more [[#whitespace character|whitespace characters]]
|
||||
2. Sequence `>`
|
||||
3. Zero or more [[#whitespace character|whitespace characters]]
|
||||
|
||||
A *content cell* is represented by the following:
|
||||
1. Zero or more [[#whitespace character|whitespace characters]]
|
||||
2. One or more [[#inline elements|inline elements]] not comprised of `|`
|
||||
3. Zero or more [[#whitespace character|whitespace characters]]
|
||||
|
||||
A *cell boundary* is represented by the pipe character (`U+007C` aka `|`).
|
||||
|
||||
=== Inline Elements ===
|
||||
|
||||
The vimwiki language also has a variety of syntax that can be used within a
|
||||
line on a page. These are referred to as *inline elements* and can be found
|
||||
within a variety of [[#block elements|block elements]] as well as nested
|
||||
within other inline elements.
|
||||
|
||||
==== Math Inline ====
|
||||
|
||||
A math inline element is composed of a single-line formula.
|
||||
Like its big brother, the [[#math block|math block]], it is rendered in HTML
|
||||
using the [[https://www.mathjax.org/|MathJax engine]].
|
||||
|
||||
{{{vimwiki
|
||||
$ \sum_i a_i^2 = 1 $
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
An *inline math* element is represented by the following:
|
||||
1. A dollar sign (`U+0024` aka `$`)
|
||||
2. One or more [[#character|characters]] representing [[https://en.wikipedia.org/wiki/TeX|TeX syntax]]
|
||||
that are not a dollar sign or [[#line ending|line ending]]
|
||||
3. A dollar sign (`U+0024` aka `$`)
|
||||
|
||||
*Extra Notes*: The formula within the inline element is trimmed to remove all
|
||||
leading and trailing [[#whitespace character|whitespace characters]].
|
||||
|
||||
==== Tags ====
|
||||
|
||||
A tags element is composed of a series of individual tag elements. It is used
|
||||
both to mark various places within a page as well as act as an [[#anchor|anchor]].
|
||||
|
||||
{{{vimwiki
|
||||
:tag-1:tag-2:
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *tags* element is represented by the following:
|
||||
1. A [[#tag separator|tag separator]]
|
||||
2. A sequence of [[#tag|tag]] separated by [[#tag separator|tag separator]]
|
||||
3. A [[#tag separator|tag separator]]
|
||||
|
||||
A *tag* is represented by one or more [[#character|characters]] that are not a colon,
|
||||
[[#whitespace character|whitespace]], or [[#line ending|line ending]]
|
||||
|
||||
A *tag separator* is represented by a colon (`U+003A` aka `:`).
|
||||
|
||||
==== Link ====
|
||||
|
||||
A link is a crucial inline element of vimwiki and is able to connect pages
|
||||
with each other as well as external wikis and resources.
|
||||
|
||||
{{{vimwiki
|
||||
[[other page|link to another page]]
|
||||
[[wiki1:page|link to page in another wiki]]
|
||||
[[#some#anchor|link to another location in same page]]
|
||||
[[diary:2020-12-23|link to diary entry]]
|
||||
{{https://example.com/img.jpg|Transclusion to pull in image}}
|
||||
[[https://example.com|{{https://example.com/img.jpg}}]]
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *link* is represented by one of the following:
|
||||
* A [[#wiki link|wiki link]]
|
||||
* An [[#interwiki link|interwiki link]]
|
||||
* A [[#diary link|diary link]]
|
||||
* An [[#external file link|external file link]]
|
||||
* A [[#raw link|raw link]]
|
||||
* A [[#transclusion link|transclusion link]]
|
||||
|
||||
A *wiki link* is represented by the following:
|
||||
1. A [[#link start seq|link start seq]]
|
||||
2. At least one of the following (in order):
|
||||
1. An optional [[#link path|link path]]
|
||||
2. An optional [[#link anchor|link anchor]]
|
||||
3. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
|
||||
4. A [[#link end seq|link end seq]]
|
||||
|
||||
An *interwiki link* is represented by one of the following:
|
||||
* An [[#indexed interwiki link|indexed interwiki link]]
|
||||
* An [[#named interwiki link|named interwiki link]]
|
||||
|
||||
An *indexed interwiki link* is represented by the following:
|
||||
1. A [[#link start seq|link start seq]]
|
||||
2. The sequence `wiki`
|
||||
3. One or more digits (`0-9`)
|
||||
4. A colon (`U+003A` aka `:`)
|
||||
5. A [[#link path|link path]]
|
||||
6. An optional [[#link anchor|link anchor]]
|
||||
7. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
|
||||
8. A [[#link end seq|link end seq]]
|
||||
|
||||
A *named interwiki link* is represented by the following:
|
||||
1. A [[#link start seq|link start seq]]
|
||||
2. The sequence `wn.`
|
||||
3. One or more [[#alphanumeric character|alphanumeric characters]]
|
||||
4. A colon (`U+003A` aka `:`)
|
||||
5. A [[#link path|link path]]
|
||||
6. An optional [[#link anchor|link anchor]]
|
||||
7. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
|
||||
8. A [[#link end seq|link end seq]]
|
||||
|
||||
An *external file link* is represented by the following:
|
||||
1. A [[#link start seq|link start seq]]
|
||||
2. A [[#link uri|link uri]] whose schema is `local` or `file` or has no schema
|
||||
and starts with `//` for an absolute file path
|
||||
3. A [[#link path|link path]]
|
||||
4. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
|
||||
5. A [[#link end seq|link end seq]]
|
||||
|
||||
A *raw link* is represented by a [[#link uri|link uri]] not found within
|
||||
another link type.
|
||||
|
||||
A *transclusion link* is represented by the following:
|
||||
1. The sequence `{{`
|
||||
2. A [[#link uri|link uri]]
|
||||
3. An optional [[#link inner separator|link inner separator]] and [[#link description|link description]]
|
||||
4. An optional sequence of [[#link key value pair|link key value pairs]],
|
||||
each separated by [[#link inner separator|link inner separator]]
|
||||
4. The sequence `}}`
|
||||
|
||||
A *link key value pair* is represented by the following:
|
||||
1. One or more [[#character|characters]] that are not a pipe symbol (`U+007C`
|
||||
aka `|`), equals sign (`U+003D` aka `=`), `}}`, or [[#line ending|line ending]]
|
||||
2. An equals sign (`U+003D` aka `=`)
|
||||
3. A quotation mark (`U+0022` aka `"`)
|
||||
4. One or more [[#character|characters]] that are not a pipe symbol (`U+007C`
|
||||
aka `|`), quotation mark (`U+0022` aka `"`), `}}`, or [[#line ending|line ending]]
|
||||
5. A quotation mark (`U+0022` aka `"`)
|
||||
|
||||
A *link path* is represented by the following:
|
||||
1. Does not start with a [[#link anchor prefix|link anchor prefix]]
|
||||
2. One or more [[#character|characters]] that are not a [[#link anchor prefix|link anchor prefix]],
|
||||
[[#link inner separator|link inner separator]], [[#link end seq|link end seq]], or [[#line ending|line ending]]
|
||||
|
||||
A *link description* is represented by one of the following:
|
||||
* A [[#link uri|link uri]]
|
||||
* One or more [[#character|characters]] that are not a [[#link end seq|link end seq]] or [[#line ending|line ending]]
|
||||
|
||||
A *link anchor* is represented by a series of pairs, each comprised of
|
||||
a [[#link anchor prefix|link anchor prefix]] and a [[#link anchor element|link anchor element]]
|
||||
|
||||
A *link anchor element* is represented by one or more [[#character|characters]] that are
|
||||
not a [[#link anchor prefix|link anchor prefix]], [[#link inner separator|link inner separator]],
|
||||
[[#link end seq|link end seq]], or [[#line ending|line ending]]
|
||||
|
||||
A *link anchor prefix* is represented by a pound symbol (`U+0023` aka `#`).
|
||||
|
||||
A *link inner separator* is represented by a pipe symbol (`U+007C` aka `|`).
|
||||
|
||||
A *link start seq* is represented by `[[`.
|
||||
|
||||
A *link end seq* is represented by `]]`.
|
||||
|
||||
A *link uri* is represented by the following:
|
||||
1. Starts with `www.`, `//`, or a [[#link uri scheme|link uri scheme]]
|
||||
a. If starting with `www.`, we add a virtual prefix of `https://` going forward
|
||||
b. If starting with `//`, we add a virtual prefix of `file:/` going forward
|
||||
2. One or more [[#character|characters]] that are not [[#whitespace character|whitespace characters]]
|
||||
or [[#line ending|line ending]]
|
||||
|
||||
A *link uri scheme* is represented by a series of alphanumeric [[#character|characters]]
|
||||
(`a-z`, `A-Z`, `0-9`) as well as plus (`U+002B` aka `+`), period (`U+002E`
|
||||
aka `.`), and hyphen (`U+002D` aka `-`). The scheme is terminated by a
|
||||
colon (`U+003A` aka `:`).
|
||||
|
||||
*Extra Notes*: Additional validation should be done to ensure that a
|
||||
[[#line uri|link uri]] properly adheres to [[https://tools.ietf.org/html/rfc3986|RFC3986]].
|
||||
|
||||
==== Decorated Text ====
|
||||
|
||||
Decorated text supports a variety of markups across [[#link|links]],
|
||||
[[#keyword|keywords]], non-repeating [[#decorated text|decorated text]], and [[#text|text]].
|
||||
|
||||
It mirrors these different HTML elements:
|
||||
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong|strong]]
|
||||
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em|em]]
|
||||
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s|s]]
|
||||
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code|code]]
|
||||
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup|sup]]
|
||||
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub|sub]]
|
||||
|
||||
{{{vimwiki
|
||||
*bold*
|
||||
_italic_
|
||||
~~strikeout~~
|
||||
`code`
|
||||
^superscript^
|
||||
,,superscript,,
|
||||
}}}
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
*Decorated text* is represented by one of the following:
|
||||
* [[#bold text|Bold text]]
|
||||
* [[#italic text|Italic text]]
|
||||
* [[#strikeout text|Strikeout text]]
|
||||
* [[#code text|Code text]]
|
||||
* [[#superscript text|Superscript text]]
|
||||
* [[#subscript text|Subscript text]]
|
||||
|
||||
*Bold text* is represented by the following:
|
||||
1. An asterisk (`U+002A` aka `*`)
|
||||
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
|
||||
an asterisk (`U+002A` aka `*`) is encountered
|
||||
3. An asterisk (`U+002A` aka `*`)
|
||||
|
||||
*Italic text* is represented by the following:
|
||||
1. An underscore (`U+005F` aka `_`)
|
||||
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
|
||||
an underscore (`U+005F` aka `_`) is encountered
|
||||
3. An underscore (`U+005F` aka `_`)
|
||||
|
||||
*Strikeout text* is represented by the following:
|
||||
1. Two tilde (`U+007E` aka `~`)
|
||||
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
|
||||
two tilde (`U+007E` aka `~`) are encountered
|
||||
3. Two tilde (`U+007E` aka `~`)
|
||||
|
||||
*Code text* is represented by the following:
|
||||
1. A backtick (`U+0060`)
|
||||
2. Any character other than a backtick or [[#line ending|line ending]]
|
||||
3. A backtick (`U+0060`)
|
||||
|
||||
*Superscript text* is represented by the following:
|
||||
1. A carrot or circumflex accent (`U+005E` aka `^`)
|
||||
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
|
||||
a carrot or circumflex accent (`U+005E` aka `^`) is encountered
|
||||
3. A carrot or circumflex accent (`U+005E` aka `^`)
|
||||
|
||||
*Superscript text* is represented by the following:
|
||||
1. Two commas (`U+002C` aka `,`)
|
||||
2. One or more [[#link|links]], [[#keyword|keywords]], [[#non-repeated decorated text|non-repeated decorated text]], or [[#text|text]] until
|
||||
two commas (`U+002C` aka `,`) are encountered
|
||||
3. Two commas (`U+002C` aka `,`)
|
||||
|
||||
*Non-repeated decorated text* is represented as [[#decorated text|decorated text]]
|
||||
where no previous styling is seen again until that styling is closed. For
|
||||
example, if [[#bold text|bold text]] is first seen, there will not be another
|
||||
case of bold text until after the current one has ended
|
||||
(`*bold *inner bold* text*` is not allowed).
|
||||
|
||||
==== Keyword ====
|
||||
|
||||
Keywords are specific, case-sensitive words that have an alternative
|
||||
highlighting within vim as well as provide highlighting in generated HTML
|
||||
via classes.
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *keyword* is represented as one of the following:
|
||||
* `DONE`
|
||||
* `FIXED`
|
||||
* `FIXME`
|
||||
* `STARTED`
|
||||
* `TODO`
|
||||
* `XXX`
|
||||
|
||||
==== Text ====
|
||||
|
||||
Text is a plain series of [[#character|characters]] that have no special stylings applied
|
||||
directly, but can be included in other [[#inline elements|inline elements]].
|
||||
|
||||
===== Syntax =====
|
||||
|
||||
A *text* is represented as one or more [[#character|characters]] until any of the following
|
||||
is encountered:
|
||||
* [[#inline math|inline math]]
|
||||
* [[#tags|tags]]
|
||||
* [[#link|link]]
|
||||
* [[#decorated text|decorated text]]
|
||||
* [[#keyword|keyword]]
|
||||
* [[#line ending|line ending]]
|
||||
|
||||
==== Comments ====
|
||||
|
||||
A special type of inline element is the comment. Compared to all other inline
|
||||
elements, comments are unique in that they do not render into any other
|
||||
format (HTML, PDF, etc) and - in the case of multi-line comments - can span
|
||||
across more than one line.
|
||||
|
||||
There are two types of comments:
|
||||
|
||||
1. Line comment in the form of `%%CONTENT`
|
||||
2. Multi-line comment in the form of `%%+CONTENT++%`
|
||||
|
||||
===== Line Comment Syntax =====
|
||||
|
||||
1. A *line comment* is represented by the following:
|
||||
1. The sequence `%%`
|
||||
2. Any character until [[#line ending|line ending]]
|
||||
|
||||
*Extra Notes*: A line comment does not consume a [[#line ending|line ending]],
|
||||
only the [[#character|characters]] leading up to one. If a line comment is at the beginning of
|
||||
a line, it will leave a blank line in its place.
|
||||
|
||||
===== Multi-line Comment Syntax =====
|
||||
|
||||
1. A *multi-line comment* is represented by the following:
|
||||
1. The sequence `%%+`
|
||||
2. Any character until the sequence `+%%`
|
||||
3. The sequence `+%%`
|
||||
|
||||
*Extra Notes*: A multi-line comment consumes all [[#character|characters]] - including
|
||||
[[#line ending|line ending]] - between the surrounding character sequences. It
|
||||
can be used to join content in separate lines together. See example below.
|
||||
|
||||
{{{vimwiki
|
||||
first line%%+
|
||||
+%%second line
|
||||
|
||||
would become
|
||||
|
||||
first linesecond line
|
||||
}}}
|
||||
|
||||
== Parser Details ==
|
||||
|
||||
When building a parser for the vimwiki language, certain elements may overlap
|
||||
in the text that they can match. This means that the order in which elements
|
||||
are evaluated can affect how a page is perceived.
|
||||
|
||||
Additionally, the inclusion of [[#comments|comments]] further complicates the
|
||||
process of parsing a file. Comments can be placed alongside inline elements,
|
||||
which enables them to be in most locations within vimwiki. Compared to any
|
||||
other element, comments yield empty text when rendered. This can result in
|
||||
shortening of lines and even removal of [[#line ending|line ending]] characters.
|
||||
|
||||
Below is a breakdown of element categorization:
|
||||
|
||||
{{{
|
||||
Comment =
|
||||
Page = (Block Element)+
|
||||
Block Element =
|
||||
| Header
|
||||
| Definition List
|
||||
| List
|
||||
| Table
|
||||
| Math Block
|
||||
| Blockquote
|
||||
| Divider
|
||||
| Placeholder
|
||||
| Paragraph
|
||||
Inline Block Element =
|
||||
| List Item
|
||||
| Term
|
||||
| Definition
|
||||
Inline Element =
|
||||
| Multi Line Comment
|
||||
| Line Comment
|
||||
| Math Inline
|
||||
| Tags
|
||||
| Link
|
||||
| Decorated Text
|
||||
| Keyword
|
||||
| Text
|
||||
}}}
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 360 KiB |
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="100"
|
||||
height="100"
|
||||
viewBox="0 0 186 186.0465"
|
||||
fill="none"
|
||||
version="1.1"
|
||||
id="svg86"
|
||||
sodipodi:docname="vertical-logo.svg"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
|
||||
<metadata
|
||||
id="metadata92">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs90" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1256"
|
||||
inkscape:window-height="1000"
|
||||
id="namedview88"
|
||||
showgrid="false"
|
||||
inkscape:zoom="6.33"
|
||||
inkscape:cx="48.744425"
|
||||
inkscape:cy="52.804906"
|
||||
inkscape:window-x="1616"
|
||||
inkscape:window-y="64"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg86"
|
||||
units="px" />
|
||||
<path
|
||||
d="m 57.306337,151.56994 c -1.657094,-0.76144 -2.982911,-1.87997 -3.977454,-3.35539 -0.947014,-1.47545 -1.894026,-3.1175 -2.841039,-4.9261 -0.142593,-0.28556 -0.284465,-0.57111 -0.426336,-0.85672 -0.142592,-0.28555 -0.284465,-0.54728 -0.426335,-0.78527 l -0.994544,-1.85624 -0.568208,-1.14226 -0.852672,0.78534 -1.278288,1.14225 -0.710079,0.71391 c -1.231478,1.14226 -2.486,2.28461 -3.765006,3.42686 -1.230758,1.0947 -2.557296,2.09415 -3.977457,2.99848 -1.373348,0.85672 -2.841757,1.57062 -4.403789,2.14179 -1.515941,0.52354 -3.173033,0.80909 -4.97272,0.85665 l -1.562749,-0.78527 c -0.899483,-0.47599 -1.657093,-0.90434 -2.272833,-1.28507 -0.615736,-0.3808 -1.325816,-0.97571 -2.130958,-1.7848 -0.236933,-0.42835 -0.450102,-0.83288 -0.639503,-1.21369 -0.141872,-0.38073 -0.307511,-0.76153 -0.496912,-1.14227 -0.520678,-0.95188 -0.947013,-1.8086 -1.278287,-2.57013 -0.331995,-0.76154 -0.663269,-1.61825 -0.994543,-2.57015 0.141873,-0.66627 0.35504,-1.78479 0.638784,-3.35542 0.284464,-1.61823 0.615738,-3.37922 0.994543,-5.28301 0.426335,-1.90386 0.852669,-3.80765 1.279006,-5.71144 0.473146,-1.95134 0.947014,-3.64095 1.420159,-5.06883 0.426337,-1.23744 0.900204,-2.54633 1.42088,-3.92658 0.568207,-1.38026 1.160181,-2.64151 1.775918,-3.78376 0.66255,-1.18989 1.37335,-2.18942 2.13096,-2.9985 0.757611,-0.85671 1.562753,-1.35644 2.414704,-1.49924 0.236932,0.33317 0.497632,0.57116 0.781375,0.71391 0.284464,0.1428 0.544442,0.2618 0.781376,0.35697 0.663268,0.95191 1.302053,1.76099 1.917791,2.42733 0.66327,0.66635 1.42088,1.33263 2.273552,1.99898 -0.236934,1.18989 -0.591973,2.52251 -1.065841,3.99801 -0.426336,1.42781 -0.899482,2.87943 -1.42088,4.35493 -0.473145,1.4278 -0.947012,2.83188 -1.420158,4.21213 -0.473867,1.38024 -0.852671,2.57013 -1.136416,3.56959 -0.284464,0.80914 -0.521397,1.71342 -0.710799,2.71293 -0.426335,1.76099 -0.828187,4.16457 -1.207712,7.21063 0.568927,-0.14281 1.183945,-0.45217 1.847215,-0.92808 0.663269,-0.47599 1.302054,-0.97571 1.917791,-1.49925 0.710079,-0.57117 1.42088,-1.2137 2.130959,-1.9276 0.899483,-0.90434 1.657094,-1.73725 2.272831,-2.49879 0.615739,-0.76143 1.183947,-1.54679 1.704625,-2.35588 0.568926,-0.80915 1.137135,-1.68961 1.705343,-2.64157 0.568207,-0.99946 1.254521,-2.16553 2.059663,-3.49823 0.71008,-1.14225 1.444645,-2.35589 2.202256,-3.64096 0.80442,-1.33269 1.585796,-2.59394 2.343406,-3.78383 0.805141,-1.23744 1.586517,-2.35596 2.344128,-3.35541 0.75761,-0.99953 1.444645,-1.7848 2.060383,-2.35596 0.378806,0.47598 0.851952,0.92808 1.420159,1.35643 0.615739,0.42836 1.255241,0.76154 1.917791,0.99953 0.284464,0.42835 0.545162,0.8329 0.781377,1.21362 0.284463,0.33318 0.545161,0.64253 0.781375,0.92816 0.284464,0.42835 0.545163,0.8329 0.781375,1.21363 0.284465,0.3808 0.545164,0.76153 0.781376,1.14233 -0.04681,0.3331 -0.118106,0.76145 -0.213168,1.285 -0.09435,0.52353 -0.212448,1.0947 -0.35504,1.71342 -0.09435,0.61872 -0.213168,1.26126 -0.355039,1.9276 -0.141872,0.61872 -0.283743,1.21371 -0.426336,1.7848 -0.378805,1.8086 -0.662548,3.16512 -0.851951,4.06939 -0.189404,0.90433 -0.331995,1.61824 -0.426337,2.14177 -0.04753,0.52354 -0.09507,0.97572 -0.141871,1.35644 0,0.33317 0,0.80917 0,1.42789 -0.04753,0.47591 -0.02377,0.95189 0.07058,1.4278 0.04753,0.42835 0.142593,0.88052 0.284464,1.35643 0.141873,0.47599 0.331275,0.90434 0.568207,1.28507 l 2.841039,-2.21315 c 0.805143,-0.61871 1.562754,-1.45162 2.272834,-2.4987 0.758329,-1.0947 1.46841,-2.33214 2.130959,-3.71239 0.7108,-1.42787 1.397113,-2.97468 2.060384,-4.64055 0.662548,-1.6658 1.325816,-3.35541 1.988367,-5.06884 0.994543,-2.52251 1.989087,-4.97366 2.98363,-7.35342 1.042075,-2.3797 2.036618,-4.21212 2.983631,-5.4972 1.041355,0.66633 1.941557,1.35644 2.699168,2.07043 0.80514,0.66627 1.491454,1.40398 2.059663,2.21313 0.568207,0.80909 1.018308,1.73717 1.349582,2.78425 0.378807,1.04716 0.639505,2.28459 0.781376,3.71247 -0.852672,1.66581 -1.680857,3.37923 -2.485999,5.1402 -0.75761,1.76106 -1.491454,3.52204 -2.202255,5.28302 -0.947012,2.28459 -1.941557,4.56912 -2.982911,6.8537 -0.994543,2.28452 -2.107193,4.47393 -3.33867,6.56808 -1.231477,2.04661 -2.604827,3.95041 -4.120047,5.71138 -1.515221,1.71343 -3.267375,3.16511 -5.256465,4.35493 -0.520676,-0.14272 -0.970777,-0.21417 -1.349583,-0.21417 -0.75761,0 -1.396394,0.21417 -1.917791,0.64252 z"
|
||||
fill="#e5e5e5"
|
||||
id="path76"
|
||||
style="stroke-width:0.721988" />
|
||||
<path
|
||||
d="m 92.396232,145.6444 c 0.236928,1.42788 0.141863,2.54633 -0.284466,3.35548 -0.378802,0.80908 -0.947017,1.40399 -1.704611,1.78479 -0.710087,0.42835 -1.538988,0.66635 -2.486004,0.71391 -0.947016,0.0477 -1.846494,0 -2.699175,-0.14281 -0.473857,-0.66628 -0.899478,-1.49919 -1.278291,-2.4987 -0.378791,-0.99953 -0.734555,-2.02279 -1.065829,-3.06986 -0.331275,-1.0947 -0.6395,-2.1656 -0.923258,-3.21269 -0.236934,-1.04707 -0.450096,-1.97515 -0.6395,-2.78431 0.236936,-0.5711 0.378811,-1.21363 0.426332,-1.92761 0.09436,-0.76145 0.141875,-1.52298 0.141875,-2.28452 0.04755,-0.76153 0.07133,-1.52306 0.07133,-2.28458 0.04756,-0.80909 0.118115,-1.57063 0.213181,-2.28453 0.331274,-1.99897 0.805132,-3.90276 1.420154,-5.71137 0.663269,-1.8086 1.183945,-3.68865 1.562747,-5.63999 0.09512,-0.42837 0.04756,-0.8329 -0.141864,-1.2137 -0.141873,-0.38074 -0.165642,-0.73772 -0.07129,-1.0709 0.04755,-0.19037 0.189401,-0.30936 0.426341,-0.35691 0.236917,-0.0953 0.378791,-0.26181 0.426329,-0.49979 0.141874,-0.52354 0.165643,-0.9519 0.07129,-1.28508 -0.04755,-0.33316 0.04681,-0.73771 0.283747,-1.21363 0.236929,-0.3808 0.521395,-0.92808 0.852669,-1.64205 0.378803,-0.76153 0.520677,-1.54681 0.426331,-2.35595 0.42561,-0.28556 0.828191,-0.61873 1.206994,-0.99945 0.378802,-0.3808 0.757615,-0.71391 1.136417,-0.99953 0.42633,-0.33317 0.876429,-0.61872 1.350296,-0.85668 0.520677,-0.23799 1.136418,-0.35698 1.846505,-0.35698 0.378802,0.47595 0.61572,0.99948 0.710066,1.57065 0.142594,0.5711 0.260709,1.14226 0.355044,1.71343 0.142593,0.57108 0.331995,1.11844 0.568934,1.64198 0.236209,0.47598 0.638769,0.85671 1.206983,1.14233 0,0.38073 0,0.85665 0,1.42781 0,0.57116 0.02373,1.14225 0.07129,1.71342 0.04755,0.52354 0.141874,1.02327 0.283748,1.49926 0.1894,0.42835 0.473867,0.71389 0.852673,0.8567 -0.852673,2.28452 -1.657097,4.54531 -2.414702,6.78226 -0.710807,2.23697 -1.302779,4.49774 -1.775926,6.78226 -0.473858,2.23697 -0.781375,4.49774 -0.923968,6.78227 -0.09437,2.28459 0.07129,4.59293 0.497637,6.92508 z"
|
||||
fill="#e5e5e5"
|
||||
id="path78"
|
||||
style="stroke-width:0.721988" />
|
||||
<path
|
||||
d="m 143.46797,148.07174 c -2.27282,0.0952 -4.28569,0.0477 -6.03785,-0.14276 -1.70461,-0.19042 -3.38546,-0.64252 -5.04328,-1.3565 -0.0944,-0.0477 -0.1894,-0.16655 -0.28375,-0.35691 -0.0951,-0.19036 -0.1894,-0.33318 -0.28446,-0.42836 -0.28374,-0.14281 -0.63949,-0.19038 -1.06513,-0.14281 -0.37881,0 -0.7108,-0.0477 -0.99453,-0.14281 -0.37881,-0.19037 -0.97078,-0.54728 -1.77593,-1.07082 -0.80513,-0.57116 -1.53898,-1.0947 -2.20226,-1.57069 -0.85193,-0.66628 -1.65709,-1.33263 -2.41469,-1.99897 -0.75761,-0.66636 -1.42089,-1.38026 -1.9891,-2.14179 -0.14186,-0.19036 -0.33127,-0.28556 -0.5682,-0.28556 -0.23693,-0.0477 -0.45011,-0.11898 -0.63949,-0.21416 -1.37336,0.8567 -2.53354,1.9276 -3.48055,3.21268 -0.94701,1.28506 -1.8465,2.59388 -2.69917,3.92656 -0.85195,1.33262 -1.75215,2.59389 -2.69916,3.78377 -0.94703,1.18989 -2.15474,2.09425 -3.62243,2.71295 -0.42633,0 -0.80513,-0.0715 -1.13642,-0.21418 -0.33127,-0.14279 -0.6395,-0.33316 -0.92323,-0.57116 -0.28448,-0.19036 -0.56822,-0.38072 -0.85268,-0.57116 -0.28446,-0.19036 -0.59198,-0.33311 -0.92326,-0.42835 0,-0.5711 -0.11882,-1.09464 -0.35503,-1.57062 -0.18941,-0.47591 -0.40258,-0.92808 -0.63951,-1.35644 -0.18939,-0.42835 -0.33127,-0.8329 -0.42632,-1.2137 -0.0944,-0.42835 0,-0.83289 0.28445,-1.21362 -0.28445,-0.28555 -0.7108,-0.59499 -1.27901,-0.92808 0.28446,-0.28562 0.40258,-0.54736 0.35505,-0.78536 0,-0.238 -0.0468,-0.47599 -0.14187,-0.7139 -0.0944,-0.23798 -0.18941,-0.49979 -0.28376,-0.78534 -0.0476,-0.28556 0.0239,-0.57116 0.21317,-0.85672 0.23622,0 0.52068,-0.0476 0.85197,-0.14273 -0.28375,-0.3808 -0.42635,-0.59498 -0.42635,-0.64255 0.0476,-0.0953 0,-0.21417 -0.14186,-0.35698 -0.0944,-0.28555 -0.0476,-0.45218 0.14186,-0.49972 0.18941,-0.0952 0.37881,-0.19044 0.56821,-0.28562 0.18941,-2.33215 0.59197,-4.49767 1.20772,-6.49671 0.61573,-1.99898 1.30205,-3.92659 2.06037,-5.78275 0.75763,-1.85623 1.49146,-3.73621 2.20153,-5.64 0.75761,-1.90378 1.37336,-3.95039 1.84722,-6.13972 0.52069,-0.52355 0.92326,-1.14234 1.207,-1.85624 0.33199,-0.7139 0.66327,-1.42781 0.99455,-2.14179 0.3788,-0.71389 0.78137,-1.40398 1.20771,-2.07033 0.47314,-0.71391 1.11265,-1.28507 1.91778,-1.71343 0.66327,0.0476 1.25525,0.23797 1.77593,0.57117 0.52068,0.28555 1.16017,0.40454 1.91778,0.35691 0.14188,0.23799 0.2607,0.47599 0.35504,0.71399 0.14188,0.23792 0.30824,0.4759 0.49765,0.71389 l 1.06511,-0.21417 c 0.52068,0.42836 0.9708,0.9757 1.34959,1.64197 0.42633,0.6188 0.71007,1.28508 0.85267,1.99905 0.14186,0.7139 0.11811,1.40399 -0.0713,2.07034 -0.1894,0.61873 -0.6395,1.11852 -1.34959,1.49925 0.0476,0.23799 0.0476,0.42835 0,0.57116 0,0.0952 -0.0238,0.19037 -0.0713,0.28555 -0.0468,0.0952 -0.0705,0.19037 -0.0705,0.28555 0,0.0952 0.0705,0.23799 0.21316,0.42836 -0.94699,0.71391 -1.6578,1.71343 -2.13094,2.99849 -0.47387,1.28507 -0.73458,2.42733 -0.78139,3.42685 0.5682,-0.57116 1.18395,-1.11851 1.8465,-1.64206 0.71009,-0.57109 1.42088,-1.11844 2.13096,-1.64198 0.75761,-0.52354 1.46842,-1.02334 2.13096,-1.49924 0.71008,-0.47599 1.34959,-0.9519 1.91779,-1.42788 1.56274,-1.42781 3.05421,-2.57015 4.47509,-3.42685 1.46769,-0.90428 3.00739,-1.9038 4.61694,-2.99843 0.37882,-0.0952 0.66328,-0.0952 0.85268,0 0.23693,0.0476 0.47316,0.119 0.71009,0.21418 0,-0.28562 -0.0944,-0.45217 -0.28375,-0.4998 -0.1426,-0.0476 -0.18941,-0.23791 -0.1426,-0.5711 0.71082,-0.19043 1.32583,-0.4046 1.84722,-0.64252 0.52068,-0.28562 1.08889,-0.54736 1.70463,-0.78535 0.42633,0.42835 0.8289,0.88053 1.20772,1.35643 0.37879,0.42837 0.89947,0.69017 1.56274,0.78535 0.23621,0.52354 0.52068,0.92808 0.85195,1.2137 0.33201,0.23792 0.66327,0.47591 0.99454,0.7139 0.33128,0.238 0.61574,0.52354 0.85267,0.85672 0.28375,0.33318 0.44939,0.85671 0.49692,1.57061 -0.18941,0.33318 -0.40257,0.69009 -0.63951,1.07089 -0.18939,0.38074 -0.37881,0.83291 -0.56821,1.35644 -0.947,0.85672 -1.91778,1.61825 -2.91231,2.2846 -0.94704,0.66627 -1.91781,1.3088 -2.91235,1.9276 -0.99382,0.61872 -2.01214,1.23744 -3.05421,1.85616 -1.04136,0.61872 -2.10718,1.35644 -3.19608,2.21316 -0.23694,0.33316 -0.54444,0.64252 -0.92324,0.92808 -0.332,0.23798 -0.68703,0.49978 -1.06584,0.78533 -0.3788,0.238 -0.73384,0.49973 -1.06513,0.78535 -0.33199,0.28554 -0.59196,0.61872 -0.78139,0.99945 -0.14258,0.0477 -0.28446,0.0714 -0.42633,0.0714 -0.14187,0 -0.28446,0.0238 -0.42632,0.0714 -0.14188,0.33317 -0.37881,0.59492 -0.71008,0.78535 -0.28446,0.19037 -0.47387,0.4521 -0.5682,0.78526 0.71006,1.52307 1.63331,2.68915 2.76973,3.49824 1.13642,0.80915 2.41543,1.40405 3.83558,1.78477 1.42087,0.33318 2.95986,0.52362 4.61768,0.57118 1.6571,0 3.38547,0 5.18517,0 0.1894,-0.0477 0.25998,-0.14281 0.21317,-0.28555 0,-0.19036 0.1181,-0.2618 0.35503,-0.21418 1.13641,0.38073 2.01214,0.92808 2.62786,1.64199 0.61575,0.66635 1.34959,1.3327 2.20227,1.99904 -0.095,1.80854 -0.63951,3.30779 -1.63406,4.49769 -0.99453,1.18988 -2.32035,2.14177 -3.97745,2.85568 z"
|
||||
fill="#e5e5e5"
|
||||
id="path80"
|
||||
style="stroke-width:0.721988" />
|
||||
<path
|
||||
d="m 162.64661,145.6444 c 0.23693,1.42788 0.14187,2.54633 -0.28446,3.35548 -0.37882,0.80908 -0.94703,1.40399 -1.70463,1.78479 -0.7101,0.42835 -1.539,0.66635 -2.486,0.71391 -0.94702,0.0477 -1.84721,0 -2.69917,-0.14281 -0.47387,-0.66628 -0.9002,-1.49919 -1.279,-2.4987 -0.37881,-0.99953 -0.73384,-2.02279 -1.06514,-3.06986 -0.33127,-1.0947 -0.63948,-2.1656 -0.92323,-3.21269 -0.23696,-1.04707 -0.45011,-1.97515 -0.63951,-2.78431 0.23694,-0.5711 0.3788,-1.21363 0.42633,-1.92761 0.0944,-0.76145 0.14187,-1.52298 0.14187,-2.28452 0.0476,-0.76153 0.0712,-1.52306 0.0712,-2.28458 0.0468,-0.80909 0.11812,-1.57063 0.21317,-2.28453 0.33126,-1.99897 0.80441,-3.90276 1.42017,-5.71137 0.66327,-1.8086 1.18395,-3.68865 1.56275,-5.63999 0.0951,-0.42837 0.0476,-0.8329 -0.14188,-1.2137 -0.14187,-0.38074 -0.16565,-0.73772 -0.0713,-1.0709 0.0476,-0.19037 0.18939,-0.30936 0.42634,-0.35691 0.23693,-0.0953 0.3788,-0.26181 0.42633,-0.49979 0.14188,-0.52354 0.16563,-0.9519 0.0712,-1.28508 -0.0476,-0.33316 0.0468,-0.73771 0.28375,-1.21363 0.23695,-0.3808 0.52066,-0.92808 0.85266,-1.64205 0.37881,-0.76153 0.52068,-1.54681 0.42562,-2.35595 0.42635,-0.28556 0.82891,-0.61873 1.20772,-0.99945 0.3788,-0.3808 0.75759,-0.71391 1.13641,-0.99953 0.42634,-0.33317 0.87644,-0.61872 1.34959,-0.85668 0.52139,-0.23799 1.13641,-0.35698 1.8472,-0.35698 0.37881,0.47595 0.61575,0.99948 0.7101,1.57065 0.14187,0.5711 0.26068,1.14226 0.35503,1.71343 0.14259,0.57108 0.332,1.11844 0.56821,1.64198 0.23694,0.47598 0.63949,0.85671 1.2077,1.14233 0,0.38073 0,0.85665 0,1.42781 0,0.57116 0.0238,1.14225 0.0713,1.71342 0.0476,0.52354 0.14186,1.02327 0.28374,1.49926 0.18941,0.42835 0.47386,0.71389 0.85266,0.8567 -0.85266,2.28452 -1.6578,4.54531 -2.41542,6.78226 -0.71008,2.23697 -1.30205,4.49774 -1.77521,6.78226 -0.47386,2.23697 -0.78137,4.49774 -0.92395,6.78227 -0.0944,2.28459 0.0712,4.59293 0.49763,6.92508 z"
|
||||
fill="#e5e5e5"
|
||||
id="path82"
|
||||
style="stroke-width:0.721988" />
|
||||
<rect
|
||||
x="84.206207"
|
||||
width="14.097202"
|
||||
height="167.75996"
|
||||
rx="1.5241456"
|
||||
fill="#00ffa3"
|
||||
id="rect84"
|
||||
y="-176.87997"
|
||||
style="stroke-width:1.0187"
|
||||
transform="rotate(90)" />
|
||||
<path
|
||||
d="m 70.621435,35.89871 c 2.69107,1.604304 4.036557,3.312078 4.036557,5.123322 0,1.034983 -0.517539,2.458192 -1.552521,4.269435 L 57.036869,72.848731 c -0.517538,0.879731 -1.345487,1.68193 -2.484035,2.406408 -1.138548,0.672791 -2.277,1.00914 -3.415548,1.00914 -1.086765,0 -2.147687,-0.258722 -3.18267,-0.776261 -0.983295,-0.569227 -1.68193,-1.138548 -2.095904,-1.707775 L 45.160077,72.926356 29.01385,45.291467 c -1.035015,-1.707774 -1.552523,-3.105044 -1.552523,-4.191809 0,-1.863026 1.345517,-3.596644 4.036557,-5.200948 1.966524,-1.138547 3.519047,-1.707774 4.657566,-1.707774 1.138548,0 2.018278,0.362286 2.639287,1.086765 0.672791,0.672791 1.371426,1.707774 2.095904,3.105044 L 51.05966,57.944521 61.228678,38.382745 c 0.569227,-0.983296 0.983296,-1.68193 1.242018,-2.095904 0.310504,-0.465757 0.77626,-0.90567 1.39727,-1.319644 0.621008,-0.465756 1.449051,-0.698635 2.484034,-0.698635 1.034984,0 2.458191,0.543382 4.269435,1.630148 z"
|
||||
fill="#000000"
|
||||
id="path230"
|
||||
style="stroke-width:0.946656" />
|
||||
<path
|
||||
d="m 78.903761,41.798293 c 0,-1.190235 0.02584,-2.070061 0.07763,-2.639287 0.10347,-0.621009 0.336348,-1.319644 0.698635,-2.095904 0.724478,-1.345488 2.742756,-2.018279 6.054835,-2.018279 2.484035,0 4.243591,0.439913 5.278574,1.319644 0.879731,0.724479 1.345583,1.837182 1.39727,3.337922 0.05179,0.517539 0.07763,1.267861 0.07763,2.251156 v 27.169133 c 0,1.190236 -0.05178,2.095905 -0.155252,2.716913 -0.05169,0.569227 -0.284661,1.242018 -0.698635,2.018279 -0.672696,1.345487 -2.665132,2.018278 -5.977209,2.018278 -3.260296,0 -5.252731,-0.698635 -5.977209,-2.095905 -0.362287,-0.77626 -0.595165,-1.449051 -0.698635,-2.018278 -0.05179,-0.569226 -0.07763,-1.474895 -0.07763,-2.716913 z"
|
||||
fill="#000000"
|
||||
id="path232"
|
||||
style="stroke-width:0.946656" />
|
||||
<path
|
||||
d="m 112.04102,40.401023 c 2.43225,-3.67427 5.3562,-5.511452 8.77175,-5.511452 5.27819,0 9.21156,2.251156 11.79878,6.75347 0.56989,-0.776261 1.24201,-1.578366 2.01828,-2.406409 0.82832,-0.879731 2.12241,-1.811244 3.8813,-2.79454 1.75984,-1.034982 3.5708,-1.552521 5.43383,-1.552521 4.14069,0 7.60736,1.604304 10.40189,4.812818 2.79454,3.156825 4.19182,8.409462 4.19182,15.758097 v 13.584566 c 0,1.190235 -0.0512,2.095905 -0.15526,2.716913 -0.0512,0.569227 -0.28399,1.242018 -0.69864,2.018278 -0.67212,1.39727 -2.66483,2.095905 -5.9772,2.095905 -3.2603,0 -5.25207,-0.724479 -5.97721,-2.17353 -0.36162,-0.776262 -0.5945,-1.449053 -0.69864,-2.018278 -0.0511,-0.62101 -0.0776,-1.526679 -0.0776,-2.716914 V 55.382859 c 0,-4.502313 -1.60365,-6.75347 -4.81283,-6.75347 -1.81095,0 -3.05297,0.595166 -3.72605,1.785401 -0.62101,1.190235 -0.93151,2.872165 -0.93151,5.045696 v 13.584566 c 0,1.242018 -0.0511,2.147687 -0.15526,2.716913 -0.0511,0.569227 -0.28399,1.242018 -0.69863,2.018278 -0.72419,1.39727 -2.74247,2.095905 -6.05483,2.095905 -3.2603,0 -5.25207,-0.724479 -5.97721,-2.17353 -0.36162,-0.776262 -0.59479,-1.449053 -0.69826,-2.018278 -0.0518,-0.62101 -0.0776,-1.526679 -0.0776,-2.716914 V 55.382859 c 0,-4.502313 -1.6043,-6.75347 -4.81282,-6.75347 -3.10505,0 -4.65756,2.251157 -4.65756,6.75347 v 13.739819 c 0,1.190236 -0.0518,2.095905 -0.15526,2.716913 -0.0518,0.569227 -0.28466,1.242018 -0.69864,2.018279 -0.77625,1.345487 -2.79453,2.018278 -6.05484,2.018278 -3.26028,0 -5.25272,-0.698635 -5.977196,-2.095905 -0.362286,-0.77626 -0.595164,-1.449051 -0.698635,-2.018278 -0.05178,-0.569226 -0.07763,-1.474895 -0.07763,-2.716913 V 41.720667 c 0,-1.190236 0.02584,-2.070061 0.07763,-2.639287 0.103471,-0.621009 0.362288,-1.293799 0.776262,-2.018278 0.776259,-1.39727 2.613439,-2.095905 5.511449,-2.095905 2.89801,0 4.78698,0.465757 5.66671,1.39727 0.87972,0.931513 1.31964,2.277 1.31964,4.036556 z"
|
||||
fill="#000000"
|
||||
id="path234"
|
||||
style="stroke-width:0.946656" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,598 @@
|
||||
*vimwiki-emoji.txt* A Reference table of markdown emoji
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *vimwiki-emoji*
|
||||
|
||||
1. People |vimwiki-emoji-people|
|
||||
1.1. Face |vimwiki-emoji-face|
|
||||
1.2. Job |vimwiki-emoji-job|
|
||||
1.3. Familly |vimwiki-emoji-familly|
|
||||
2. Activity |vimwiki-emoji-activity|
|
||||
3. Places |vimwiki-emoji-places|
|
||||
4. Nature |vimwiki-emoji-nature|
|
||||
5. Objects |vimwiki-emoji-objects|
|
||||
6. Foods |vimwiki-emoji-foods|
|
||||
7. Symbols |vimwiki-emoji-symbols|
|
||||
8. Flags |vimwiki-emoji-flags|
|
||||
|
||||
==============================================================================
|
||||
1. People *vimwiki-emoji-people*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1.1 Face *vimwiki-emoji-face*
|
||||
|
||||
| 😀 | grinning | 😃 | smiley | 😄 | smile
|
||||
| 😁 | grin | 😆 | laughing | 😅 | sweat_smile
|
||||
| 😂 | joy | 🤣 | rofl | ☺️ | relaxed
|
||||
| 😊 | blush | 😇 | innocent | 🙂 | slightly_smiling_face
|
||||
| 🙃 | upside_down_face | 😉 | wink | 😌 | relieved
|
||||
| 😍 | heart_eyes | 😘 | kissing_heart | 😗 | kissing
|
||||
| 😙 | kissing_smiling_eyes | 😚 | kissing_closed_eyes | 😋 | yum
|
||||
| 😜 | stuck_out_tongue_winking_eye | 😝 | stuck_out_tongue_closed_eyes| 😛 | stuck_out_tongue
|
||||
| 🤑 | money_mouth_face | 🤗 | hugs | 🤓 | nerd_face
|
||||
| 😎 | sunglasses | 🤡 | clown_face | 🤠 | cowboy_hat_face
|
||||
| 😏 | smirk | 😒 | unamused | 😞 | disappointed
|
||||
| 😔 | pensive | 😟 | worried | 😕 | confused
|
||||
| 🙁 | slightly_frowning_face | ☹️ | frowning_face | 😣 | persevere
|
||||
| 😖 | confounded | 😫 | tired_face | 😩 | weary
|
||||
| 😤 | triumph | 😠 | angry | 😡 | rage
|
||||
| 😶 | no_mouth | 😐 | neutral_face | 😑 | expressionless
|
||||
| 😯 | hushed | 😦 | frowning | 😧 | anguished
|
||||
| 😮 | open_mouth | 😲 | astonished | 😵 | dizzy_face
|
||||
| 😳 | flushed | 😱 | scream | 😨 | fearful
|
||||
| 😰 | cold_sweat | 😢 | cry | 😥 | disappointed_relieved
|
||||
| 🤤 | drooling_face | 😭 | sob | 😓 | sweat
|
||||
| 😪 | sleepy | 😴 | sleeping | 🙄 | roll_eyes
|
||||
| 🤔 | thinking | 🤥 | lying_face | 😬 | grimacing
|
||||
| 🤐 | zipper_mouth_face | 🤢 | nauseated_face | 🤧 | sneezing_face
|
||||
| 😷 | mask | 🤒 | face_with_thermometer | 🤕 | face_with_head_bandage
|
||||
| 😈 | smiling_imp | 👿 | imp | 👹 | japanese_ogre
|
||||
| 👺 | japanese_goblin | 💩 | hankey | 👻 | ghost
|
||||
| 💀 | skull | ☠️ | skull_and_crossbones| 👽 | alien
|
||||
| 👾 | space_invader | 🤖 | robot | 🎃 | jack_o_lantern
|
||||
| 😺 | smiley_cat | 😸 | smile_cat | 😹 | joy_cat
|
||||
| 😻 | heart_eyes_cat | 😼 | smirk_cat | 😽 | kissing_cat
|
||||
| 🙀 | scream_cat | 😿 | crying_cat_face | 😾 | pouting_cat
|
||||
| 👐 | open_hands | 🙌 | raised_hands | 👏 | clap
|
||||
| 🙏 | pray | 🤝 | handshake | 👍 | +1
|
||||
| 👎 | -1 | 👊 | fist_oncoming | ✊ | fist_raised
|
||||
| 🤛 | fist_left | 🤜 | fist_right | 🤞 | crossed_fingers
|
||||
| ✌️ | v | 🤘 | metal | 👌 | ok_hand
|
||||
| 👈 | point_left | 👉 | point_right | 👆 | point_up_2
|
||||
| 👇 | point_down | ☝️ | point_up | ✋ | hand
|
||||
| 🤚 | raised_back_of_hand | 🖐 | raised_hand_with_fingers_splayed | 🖖 | vulcan_salute
|
||||
| 👋 | wave | 🤙 | call_me_hand | 💪 | muscle
|
||||
| 🖕 | middle_finger | ✍️ | writing_hand | 🤳 | selfie
|
||||
| 💅 | nail_care | 💍 | ring | 💄 | lipstick
|
||||
| 💋 | kiss | 👄 | lips | 👅 | tongue
|
||||
| 👂 | ear | 👃 | nose | 👣 | footprints
|
||||
| 👁 | eye | 👀 | eyes | 🗣 | speaking_head
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1.2 Job *vimwiki-emoji-job*
|
||||
|
||||
| 👤 | bust_in_silhouette | 👥 | busts_in_silhouette | 👶 | baby
|
||||
| 👦 | boy | 👧 | girl | 👨 | man
|
||||
| 👩 | woman | 👱♀️ | blonde_woman| 👱 | blonde_man
|
||||
| 👴 | older_man | 👵 | older_woman | 👲 | man_with_gua_pi_mao
|
||||
| 👳♀️ | woman_with_turban | 👳 | man_with_turban
|
||||
| 👮♀️ | policewoman | 👮 | policeman
|
||||
| 👷♀️ | construction_worker_woman| 👷 | construction_worker_man
|
||||
| 💂♀️ | guardswoman | 💂 | guardsman
|
||||
| 🕵️♀️ | female_detective | 🕵️ | male_detective
|
||||
| 👩⚕️ | woman_health_worker | 👨⚕️ | man_health_worker
|
||||
| 👩🌾 | woman_farmer | 👨🌾 | man_farmer
|
||||
| 👩🍳 | woman_cook | 👨🍳 | man_cook
|
||||
| 👩🎓 | woman_student | 👨🎓 | man_student
|
||||
| 👩🎤 | woman_singer | 👨🎤 | man_singer
|
||||
| 👩🏫 | woman_teacher | 👨🏫 | man_teacher
|
||||
| 👩🏭 | woman_factory_worker | 👨🏭 | man_factory_worker
|
||||
| 👩💻 | woman_technologist | 👨💻 | man_technologist
|
||||
| 👩💼 | woman_office_worker | 👨💼 | man_office_worker
|
||||
| 👩🔧 | woman_mechanic | 👨🔧 | man_mechanic
|
||||
| 👩🔬 | woman_scientist | 👨🔬 | man_scientist
|
||||
| 👩🎨 | woman_artist | 👨🎨 | man_artist
|
||||
| 👩🚒 | woman_firefighter | 👨🚒 | man_firefighter
|
||||
| 👩✈️ | woman_pilot | 👨✈️ | man_pilot
|
||||
| 👩🚀 | woman_astronaut | 👨🚀 | man_astronaut
|
||||
| 👩⚖️ | woman_judge | 👨⚖️ | man_judge
|
||||
| 🤶 | mrs_claus | 🎅 | santa
|
||||
| 👸 | princess | 🤴 | prince
|
||||
| 👰 | bride_with_veil | 🤵 | man_in_tuxedo
|
||||
| 👼 | angel | 🤰 | pregnant_woman
|
||||
| 🙇♀️ | bowing_woman | 🙇 | bowing_man
|
||||
| 💁 | tipping_hand_woman | 💁♂️ | tipping_hand_man
|
||||
| 🙅 | no_good_woman | 🙅♂️ | no_good_man
|
||||
| 🙆 | ok_woman | 🙆♂️ | ok_man
|
||||
| 🙋 | raising_hand_woman | 🙋♂️ | raising_hand_man
|
||||
| 🤦♀️ | woman_facepalming | 🤦♂️ | man_facepalming
|
||||
| 🤷♀️ | woman_shrugging | 🤷♂️ | man_shrugging
|
||||
| 🙎 | pouting_woman | 🙎♂️ | pouting_man
|
||||
| 🙍 | frowning_woman | 🙍♂️ | frowning_man
|
||||
| 💇 | haircut_woman | 💇♂️ | haircut_man
|
||||
| 💆 | massage_woman | 💆♂️ | massage_man
|
||||
| 🕴 | business_suit_levitating | 💃 | dancer
|
||||
| 🕺 | man_dancing | 👯 | dancing_women
|
||||
| 👯♂️ | dancing_men | 🚶♀️ | walking_woman
|
||||
| 🚶 | walking_man | 🏃♀️ | running_woman
|
||||
| 🏃 | running_man | 👚 | womans_clothes
|
||||
| 👕 | shirt | 👖 | jeans
|
||||
| 👔 | necktie | 👗 | dress | 👙 | bikini
|
||||
| 👘 | kimono | 👠 | high_heel | 👡 | sandal
|
||||
| 👢 | boot | 👞 | mans_shoe | 👟 | athletic_shoe
|
||||
| 👒 | womans_hat | 🎩 | tophat | 🎓 | mortar_board
|
||||
| 👑 | crown | ⛑ | rescue_worker_helmet| 🎒 | school_satchel
|
||||
| 👝 | pouch | 👛 | purse | 👜 | handbag
|
||||
| 💼 | briefcase | 👓 | eyeglasses | 🕶 | dark_sunglasses
|
||||
| 🌂 | closed_umbrella | ☂️ | open_umbrella
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1.3 Familly *vimwiki-emoji-familly*
|
||||
|
||||
| 👫 | couple
|
||||
| 👭 | two_women_holding_hands
|
||||
| 👬 | two_men_holding_hands
|
||||
| 💑 | couple_with_heart_woman_man
|
||||
| 👩❤️👩 | couple_with_heart_woman_woman
|
||||
| 👨❤️👨 | couple_with_heart_man_man
|
||||
| 💏 | couplekiss_man_woman
|
||||
| 👩❤️💋👩 | couplekiss_woman_woman
|
||||
| 👨❤️💋👨 | couplekiss_man_man
|
||||
| 👪 | family_man_woman_boy
|
||||
| 👨👩👧 | family_man_woman_girl
|
||||
| 👨👩👧👦 | family_man_woman_girl_boy
|
||||
| 👨👩👦👦 | family_man_woman_boy_boy
|
||||
| 👨👩👧👧 | family_man_woman_girl_girl
|
||||
| 👩👩👦 | family_woman_woman_boy
|
||||
| 👩👩👧 | family_woman_woman_girl
|
||||
| 👩👩👧👦 | family_woman_woman_girl_boy
|
||||
| 👩👩👦👦 | family_woman_woman_boy_boy
|
||||
| 👩👩👧👧 | family_woman_woman_girl_girl
|
||||
| 👨👨👦 | family_man_man_boy
|
||||
| 👨👨👧 | family_man_man_girl
|
||||
| 👨👨👧👦 | family_man_man_girl_boy
|
||||
| 👨👨👦👦 | family_man_man_boy_boy
|
||||
| 👨👨👧👧 | family_man_man_girl_girl
|
||||
| 👩👦 | family_woman_boy
|
||||
| 👩👧 | family_woman_girl
|
||||
| 👩👧👦 | family_woman_girl_boy
|
||||
| 👩👦👦 | family_woman_boy_boy
|
||||
| 👩👧👧 | family_woman_girl_girl
|
||||
| 👨👦 | family_man_boy
|
||||
| 👨👧 | family_man_girl
|
||||
| 👨👧👦 | family_man_girl_boy
|
||||
| 👨👦👦 | family_man_boy_boy
|
||||
| 👨👧👧 | family_man_girl_girl
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. Activity *vimwiki-emoji-activity*
|
||||
|
||||
| 👴 | older_man | 👵 | older_woman | 👲 | man_with_gua_pi_mao
|
||||
| ⚽️ | soccer | 🏀 | basketball | 🏈 | football
|
||||
| ⚾️ | baseball | 🎾 | tennis | 🏐 | volleyball
|
||||
| 🏉 | rugby_football | 🎱 | 8ball | 🏓 | ping_pong
|
||||
| 🏸 | badminton | 🥅 | goal_net | 🏒 | ice_hockey
|
||||
| 🏑 | field_hockey | 🏏 | cricket | ⛳️ | golf
|
||||
| 🏹 | bow_and_arrow | 🎣 | fishing_pole_and_fish | 🥊 | boxing_glove
|
||||
| 🥋 | martial_arts_uniform | ⛸ | ice_skate | 🎿 | ski
|
||||
| ⛷ | skier | 🏂 | snowboarder
|
||||
| 🏋️♀️ | weight_lifting_woman | 🏋️ | weight_lifting_man
|
||||
| 🤺 | person_fencing | 🤼♀️ | women_wrestling
|
||||
| 🤼♂️ | men_wrestling | 🤸♀️ | woman_cartwheeling
|
||||
| 🤸♂️ | man_cartwheeling | ⛹️♀️ | basketball_woman
|
||||
| ⛹️ | basketball_man | 🤾♀️ | woman_playing_handball
|
||||
| 🤾♂️ | man_playing_handball | 🏌️♀️ | golfing_woman
|
||||
| 🏌️ | golfing_man | 🏄♀️ | surfing_woman
|
||||
| 🏄 | surfing_man | 🏊♀️ | swimming_woman
|
||||
| 🏊 | swimming_man | 🤽♀️ | woman_playing_water_polo
|
||||
| 🤽♂️ | man_playing_water_polo | 🚣♀️ | rowing_woman
|
||||
| 🚣 | rowing_man | 🏇 | horse_racing
|
||||
| 🚴♀️ | biking_woman | 🚴 | biking_man
|
||||
| 🚵♀️ | mountain_biking_woman | 🚵 | mountain_biking_man
|
||||
| 🎽 | running_shirt_with_sash | 🏅 | medal_sports
|
||||
| 🎖 | medal_military | 🥇 | 1st_place_medal | 🥈 | 2nd_place_medal
|
||||
| 🥉 | 3rd_place_medal | 🏆 | trophy | 🏵 | rosette
|
||||
| 🎗 | reminder_ribbon | 🎫 | ticket | 🎟 | tickets
|
||||
| 🎪 | circus_tent | 🤹♀️ | woman_juggling | 🤹♂️ | man_juggling
|
||||
| 🎭 | performing_arts | 🎨 | art | 🎬 | clapper
|
||||
| 🎤 | microphone | 🎧 | headphones | 🎼 | musical_score
|
||||
| 🎹 | musical_keyboard | 🥁 | drum | 🎷 | saxophone
|
||||
| 🎺 | trumpet | 🎸 | guitar | 🎻 | violin
|
||||
| 🎲 | game_die | 🎯 | dart | 🎳 | bowling
|
||||
| 🎮 | video_game | 🎰 | slot_machine
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. Places *vimwiki-emoji-places*
|
||||
|
||||
| 🚗 | car | 🚕 | taxi | 🚙 | blue_car
|
||||
| 🚌 | bus | 🚎 | trolleybus | 🏎 | racing_car
|
||||
| 🚓 | police_car | 🚑 | ambulance | 🚒 | fire_engine
|
||||
| 🚐 | minibus | 🚚 | truck | 🚛 | articulated_lorry
|
||||
| 🚜 | tractor | 🛴 | kick_scooter | 🚲 | bike
|
||||
| 🛵 | motor_scooter | 🏍 | motorcycle | 🚨 | rotating_light
|
||||
| 🚔 | oncoming_police_car | 🚍 | oncoming_bus | 🚘 | oncoming_automobile
|
||||
| 🚖 | oncoming_taxi | 🚡 | aerial_tramway | 🚠 | mountain_cableway
|
||||
| 🚟 | suspension_railway | 🚃 | railway_car | 🚋 | train
|
||||
| 🚞 | mountain_railway | 🚝 | monorail | 🚄 | bullettrain_side
|
||||
| 🚅 | bullettrain_front | 🚈 | light_rail | 🚂 | steam_locomotive
|
||||
| 🚆 | train2 | 🚇 | metro | 🚊 | tram
|
||||
| 🚉 | station | 🚁 | helicopter | 🛩 | small_airplane
|
||||
| ✈️ | airplane | 🛫 | flight_departure | 🛬 | flight_arrival
|
||||
| 🚀 | rocket | 🛰 | artificial_satellite| 💺 | seat
|
||||
| 🛶 | canoe | ⛵️ | boat | 🛥 | motor_boat
|
||||
| 🚤 | speedboat | 🛳 | passenger_ship | ⛴ | ferry
|
||||
| 🚢 | ship | ⚓️ | anchor | 🚧 | construction
|
||||
| ⛽️ | fuelpump | 🚏 | busstop | 🚦 | vertical_traffic_light
|
||||
| 🚥 | traffic_light | 🗺 | world_map | 🗿 | moyai
|
||||
| 🗽 | statue_of_liberty | ⛲️ | fountain | 🗼 | tokyo_tower
|
||||
| 🏰 | european_castle | 🏯 | japanese_castle | 🏟 | stadium
|
||||
| 🎡 | ferris_wheel | 🎢 | roller_coaster | 🎠 | carousel_horse
|
||||
| ⛱ | parasol_on_ground | 🏖 | beach_umbrella | 🏝 | desert_island
|
||||
| ⛰ | mountain | 🏔 | mountain_snow | 🗻 | mount_fuji
|
||||
| 🌋 | volcano | 🏜 | desert | 🏕 | camping
|
||||
| ⛺️ | tent | 🛤 | railway_track | 🛣 | motorway
|
||||
| 🏗 | building_construction| 🏭 | factory | 🏠 | house
|
||||
| 🏡 | house_with_garden | 🏘 | houses | 🏚 | derelict_house
|
||||
| 🏢 | office | 🏬 | department_store | 🏣 | post_office
|
||||
| 🏤 | european_post_office | 🏥 | hospital | 🏦 | bank
|
||||
| 🏨 | hotel | 🏪 | convenience_store | 🏫 | school
|
||||
| 🏩 | love_hotel | 💒 | wedding | 🏛 | classical_building
|
||||
| ⛪️ | church | 🕌 | mosque | 🕍 | synagogue
|
||||
| 🕋 | kaaba | ⛩ | shinto_shrine | 🗾 | japan
|
||||
| 🎑 | rice_scene | 🏞 | national_park | 🌅 | sunrise
|
||||
| 🌄 | sunrise_over_mountain| 🌠 | stars | 🎇 | sparkler
|
||||
| 🎆 | fireworks | 🌇 | city_sunrise | 🌆 | city_sunset
|
||||
| 🏙 | cityscape | 🌃 | night_with_stars | 🌌 | milky_way
|
||||
| 🌉 | bridge_at_night | 🌁 | foggy
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. Nature *vimwiki-emoji-nature*
|
||||
|
||||
| 🐶 | dog | 🐱 | cat | 🐭 | mouse
|
||||
| 🐹 | hamster | 🐰 | rabbit | 🦊 | fox_face
|
||||
| 🐻 | bear | 🐼 | panda_face | 🐨 | koala
|
||||
| 🐯 | tiger | 🦁 | lion | 🐮 | cow
|
||||
| 🐷 | pig | 🐽 | pig_nose | 🐸 | frog
|
||||
| 🐵 | monkey_face | 🙈 | see_no_evil | 🙉 | hear_no_evil
|
||||
| 🙊 | speak_no_evil | 🐒 | monkey | 🐔 | chicken
|
||||
| 🐧 | penguin | 🐦 | bird | 🐤 | baby_chick
|
||||
| 🐣 | hatching_chick | 🐥 | hatched_chick | 🦆 | duck
|
||||
| 🦅 | eagle | 🦉 | owl | 🦇 | bat
|
||||
| 🐺 | wolf | 🐗 | boar | 🐴 | horse
|
||||
| 🦄 | unicorn | 🐝 | bee | 🐛 | bug
|
||||
| 🦋 | butterfly | 🐌 | snail | 🐚 | shell
|
||||
| 🐞 | beetle | 🐜 | ant | 🕷 | spider
|
||||
| 🕸 | spider_web | 🐢 | turtle | 🐍 | snake
|
||||
| 🦎 | lizard | 🦂 | scorpion | 🦀 | crab
|
||||
| 🦑 | squid | 🐙 | octopus | 🦐 | shrimp
|
||||
| 🐠 | tropical_fish | 🐟 | fish | 🐡 | blowfish
|
||||
| 🐬 | dolphin | 🦈 | shark | 🐳 | whale
|
||||
| 🐋 | whale2 | 🐊 | crocodile | 🐆 | leopard
|
||||
| 🐅 | tiger2 | 🐃 | water_buffalo | 🐂 | ox
|
||||
| 🐄 | cow2 | 🦌 | deer | 🐪 | dromedary_camel
|
||||
| 🐫 | camel | 🐘 | elephant | 🦏 | rhinoceros
|
||||
| 🦍 | gorilla | 🐎 | racehorse | 🐖 | pig2
|
||||
| 🐐 | goat | 🐏 | ram | 🐑 | sheep
|
||||
| 🐕 | dog2 | 🐩 | poodle | 🐈 | cat2
|
||||
| 🐓 | rooster | 🦃 | turkey | 🕊 | dove
|
||||
| 🐇 | rabbit2 | 🐁 | mouse2 | 🐀 | rat
|
||||
| 🐿 | chipmunk | 🐾 | feet | 🐉 | dragon
|
||||
| 🐲 | dragon_face | 🌵 | cactus | 🎄 | christmas_tree
|
||||
| 🌲 | evergreen_tree | 🌳 | deciduous_tree | 🌴 | palm_tree
|
||||
| 🌱 | seedling | 🌿 | herb | ☘️ | shamrock
|
||||
| 🍀 | four_leaf_clover | 🎍 | bamboo | 🎋 | tanabata_tree
|
||||
| 🍃 | leaves | 🍂 | fallen_leaf | 🍁 | maple_leaf
|
||||
| 🍄 | mushroom | 🌾 | ear_of_rice | 💐 | bouquet
|
||||
| 🌷 | tulip | 🌹 | rose | 🥀 | wilted_flower
|
||||
| 🌻 | sunflower | 🌼 | blossom | 🌸 | cherry_blossom
|
||||
| 🌺 | hibiscus | 🌎 | earth_americas | 🌍 | earth_africa
|
||||
| 🌏 | earth_asia | 🌕 | full_moon | 🌖 | waning_gibbous_moon
|
||||
| 🌗 | last_quarter_moon | 🌘 | waning_crescent_moon| 🌑 | new_moon
|
||||
| 🌒 | waxing_crescent_moon | 🌓 | first_quarter_moon | 🌔 | moon
|
||||
| 🌚 | new_moon_with_face | 🌝 | full_moon_with_face | 🌞 | sun_with_face
|
||||
| 🌛 | first_quarter_moon_with_face | 🌜 | last_quarter_moon_with_face
|
||||
| 🌙 | crescent_moon | 💫 | dizzy | ⭐️ | star
|
||||
| 🌟 | star2 | ✨ | sparkles | ⚡️ | zap
|
||||
| 🔥 | fire | 💥 | boom | ☄️ | comet
|
||||
| ☀️ | sunny | 🌤 | sun_behind_small_cloud
|
||||
| ⛅️ | partly_sunny | 🌥 | sun_behind_large_cloud
|
||||
| 🌦 | sun_behind_rain_cloud | 🌈 | rainbow
|
||||
| ☁️ | cloud | 🌧 | cloud_with_rain
|
||||
| ⛈ | cloud_with_lightning_and_rain | 🌩 | cloud_with_lightning
|
||||
| 🌨 | cloud_with_snow | ☃️ | snowman_with_snow | ⛄️ | snowman
|
||||
| ❄️ | snowflake | 🌬 | wind_face | 💨 | dash
|
||||
| 🌪 | tornado | 🌫 | fog | 🌊 | ocean
|
||||
| 💧 | droplet | 💦 | sweat_drops | ☔️ | umbrella
|
||||
|
||||
|
||||
==============================================================================
|
||||
5. Objects *vimwiki-emoji-objects*
|
||||
|
||||
| ⌚️ | watch | 📱 | iphone | 📲 | calling
|
||||
| 💻 | computer | ⌨️ | keyboard | 🖥 | desktop_computer
|
||||
| 🖨 | printer | 🖱 | computer_mouse | 🖲 | trackball
|
||||
| 🕹 | joystick | 🗜 | clamp | 💽 | minidisc
|
||||
| 💾 | floppy_disk | 💿 | cd | 📀 | dvd
|
||||
| 📼 | vhs | 📷 | camera | 📸 | camera_flash
|
||||
| 📹 | video_camera | 🎥 | movie_camera | 📽 | film_projector
|
||||
| 🎞 | film_strip | 📞 | telephone_receiver | ☎️ | phone
|
||||
| 📟 | pager | 📠 | fax | 📺 | tv
|
||||
| 📻 | radio | 🎙 | studio_microphone | 🎚 | level_slider
|
||||
| 🎛 | control_knobs | ⏱ | stopwatch | ⏲ | timer_clock
|
||||
| ⏰ | alarm_clock | 🕰 | mantelpiece_clock | ⌛️ | hourglass
|
||||
| ⏳ | hourglass_flowing_sand | 📡 | satellite
|
||||
| 🔋 | battery | 🔌 | electric_plug | 💡 | bulb
|
||||
| 🔦 | flashlight | 🕯 | candle | 🗑 | wastebasket
|
||||
| 🛢 | oil_drum | 💸 | money_with_wings | 💵 | dollar
|
||||
| 💴 | yen | 💶 | euro | 💷 | pound
|
||||
| 💰 | moneybag | 💳 | credit_card | 💎 | gem
|
||||
| ⚖️ | balance_scale | 🔧 | wrench | 🔨 | hammer
|
||||
| ⚒ | hammer_and_pick | 🛠 | hammer_and_wrench | ⛏ | pick
|
||||
| 🔩 | nut_and_bolt | ⚙️ | gear | ⛓ | chains
|
||||
| 🔫 | gun | 💣 | bomb | 🔪 | hocho
|
||||
| 🗡 | dagger | ⚔️ | crossed_swords | 🛡 | shield
|
||||
| 🚬 | smoking | ⚰️ | coffin | ⚱️ | funeral_urn
|
||||
| 🏺 | amphora | 🔮 | crystal_ball | 📿 | prayer_beads
|
||||
| 💈 | barber | ⚗️ | alembic | 🔭 | telescope
|
||||
| 🔬 | microscope | 🕳 | hole | 💊 | pill
|
||||
| 💉 | syringe | 🌡 | thermometer | 🚽 | toilet
|
||||
| 🚰 | potable_water | 🚿 | shower | 🛁 | bathtub
|
||||
| 🛀 | bath | 🛎 | bellhop_bell | 🔑 | key
|
||||
| 🗝 | old_key | 🚪 | door | 🛋 | couch_and_lamp
|
||||
| 🛏 | bed | 🛌 | sleeping_bed | 🖼 | framed_picture
|
||||
| 🛍 | shopping | 🛒 | shopping_cart | 🎁 | gift
|
||||
| 🎈 | balloon | 🎏 | flags | 🎀 | ribbon
|
||||
| 🎊 | confetti_ball | 🎉 | tada | 🎎 | dolls
|
||||
| 🏮 | izakaya_lantern | 🎐 | wind_chime | ✉️ | email
|
||||
| 📩 | envelope_with_arrow | 📨 | incoming_envelope | 📧 | e-mail
|
||||
| 💌 | love_letter | 📥 | inbox_tray | 📤 | outbox_tray
|
||||
| 📦 | package | 🏷 | label | 📪 | mailbox_closed
|
||||
| 📫 | mailbox | 📬 | mailbox_with_mail | 📭 | mailbox_with_no_mail
|
||||
| 📮 | postbox | 📯 | postal_horn | 📜 | scroll
|
||||
| 📃 | page_with_curl | 📄 | page_facing_up | 📑 | bookmark_tabs
|
||||
| 📊 | bar_chart | 📈 | chart_with_upwards_trend
|
||||
| 📉 | chart_with_downwards_trend | 🗒 | spiral_notepad
|
||||
| 🗓 | spiral_calendar | 📆 | calendar | 📅 | date
|
||||
| 📇 | card_index | 🗃 | card_file_box | 🗳 | ballot_box
|
||||
| 🗄 | file_cabinet | 📋 | clipboard | 📁 | file_folder
|
||||
| 📂 | open_file_folder | 🗂 | card_index_dividers | 🗞 | newspaper_roll
|
||||
| 📰 | newspaper | 📓 | notebook | 📔 | notebook_with_decorative_cover
|
||||
| 📒 | ledger | 📕 | closed_book | 📗 | green_book
|
||||
| 📘 | blue_book | 📙 | orange_book | 📚 | books
|
||||
| 📖 | book | 🔖 | bookmark | 🔗 | link
|
||||
| 📎 | paperclip | 🖇 | paperclips | 📐 | triangular_ruler
|
||||
| 📏 | straight_ruler | 📌 | pushpin | 📍 | round_pushpin
|
||||
| ✂️ | scissors | 🖊 | pen | 🖋 | fountain_pen
|
||||
| ✒️ | black_nib | 🖌 | paintbrush | 🖍 | crayon
|
||||
| 📝 | memo | ✏️ | pencil2 | 🔍 | mag
|
||||
| 🔎 | mag_right | 🔏 | lock_with_ink_pen | 🔐 | closed_lock_with_key
|
||||
| 🔒 | lock | 🔓 | unlock
|
||||
|
||||
|
||||
==============================================================================
|
||||
6. Foods *vimwiki-emoji-foods*
|
||||
|
||||
| 🍏 | green_apple | 🍎 | apple | 🍐 | pear
|
||||
| 🍊 | tangerine | 🍋 | lemon | 🍌 | banana
|
||||
| 🍉 | watermelon | 🍇 | grapes | 🍓 | strawberry
|
||||
| 🍈 | melon | 🍒 | cherries | 🍑 | peach
|
||||
| 🍍 | pineapple | 🥝 | kiwi_fruit | 🥑 | avocado
|
||||
| 🍅 | tomato | 🍆 | eggplant | 🥒 | cucumber
|
||||
| 🥕 | carrot | 🌽 | corn | 🌶 | hot_pepper
|
||||
| 🥔 | potato | 🍠 | sweet_potato | 🌰 | chestnut
|
||||
| 🥜 | peanuts | 🍯 | honey_pot | 🥐 | croissant
|
||||
| 🍞 | bread | 🥖 | baguette_bread | 🧀 | cheese
|
||||
| 🥚 | egg | 🍳 | fried_egg | 🥓 | bacon
|
||||
| 🥞 | pancakes | 🍤 | fried_shrimp | 🍗 | poultry_leg
|
||||
| 🍖 | meat_on_bone | 🍕 | pizza | 🌭 | hotdog
|
||||
| 🍔 | hamburger | 🍟 | fries | 🥙 | stuffed_flatbread
|
||||
| 🌮 | taco | 🌯 | burrito | 🥗 | green_salad
|
||||
| 🥘 | shallow_pan_of_food | 🍝 | spaghetti | 🍜 | ramen
|
||||
| 🍲 | stew | 🍥 | fish_cake | 🍣 | sushi
|
||||
| 🍱 | bento | 🍛 | curry | 🍚 | rice
|
||||
| 🍙 | rice_ball | 🍘 | rice_cracker | 🍢 | oden
|
||||
| 🍡 | dango | 🍧 | shaved_ice | 🍨 | ice_cream
|
||||
| 🍦 | icecream | 🍰 | cake | 🎂 | birthday
|
||||
| 🍮 | custard | 🍭 | lollipop | 🍬 | candy
|
||||
| 🍫 | chocolate_bar | 🍿 | popcorn | 🍩 | doughnut
|
||||
| 🍪 | cookie | 🥛 | milk_glass | 🍼 | baby_bottle
|
||||
| ☕️ | coffee | 🍵 | tea | 🍶 | sake
|
||||
| 🍺 | beer | 🍻 | beers | 🥂 | clinking_glasses
|
||||
| 🍷 | wine_glass | 🥃 | tumbler_glass | 🍸 | cocktail
|
||||
| 🍹 | tropical_drink | 🍾 | champagne | 🥄 | spoon
|
||||
| 🍴 | fork_and_knife | 🍽 | plate_with_cutlery
|
||||
|
||||
|
||||
==============================================================================
|
||||
7. Symbols *vimwiki-emoji-symbols*
|
||||
|
||||
| ❤️ | heart | 💛 | yellow_heart | 💚 | green_heart
|
||||
| 💙 | blue_heart | 💜 | purple_heart | 🖤 | black_heart
|
||||
| 💔 | broken_heart | ❣️ | heavy_heart_exclamation
|
||||
| 💕 | two_hearts | 💞 | revolving_hearts | 💓 | heartbeat
|
||||
| 💗 | heartpulse | 💖 | sparkling_heart | 💘 | cupid
|
||||
| 💝 | gift_heart | 💟 | heart_decoration | ☮️ | peace_symbol
|
||||
| ✝️ | latin_cross | ☪️ | star_and_crescent | 🕉 | om
|
||||
| ☸️ | wheel_of_dharma | ✡️ | star_of_david | 🔯 | six_pointed_star
|
||||
| 🕎 | menorah | ☯️ | yin_yang | ☦️ | orthodox_cross
|
||||
| 🛐 | place_of_worship | ⛎ | ophiuchus | ♈️ | aries
|
||||
| ♉️ | taurus | ♊️ | gemini | ♋️ | cancer
|
||||
| ♌️ | leo | ♍️ | virgo | ♎️ | libra
|
||||
| ♏️ | scorpius | ♐️ | sagittarius | ♑️ | capricorn
|
||||
| ♒️ | aquarius | ♓️ | pisces | 🆔 | id
|
||||
| ⚛️ | atom_symbol | 🉑 | accept | ☢️ | radioactive
|
||||
| ☣️ | biohazard | 📴 | mobile_phone_off | 📳 | vibration_mode
|
||||
| 🈶 | u6709 | 🈚️ | u7121 | 🈸 | u7533
|
||||
| 🈺 | u55b6 | 🈷️ | u6708 | ✴️ | eight_pointed_black_star
|
||||
| 🆚 | vs | 💮 | white_flower | 🉐 | ideograph_advantage
|
||||
| ㊙️ | secret | ㊗️ | congratulations | 🈴 | u5408
|
||||
| 🈵 | u6e80 | 🈹 | u5272 | 🈲 | u7981
|
||||
| 🅰️ | a | 🅱️ | b | 🆎 | ab
|
||||
| 🆑 | cl | 🅾️ | o2 | 🆘 | sos
|
||||
| ❌ | x | ⭕️ | o | 🛑 | stop_sign
|
||||
| ⛔️ | no_entry | 📛 | name_badge | 🚫 | no_entry_sign
|
||||
| 💯 | 100 | 💢 | anger | ♨️ | hotsprings
|
||||
| 🚷 | no_pedestrians | 🚯 | do_not_litter | 🚳 | no_bicycles
|
||||
| 🚱 | non-potable_water | 🔞 | underage | 📵 | no_mobile_phones
|
||||
| 🚭 | no_smoking | ❗️ | exclamation | ❕ | grey_exclamation
|
||||
| ❓ | question | ❔ | grey_question | ‼️ | bangbang
|
||||
| ⁉️ | interrobang | 🔅 | low_brightness | 🔆 | high_brightness
|
||||
| 〽️ | part_alternation_mark | ⚠️ | warning
|
||||
| 🚸 | children_crossing | 🔱 | trident | ⚜️ | fleur_de_lis
|
||||
| 🔰 | beginner | ♻️ | recycle | ✅ | white_check_mark
|
||||
| 🈯️ | u6307 | 💹 | chart | ❇️ | sparkle
|
||||
| ✳️ | eight_spoked_asterisk | ❎ | negative_squared_cross_mark
|
||||
| 🌐 | globe_with_meridians | 💠 | diamond_shape_with_a_dot_inside
|
||||
| Ⓜ️ | m | 🌀 | cyclone | 💤 | zzz
|
||||
| 🏧 | atm | 🚾 | wc | ♿️ | wheelchair
|
||||
| 🅿️ | parking | 🈳 | u7a7a | 🈂️ | sa
|
||||
| 🛂 | passport_control | 🛃 | customs | 🛄 | baggage_claim
|
||||
| 🛅 | left_luggage | 🚹 | mens | 🚺 | womens
|
||||
| 🚼 | baby_symbol | 🚻 | restroom | 🚮 | put_litter_in_its_place
|
||||
| 🎦 | cinema | 📶 | signal_strength | 🈁 | koko
|
||||
| 🔣 | symbols | ℹ️ | information_source | 🔤 | abc
|
||||
| 🔡 | abcd | 🔠 | capital_abcd | 🆖 | ng
|
||||
| 🆗 | ok | 🆙 | up | 🆒 | cool
|
||||
| 🆕 | new | 🆓 | free |0️⃣ | zero
|
||||
| 1️⃣ | one | 2️⃣ | two |3️⃣ | three
|
||||
| 4️⃣ | four |5️⃣ | five |6️⃣ | six
|
||||
| 7️⃣ | seven |8️⃣ | eight |9️⃣ | nine
|
||||
| 🔟 | keycap_ten | 🔢 | 1234 |#️⃣ | hash
|
||||
| *️⃣ | asterisk | ▶️ | arrow_forward | ⏸ | pause_button
|
||||
| ⏯ | play_or_pause_button | ⏹ | stop_button
|
||||
| ⏺ | record_button | ⏭ | next_track_button | ⏮ | previous_track_button
|
||||
| ⏩ | fast_forward | ⏪ | rewind | ⏫ | arrow_double_up
|
||||
| ⏬ | arrow_double_down | ◀️ | arrow_backward | 🔼 | arrow_up_small
|
||||
| 🔽 | arrow_down_small | ➡️ | arrow_right | ⬅️ | arrow_left
|
||||
| ⬆️ | arrow_up | ⬇️ | arrow_down | ↗️ | arrow_upper_right
|
||||
| ↘️ | arrow_lower_right | ↙️ | arrow_lower_left | ↖️ | arrow_upper_left
|
||||
| ↕️ | arrow_up_down | ↔️ | left_right_arrow | ↪️ | arrow_right_hook
|
||||
| ↩️ | leftwards_arrow_with_hook | ⤴️ | arrow_heading_up
|
||||
| ⤵️ | arrow_heading_down | 🔀 | twisted_rightwards_arrows
|
||||
| 🔁 | repeat | 🔂 | repeat_one
|
||||
| 🔄 | arrows_counterclockwise | 🔃 | arrows_clockwise
|
||||
| 🎵 | musical_note | 🎶 | notes | ➕ | heavy_plus_sign
|
||||
| ➖ | heavy_minus_sign | ➗ | heavy_division_sign | ✖️ | heavy_multiplication_x
|
||||
| 💲 | heavy_dollar_sign | 💱 | currency_exchange | ™️ | tm
|
||||
| ©️ | copyright | ®️ | registered | 〰️ | wavy_dash
|
||||
| ➰ | curly_loop | ➿ | loop | 🔚 | end
|
||||
| 🔙 | back | 🔛 | on | 🔝 | top
|
||||
| 🔜 | soon | ✔️ | heavy_check_mark | ☑️ | ballot_box_with_check
|
||||
| 🔘 | radio_button | ⚪️ | white_circle | ⚫️ | black_circle
|
||||
| 🔴 | red_circle | 🔵 | large_blue_circle | 🔺 | small_red_triangle
|
||||
| 🔻 | small_red_triangle_down | 🔸 | small_orange_diamond
|
||||
| 🔹 | small_blue_diamond | 🔶 | large_orange_diamond| 🔷 | large_blue_diamond
|
||||
| 🔳 | white_square_button | 🔲 | black_square_button | ▪️ | black_small_square
|
||||
| ▫️ | white_small_square | ◾️ | black_medium_small_square
|
||||
| ◽️ | white_medium_small_square | ◼️ | black_medium_square
|
||||
| ◻️ | white_medium_square | ⬛️ | black_large_square | ⬜️ | white_large_square
|
||||
| 🔈 | speaker | 🔇 | mute | 🔉 | sound
|
||||
| 🔊 | loud_sound | 🔔 | bell | 🔕 | no_bell
|
||||
| 📣 | mega | 📢 | loudspeaker | 👁🗨 | eye_speech_bubble
|
||||
| 💬 | speech_balloon | 💭 | thought_balloon | 🗯 | right_anger_bubble
|
||||
| ♠️ | spades | ♣️ | clubs | ♥️ | hearts
|
||||
| ♦️ | diamonds | 🃏 | black_joker | 🎴 | flower_playing_cards
|
||||
| 🀄️ | mahjong | 🕐 | clock1 | 🕑 | clock2
|
||||
| 🕒 | clock3 | 🕓 | clock4 | 🕔 | clock5
|
||||
| 🕕 | clock6 | 🕖 | clock7 | 🕗 | clock8
|
||||
| 🕘 | clock9 | 🕙 | clock10 | 🕚 | clock11
|
||||
| 🕛 | clock12 | 🕜 | clock130 | 🕝 | clock230
|
||||
| 🕞 | clock330 | 🕟 | clock430 | 🕠 | clock530
|
||||
| 🕡 | clock630 | 🕢 | clock730 | 🕣 | clock830
|
||||
| 🕤 | clock930 | 🕥 | clock1030 | 🕦 | clock1130
|
||||
| 🕧 | clock1230
|
||||
|
||||
|
||||
8. Flags *vimwiki-emoji-flags*
|
||||
==============================================================================
|
||||
|
||||
| 🏳️ | white_flag | 🏴 | black_flag | 🏁 | checkered_flag
|
||||
| 🚩 | triangular_flag_on_post | 🏳️🌈 | rainbow_flag
|
||||
| 🇦🇫 | afghanistan | 🇦🇽 | aland_islands | 🇦🇱 | albania
|
||||
| 🇩🇿 | algeria | 🇦🇸 | american_samoa | 🇦🇩 | andorra
|
||||
| 🇦🇴 | angola | 🇦🇮 | anguilla | 🇦🇶 | antarctica
|
||||
| 🇦🇬 | antigua_barbuda | 🇦🇷 | argentina | 🇦🇲 | armenia
|
||||
| 🇦🇼 | aruba | 🇦🇺 | australia | 🇦🇹 | austria
|
||||
| 🇦🇿 | azerbaijan | 🇧🇸 | bahamas | 🇧🇭 | bahrain
|
||||
| 🇧🇩 | bangladesh | 🇧🇧 | barbados | 🇧🇾 | belarus
|
||||
| 🇧🇪 | belgium | 🇧🇿 | belize | 🇧🇯 | benin
|
||||
| 🇧🇲 | bermuda | 🇧🇹 | bhutan | 🇧🇴 | bolivia
|
||||
| 🇧🇶 | caribbean_netherlands | 🇧🇦 | bosnia_herzegovina
|
||||
| 🇧🇼 | botswana | 🇧🇷 | brazil | 🇮🇴 | british_indian_ocean_territory
|
||||
| 🇻🇬 | british_virgin_islands | 🇧🇳 | brunei
|
||||
| 🇧🇬 | bulgaria | 🇧🇫 | burkina_faso | 🇧🇮 | burundi
|
||||
| 🇨🇻 | cape_verde | 🇰🇭 | cambodia | 🇨🇲 | cameroon
|
||||
| 🇨🇦 | canada | 🇮🇨 | canary_islands | 🇰🇾 | cayman_islands
|
||||
| 🇨🇫 | central_african_republic | 🇹🇩 | chad
|
||||
| 🇨🇱 | chile | 🇨🇳 | cn | 🇨🇽 | christmas_island
|
||||
| 🇨🇨 | cocos_islands | 🇨🇴 | colombia | 🇰🇲 | comoros
|
||||
| 🇨🇬 | congo_brazzaville | 🇨🇩 | congo_kinshasa | 🇨🇰 | cook_islands
|
||||
| 🇨🇷 | costa_rica | 🇨🇮 | cote_divoire | 🇭🇷 | croatia
|
||||
| 🇨🇺 | cuba | 🇨🇼 | curacao | 🇨🇾 | cyprus
|
||||
| 🇨🇿 | czech_republic | 🇩🇰 | denmark | 🇩🇯 | djibouti
|
||||
| 🇩🇲 | dominica | 🇩🇴 | dominican_republic| 🇪🇨 | ecuador
|
||||
| 🇪🇬 | egypt | 🇸🇻 | el_salvador | 🇬🇶 | equatorial_guinea
|
||||
| 🇪🇷 | eritrea | 🇪🇪 | estonia | 🇪🇹 | ethiopia
|
||||
| 🇪🇺 | eu | 🇫🇰 | falkland_islands | 🇫🇴 | faroe_islands
|
||||
| 🇫🇯 | fiji | 🇫🇮 | finland | 🇫🇷 | fr
|
||||
| 🇬🇫 | french_guiana | 🇵🇫 | french_polynesia | 🇹🇫 | french_southern_territories
|
||||
| 🇬🇦 | gabon | 🇬🇲 | gambia | 🇬🇪 | georgia
|
||||
| 🇩🇪 | de | 🇬🇭 | ghana | 🇬🇮 | gibraltar
|
||||
| 🇬🇷 | greece | 🇬🇱 | greenland | 🇬🇩 | grenada
|
||||
| 🇬🇵 | guadeloupe | 🇬🇺 | guam | 🇬🇹 | guatemala
|
||||
| 🇬🇬 | guernsey | 🇬🇳 | guinea | 🇬🇼 | guinea_bissau
|
||||
| 🇬🇾 | guyana | 🇭🇹 | haiti | 🇭🇳 | honduras
|
||||
| 🇭🇰 | hong_kong | 🇭🇺 | hungary | 🇮🇸 | iceland
|
||||
| 🇮🇳 | india | 🇮🇩 | indonesia | 🇮🇷 | iran
|
||||
| 🇮🇶 | iraq | 🇮🇪 | ireland | 🇮🇲 | isle_of_man
|
||||
| 🇮🇱 | israel | 🇮🇹 | it | 🇯🇲 | jamaica
|
||||
| 🇯🇵 | jp | 🎌 | crossed_flags | 🇯🇪 | jersey
|
||||
| 🇯🇴 | jordan | 🇰🇿 | kazakhstan | 🇰🇪 | kenya
|
||||
| 🇰🇮 | kiribati | 🇽🇰 | kosovo | 🇰🇼 | kuwait
|
||||
| 🇰🇬 | kyrgyzstan | 🇱🇦 | laos | 🇱🇻 | latvia
|
||||
| 🇱🇧 | lebanon | 🇱🇸 | lesotho | 🇱🇷 | liberia
|
||||
| 🇱🇾 | libya | 🇱🇮 | liechtenstein | 🇱🇹 | lithuania
|
||||
| 🇱🇺 | luxembourg | 🇲🇴 | macau | 🇲🇰 | macedonia
|
||||
| 🇲🇬 | madagascar | 🇲🇼 | malawi | 🇲🇾 | malaysia
|
||||
| 🇲🇻 | maldives | 🇲🇱 | mali | 🇲🇹 | malta
|
||||
| 🇲🇭 | marshall_islands | 🇲🇶 | martinique | 🇲🇷 | mauritania
|
||||
| 🇲🇺 | mauritius | 🇾🇹 | mayotte | 🇲🇽 | mexico
|
||||
| 🇫🇲 | micronesia | 🇲🇩 | moldova | 🇲🇨 | monaco
|
||||
| 🇲🇳 | mongolia | 🇲🇪 | montenegro | 🇲🇸 | montserrat
|
||||
| 🇲🇦 | morocco | 🇲🇿 | mozambique | 🇲🇲 | myanmar
|
||||
| 🇳🇦 | namibia | 🇳🇷 | nauru | 🇳🇵 | nepal
|
||||
| 🇳🇱 | netherlands | 🇳🇨 | new_caledonia | 🇳🇿 | new_zealand
|
||||
| 🇳🇮 | nicaragua | 🇳🇪 | niger | 🇳🇬 | nigeria
|
||||
| 🇳🇺 | niue | 🇳🇫 | norfolk_island | 🇲🇵 | northern_mariana_islands
|
||||
| 🇰🇵 | north_korea | 🇳🇴 | norway | 🇴🇲 | oman
|
||||
| 🇵🇰 | pakistan | 🇵🇼 | palau | 🇵🇸 | palestinian_territories
|
||||
| 🇵🇦 | panama | 🇵🇬 | papua_new_guinea | 🇵🇾 | paraguay
|
||||
| 🇵🇪 | peru | 🇵🇭 | philippines | 🇵🇳 | pitcairn_islands
|
||||
| 🇵🇱 | poland | 🇵🇹 | portugal | 🇵🇷 | puerto_rico
|
||||
| 🇶🇦 | qatar | 🇷🇪 | reunion | 🇷🇴 | romania
|
||||
| 🇷🇺 | ru | 🇷🇼 | rwanda | 🇧🇱 | st_barthelemy
|
||||
| 🇸🇭 | st_helena | 🇰🇳 | st_kitts_nevis | 🇱🇨 | st_lucia
|
||||
| 🇵🇲 | st_pierre_miquelon | 🇻🇨 | st_vincent_grenadines
|
||||
| 🇼🇸 | samoa | 🇸🇲 | san_marino | 🇸🇹 | sao_tome_principe
|
||||
| 🇸🇦 | saudi_arabia | 🇸🇳 | senegal | 🇷🇸 | serbia
|
||||
| 🇸🇨 | seychelles | 🇸🇱 | sierra_leone | 🇸🇬 | singapore
|
||||
| 🇸🇽 | sint_maarten | 🇸🇰 | slovakia | 🇸🇮 | slovenia
|
||||
| 🇸🇧 | solomon_islands | 🇸🇴 | somalia | 🇿🇦 | south_africa
|
||||
| 🇬🇸 | south_georgia_south_sandwich_islands| 🇰🇷 | kr
|
||||
| 🇸🇸 | south_sudan | 🇪🇸 | es | 🇱🇰 | sri_lanka
|
||||
| 🇸🇩 | sudan | 🇸🇷 | suriname | 🇸🇿 | swaziland
|
||||
| 🇸🇪 | sweden | 🇨🇭 | switzerland | 🇸🇾 | syria
|
||||
| 🇹🇼 | taiwan | 🇹🇯 | tajikistan | 🇹🇿 | tanzania
|
||||
| 🇹🇭 | thailand | 🇹🇱 | timor_leste | 🇹🇬 | togo
|
||||
| 🇹🇰 | tokelau | 🇹🇴 | tonga | 🇹🇹 | trinidad_tobago
|
||||
| 🇹🇳 | tunisia | 🇹🇷 | tr | 🇹🇲 | turkmenistan
|
||||
| 🇹🇨 | turks_caicos_islands| 🇹🇻 | tuvalu | 🇺🇬 | uganda
|
||||
| 🇺🇦 | ukraine | 🇦🇪 | united_arab_emirate| 🇬🇧 | gb
|
||||
| 🇺🇸 | us | 🇻🇮 | us_virgin_islands | 🇺🇾 | uruguay
|
||||
| 🇺🇿 | uzbekistan | 🇻🇺 | vanuatu | 🇻🇦 | vatican_city
|
||||
| 🇻🇪 | venezuela | 🇻🇳 | vietnam | 🇼🇫 | wallis_futuna
|
||||
| 🇪🇭 | western_sahara | 🇾🇪 | yemen | 🇿🇲 | zambia
|
||||
| 🇿🇼 | zimbabwe
|
||||
|
After Width: | Height: | Size: 466 KiB |
@@ -4,21 +4,23 @@
|
||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
||||
|
||||
|
||||
if exists("g:loaded_vimwiki") || &cp
|
||||
" Clause: load only once
|
||||
if exists('g:loaded_vimwiki') || &compatible
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki = 1
|
||||
|
||||
" Set to version number for release, otherwise -1 for dev-branch
|
||||
let s:plugin_vers = 2.4
|
||||
" Set to version number for release:
|
||||
let g:vimwiki_version = '2022.12.02'
|
||||
|
||||
" Get the directory the script is installed in
|
||||
let s:plugin_dir = expand('<sfile>:p:h:h')
|
||||
|
||||
let s:old_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Save peace in the galaxy
|
||||
let s:old_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
" Save autowriteall variable state
|
||||
if exists('g:vimwiki_autowriteall')
|
||||
let s:vimwiki_autowriteall_saved = g:vimwiki_autowriteall
|
||||
else
|
||||
@@ -26,8 +28,8 @@ else
|
||||
endif
|
||||
|
||||
|
||||
" this is called when the cursor leaves the buffer
|
||||
function! s:setup_buffer_leave()
|
||||
" Autocommand called when the cursor leaves the buffer
|
||||
function! s:setup_buffer_leave() abort
|
||||
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
|
||||
" a registered wiki and not a temporary wiki)
|
||||
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
|
||||
@@ -42,8 +44,8 @@ function! s:setup_buffer_leave()
|
||||
endfunction
|
||||
|
||||
|
||||
" create a new temporary wiki for the current buffer
|
||||
function! s:create_temporary_wiki()
|
||||
" Create a new temporary wiki for the current buffer
|
||||
function! s:create_temporary_wiki() abort
|
||||
let path = expand('%:p:h')
|
||||
let ext = '.'.expand('%:e')
|
||||
|
||||
@@ -67,10 +69,10 @@ function! s:create_temporary_wiki()
|
||||
endfunction
|
||||
|
||||
|
||||
" This function is called when Vim opens a new buffer with a known wiki
|
||||
" Autocommand called when Vim opens a new buffer with a known wiki
|
||||
" extension. Both when the buffer has never been opened in this session and
|
||||
" when it has.
|
||||
function! s:setup_new_wiki_buffer()
|
||||
function! s:setup_new_wiki_buffer() abort
|
||||
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
if wiki_nr == -1 " it's not in a known wiki directory
|
||||
if vimwiki#vars#get_global('global_ext')
|
||||
@@ -82,55 +84,66 @@ function! s:setup_new_wiki_buffer()
|
||||
endif
|
||||
|
||||
if vimwiki#vars#get_wikilocal('maxhi')
|
||||
call vimwiki#vars#set_bufferlocal('existing_wikifiles', vimwiki#base#get_wikilinks(wiki_nr, 1))
|
||||
call vimwiki#vars#set_bufferlocal('existing_wikifiles', vimwiki#base#get_wikilinks(wiki_nr, 1, ''))
|
||||
call vimwiki#vars#set_bufferlocal('existing_wikidirs',
|
||||
\ vimwiki#base#get_wiki_directories(wiki_nr))
|
||||
endif
|
||||
|
||||
" this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are
|
||||
" sourced
|
||||
setfiletype vimwiki
|
||||
|
||||
call vimwiki#u#ft_set()
|
||||
endfunction
|
||||
|
||||
|
||||
" this is called when the cursor enters the buffer
|
||||
function! s:setup_buffer_enter()
|
||||
" Autocommand called when the cursor enters the buffer
|
||||
function! s:setup_buffer_enter() abort
|
||||
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
|
||||
" a registered wiki and not a temporary wiki)
|
||||
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
|
||||
return
|
||||
endif
|
||||
|
||||
if &filetype != 'vimwiki'
|
||||
setfiletype vimwiki
|
||||
call s:set_global_options()
|
||||
endfunction
|
||||
|
||||
|
||||
" Autocommand called when the buffer enters a window or when running a diff
|
||||
function! s:setup_buffer_win_enter() abort
|
||||
" don't do anything if it's not managed by Vimwiki (that is, when it's not in
|
||||
" a registered wiki and not a temporary wiki)
|
||||
if vimwiki#vars#get_bufferlocal('wiki_nr') == -1
|
||||
return
|
||||
endif
|
||||
|
||||
call s:set_global_options()
|
||||
if !vimwiki#u#ft_is_vw()
|
||||
call vimwiki#u#ft_set()
|
||||
endif
|
||||
|
||||
call s:set_windowlocal_options()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:setup_cleared_syntax()
|
||||
" Help syntax reloading
|
||||
function! s:setup_cleared_syntax() abort
|
||||
" highlight groups that get cleared
|
||||
" on colorscheme change because they are not linked to Vim-predefined groups
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
|
||||
hi def VimwikiUnderline gui=underline
|
||||
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
|
||||
hi def VimwikiUnderline term=underline cterm=underline gui=underline
|
||||
if vimwiki#vars#get_global('hl_headers') == 1
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
|
||||
\ . vimwiki#vars#get_global('hcolor_guifg_'.&bg)[i-1]
|
||||
\ .' gui=bold ctermfg='.vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[i-1]
|
||||
\ . vimwiki#vars#get_global('hcolor_guifg_'.&background)[i-1]
|
||||
\ .' gui=bold ctermfg='.vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[i-1]
|
||||
\ .' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:vimwiki_get_known_extensions()
|
||||
" Return: list of extension known vy vimwiki
|
||||
function! s:vimwiki_get_known_extensions() abort
|
||||
" Getting all extensions that different wikis could have
|
||||
let extensions = {}
|
||||
for idx in range(vimwiki#vars#number_of_wikis())
|
||||
@@ -148,7 +161,7 @@ endfunction
|
||||
" Set settings which are global for Vim, but should only be executed for
|
||||
" Vimwiki buffers. So they must be set when the cursor enters a Vimwiki buffer
|
||||
" and reset when the cursor leaves the buffer.
|
||||
function! s:set_global_options()
|
||||
function! s:set_global_options() abort
|
||||
let s:vimwiki_autowriteall_saved = &autowriteall
|
||||
let &autowriteall = vimwiki#vars#get_global('autowriteall')
|
||||
|
||||
@@ -161,7 +174,7 @@ endfunction
|
||||
" Set settings which are local to a window. In a new tab they would be reset to
|
||||
" Vim defaults. So we enforce our settings here when the cursor enters a
|
||||
" Vimwiki buffer.
|
||||
function! s:set_windowlocal_options()
|
||||
function! s:set_windowlocal_options() abort
|
||||
if !&diff " if Vim is currently in diff mode, don't interfere with its folding
|
||||
let foldmethod = vimwiki#vars#get_global('folding')
|
||||
if foldmethod =~? '^expr.*'
|
||||
@@ -183,8 +196,8 @@ function! s:set_windowlocal_options()
|
||||
endif
|
||||
endif
|
||||
|
||||
if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
|
||||
let &conceallevel = vimwiki#vars#get_global('conceallevel')
|
||||
if exists('+conceallevel')
|
||||
let &l:conceallevel = vimwiki#vars#get_global('conceallevel')
|
||||
endif
|
||||
|
||||
if vimwiki#vars#get_global('auto_chdir')
|
||||
@@ -193,60 +206,106 @@ function! s:set_windowlocal_options()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:get_version()
|
||||
if s:plugin_vers != -1
|
||||
echo "Stable version: " . s:plugin_vers
|
||||
" Echo vimwiki version
|
||||
" Called by :VimwikiShowVersion
|
||||
function! s:get_version() abort
|
||||
echo 'Version: ' . g:vimwiki_version
|
||||
let l:plugin_rev = system('git --git-dir ' . s:plugin_dir . '/.git rev-parse --short HEAD')
|
||||
let l:plugin_branch = system('git --git-dir ' . s:plugin_dir . '/.git rev-parse --abbrev-ref HEAD')
|
||||
let l:plugin_date = system('git --git-dir ' . s:plugin_dir . '/.git show -s --format=%ci')
|
||||
if v:shell_error == 0
|
||||
echo 'Os: ' . vimwiki#u#os_name()
|
||||
echo 'Vim: ' . v:version
|
||||
echo 'Branch: ' . l:plugin_branch
|
||||
echo 'Revision: ' . l:plugin_rev
|
||||
echo 'Date: ' . l:plugin_date
|
||||
else
|
||||
let a:plugin_rev = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --short HEAD")
|
||||
let a:plugin_branch = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --abbrev-ref HEAD")
|
||||
let a:plugin_date = system("git --git-dir " . s:plugin_dir . "/.git show -s --format=%ci")
|
||||
if v:shell_error == 0
|
||||
echo "Branch: " . a:plugin_branch
|
||||
echo "Revision: " . a:plugin_rev
|
||||
echo "Date: " . a:plugin_date
|
||||
else
|
||||
echo "Unknown version"
|
||||
endif
|
||||
echo 'Unable to retrieve repository info'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" Initialization of Vimwiki starts here. Make sure everything below does not
|
||||
" cause autoload/vimwiki/base.vim to be loaded
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Initialization of Vimwiki starts here.
|
||||
" Make sure everything below does not cause autoload/vimwiki/base.vim
|
||||
" to be loaded
|
||||
call vimwiki#vars#init()
|
||||
|
||||
|
||||
" Define callback functions which the user can redefine
|
||||
if !exists("*VimwikiLinkHandler")
|
||||
if !exists('*VimwikiLinkHandler')
|
||||
function VimwikiLinkHandler(url)
|
||||
return 0
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if !exists("*VimwikiLinkConverter")
|
||||
if !exists('*VimwikiLinkConverter')
|
||||
function VimwikiLinkConverter(url, source, target)
|
||||
" Return the empty string when unable to process link
|
||||
return ''
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if !exists("*VimwikiWikiIncludeHandler")
|
||||
if !exists('*VimwikiWikiIncludeHandler')
|
||||
function! VimwikiWikiIncludeHandler(value)
|
||||
return ''
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
" Write a level 1 header to new wiki files
|
||||
" a:fname should be an absolute filepath
|
||||
function! s:create_h1(fname) abort
|
||||
" Clause: Don't do anything for unregistered wikis
|
||||
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
if idx == -1
|
||||
return
|
||||
endif
|
||||
|
||||
" Clause: no auto_header
|
||||
if !vimwiki#vars#get_global('auto_header')
|
||||
return
|
||||
endif
|
||||
|
||||
" Clause: don't create header for the diary index page
|
||||
if vimwiki#path#is_equal(a:fname,
|
||||
\ vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx).
|
||||
\ vimwiki#vars#get_wikilocal('diary_index', idx).vimwiki#vars#get_wikilocal('ext', idx))
|
||||
return
|
||||
endif
|
||||
|
||||
" Get tail of filename without extension
|
||||
let title = expand('%:t:r')
|
||||
|
||||
" Clause: don't insert header for index page
|
||||
if title ==# vimwiki#vars#get_wikilocal('index', idx)
|
||||
return
|
||||
endif
|
||||
|
||||
" Don't substitute space char for diary pages
|
||||
if title !~# '^\d\{4}-\d\d-\d\d'
|
||||
" NOTE: it is possible this could remove desired characters if the 'links_space_char'
|
||||
" character matches characters that are intentionally used in the title.
|
||||
let title = substitute(title, vimwiki#vars#get_wikilocal('links_space_char'), ' ', 'g')
|
||||
endif
|
||||
|
||||
" Insert the header
|
||||
if vimwiki#vars#get_wikilocal('syntax') ==? 'markdown'
|
||||
keepjumps call append(0, '# ' . title)
|
||||
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
|
||||
keepjumps call append(1, '')
|
||||
endfor
|
||||
else
|
||||
keepjumps call append(0, '= ' . title . ' =')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Define autocommands for all known wiki extensions
|
||||
|
||||
let s:known_extensions = s:vimwiki_get_known_extensions()
|
||||
|
||||
if index(s:known_extensions, '.wiki') > -1
|
||||
augroup filetypedetect
|
||||
" clear FlexWiki's stuff
|
||||
" Clear FlexWiki's stuff
|
||||
au! * *.wiki
|
||||
augroup end
|
||||
endif
|
||||
@@ -254,124 +313,147 @@ endif
|
||||
augroup vimwiki
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:setup_cleared_syntax()
|
||||
for s:ext in s:known_extensions
|
||||
exe 'autocmd BufNewFile,BufRead *'.s:ext.' call s:setup_new_wiki_buffer()'
|
||||
exe 'autocmd BufEnter *'.s:ext.' call s:setup_buffer_enter()'
|
||||
exe 'autocmd BufLeave *'.s:ext.' call s:setup_buffer_leave()'
|
||||
" Format tables when exit from insert mode. Do not use textwidth to
|
||||
" autowrap tables.
|
||||
if vimwiki#vars#get_global('table_auto_fmt')
|
||||
exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))'
|
||||
exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))'
|
||||
endif
|
||||
if vimwiki#vars#get_global('folding') =~? ':quick$'
|
||||
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
|
||||
" Don't screw up folds when inserting text that might affect them, until
|
||||
" leaving insert mode. Foldmethod is local to the window. Protect against
|
||||
" screwing up folding when switching between windows.
|
||||
exe 'autocmd InsertEnter *'.s:ext.' if !exists("w:last_fdm") | let w:last_fdm=&foldmethod'.
|
||||
\ ' | setlocal foldmethod=manual | endif'
|
||||
exe 'autocmd InsertLeave,WinLeave *'.s:ext.' if exists("w:last_fdm") |'.
|
||||
\ 'let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif'
|
||||
endif
|
||||
endfor
|
||||
|
||||
" ['.md', '.mdown'] => *.md,*.mdown
|
||||
let pat = join(map(s:known_extensions, '"*" . v:val'), ',')
|
||||
exe 'autocmd BufNewFile,BufRead '.pat.' call s:setup_new_wiki_buffer()'
|
||||
exe 'autocmd BufEnter '.pat.' call s:setup_buffer_enter()'
|
||||
exe 'autocmd BufLeave '.pat.' call s:setup_buffer_leave()'
|
||||
exe 'autocmd BufWinEnter '.pat.' call s:setup_buffer_win_enter()'
|
||||
if exists('##DiffUpdated')
|
||||
exe 'autocmd DiffUpdated '.pat.' call s:setup_buffer_win_enter()'
|
||||
endif
|
||||
" automatically generate a level 1 header for new files
|
||||
exe 'autocmd BufNewFile '.pat.' call s:create_h1(expand("%:p"))'
|
||||
" Format tables when exit from insert mode. Do not use textwidth to
|
||||
" autowrap tables.
|
||||
if vimwiki#vars#get_global('table_auto_fmt')
|
||||
exe 'autocmd InsertLeave '.pat.' call vimwiki#tbl#format(line("."), 2)'
|
||||
endif
|
||||
if vimwiki#vars#get_global('folding') =~? ':quick$'
|
||||
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
|
||||
" Don't screw up folds when inserting text that might affect them, until
|
||||
" leaving insert mode. Foldmethod is local to the window. Protect against
|
||||
" screwing up folding when switching between windows.
|
||||
exe 'autocmd InsertEnter '.pat.' if !exists("w:last_fdm") | let w:last_fdm=&foldmethod'.
|
||||
\ ' | setlocal foldmethod=manual | endif'
|
||||
exe 'autocmd InsertLeave,WinLeave '.pat.' if exists("w:last_fdm") |'.
|
||||
\ 'let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif'
|
||||
endif
|
||||
augroup END
|
||||
|
||||
|
||||
|
||||
" Declare global commands
|
||||
command! VimwikiUISelect call vimwiki#base#ui_select()
|
||||
" why not using <count> instead of v:count1?
|
||||
" See https://github.com/vimwiki-backup/vimwiki/issues/324
|
||||
command! -count=1 VimwikiIndex
|
||||
\ call vimwiki#base#goto_index(v:count1)
|
||||
command! -count=1 VimwikiTabIndex
|
||||
\ call vimwiki#base#goto_index(v:count1, 1)
|
||||
|
||||
command! -count=1 VimwikiDiaryIndex
|
||||
\ call vimwiki#diary#goto_diary_index(v:count1)
|
||||
command! -count=1 VimwikiMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count)
|
||||
command! -count=1 VimwikiTabMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count, 1)
|
||||
command! -count=1 VimwikiMakeYesterdayDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count, 0,
|
||||
\ vimwiki#diary#diary_date_link(localtime() - 60*60*24))
|
||||
command! -count=1 VimwikiMakeTomorrowDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count, 0,
|
||||
\ vimwiki#diary#diary_date_link(localtime() + 60*60*24))
|
||||
" these commands take a count e.g. :VimwikiIndex 2
|
||||
" the default behavior is to open the index, diary etc.
|
||||
" for the CURRENT wiki if no count is given
|
||||
command! -count=0 VimwikiIndex
|
||||
\ call vimwiki#base#goto_index(<count>)
|
||||
|
||||
command! -count=0 VimwikiTabIndex
|
||||
\ call vimwiki#base#goto_index(<count>, 1)
|
||||
|
||||
command! -count=0 VimwikiDiaryIndex
|
||||
\ call vimwiki#diary#goto_diary_index(<count>)
|
||||
|
||||
command! -count=0 VimwikiMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(<count>, 5)
|
||||
|
||||
command! -count=0 VimwikiTabMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(<count>, 1)
|
||||
|
||||
command! -count=0 VimwikiMakeYesterdayDiaryNote
|
||||
\ call vimwiki#diary#make_note(<count>, 0,
|
||||
\ vimwiki#diary#diary_date_link(localtime(), -1))
|
||||
|
||||
command! -count=0 VimwikiMakeTomorrowDiaryNote
|
||||
\ call vimwiki#diary#make_note(<count>, 0,
|
||||
\ vimwiki#diary#diary_date_link(localtime(), 1))
|
||||
|
||||
command! VimwikiDiaryGenerateLinks
|
||||
\ call vimwiki#diary#generate_diary_section()
|
||||
|
||||
command! VimwikiShowVersion call s:get_version()
|
||||
|
||||
command! -nargs=* -complete=customlist,vimwiki#vars#complete
|
||||
\ VimwikiVar call vimwiki#vars#cmd(<q-args>)
|
||||
|
||||
|
||||
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
|
||||
" Declare global maps
|
||||
" <Plug> global definitions
|
||||
nnoremap <silent><script> <Plug>VimwikiIndex
|
||||
\ :<C-U>call vimwiki#base#goto_index(v:count)<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiTabIndex
|
||||
\ :<C-U>call vimwiki#base#goto_index(v:count, 1)<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiUISelect
|
||||
\ :VimwikiUISelect<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiDiaryIndex
|
||||
\ :<C-U>call vimwiki#diary#goto_diary_index(v:count)<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiDiaryGenerateLinks
|
||||
\ :VimwikiDiaryGenerateLinks<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiMakeDiaryNote
|
||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 5)<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiTabMakeDiaryNote
|
||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 1)<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiMakeYesterdayDiaryNote
|
||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
|
||||
\ vimwiki#diary#diary_date_link(localtime(), -1))<CR>
|
||||
nnoremap <silent><script> <Plug>VimwikiMakeTomorrowDiaryNote
|
||||
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
|
||||
\ vimwiki#diary#diary_date_link(localtime(), 1))<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiIndex')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'w <Plug>VimwikiIndex'
|
||||
|
||||
" Set default global key mappings
|
||||
if str2nr(vimwiki#vars#get_global('key_mappings').global)
|
||||
" Get the user defined prefix (default <leader>w)
|
||||
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
|
||||
|
||||
call vimwiki#u#map_key('n', s:map_prefix . 'w', '<Plug>VimwikiIndex', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . 't', '<Plug>VimwikiTabIndex', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . 's', '<Plug>VimwikiUISelect', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . 'i', '<Plug>VimwikiDiaryIndex', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>i', '<Plug>VimwikiDiaryGenerateLinks', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>w', '<Plug>VimwikiMakeDiaryNote', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>t', '<Plug>VimwikiTabMakeDiaryNote', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>y', '<Plug>VimwikiMakeYesterdayDiaryNote', 2)
|
||||
call vimwiki#u#map_key('n', s:map_prefix . '<Leader>m', '<Plug>VimwikiMakeTomorrowDiaryNote', 2)
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabIndex')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'t <Plug>VimwikiTabIndex'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiUISelect')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'s <Plug>VimwikiUISelect'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryIndex')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'i <Plug>VimwikiDiaryIndex'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDiaryGenerateLinks')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>i <Plug>VimwikiDiaryGenerateLinks'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiMakeDiaryNote')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>w <Plug>VimwikiMakeDiaryNote'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>t <Plug>VimwikiTabMakeDiaryNote'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
|
||||
\ :VimwikiTabMakeDiaryNote<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiMakeYesterdayDiaryNote')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>y <Plug>VimwikiMakeYesterdayDiaryNote'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiMakeYesterdayDiaryNote
|
||||
\ :VimwikiMakeYesterdayDiaryNote<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiMakeTomorrowDiaryNote')
|
||||
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>m <Plug>VimwikiMakeTomorrowDiaryNote'
|
||||
endif
|
||||
nnoremap <unique><script> <Plug>VimwikiMakeTomorrowDiaryNote
|
||||
\ :VimwikiMakeTomorrowDiaryNote<CR>
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:build_menu(topmenu)
|
||||
" Build global wiki menu (GUI)
|
||||
function! s:build_menu(topmenu) abort
|
||||
let wnamelist = []
|
||||
for idx in range(vimwiki#vars#number_of_wikis())
|
||||
let norm_path = fnamemodify(vimwiki#vars#get_wikilocal('path', idx), ':h:t')
|
||||
let norm_path = escape(norm_path, '\ \.')
|
||||
execute 'menu '.a:topmenu.'.Open\ index.'.norm_path.
|
||||
let wname = vimwiki#vars#get_wikilocal('name', idx)
|
||||
if wname ==? ''
|
||||
" fall back to the path if wiki isn't named
|
||||
let wname = fnamemodify(vimwiki#vars#get_wikilocal('path', idx), ':h:t')
|
||||
endif
|
||||
|
||||
if index(wnamelist, wname) != -1
|
||||
" append wiki index number to duplicate entries
|
||||
let wname = wname . ' ' . string(idx + 1)
|
||||
endif
|
||||
|
||||
" add entry to the list of names for duplicate checks
|
||||
call add(wnamelist, wname)
|
||||
|
||||
" escape spaces and periods
|
||||
let wname = escape(wname, '\ \.')
|
||||
|
||||
" build the menu
|
||||
execute 'menu '.a:topmenu.'.Open\ index.'.wname.
|
||||
\ ' :call vimwiki#base#goto_index('.(idx+1).')<CR>'
|
||||
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.norm_path.
|
||||
execute 'menu '.a:topmenu.'.Open/Create\ diary\ note.'.wname.
|
||||
\ ' :call vimwiki#diary#make_note('.(idx+1).')<CR>'
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:build_table_menu(topmenu)
|
||||
|
||||
" Build global table menu (GUI)
|
||||
function! s:build_table_menu(topmenu) abort
|
||||
exe 'menu '.a:topmenu.'.-Sep- :'
|
||||
exe 'menu '.a:topmenu.'.Table.Create\ (enter\ cols\ rows) :VimwikiTable '
|
||||
exe 'nmenu '.a:topmenu.'.Table.Format<tab>gqq gqq'
|
||||
@@ -382,6 +464,7 @@ function! s:build_table_menu(topmenu)
|
||||
endfunction
|
||||
|
||||
|
||||
" Build Menus now
|
||||
if !empty(vimwiki#vars#get_global('menu'))
|
||||
call s:build_menu(vimwiki#vars#get_global('menu'))
|
||||
call s:build_table_menu(vimwiki#vars#get_global('menu'))
|
||||
@@ -395,4 +478,5 @@ if vimwiki#vars#get_global('use_calendar')
|
||||
endif
|
||||
|
||||
|
||||
let &cpo = s:old_cpo
|
||||
" Restore peace in the galaxy
|
||||
let &cpoptions = s:old_cpo
|
||||
|
||||
@@ -6,19 +6,31 @@
|
||||
" Quit if syntax file is already loaded
|
||||
if v:version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
elseif exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
let s:current_syntax = vimwiki#vars#get_wikilocal('syntax')
|
||||
|
||||
" Get config: possibly concealed chars
|
||||
let b:vimwiki_syntax_conceal = exists('+conceallevel') ? ' conceal' : ''
|
||||
let b:vimwiki_syntax_concealends = has('conceal') ? ' concealends' : ''
|
||||
|
||||
|
||||
" Populate all syntax vars
|
||||
" Include syntax/vimwiki_markdown.vim as "side effect"
|
||||
call vimwiki#vars#populate_syntax_vars(s:current_syntax)
|
||||
let syntax_dic = g:vimwiki_syntaxlocal_vars[s:current_syntax]
|
||||
|
||||
" Declare nesting capabilities
|
||||
" -- to be embedded in standard: bold, italic, underline
|
||||
|
||||
" text: `code` or ``code`` only inline
|
||||
" Note: `\%(^\|[^`]\)\@<=` means after a new line or a non `
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature
|
||||
function! s:add_target_syntax_ON(target, type)
|
||||
function! s:add_target_syntax_ON(target, type) abort
|
||||
let prefix0 = 'syntax match '.a:type.' `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match '.a:type.'T `'
|
||||
@@ -28,7 +40,7 @@ function! s:add_target_syntax_ON(target, type)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:add_target_syntax_OFF(target)
|
||||
function! s:add_target_syntax_OFF(target) abort
|
||||
let prefix0 = 'syntax match VimwikiNoExistsLink `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
@@ -38,7 +50,7 @@ function! s:add_target_syntax_OFF(target)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:highlight_existing_links()
|
||||
function! s:highlight_existing_links() abort
|
||||
" Wikilink
|
||||
" Conditional highlighting that depends on the existence of a wiki file or
|
||||
" directory is only available for *schemeless* wiki links
|
||||
@@ -51,33 +63,33 @@ function! s:highlight_existing_links()
|
||||
" match [[URL]]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[URL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" match {{URL}}
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match {{URL|...}}
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
||||
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[DIRURL]]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
|
||||
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
||||
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[DIRURL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
|
||||
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
||||
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
endfunction
|
||||
|
||||
@@ -99,91 +111,102 @@ else
|
||||
endif
|
||||
|
||||
|
||||
" Weblink
|
||||
" Weblink: [DESCRIPTION](FILE)
|
||||
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink')
|
||||
|
||||
|
||||
" WikiLink
|
||||
" WikiLink:
|
||||
" All remaining schemes are highlighted automatically
|
||||
let s:rxSchemes = '\%('.
|
||||
\ vimwiki#vars#get_global('schemes') . '\|'.
|
||||
\ vimwiki#vars#get_global('web_schemes1').
|
||||
\ vimwiki#vars#get_global('schemes_local') . '\|'.
|
||||
\ vimwiki#vars#get_global('schemes_web').
|
||||
\ '\):'
|
||||
|
||||
|
||||
" a) match [[nonwiki-scheme-URL]]
|
||||
let s:target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
|
||||
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
|
||||
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
||||
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
|
||||
let s:target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
|
||||
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
|
||||
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
||||
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '', '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
|
||||
" a) match {{nonwiki-scheme-URL}}
|
||||
let s:target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
|
||||
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
|
||||
\ vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
||||
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
" b) match {{nonwiki-scheme-URL}[{...}]}
|
||||
let s:target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
|
||||
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
|
||||
\ vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
||||
\ vimwiki#vars#get_global('rxWikiInclArgs'), '', '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
|
||||
|
||||
" List:
|
||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
|
||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
||||
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
|
||||
|
||||
" Header levels, 1-6
|
||||
" Task List Done:
|
||||
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
||||
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
||||
\ . vimwiki#vars#get_global('listsym_rejected')
|
||||
\ . ']\]\s\(.*\)$/ '
|
||||
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
||||
execute 'syntax match VimwikiCheckBoxDone /'
|
||||
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
|
||||
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
endif
|
||||
|
||||
|
||||
" Header Level: 1..6
|
||||
for s:i in range(1,6)
|
||||
" WebLink are for markdown but putting them here avoidcode duplication
|
||||
" -- and syntax folding Issue #1009
|
||||
execute 'syntax match VimwikiHeader'.s:i
|
||||
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax).
|
||||
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
|
||||
\ 'VimwikiLink,@Spell'
|
||||
execute 'syntax region VimwikiH'.s:i.'Folding start=/'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax).
|
||||
\ '/me=s-1 transparent fold'
|
||||
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax)
|
||||
\ . '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'
|
||||
\ . 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,VimwikiList,VimwikiListTodo,@Spell'
|
||||
execute 'syntax region VimwikiH'.s:i.'Folding start=/'
|
||||
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'
|
||||
\ . vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax)
|
||||
\ . '/me=s-1'
|
||||
\ . ' transparent fold'
|
||||
endfor
|
||||
|
||||
|
||||
|
||||
" possibly concealed chars
|
||||
let s:conceal = exists("+conceallevel") ? ' conceal' : ''
|
||||
|
||||
execute 'syn match VimwikiEqInChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal
|
||||
execute 'syn match VimwikiBoldChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal
|
||||
execute 'syn match VimwikiItalicChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'.s:conceal
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_italicbold').'/'.s:conceal
|
||||
execute 'syn match VimwikiCodeChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_code').'/'.s:conceal
|
||||
execute 'syn match VimwikiDelTextChar contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_deltext').'/'.s:conceal
|
||||
execute 'syn match VimwikiSuperScript contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_superscript').'/'.s:conceal
|
||||
execute 'syn match VimwikiSubScript contained /'.
|
||||
\ vimwiki#vars#get_syntaxlocal('char_subscript').'/'.s:conceal
|
||||
|
||||
|
||||
|
||||
" SetExt Header:
|
||||
" TODO mutualise SetExt Regexp
|
||||
let setex_header1_re = '^\s\{0,3}[^>].*\n\s\{0,3}==\+$'
|
||||
let setex_header2_re = '^\s\{0,3}[^>].*\n\s\{0,3}--\+$'
|
||||
execute 'syntax match VimwikiHeader1'
|
||||
\ . ' /'. setex_header1_re . '/ '
|
||||
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
|
||||
\ 'VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader2'
|
||||
\ . ' /'. setex_header2_re . '/ ' .
|
||||
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
|
||||
\ 'VimwikiLink,@Spell'
|
||||
|
||||
|
||||
let s:options = ' contained transparent contains=NONE'
|
||||
if exists('+conceallevel')
|
||||
let s:options .= b:vimwiki_syntax_conceal
|
||||
endif
|
||||
|
||||
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
||||
" VimwikiLinkRest group is left undefined if link shortening is not desired
|
||||
if exists("+conceallevel") && vimwiki#vars#get_global('url_maxsave') > 0
|
||||
let s:options .= s:conceal
|
||||
if exists('+conceallevel') && vimwiki#vars#get_global('url_maxsave') > 0
|
||||
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
|
||||
\.'\%([/#?]\w\|\S\{'.vimwiki#vars#get_global('url_maxsave').'}\)`'.' cchar=~'.s:options
|
||||
endif
|
||||
@@ -206,34 +229,14 @@ execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix1
|
||||
|
||||
" non concealed chars
|
||||
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxH').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH').
|
||||
\ vimwiki#vars#get_syntaxlocal('header_symbol').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('header_symbol').
|
||||
\ '\+\s*$\)/'
|
||||
execute 'syn match VimwikiEqInCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_eqin').'/'
|
||||
execute 'syn match VimwikiBoldCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_bold').'/'
|
||||
execute 'syn match VimwikiItalicCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_italic').'/'
|
||||
execute 'syn match VimwikiBoldItalicCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'
|
||||
execute 'syn match VimwikiItalicBoldCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_italicbold').'/'
|
||||
execute 'syn match VimwikiCodeCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_code').'/'
|
||||
execute 'syn match VimwikiDelTextCharT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_deltext').'/'
|
||||
execute 'syn match VimwikiSuperScriptT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_superscript').'/'
|
||||
execute 'syn match VimwikiSubScriptT contained /'
|
||||
\ .vimwiki#vars#get_syntaxlocal('char_subscript').'/'
|
||||
|
||||
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_wikilocal('rx_todo') .'/'
|
||||
|
||||
|
||||
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_global('rxTodo') .'/'
|
||||
|
||||
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
" Table:
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiNoExistsLinkT,
|
||||
@@ -247,85 +250,26 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ VimwikiSubScriptT,
|
||||
\ VimwikiCodeT,
|
||||
\ VimwikiEqInT,
|
||||
\ VimwikiEmoji,
|
||||
\ @Spell
|
||||
syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
|
||||
" Lists
|
||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'/'
|
||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
||||
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
|
||||
|
||||
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
|
||||
\ . '\s*\[['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
|
||||
\ . vimwiki#vars#get_global('listsym_rejected')
|
||||
\ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
||||
execute 'syntax match VimwikiCheckBoxDone /'
|
||||
\ . vimwiki#vars#get_syntaxlocal('rxListItemAndChildren')
|
||||
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
endif
|
||||
|
||||
|
||||
execute 'syntax match VimwikiEqIn /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
|
||||
\ '/ contains=VimwikiEqInChar'
|
||||
execute 'syntax match VimwikiEqInT /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
|
||||
\ '/ contained contains=VimwikiEqInCharT'
|
||||
|
||||
execute 'syntax match VimwikiBold /'.vimwiki#vars#get_syntaxlocal('rxBold').
|
||||
\ '/ contains=VimwikiBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldT /'.vimwiki#vars#get_syntaxlocal('rxBold').
|
||||
\ '/ contained contains=VimwikiBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiItalic /'.vimwiki#vars#get_syntaxlocal('rxItalic').
|
||||
\ '/ contains=VimwikiItalicChar,@Spell'
|
||||
execute 'syntax match VimwikiItalicT /'.vimwiki#vars#get_syntaxlocal('rxItalic').
|
||||
\ '/ contained contains=VimwikiItalicCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiBoldItalic /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
|
||||
\ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldItalicT /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
|
||||
\ '/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiItalicBold /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
|
||||
\ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiItalicBoldT /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
|
||||
\ '/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiDelText /'.vimwiki#vars#get_syntaxlocal('rxDelText').
|
||||
\ '/ contains=VimwikiDelTextChar,@Spell'
|
||||
execute 'syntax match VimwikiDelTextT /'.vimwiki#vars#get_syntaxlocal('rxDelText').
|
||||
\ '/ contained contains=VimwikiDelTextChar,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiSuperScript /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
|
||||
\ '/ contains=VimwikiSuperScriptChar,@Spell'
|
||||
execute 'syntax match VimwikiSuperScriptT /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
|
||||
\ '/ contained contains=VimwikiSuperScriptCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiSubScript /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
|
||||
\ '/ contains=VimwikiSubScriptChar,@Spell'
|
||||
execute 'syntax match VimwikiSubScriptT /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
|
||||
\ '/ contained contains=VimwikiSubScriptCharT,@Spell'
|
||||
|
||||
execute 'syntax match VimwikiCode /'.vimwiki#vars#get_syntaxlocal('rxCode').
|
||||
\ '/ contains=VimwikiCodeChar'
|
||||
execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode').
|
||||
\ '/ contained contains=VimwikiCodeCharT'
|
||||
|
||||
|
||||
" <hr> horizontal rule
|
||||
" Horizontal Rule: <hr>
|
||||
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
|
||||
|
||||
execute 'syntax region VimwikiPre start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
|
||||
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'
|
||||
" Preformated Text: `like that`
|
||||
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
|
||||
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
|
||||
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@NoSpell'.concealpre
|
||||
|
||||
" Equation Text: $like that$
|
||||
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
|
||||
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@Spell'
|
||||
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell'
|
||||
|
||||
|
||||
" placeholders
|
||||
" Placeholder:
|
||||
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
|
||||
syntax match VimwikiPlaceholder
|
||||
\ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
||||
@@ -336,27 +280,88 @@ syntax match VimwikiPlaceholder
|
||||
syntax match VimwikiPlaceholderParam /.*/ contained
|
||||
|
||||
|
||||
" html tags
|
||||
if vimwiki#vars#get_global('valid_html_tags') != ''
|
||||
" Html Tag: <u>
|
||||
if vimwiki#vars#get_global('valid_html_tags') !=? ''
|
||||
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
|
||||
|
||||
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('rxComment').
|
||||
\ '/ contains=@Spell,VimwikiTodo'
|
||||
" Html Typeface: <b>bold text</b>
|
||||
let html_typeface = {
|
||||
\ 'bold': [['<b>', '</b\_s*>'], ['<strong>', '</strong\_s*>']],
|
||||
\ 'italic': [['<i>', '</i\_s*>'], ['<em>', '</em\_s*>']],
|
||||
\ 'underline': [['<u>', '</u\_s*>']],
|
||||
\ 'code': [['<code>', '</code\_s*>']],
|
||||
\ 'del': [['<del>', '</del\_s*>']],
|
||||
\ 'eq': [],
|
||||
\ 'sup': [['<sup>', '</sup\_s*>']],
|
||||
\ 'sub': [['<sub>', '</sub\_s*>']],
|
||||
\ }
|
||||
" Highlight now
|
||||
call vimwiki#u#hi_typeface(html_typeface)
|
||||
endif
|
||||
|
||||
" tags
|
||||
execute 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
|
||||
" Html Color: <span style="color:#FF0000";>Red paragraph</span>
|
||||
" -- See: h color_dic
|
||||
let color_dic = vimwiki#vars#get_wikilocal('color_dic')
|
||||
let color_tag = vimwiki#vars#get_wikilocal('color_tag_template')
|
||||
for [color_key, color_value] in items(color_dic)
|
||||
let [fg, bg] = color_value
|
||||
let delimiter = color_tag
|
||||
let delimiter = substitute(delimiter, '__COLORFG__', fg, 'g')
|
||||
let delimiter = substitute(delimiter, '__COLORBG__', bg, 'g')
|
||||
" The user input has been already checked
|
||||
let [pre_region, post_region] = split(delimiter, '__CONTENT__')
|
||||
let cmd = 'syntax region Vimwiki' . color_key . ' matchgroup=VimwikiDelimiterColor'
|
||||
\ . ' start=/' . pre_region . '/'
|
||||
\ . ' end=/' . post_region . '/'
|
||||
\ . ' ' . b:vimwiki_syntax_concealends
|
||||
execute cmd
|
||||
|
||||
" Build highlight command
|
||||
let cmd = 'hi Vimwiki' . color_key
|
||||
if fg !=# ''
|
||||
let cmd .= ' guifg=' . fg
|
||||
endif
|
||||
if bg !=# ''
|
||||
let cmd .= ' guibg=' . bg
|
||||
endif
|
||||
execute cmd
|
||||
endfor
|
||||
|
||||
" Html mark tag, feature request in issue #1261
|
||||
let cmd = 'syntax region VimwikiMarkTag matchgroup=VimwikiDelimiterColor'
|
||||
\ . ' start=/<mark>/'
|
||||
\ . ' end=+</mark>+'
|
||||
\ . ' ' . b:vimwiki_syntax_concealends
|
||||
execute cmd
|
||||
|
||||
|
||||
" Comment: home made
|
||||
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex').
|
||||
\ '/ contains=@Spell,VimwikiTodo'
|
||||
" Only do syntax highlighting for multiline comments if they exist
|
||||
let mc_format = vimwiki#vars#get_syntaxlocal('multiline_comment_format')
|
||||
if !empty(mc_format.pre_mark) && !empty(mc_format.post_mark)
|
||||
execute 'syntax region VimwikiMultilineComment start=/'.mc_format.pre_mark.
|
||||
\ '/ end=/'.mc_format.post_mark.'/ contains=@NoSpell,VimwikiTodo'
|
||||
endif
|
||||
|
||||
" header groups highlighting
|
||||
" Tag:
|
||||
let tag_cmd = 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
|
||||
let tf = vimwiki#vars#get_wikilocal('tag_format')
|
||||
if exists('+conceallevel') && tf.conceal != 0
|
||||
let tag_cmd .= ' conceal'
|
||||
if tf.cchar !=# ''
|
||||
let tag_cmd .= ' cchar=' . tf.cchar
|
||||
endif
|
||||
endif
|
||||
execute tag_cmd
|
||||
|
||||
|
||||
" Header Groups: highlighting
|
||||
if vimwiki#vars#get_global('hl_headers') == 0
|
||||
" Strangely in default colorscheme Title group is not set to bold for cterm...
|
||||
if !exists("g:colors_name")
|
||||
if !exists('g:colors_name')
|
||||
hi Title cterm=bold
|
||||
endif
|
||||
for s:i in range(1,6)
|
||||
@@ -365,36 +370,65 @@ if vimwiki#vars#get_global('hl_headers') == 0
|
||||
else
|
||||
for s:i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg='
|
||||
\ .vimwiki#vars#get_global('hcolor_guifg_'.&bg)[s:i-1].' gui=bold ctermfg='
|
||||
\ .vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[s:i-1].' term=bold cterm=bold'
|
||||
\ .vimwiki#vars#get_global('hcolor_guifg_'.&background)[s:i-1].' gui=bold ctermfg='
|
||||
\ .vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[s:i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
|
||||
|
||||
" Typeface: -> u.vim
|
||||
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
|
||||
call vimwiki#u#hi_typeface(s:typeface_dic)
|
||||
|
||||
|
||||
" Link highlighting groups
|
||||
""""""""""""""""""""""""""
|
||||
|
||||
hi def link VimwikiMarkers Normal
|
||||
hi def link VimwikiError Normal
|
||||
|
||||
hi def link VimwikiEqIn Number
|
||||
hi def link VimwikiEqInT VimwikiEqIn
|
||||
|
||||
" Typeface 1
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||
hi def link VimwikiBoldT VimwikiBold
|
||||
|
||||
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
||||
hi def link VimwikiItalicT VimwikiItalic
|
||||
|
||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
|
||||
hi def VimwikiUnderline term=underline cterm=underline gui=underline
|
||||
|
||||
" Typeface 2
|
||||
" Bold > Italic > Underline
|
||||
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
|
||||
hi def link VimwikiItalicBold VimwikiBoldItalic
|
||||
hi def link VimwikiBoldItalicT VimwikiBoldItalic
|
||||
hi def link VimwikiItalicBoldT VimwikiBoldItalic
|
||||
|
||||
hi def VimwikiUnderline gui=underline
|
||||
hi def VimwikiBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
|
||||
hi def link VimwikiUnderlineBold VimwikiBoldUnderline
|
||||
|
||||
hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=italic,underline
|
||||
hi def link VimwikiUnderlineItalic VimwikiItalicUnderline
|
||||
|
||||
" Typeface 3
|
||||
hi def VimwikiBoldItalicUnderline term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
|
||||
hi def link VimwikiBoldUnderlineItalic VimwikiBoldItalicUnderline
|
||||
hi def link VimwikiItalicBoldUnderline VimwikiBoldItalicUnderline
|
||||
hi def link VimwikiItalicUnderlineBold VimwikiBoldItalicUnderline
|
||||
hi def link VimwikiUnderlineBoldItalic VimwikiBoldItalicUnderline
|
||||
hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
|
||||
|
||||
" Code
|
||||
hi def link VimwikiCode PreProc
|
||||
hi def link VimwikiCodeT VimwikiCode
|
||||
|
||||
" Mark
|
||||
hi def VimwikiMarkTag term=bold ctermbg=yellow ctermfg=black guibg=yellow guifg=black
|
||||
hi def link VimwikiPre PreProc
|
||||
hi def link VimwikiPreT VimwikiPre
|
||||
hi def link VimwikiPreDelim VimwikiPre
|
||||
|
||||
hi def link VimwikiMath Number
|
||||
hi def link VimwikiMathT VimwikiMath
|
||||
@@ -411,7 +445,14 @@ hi def link VimwikiCheckBoxDone Comment
|
||||
hi def link VimwikiHR Identifier
|
||||
hi def link VimwikiTag Keyword
|
||||
|
||||
hi def link VimwikiDelText Constant
|
||||
|
||||
" Deleted called strikethrough
|
||||
" See $VIMRUTIME/syntax/html.vim
|
||||
if v:version > 800 || (v:version == 800 && has('patch1038')) || has('nvim-0.4.3')
|
||||
hi def VimwikiDelText term=strikethrough cterm=strikethrough gui=strikethrough
|
||||
else
|
||||
hi def link VimwikiDelText Constant
|
||||
endif
|
||||
hi def link VimwikiDelTextT VimwikiDelText
|
||||
|
||||
hi def link VimwikiSuperScript Number
|
||||
@@ -422,6 +463,7 @@ hi def link VimwikiSubScriptT VimwikiSubScript
|
||||
|
||||
hi def link VimwikiTodo Todo
|
||||
hi def link VimwikiComment Comment
|
||||
hi def link VimwikiMultilineComment Comment
|
||||
|
||||
hi def link VimwikiPlaceholder SpecialKey
|
||||
hi def link VimwikiPlaceholderParam String
|
||||
@@ -439,6 +481,7 @@ hi def link VimwikiSubScriptChar VimwikiMarkers
|
||||
hi def link VimwikiCodeChar VimwikiMarkers
|
||||
hi def link VimwikiHeaderChar VimwikiMarkers
|
||||
|
||||
" TODO remove unused due to region refactoring
|
||||
hi def link VimwikiEqInCharT VimwikiMarkers
|
||||
hi def link VimwikiBoldCharT VimwikiMarkers
|
||||
hi def link VimwikiItalicCharT VimwikiMarkers
|
||||
@@ -458,13 +501,13 @@ call vimwiki#u#reload_regexes_custom()
|
||||
|
||||
|
||||
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
|
||||
let b:current_syntax="vimwiki"
|
||||
let b:current_syntax='vimwiki'
|
||||
|
||||
|
||||
" EMBEDDED syntax setup
|
||||
" Include: Code: EMBEDDED syntax setup -> base.vim
|
||||
let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
|
||||
if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
|
||||
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep")
|
||||
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), 'keep')
|
||||
endif
|
||||
if !empty(s:nested)
|
||||
for [s:hl_syntax, s:vim_syntax] in items(s:nested)
|
||||
@@ -475,13 +518,44 @@ if !empty(s:nested)
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Include: Yaml metadata block for pandoc
|
||||
let a_yaml_delimiter = vimwiki#vars#get_syntaxlocal('yaml_metadata_block')
|
||||
for [rx_start, rx_end] in a_yaml_delimiter
|
||||
call vimwiki#base#nested_syntax(
|
||||
\ 'yaml',
|
||||
\ rx_start,
|
||||
\ rx_end,
|
||||
\ 'VimwikiPre')
|
||||
endfor
|
||||
|
||||
" LaTeX
|
||||
call vimwiki#base#nested_syntax('tex',
|
||||
|
||||
" LaTex: Load
|
||||
if !empty(globpath(&runtimepath, 'syntax/tex.vim'))
|
||||
execute 'syntax include @textGrouptex syntax/tex.vim'
|
||||
endif
|
||||
if !empty(globpath(&runtimepath, 'after/syntax/tex.vim'))
|
||||
execute 'syntax include @textGrouptex after/syntax/tex.vim'
|
||||
endif
|
||||
|
||||
" LaTeX: Block
|
||||
call vimwiki#base#nested_syntax('tex',
|
||||
\ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ '\%([[:blank:][:punct:]].*\)\?',
|
||||
\ vimwiki#vars#get_syntaxlocal('rxMathEnd'), 'VimwikiMath')
|
||||
|
||||
" LaTeX: Inline
|
||||
for u in syntax_dic.typeface.eq
|
||||
execute 'syntax region textSniptex matchgroup=texSnip'
|
||||
\ . ' start="'.u[0].'" end="'.u[1].'"'
|
||||
\ . ' contains=@texMathZoneGroup'
|
||||
\ . ' keepend oneline '. b:vimwiki_syntax_concealends
|
||||
endfor
|
||||
|
||||
" Emoji: :dog: (after tags to take precedence, after nested to not be reset)
|
||||
if and(vimwiki#vars#get_global('emoji_enable'), 1) != 0 && has('conceal')
|
||||
call vimwiki#emoji#apply_conceal()
|
||||
exe 'syn iskeyword '.&iskeyword.',-,:'
|
||||
endif
|
||||
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||
" Vimwiki syntax file
|
||||
" Description: Defines default syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
" s:default_syntax is kind of a reference to the dict in
|
||||
" g:vimwiki_syntax_variables['default']. It is used here simply as an
|
||||
" abbreviation for the latter.
|
||||
let s:default_syntax = g:vimwiki_syntax_variables['default']
|
||||
|
||||
|
||||
|
||||
" text: $ equation_inline $
|
||||
let s:default_syntax.rxEqIn = '\$[^$`]\+\$'
|
||||
let s:default_syntax.char_eqin = '\$'
|
||||
|
||||
" text: *strong*
|
||||
" let s:default_syntax.rxBold = '\*[^*]\+\*'
|
||||
let s:default_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*'.
|
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
|
||||
\'\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:default_syntax.char_bold = '*'
|
||||
|
||||
" text: _emphasis_
|
||||
" let s:default_syntax.rxItalic = '_[^_]\+_'
|
||||
let s:default_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_'.
|
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
|
||||
\'_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:default_syntax.char_italic = '_'
|
||||
|
||||
" text: *_bold italic_* or _*italic bold*_
|
||||
let s:default_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*_'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'_\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:default_syntax.char_bolditalic = '\*_'
|
||||
|
||||
let s:default_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_\*'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'\*_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:default_syntax.char_italicbold = '_\*'
|
||||
|
||||
" text: `code`
|
||||
let s:default_syntax.rxCode = '`[^`]\+`'
|
||||
let s:default_syntax.char_code = '`'
|
||||
|
||||
" text: ~~deleted text~~
|
||||
let s:default_syntax.rxDelText = '\~\~[^~`]\+\~\~'
|
||||
let s:default_syntax.char_deltext = '\~\~'
|
||||
|
||||
" text: ^superscript^
|
||||
let s:default_syntax.rxSuperScript = '\^[^^`]\+\^'
|
||||
let s:default_syntax.char_superscript = '^'
|
||||
|
||||
" text: ,,subscript,,
|
||||
let s:default_syntax.rxSubScript = ',,[^,`]\+,,'
|
||||
let s:default_syntax.char_subscript = ',,'
|
||||
|
||||
" generic headers
|
||||
let s:default_syntax.rxH = '='
|
||||
let s:default_syntax.symH = 1
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let s:default_syntax.rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let s:default_syntax.rxTableSep = '|'
|
||||
|
||||
" Lists
|
||||
let s:default_syntax.bullet_types = ['-', '*', '#']
|
||||
" 1 means the bullets can be repeatet to indicate the level, like * ** ***
|
||||
" 0 means the bullets stand on their own and the level is indicated by the indentation
|
||||
let s:default_syntax.recurring_bullets = 0
|
||||
let s:default_syntax.number_types = ['1)', '1.', 'i)', 'I)', 'a)', 'A)']
|
||||
"this should contain at least one element
|
||||
"it is used for i_<C-L><C-J> among other things
|
||||
let s:default_syntax.list_markers = ['-', '1.', '*', 'I)', 'a)']
|
||||
let s:default_syntax.rxListDefine = '::\(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
let s:default_syntax.rxPreStart = '{{{'
|
||||
let s:default_syntax.rxPreEnd = '}}}'
|
||||
|
||||
" Math block
|
||||
let s:default_syntax.rxMathStart = '{{\$'
|
||||
let s:default_syntax.rxMathEnd = '}}\$'
|
||||
|
||||
let s:default_syntax.rxComment = '^\s*%%.*$'
|
||||
let s:default_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:''[:space:]]\+:\)\+\%(\s\|$\)\@='
|
||||
|
||||
let s:default_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
|
||||
let s:default_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
|
||||
let s:default_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*'.
|
||||
\ '[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:default_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
|
||||
\ '\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:default_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
|
||||
let s:default_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
|
||||
let s:default_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
|
||||
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
|
||||
@@ -1,104 +0,0 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||
" Vimwiki syntax file
|
||||
" Description: Defines markdown syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
" see the comments in vimwiki_default.vim for some info about this file
|
||||
|
||||
|
||||
let s:markdown_syntax = g:vimwiki_syntax_variables['markdown']
|
||||
|
||||
" text: $ equation_inline $
|
||||
let s:markdown_syntax.rxEqIn = '\$[^$`]\+\$'
|
||||
let s:markdown_syntax.char_eqin = '\$'
|
||||
|
||||
" text: *strong*
|
||||
" let s:markdown_syntax.rxBold = '\*[^*]\+\*'
|
||||
let s:markdown_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*'.
|
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
|
||||
\'\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:markdown_syntax.char_bold = '*'
|
||||
|
||||
" text: _emphasis_
|
||||
" let s:markdown_syntax.rxItalic = '_[^_]\+_'
|
||||
let s:markdown_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_'.
|
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
|
||||
\'_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:markdown_syntax.char_italic = '_'
|
||||
|
||||
" text: *_bold italic_* or _*italic bold*_
|
||||
let s:markdown_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*_'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'_\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:markdown_syntax.char_bolditalic = '\*_'
|
||||
|
||||
let s:markdown_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_\*'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'\*_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:markdown_syntax.char_italicbold = '_\*'
|
||||
|
||||
" text: `code`
|
||||
let s:markdown_syntax.rxCode = '`[^`]\+`'
|
||||
let s:markdown_syntax.char_code = '`'
|
||||
|
||||
" text: ~~deleted text~~
|
||||
let s:markdown_syntax.rxDelText = '\~\~[^~`]\+\~\~'
|
||||
let s:markdown_syntax.char_deltext = '\~\~'
|
||||
|
||||
" text: ^superscript^
|
||||
let s:markdown_syntax.rxSuperScript = '\^[^^`]\+\^'
|
||||
let s:markdown_syntax.char_superscript = '^'
|
||||
|
||||
" text: ,,subscript,,
|
||||
let s:markdown_syntax.rxSubScript = ',,[^,`]\+,,'
|
||||
let s:markdown_syntax.char_subscript = ',,'
|
||||
|
||||
" generic headers
|
||||
let s:markdown_syntax.rxH = '#'
|
||||
let s:markdown_syntax.symH = 0
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let s:markdown_syntax.rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let s:markdown_syntax.rxTableSep = '|'
|
||||
|
||||
" Lists
|
||||
let s:markdown_syntax.bullet_types = ['-', '*', '+']
|
||||
let s:markdown_syntax.recurring_bullets = 0
|
||||
let s:markdown_syntax.number_types = ['1.']
|
||||
let s:markdown_syntax.list_markers = ['-', '*', '+', '1.']
|
||||
let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
let s:markdown_syntax.rxPreStart = '```'
|
||||
let s:markdown_syntax.rxPreEnd = '```'
|
||||
|
||||
" Math block
|
||||
let s:markdown_syntax.rxMathStart = '\$\$'
|
||||
let s:markdown_syntax.rxMathEnd = '\$\$'
|
||||
|
||||
let s:markdown_syntax.rxComment = '^\s*%%.*$\|<!--[^>]*-->'
|
||||
let s:markdown_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
|
||||
|
||||
let s:markdown_syntax.header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
|
||||
let s:markdown_syntax.header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$'
|
||||
let s:markdown_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs'.
|
||||
\ '\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:markdown_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
|
||||
\ '\%([[:punct:]]\|\s\|$\)\@='
|
||||
let s:markdown_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
|
||||
let s:markdown_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
|
||||
let s:markdown_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
|
||||
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
|
||||
@@ -1,10 +1,10 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||
" Vimwiki syntax file
|
||||
" Description: Defines markdown custom syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:add_target_syntax_ON(target, type)
|
||||
function! s:add_target_syntax_ON(target, type) abort
|
||||
let prefix0 = 'syntax match '.a:type.' `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match '.a:type.'T `'
|
||||
@@ -14,7 +14,7 @@ function! s:add_target_syntax_ON(target, type)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:add_target_syntax_OFF(target, type)
|
||||
function! s:add_target_syntax_OFF(target, type) abort
|
||||
let prefix0 = 'syntax match VimwikiNoExistsLink `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
@@ -24,18 +24,18 @@ function! s:add_target_syntax_OFF(target, type)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:wrap_wikilink1_rx(target)
|
||||
function! s:wrap_wikilink1_rx(target) abort
|
||||
return vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidPrefix') . a:target.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1InvalidSuffix')
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:existing_mkd_refs()
|
||||
function! s:existing_mkd_refs() abort
|
||||
return keys(vimwiki#markdown_base#scan_reflinks())
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:highlight_existing_links()
|
||||
function! s:highlight_existing_links() abort
|
||||
" Wikilink1
|
||||
" Conditional highlighting that depends on the existence of a wiki file or
|
||||
" directory is only available for *schemeless* wiki links
|
||||
@@ -52,34 +52,34 @@ function! s:highlight_existing_links()
|
||||
" match [URL][]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
|
||||
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][URL]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
|
||||
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ safe_links, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
|
||||
" match [DIRURL][]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
|
||||
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][DIRURL]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
|
||||
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ safe_dirs, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
|
||||
" match [MKDREF][]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
|
||||
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][MKDREF]
|
||||
let target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
|
||||
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ safe_reflinks, vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
endfunction
|
||||
|
||||
@@ -99,41 +99,32 @@ endif
|
||||
|
||||
" Weblink
|
||||
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink1'), 'VimwikiWeblink1')
|
||||
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxImage'), 'VimwikiImage')
|
||||
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let s:rxSchemes = '\%('.
|
||||
\ vimwiki#vars#get_global('schemes') . '\|'.
|
||||
\ vimwiki#vars#get_global('web_schemes1').
|
||||
\ vimwiki#vars#get_global('schemes_local') . '\|'.
|
||||
\ vimwiki#vars#get_global('schemes_web').
|
||||
\ '\):'
|
||||
|
||||
" a) match [nonwiki-scheme-URL]
|
||||
let s:target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template1')),
|
||||
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
|
||||
" b) match [DESCRIPTION][nonwiki-scheme-URL]
|
||||
let s:target = vimwiki#base#apply_template(
|
||||
\ vimwiki#u#escape(vimwiki#vars#get_syntaxlocal('WikiLink1Template2')),
|
||||
\ s:rxSchemes . vimwiki#vars#get_syntaxlocal('rxWikiLink1Url'),
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '')
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWikiLink1Descr'), '', '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
|
||||
|
||||
|
||||
|
||||
" Header levels, 1-6
|
||||
for s:i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i).
|
||||
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
|
||||
\ 'VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
endfor
|
||||
|
||||
|
||||
|
||||
" concealed chars
|
||||
if exists("+conceallevel")
|
||||
if exists('+conceallevel')
|
||||
syntax conceal on
|
||||
endif
|
||||
|
||||
@@ -157,15 +148,21 @@ execute 'syn match VimwikiWeblink1Char "'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
|
||||
execute 'syn match VimwikiWeblink1Char "'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options
|
||||
"image
|
||||
execute 'syn match VimwikiImageChar "!"'.s:options
|
||||
execute 'syn match VimwikiImageChar "'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
|
||||
execute 'syn match VimwikiImageChar "'.
|
||||
\ vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options
|
||||
|
||||
if exists("+conceallevel")
|
||||
if exists('+conceallevel')
|
||||
syntax conceal off
|
||||
endif
|
||||
|
||||
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiWeblink1T,
|
||||
@@ -183,9 +180,14 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
|
||||
|
||||
" TODO fix behavior within lists https://github.github.com/gfm/#list-items
|
||||
" indented code blocks https://github.github.com/gfm/#indented-code-blocks
|
||||
" execute 'syntax match VimwikiIndentedCodeBlock /' . vimwiki#vars#get_syntaxlocal('rxIndentedCodeBlock') . '/'
|
||||
" hi def link VimwikiIndentedCodeBlock VimwikiPre
|
||||
|
||||
" syntax group highlighting
|
||||
hi def link VimwikiImage VimwikiLink
|
||||
hi def link VimwikiImageT VimwikiLink
|
||||
hi def link VimwikiWeblink1 VimwikiLink
|
||||
hi def link VimwikiWeblink1T VimwikiLink
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||
" Vimwiki syntax file
|
||||
" Description: Defines mediaWiki syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
" see the comments in vimwiki_default.vim for some info about this file
|
||||
|
||||
|
||||
let s:media_syntax = g:vimwiki_syntax_variables['media']
|
||||
|
||||
" text: $ equation_inline $
|
||||
let s:media_syntax.rxEqIn = '\$[^$`]\+\$'
|
||||
let s:media_syntax.char_eqin = '\$'
|
||||
|
||||
" text: '''strong'''
|
||||
let s:media_syntax.rxBold = "'''[^']\\+'''"
|
||||
let s:media_syntax.char_bold = "'''"
|
||||
|
||||
" text: ''emphasis''
|
||||
let s:media_syntax.rxItalic = "''[^']\\+''"
|
||||
let s:media_syntax.char_italic = "''"
|
||||
|
||||
" text: '''''strong italic'''''
|
||||
let s:media_syntax.rxBoldItalic = "'''''[^']\\+'''''"
|
||||
let s:media_syntax.rxItalicBold = s:media_syntax.rxBoldItalic
|
||||
let s:media_syntax.char_bolditalic = "'''''"
|
||||
let s:media_syntax.char_italicbold = s:media_syntax.char_bolditalic
|
||||
|
||||
" text: `code`
|
||||
let s:media_syntax.rxCode = '`[^`]\+`'
|
||||
let s:media_syntax.char_code = '`'
|
||||
|
||||
" text: ~~deleted text~~
|
||||
let s:media_syntax.rxDelText = '\~\~[^~]\+\~\~'
|
||||
let s:media_syntax.char_deltext = '\~\~'
|
||||
|
||||
" text: ^superscript^
|
||||
let s:media_syntax.rxSuperScript = '\^[^^]\+\^'
|
||||
let s:media_syntax.char_superscript = '^'
|
||||
|
||||
" text: ,,subscript,,
|
||||
let s:media_syntax.rxSubScript = ',,[^,]\+,,'
|
||||
let s:media_syntax.char_subscript = ',,'
|
||||
|
||||
" generic headers
|
||||
let s:media_syntax.rxH = '='
|
||||
let s:media_syntax.symH = 1
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let s:media_syntax.rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let s:media_syntax.rxTableSep = '|'
|
||||
|
||||
" Lists
|
||||
let s:media_syntax.bullet_types = ['*', '#']
|
||||
let s:media_syntax.recurring_bullets = 1
|
||||
let s:media_syntax.number_types = []
|
||||
let s:media_syntax.list_markers = ['*', '#']
|
||||
let s:media_syntax.rxListDefine = '^\%(;\|:\)\s'
|
||||
|
||||
" Preformatted text
|
||||
let s:media_syntax.rxPreStart = '<pre>'
|
||||
let s:media_syntax.rxPreEnd = '<\/pre>'
|
||||
|
||||
" Math block
|
||||
let s:media_syntax.rxMathStart = '{{\$'
|
||||
let s:media_syntax.rxMathEnd = '}}\$'
|
||||
|
||||
let s:media_syntax.rxComment = '^\s*%%.*$'
|
||||
let s:media_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
|
||||
|
||||
let s:media_syntax.header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
|
||||
let s:media_syntax.header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
|
||||
let s:media_syntax.bold_search = "'''\\zs[^']\\+\\ze'''"
|
||||
let s:media_syntax.bold_match = '''''''__Text__'''''''
|
||||
" ^- this strange looking thing is equivalent to "'''__Text__'''" but since we later
|
||||
" want to call escape() on this string, we must keep it in single quotes
|
||||
let s:media_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
|
||||
let s:media_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
|
||||
let s:media_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
|
||||
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
|
||||
@@ -0,0 +1,85 @@
|
||||
# Vimwiki Tests
|
||||
|
||||
This directory contains a test framework used to automatically test/verify
|
||||
Vimwiki functionality. It is based on the following tools:
|
||||
|
||||
- [vim-testbed GitHub](https://github.com/tweekmonster/vim-testbed) or on [testbed/vim dockerhub](https://hub.docker.com/r/testbed/vim)
|
||||
- [Vader](https://github.com/junegunn/vader.vim)
|
||||
- [Vint](https://github.com/Kuniwak/vint)
|
||||
|
||||
|
||||
## Resources
|
||||
|
||||
- [Vim patches](http://ftp.vim.org/pub/vim/patches/)
|
||||
- Example test cases:
|
||||
- [vim-easy-align](https://github.com/junegunn/vim-easy-align/tree/master/test)
|
||||
- [vim-plug](https://github.com/junegunn/vim-plug/tree/master/test)
|
||||
- [ale](https://github.com/w0rp/ale/tree/master/test)
|
||||
- [Other projects](https://github.com/junegunn/vader.vim/wiki/Projects-using-Vader)
|
||||
|
||||
|
||||
## Building Docker Image
|
||||
|
||||
To build the Docker image run `docker build -t vimwiki .` from the Vimwiki
|
||||
repository root (same location as the Dockerfile).
|
||||
|
||||
|
||||
## Running Tests
|
||||
|
||||
### Manual Steps
|
||||
|
||||
Starting in the test directory run this command:
|
||||
|
||||
```sh
|
||||
docker run -it --rm -v $PWD/../:/testplugin -v $PWD/../test:/home vimwiki vim_7.4.1099 -u test/vimrc -i NONE
|
||||
```
|
||||
|
||||
This will open a vim instance in the docker container and then all tests
|
||||
can be run with `:Vader test/*` or individual tests can be run.
|
||||
|
||||
**Note:** Substitute `vim_7.4.1099` for any of the vim versions in the Dockerfile.
|
||||
|
||||
### Automated Tests
|
||||
|
||||
The script in the `test/` directory named `run_test.sh` can be used to
|
||||
automatically run all tests for all installed vim versions. The vim/nvim
|
||||
versions are parsed from the Dockerfile. This script will also run `Vint` for all
|
||||
plugin source files. For more information run `./run_tests.sh -h`.
|
||||
|
||||
|
||||
## Writing Tests
|
||||
|
||||
You are advice to write tests at the top of the file where you want to include it because some `Execute` can have some side effect making it hard to debug
|
||||
|
||||
### Inside the container
|
||||
|
||||
- `$USER` -> `vimtest` : unprivileged => very hard to mess up things
|
||||
- `$HOME` -> `/home/vimtest` : but it is readonly !
|
||||
- `$PWD` -> `/testplugin` : mapped to vimwiki plugin root directory
|
||||
|
||||
For more information, read the [base docker image](https://github.com/tweekmonster/vim-testbed)
|
||||
|
||||
|
||||
## Known Issues
|
||||
|
||||
1. neovim v0.2.x does not work correctly with Vader output from the docker
|
||||
container. No test results are printed and an error message saying
|
||||
`Vim: Error reading input, exiting...`
|
||||
- Probably need to look into this more and determine if the issue is Vader,
|
||||
Neovim, or Docker.
|
||||
2. Vader does not play nice with the location list. Tests that use the location
|
||||
list should be placed in `independent_runs/`.
|
||||
- [Vader Issue #199](https://github.com/junegunn/vader.vim/issues/199)
|
||||
|
||||
|
||||
## Notable Vim patches
|
||||
|
||||
- `v7.3.831` `getbufvar` added a default value
|
||||
- `v7.4.236` add ability to check patch with has("patch-7.4.123")
|
||||
- `v7.4.279` added the option to for `globpath()` to return a list
|
||||
- `v7.4.1546` sticky type checking removed (allow a variables type to change)
|
||||
- `v7.4.1989` `filter()` accepts a Funcref
|
||||
- `v7.4.2044` lambda support added - see `:h expr-lambda`
|
||||
- `v7.4.2120` Added function "closure" argument
|
||||
- `v7.4.2137` add `funcref()`
|
||||
- `v8.0` async jobs and timers
|
||||
@@ -0,0 +1,42 @@
|
||||
# Test vimwiki#base#resolve_link for various inputs.
|
||||
|
||||
Execute (Resolve link for index):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('index')
|
||||
AssertEqual 'wiki0', link_infos.scheme
|
||||
AssertEqual $HOME . '/testwiki/index.wiki', link_infos.filename
|
||||
|
||||
Execute (Resolve link for /index - absolute path from wiki root):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('/index')
|
||||
AssertEqual 'wiki0', link_infos.scheme
|
||||
AssertEqual '', link_infos.anchor
|
||||
AssertEqual $HOME . '/testwiki/index.wiki', link_infos.filename
|
||||
|
||||
Execute (Resolve link for ///tmp/some_page - absolute path to standalone page):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('///tmp/some_page')
|
||||
AssertEqual '/tmp/some_page.wiki', link_infos.filename
|
||||
|
||||
Execute (Resolve link for //~/testwiki/index - page in wiki under homedir):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('//~/testwiki/index')
|
||||
AssertEqual $HOME . '/testwiki/index.wiki', expand(link_infos.filename)
|
||||
|
||||
Execute (Resolve link for diary:2020-01-01 - diary page):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('diary:2020-01-01')
|
||||
AssertEqual $HOME . '/testwiki/diary/2020-01-01.wiki', link_infos.filename
|
||||
|
||||
Execute (Resolve link to link_syntax/nested - page in subdirectory):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('link_syntax/nested')
|
||||
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', link_infos.filename
|
||||
|
||||
Execute (Resolve relative link to ./link_syntax/nested - page in subdirectory):
|
||||
VimwikiIndex 1
|
||||
let link_infos = vimwiki#base#resolve_link('link_syntax/nested')
|
||||
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', link_infos.filename
|
||||
|
||||
Execute (Clean):
|
||||
call ReloadVimwiki()
|
||||
@@ -0,0 +1,32 @@
|
||||
# Test comment string PR #946
|
||||
# TODO try default
|
||||
# TODO try editing other buffer
|
||||
#Execute (default commenstring, ft vimwiki):
|
||||
# AssertEqual &filetype[0], 't'
|
||||
# AssertEqual '/*%s*/', &commentstring
|
||||
|
||||
|
||||
Given txt (txt):
|
||||
txt
|
||||
|
||||
After (clean up):
|
||||
if exists('g:vimwiki_commentstring')
|
||||
unlet g:vimwiki_commentstring
|
||||
endif
|
||||
if exists('b:did_ftplugin')
|
||||
unlet b:did_ftplugin
|
||||
endif
|
||||
|
||||
Execute (default vimwiki commentstring):
|
||||
call vimwiki#vars#init()
|
||||
set ft=vimwiki
|
||||
AssertEqual '%%%s', &commentstring
|
||||
|
||||
Execute (html commentstring):
|
||||
let g:vimwiki_commentstring='<!-- %s -->'
|
||||
call vimwiki#vars#init()
|
||||
set ft=vimwiki
|
||||
AssertEqual '<!-- %s -->', &commentstring
|
||||
|
||||
Expect (void):
|
||||
txt
|
||||
@@ -0,0 +1,91 @@
|
||||
# Test variable management (should be small)
|
||||
|
||||
# PR #1132 make other test break ...
|
||||
|
||||
#Given vimwiki (abc def ghi jkl #1132):
|
||||
# abc def ghi jkl
|
||||
#
|
||||
#Do (vee<CR>):
|
||||
# :call SetSyntax('markdown')\<CR>
|
||||
# :call vimwiki#vars#set_wikilocal('links_space_char', '_')\<CR>
|
||||
# vee\<CR>
|
||||
# :call vimwiki#vars#set_wikilocal('links_space_char', ' ')\<CR>
|
||||
#
|
||||
#Expect (underscores in link url not in description):
|
||||
# [abc def](abc_def) ghi jkl
|
||||
#
|
||||
# Issue #980
|
||||
#
|
||||
# brennen commenting these out 2021-03-29 per @tinmarino:
|
||||
# https://github.com/vimwiki/vimwiki/pull/1108#issuecomment-806775805
|
||||
|
||||
# Given txt (txt):
|
||||
# txt
|
||||
#
|
||||
# Execute (VimWei vars #980):
|
||||
# " Set
|
||||
# call UnloadVimwiki()
|
||||
# let wiki = {}
|
||||
# let wiki.name = 'ChenWei 🦊VimwikiMd @^%@!*#&^'
|
||||
# let wiki.path = $HOME . '/testmarkdown'
|
||||
# let wiki.ext = '.md'
|
||||
# let wiki.syntax = 'markdown'
|
||||
# let wiki.nested_syntaxes = {'python': 'python'}
|
||||
#
|
||||
# " Make other tests crash
|
||||
# "let wiki.links_space_char = '_'
|
||||
# "let wiki.list_margin = 0
|
||||
# "let wiki.auto_toc = 1
|
||||
# "let wiki.auto_tags = 1
|
||||
# "let wiki.auto_generate_tags = 1
|
||||
#
|
||||
# let g:vimwiki_list = [wiki]
|
||||
# let g:vimwiki_ext2syntax = {'.md': 'markdown'}
|
||||
# let g:vimwiki_global_ext = 1
|
||||
# let g:vimwiki_autowriteall = 1
|
||||
# let g:vimwiki_auto_chdir = 1
|
||||
# let g:vimwiki_folding = 'expr'
|
||||
# call LoadVimwiki()
|
||||
#
|
||||
# " Log
|
||||
# Log 'Path (Current): ' . getcwd()
|
||||
# Log 'File: (Buffer)' . @%
|
||||
# Log 'List (Wiki): ' . string(g:vimwiki_list)
|
||||
# Log ''
|
||||
# Log 'Local (Vars):'
|
||||
# Log g:vimwiki_wikilocal_vars
|
||||
#
|
||||
# " Work
|
||||
# edit $HOME/testmarkdown/index.md
|
||||
#
|
||||
# " Assert
|
||||
# AssertEqual '/home/vimtest/testmarkdown_cwd', getcwd() . '_cwd'
|
||||
# AssertEqual '0_wiki_nr', vimwiki#vars#get_bufferlocal('wiki_nr') . '_wiki_nr'
|
||||
# AssertEqual 'markdown_syntax', vimwiki#vars#get_wikilocal('syntax') . '_syntax'
|
||||
# AssertEqual '0_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
|
||||
# Log 'Path (Current): ' . getcwd()
|
||||
# Log 'File (Buffer):' . @%
|
||||
# bprevious
|
||||
# Log 'Path (Current): ' . getcwd()
|
||||
# Log 'File (Buffer):' . @%
|
||||
# bwipeout index.md
|
||||
#
|
||||
# " Clean
|
||||
# Log 'Clean up'
|
||||
# cd /testplugin
|
||||
# unlet g:vimwiki_list
|
||||
# unlet g:vimwiki_ext2syntax
|
||||
# unlet g:vimwiki_global_ext
|
||||
# unlet g:vimwiki_autowriteall
|
||||
# unlet g:vimwiki_auto_chdir
|
||||
# unlet g:vimwiki_folding
|
||||
# unlet wiki
|
||||
# Log 'Path (Current): ' . getcwd()
|
||||
# Log 'File (Buffer):' . @%
|
||||
# call ReloadVimwiki()
|
||||
# Log g:vimwiki_wikilocal_vars
|
||||
#
|
||||
# Expect (txt):
|
||||
# txt
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,83 @@
|
||||
# VimwikiGoto
|
||||
#
|
||||
# Note: I dont know why <Tab> is inserting a Tab.
|
||||
# Well better than to insert a Chair, but it should trigger completion
|
||||
# So I used C-L
|
||||
|
||||
|
||||
Execute (VimwikiGoto buzz_bozz && Assert):
|
||||
VimwikiIndex 2
|
||||
VimwikiGoto buzz_bozz
|
||||
AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
|
||||
|
||||
Execute (VimwikiGoto buzz bozz && Assert):
|
||||
VimwikiIndex 4
|
||||
VimwikiGoto buzz bozz
|
||||
AssertEqual $HOME . '/testwiki space/buzz bozz.wiki', expand('%')
|
||||
|
||||
Do (VimwikiGoto <CR> buzz_bozz && Assert):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto\<CR>
|
||||
buzz_bozz\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
|
||||
|
||||
Do (VimwikiGoto + Completion(cmdline) && Assert):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto buzz_bo\<C-l>\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
|
||||
|
||||
Do (VimwikiGoto <CR> buzz_bo + Completion(input()) && Assert):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto\<CR>
|
||||
buzz_bo\<C-l>\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
|
||||
|
||||
Do (,wn buzz_bo + Completion(input()) && Assert):
|
||||
,wn
|
||||
buzz_bo\<C-l>\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
|
||||
|
||||
Execute (:VimwikiGoto + Completion (API)):
|
||||
VimwikiIndex 2
|
||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
let s_complete=string(vimwiki#base#get_globlinks_escaped())
|
||||
Assert -1 != stridx(s_complete, 'buzz_bozz')
|
||||
|
||||
Execute (Create dir1/dir2/test_goto_file.md):
|
||||
call system("mkdir $HOME/testmarkdown/dir1")
|
||||
call system("mkdir $HOME/testmarkdown/dir1/dir2")
|
||||
edit $HOME/testmarkdown/dir1/dir2/test_goto_file.md
|
||||
call WriteMe()
|
||||
|
||||
Execute (:VimwikiGoto + Completion in directory):
|
||||
" Return to base
|
||||
VimwikiIndex 2
|
||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
|
||||
" Complete without argment
|
||||
let s_complete1=string(vimwiki#base#get_globlinks_escaped())
|
||||
Assert -1 != stridx(s_complete1, 'test_goto_file')
|
||||
|
||||
" Complete with file argument
|
||||
let s_complete2=string(vimwiki#base#get_globlinks_escaped('test_goto_file'))
|
||||
Assert -1 != stridx(s_complete2, 'test_goto_file')
|
||||
|
||||
" Complete with start of file argument
|
||||
let s_complete3=string(vimwiki#base#get_globlinks_escaped('test_got'))
|
||||
Assert -1 != stridx(s_complete3, 'test_goto_file')
|
||||
|
||||
" Complete with (nested) dir2 argument
|
||||
let s_complete4=string(vimwiki#base#get_globlinks_escaped('dir2'))
|
||||
Assert -1 != stridx(s_complete4, 'test_goto_file')
|
||||
|
||||
" Complete with bad argument
|
||||
let l_complete5=vimwiki#base#get_globlinks_escaped('this_string_is_nowhere')
|
||||
let s_complete5=string(l_complete5)
|
||||
Assert -1 == stridx(s_complete5, 'test_goto_file')
|
||||
AssertEqual 0, len(l_complete5)
|
||||
|
||||
Execute (Clean):
|
||||
call DeleteFile("$HOME/testmarkdown/dir1/dir2/test_goto_file.md")
|
||||
call system("rm $HOME/testmarkdown/dir1")
|
||||
|
||||
# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
|
||||
@@ -0,0 +1,28 @@
|
||||
# Travel thought files
|
||||
|
||||
Given (Void for Accessing other files within vimwiki #979 {{{1):
|
||||
|
||||
|
||||
Do (At Index: Create and goto pythonfile):
|
||||
:VimwikiIndex 2\<Cr>
|
||||
Opyfile.py\<Esc>\<Cr>\<Cr>
|
||||
" See #950 appending to every file: https://github.com/vimwiki/vimwiki/issues/950
|
||||
:AssertEqual 'pyfile.py.md', expand('%:t')\<CR>
|
||||
:AssertEqual 'python', &ft\<CR>
|
||||
:Log "Clean pyfile"\<Cr>
|
||||
dd
|
||||
:VimwikiIndex 2\<Cr>
|
||||
" :call DeleteFile('pyfile.py')\<Cr>
|
||||
|
||||
|
||||
Do (At Index: Create and goto markdownfile):
|
||||
:VimwikiIndex 2\<Cr>
|
||||
Omdfile.md\<Esc>\<Cr>\<Cr>
|
||||
:AssertEqual 'mdfile.md', expand('%:t')\<CR>
|
||||
:AssertEqual 'vimwiki', &ft\<CR>
|
||||
:Log "Clean mdfile"\<Cr>
|
||||
:VimwikiIndex 2\<Cr>
|
||||
dd
|
||||
" :call DeleteFile('mdfile.md')\<Cr>
|
||||
|
||||
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
|
||||
@@ -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,59 @@
|
||||
# Fold
|
||||
|
||||
Execute (Save state):
|
||||
Log 'Previous foldmethod: ' . &foldmethod
|
||||
let save_foldmethod = &foldmethod
|
||||
|
||||
Given vimwiki (Markdown Headers):
|
||||
Some stuff 1
|
||||
# Header level 1 2
|
||||
## Header level 2 3
|
||||
Content 4
|
||||
### Header level 3 5
|
||||
# Header level 1 6
|
||||
Content 7
|
||||
## Just to end 8: Vader cannot match end-of-file
|
||||
|
||||
Execute (Markdown and Fold Syntax):
|
||||
call SetSyntax('markdown')
|
||||
set foldmethod=syntax
|
||||
|
||||
Execute (Assert Markdown: Fold Syntax):
|
||||
Log 'Supposing it starts at foldlevel 0'
|
||||
AssertEqual 'line 1:0', 'line 1:' . foldlevel(1)
|
||||
AssertEqual 'line 2:0', 'line 2:' . foldlevel(2)
|
||||
AssertEqual 'line 3:1', 'line 3:' . foldlevel(3)
|
||||
AssertEqual 'line 4:2', 'line 4:' . foldlevel(4)
|
||||
AssertEqual 'line 5:2', 'line 5:' . foldlevel(5)
|
||||
AssertEqual 'line 6:0', 'line 6:' . foldlevel(6)
|
||||
AssertEqual 'line 7:0', 'line 7:' . foldlevel(7)
|
||||
|
||||
|
||||
Given vimwiki (Wiki Headers):
|
||||
Some stuff 1
|
||||
= Header level 1 2 =
|
||||
== Header level 2 3 ==
|
||||
Content 4
|
||||
=== Header level 3 5 ===
|
||||
= Header level 1 6 =
|
||||
Content 7
|
||||
== Just to end 8 ==
|
||||
|
||||
Execute (Markdown and Fold Syntax):
|
||||
call SetSyntax('default')
|
||||
set foldmethod=syntax
|
||||
|
||||
Execute (Assert Markdown: Fold Syntax):
|
||||
Log 'Supposing it starts at foldlevel 0'
|
||||
AssertEqual 'line 1:0', 'line 1:' . foldlevel(1)
|
||||
AssertEqual 'line 2:0', 'line 2:' . foldlevel(2)
|
||||
AssertEqual 'line 3:1', 'line 3:' . foldlevel(3)
|
||||
AssertEqual 'line 4:2', 'line 4:' . foldlevel(4)
|
||||
AssertEqual 'line 5:2', 'line 5:' . foldlevel(5)
|
||||
AssertEqual 'line 6:0', 'line 6:' . foldlevel(6)
|
||||
AssertEqual 'line 7:0', 'line 7:' . foldlevel(7)
|
||||
|
||||
Execute (Restore state):
|
||||
let &foldmethod = save_foldmethod
|
||||
Log 'Next foldmethod: ' . &foldmethod
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
# Blockquotes in html convertion #55
|
||||
# TODO replace remove newline before end of pre tag: \n</pre></code> -> </pre></code>
|
||||
|
||||
|
||||
Given (Issue 2: BlockQuote restarts list numbering {{{3):
|
||||
# Item 1
|
||||
# Item 2
|
||||
|
||||
Block Quote Text
|
||||
# Item 3
|
||||
|
||||
Execute (2Html):
|
||||
call ConvertWiki2Body()
|
||||
1d | $d | $d
|
||||
|
||||
Expect (Tested by hand 2):
|
||||
<ul>
|
||||
<li>
|
||||
Item 1
|
||||
|
||||
<li>
|
||||
Item 2
|
||||
<pre><code>Block Quote Text
|
||||
</code></pre>
|
||||
|
||||
<li>
|
||||
Item 3
|
||||
|
||||
</ul>
|
||||
|
||||
Given vimwiki (Issue 1007: List with hard wraps and a blockquote):
|
||||
- Item 1
|
||||
wraps to the second line.
|
||||
This is a blockquote.
|
||||
|
||||
And this is back to the list item
|
||||
- [ ] Item 2
|
||||
wraps to the second line.
|
||||
This is a blockquote.
|
||||
|
||||
And this is back to the list item
|
||||
|
||||
Execute (2Html):
|
||||
call ConvertWiki2Body() | 1d | $d | $d
|
||||
|
||||
Expect (No blockquote):
|
||||
<ul>
|
||||
<li>
|
||||
Item 1
|
||||
wraps to the second line.
|
||||
<pre><code>This is a blockquote.
|
||||
</code></pre>
|
||||
</code></pre>
|
||||
And this is back to the list item
|
||||
|
||||
<li class="done0">
|
||||
Item 2
|
||||
wraps to the second line.
|
||||
<pre><code>This is a blockquote.
|
||||
</code></pre>
|
||||
And this is back to the list item
|
||||
|
||||
</ul>
|
||||
|
||||
#Given (Issue 3: BlockQuote at multiple list levels {{{3):
|
||||
# 1. Outer Item 1
|
||||
# 1. Inner Item 1
|
||||
#
|
||||
# > quote 1
|
||||
#
|
||||
# 2. Inner Item 2
|
||||
# 2. Outer Item 2
|
||||
#
|
||||
# > quote 2
|
||||
#
|
||||
#Execute (2Html):
|
||||
# call ConvertWiki2Body()
|
||||
# 1d | $d | $d
|
||||
#
|
||||
#Expect (Got with pandoc):
|
||||
|
||||
|
||||
Given (Issue 5: Newlines in blockquotes are not honored {{{3):
|
||||
Before
|
||||
|
||||
line 1
|
||||
line 2
|
||||
After
|
||||
|
||||
Execute (2Html):
|
||||
call ConvertWiki2Body()
|
||||
1d | $d | $d
|
||||
|
||||
Expect (Got with pandoc 5):
|
||||
<p>
|
||||
Before
|
||||
</p>
|
||||
<pre><code>line 1
|
||||
line 2
|
||||
</code></pre>
|
||||
<p>
|
||||
After
|
||||
</p>
|
||||
|
||||
|
||||
Given (Void: Basic test {{{1):
|
||||
|
||||
Execute (Edit TestHtml Wiki):
|
||||
edit $HOME/testwiki/TestHtml.wiki
|
||||
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
|
||||
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
|
||||
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
|
||||
Do (Markdown with arrow blockquotes):
|
||||
:edit $HOME/testwiki/TestHtml.wiki\<CR>
|
||||
ggdGi first paragraph\<CR>\<CR>
|
||||
> block\<CR>
|
||||
> quote\<CR>\<CR>
|
||||
last paragraph\<CR>\<Esc>
|
||||
:write\<CR>
|
||||
|
||||
|
||||
Execute (Save and Convert to html):
|
||||
edit $HOME/testwiki/TestHtml.wiki
|
||||
Vimwiki2HTML
|
||||
|
||||
|
||||
#Given (Void):
|
||||
#
|
||||
#
|
||||
#Do (Get Html body):
|
||||
# :read $HOME/html/default/TestHtml.html\<CR>
|
||||
## Goto body
|
||||
# gg/<body>\<CR>
|
||||
## Copy in b
|
||||
# "bdat
|
||||
## Delete All
|
||||
# ggdG
|
||||
## Paste body
|
||||
# "bP
|
||||
## Remove last line
|
||||
# Gdd
|
||||
## Save (Not necessary)
|
||||
# :write
|
||||
#
|
||||
#
|
||||
#
|
||||
#Expect (Plain Html):
|
||||
## the whole default html file should be here as a base + the modifications
|
||||
## from "Given"
|
||||
# <body>
|
||||
#
|
||||
# <p>
|
||||
# first paragraph
|
||||
# </p>
|
||||
#
|
||||
# <blockquote>
|
||||
# <p>
|
||||
# block
|
||||
# quote
|
||||
# </p>
|
||||
# </blockquote>
|
||||
#
|
||||
# <p>
|
||||
# last paragraph
|
||||
# </p>
|
||||
#
|
||||
# </body>
|
||||
#
|
||||
## vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,300 @@
|
||||
# Conversion: Wiki -> Html
|
||||
|
||||
#################################################
|
||||
Given vimwiki (Comments):
|
||||
This is some text
|
||||
%% This is a comment
|
||||
Test%%+INLINE COMMENT+%%1
|
||||
%%+INLINE COMMENT+%%Test2
|
||||
Test3%%+INLINE COMMENT+%%
|
||||
%%+ Multiline
|
||||
comment
|
||||
that
|
||||
is
|
||||
removed
|
||||
+%%
|
||||
Final text
|
||||
|
||||
Do (Convert):
|
||||
:call ConvertWiki2Html()\<Cr>
|
||||
# Keep only body
|
||||
ggd/<body>\<Cr>
|
||||
|
||||
Expect (Comments Removed):
|
||||
<body>
|
||||
|
||||
<p>
|
||||
This is some text
|
||||
Test1
|
||||
Test2
|
||||
Test3
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
Final text
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
#################################################
|
||||
Given vimwiki (Table no heading {{{1):
|
||||
| header1 | header2 |
|
||||
| val1 | val2 |
|
||||
| val1 | val2 |
|
||||
| val1 | val2 |
|
||||
|
||||
Do (Convert):
|
||||
:call ConvertWiki2Html()\<Cr>
|
||||
# Keep only body
|
||||
ggd/<body>\<Cr>
|
||||
|
||||
|
||||
Expect (Table no heading):
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
header1
|
||||
</td>
|
||||
<td>
|
||||
header2
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
val1
|
||||
</td>
|
||||
<td>
|
||||
val2
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
val1
|
||||
</td>
|
||||
<td>
|
||||
val2
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
val1
|
||||
</td>
|
||||
<td>
|
||||
val2
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Given vimwiki (Table with heading {{{1):
|
||||
| header1 | header2 | header3 |
|
||||
|---------|---------|---------|
|
||||
| val1 | val2 | var3 |
|
||||
| val4 | val5 | var6 |
|
||||
|
||||
Do (Convert):
|
||||
:call ConvertWiki2Html()\<Cr>
|
||||
# Keep only body
|
||||
ggd/<body>\<Cr>
|
||||
|
||||
|
||||
Expect (Table with heading):
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
header1
|
||||
</th>
|
||||
<th>
|
||||
header2
|
||||
</th>
|
||||
<th>
|
||||
header3
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
val1
|
||||
</td>
|
||||
<td>
|
||||
val2
|
||||
</td>
|
||||
<td>
|
||||
var3
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
val4
|
||||
</td>
|
||||
<td>
|
||||
val5
|
||||
</td>
|
||||
<td>
|
||||
var6
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
#################################################
|
||||
Execute (Log):
|
||||
Log '#473: Syntax "local:" doesnt work as expected. #473'
|
||||
|
||||
Given vimwiki (Void Md):
|
||||
|
||||
Execute (Edit Test473 Wiki):
|
||||
edit $HOME/testwiki/TestHtml.wiki
|
||||
|
||||
Do (Add local link: [[local:$HOME/here|Link]]):
|
||||
:edit $HOME/testwiki/Test473.wiki\<CR>
|
||||
i
|
||||
[[local:
|
||||
\<C-r>=$HOME\<Cr>
|
||||
/here|Link]]
|
||||
\<Esc>
|
||||
:call WriteMe()\<Cr>
|
||||
:Vimwiki2HTML\<Cr>
|
||||
|
||||
|
||||
Execute (Save and Convert to html):
|
||||
edit $HOME/testwiki/Test473.wiki
|
||||
Vimwiki2HTML
|
||||
AssertEqual '[[local:'.$HOME.'/here|Link]]', getline(1)
|
||||
|
||||
|
||||
Given (Void Html):
|
||||
|
||||
# TODO mutualise
|
||||
Do (Get Html body):
|
||||
:read $HOME/html/default/Test473.html\<CR>
|
||||
# Goto body
|
||||
gg/<body>\<CR>
|
||||
# Copy in b
|
||||
"bdat
|
||||
# Delete All
|
||||
ggdG
|
||||
# Paste body
|
||||
"bP
|
||||
# Remove last line
|
||||
Gdd
|
||||
# Save (Not necessary)
|
||||
:write
|
||||
|
||||
Expect (Local link):
|
||||
<body>
|
||||
|
||||
<p>
|
||||
<a href="../../here">Link</a>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
Execute (Delete):
|
||||
call DeleteFile(' $HOME/testwiki/Test473.wiki')
|
||||
|
||||
#################################################
|
||||
Given (Void):
|
||||
|
||||
Execute (Edit TestHtml Wiki):
|
||||
edit $HOME/testwiki/TestHtml.wiki
|
||||
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
|
||||
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
|
||||
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
|
||||
Do (Markdwon with %plainhtml):
|
||||
:edit $HOME/testwiki/TestHtml.wiki\<CR>
|
||||
:normal ggdG\<Cr>
|
||||
i%plainhtml<div id="test">\<CR>
|
||||
my paragraph\<CR>
|
||||
%plainhtml</div>\<CR>\<Esc>
|
||||
:set bt=\<CR>
|
||||
:write\<CR>
|
||||
|
||||
Execute (Save and Convert to html):
|
||||
edit $HOME/testwiki/TestHtml.wiki
|
||||
Vimwiki2HTML
|
||||
|
||||
Given (Void):
|
||||
|
||||
Do (Get Html body):
|
||||
:read $HOME/html/default/TestHtml.html\<CR>
|
||||
# Goto body
|
||||
gg/<body>\<CR>
|
||||
# Copy in b
|
||||
"bdat
|
||||
# Delete All
|
||||
ggdG
|
||||
# Paste body
|
||||
"bP
|
||||
# Remove last line
|
||||
Gdd
|
||||
# Save (Not necessary)
|
||||
:write
|
||||
|
||||
|
||||
|
||||
Expect (Plain Html):
|
||||
# the whole default html file should be here as a base + the modifications
|
||||
# from "Given"
|
||||
<body>
|
||||
|
||||
<div id="test">
|
||||
<p>
|
||||
my paragraph
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
Execute (Delete):
|
||||
call DeleteFile('$HOME/testwiki/TestHtml.wiki')
|
||||
|
||||
|
||||
Given vimwiki (PR: Add option to configure date string format 1073) {{{1):
|
||||
%template template_1073
|
||||
content
|
||||
|
||||
Do (template_date_format):
|
||||
# Set conf
|
||||
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = '%b %d, %Y'\<Cr>
|
||||
# Convert
|
||||
:call ConvertWiki2Html()\<Cr>
|
||||
# Erase oth and date
|
||||
:%s/[0-9]\+/Z/g\<Cr>
|
||||
:%s/[A-Z][a-z][a-z]/Z/g\<Cr>
|
||||
# Restore peace
|
||||
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = ''\<Cr>
|
||||
|
||||
Expect (Date proper format):
|
||||
<html>
|
||||
<body>
|
||||
<div class="content">
|
||||
<p><small>Zt updated on Z Z, Z</small></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
# vim: sw=2 foldmethod=marker foldlevel=30
|
||||
@@ -0,0 +1,10 @@
|
||||
# Test that %title values carry through when HTML is rendered
|
||||
|
||||
Given vimwiki (Title value):
|
||||
%title this is a title with some quotes in it: ' "
|
||||
|
||||
Some content.
|
||||
|
||||
Execute(Check for title tag):
|
||||
call ConvertWiki2Html()
|
||||
Assert 0 != search('<title>this is a title with some quotes in it: '' "</title>')
|
||||
@@ -0,0 +1,110 @@
|
||||
# Feature to generate a diray RSS feed (PR #934)
|
||||
# TODO bug with 7.3
|
||||
|
||||
#Given (Void):
|
||||
#
|
||||
#Execute (Generate HTML and RSS feed):
|
||||
# edit $HOME/testwiki/index.wiki
|
||||
# Vimwiki2HTML
|
||||
# VimwikiRss
|
||||
#
|
||||
#Given (Void):
|
||||
#
|
||||
#Do (Get HTML file):
|
||||
# :read $HOME/html/default/index.html\<CR>
|
||||
## Go to line with RSS link
|
||||
# gg/RSS\<CR>
|
||||
## Delete everything above
|
||||
# kdgg
|
||||
## Delete everything below
|
||||
# jdG
|
||||
## Save (Not necessary) => Actually make rest of batch freeze, do you really want
|
||||
## to quit buffer
|
||||
## :write
|
||||
#
|
||||
#Expect (RSS link in HTML):
|
||||
# <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
|
||||
#
|
||||
#Do (Get RSS feed):
|
||||
# :read $HOME/html/default/rss.xml\<CR>
|
||||
## Remove first line
|
||||
# ggdd
|
||||
## Replace pubDate with dummy as it's based on file modification time
|
||||
# :%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
|
||||
## Save (Not necessary)
|
||||
## :write
|
||||
#
|
||||
#Expect (RSS):
|
||||
## TODO the next line is deleted with -Es
|
||||
## <?xml version="1.0" encoding="UTF-8" ?>
|
||||
# <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
# <channel>
|
||||
# <title>Diary</title>
|
||||
# <link>https://example.com/diary/diary.html</link>
|
||||
# <description>Diary</description>
|
||||
# <pubDate>...</pubDate>
|
||||
# <atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
|
||||
# <item>
|
||||
# <title>day 4</title>
|
||||
# <link>https://example.com/diary/2020-07-25.html</link>
|
||||
# <guid isPermaLink="false">2020-07-25</guid>
|
||||
# <description><![CDATA[
|
||||
# <div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
|
||||
#
|
||||
# <div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
|
||||
#
|
||||
# <p>
|
||||
# here is some code:
|
||||
# </p>
|
||||
#
|
||||
# <pre>
|
||||
# #!/bin/sh
|
||||
# echo "hello world"
|
||||
# </pre>
|
||||
#
|
||||
# <div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
|
||||
#
|
||||
# <p>
|
||||
# an important list:
|
||||
# </p>
|
||||
#
|
||||
# <ul>
|
||||
# <li>
|
||||
# point 1
|
||||
#
|
||||
# <li>
|
||||
# point 2
|
||||
#
|
||||
# </ul>
|
||||
# ]]></description>
|
||||
# <pubDate>...</pubDate>
|
||||
# </item>
|
||||
# <item>
|
||||
# <title>Day 2</title>
|
||||
# <link>https://example.com/diary/2020-07-23.html</link>
|
||||
# <guid isPermaLink="false">2020-07-23</guid>
|
||||
# <description><![CDATA[
|
||||
# <div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
|
||||
#
|
||||
# <p>
|
||||
# another diary entry
|
||||
# </p>
|
||||
# ]]></description>
|
||||
# <pubDate>...</pubDate>
|
||||
# </item>
|
||||
# <item>
|
||||
# <title>2020-07-22</title>
|
||||
# <link>https://example.com/diary/2020-07-22.html</link>
|
||||
# <guid isPermaLink="false">2020-07-22</guid>
|
||||
# <description><![CDATA[
|
||||
# <p>
|
||||
# example diary entry for day 1.
|
||||
# </p>
|
||||
# ]]></description>
|
||||
# <pubDate>...</pubDate>
|
||||
# </item>
|
||||
# </channel>
|
||||
# </rss>
|
||||
#
|
||||
#Execute (Clean buffer modification):
|
||||
# edit! $HOME/testwiki/index.wiki
|
||||
@@ -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,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,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,177 @@
|
||||
# Non regression tests for issues, see changelog
|
||||
# In reverse chronological order
|
||||
#
|
||||
# Thanks to all contributors with issues and pull request on github
|
||||
#
|
||||
|
||||
Given vimwiki (a):
|
||||
a
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
file wiki_test.md
|
||||
|
||||
Expect (a):
|
||||
a
|
||||
|
||||
################################################################################
|
||||
Execute (Log):
|
||||
Log '#915 Vimwiki Markdown Blockquote Syntax issue'
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Given vimwiki (One blockquote):
|
||||
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.
|
||||
|
||||
Do (gqq):
|
||||
gqq
|
||||
|
||||
Expect (Well formated and cursor on Sed):
|
||||
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
|
||||
> est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
|
||||
> vel.
|
||||
|
||||
Do (move cursor and gww):
|
||||
fS
|
||||
gww
|
||||
i__HERE__
|
||||
|
||||
Expect (Well formated and cursor on Sed):
|
||||
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
|
||||
> est sed facilisis. __HERE__Sed imperdiet massa tellus, eu fermentum felis fringilla
|
||||
> vel.
|
||||
|
||||
Given vimwiki (Multiple line blockquote):
|
||||
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
|
||||
> est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
|
||||
> vel.
|
||||
|
||||
Execute (no JJ && Assert for Version > 7.3):
|
||||
normal JJ
|
||||
if v:version > 703
|
||||
AssertEqual getline(1), '> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.'
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
Execute (Log):
|
||||
Log '#949 <Enter> create link bug with Chinese characters'
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Given vimwiki (Madarin with vimwiki Yeeepy):
|
||||
你
|
||||
你好
|
||||
你们好
|
||||
你们好啊
|
||||
你们好啊啊
|
||||
你们好啊aaaaa
|
||||
aaaaa你们好啊
|
||||
|
||||
Do (Enter in all):
|
||||
\<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j \<Cr>j
|
||||
|
||||
Expect (all WORDS are links):
|
||||
[你](你)
|
||||
[你好](你好)
|
||||
[你们好](你们好)
|
||||
[你们好啊](你们好啊)
|
||||
[你们好啊啊](你们好啊啊)
|
||||
[你们好啊aaaaa](你们好啊aaaaa)
|
||||
[aaaaa你们好啊](aaaaa你们好啊)
|
||||
|
||||
|
||||
################################################################################
|
||||
Execute (Log):
|
||||
Log '#735 Fix off-by-one error in get_next_line and get_prev_line'
|
||||
file wiki_test.md
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Given vimwiki (P#735 -> I#407):
|
||||
1. item1
|
||||
2. item2
|
||||
```
|
||||
echo "hello world"
|
||||
```
|
||||
3. item3
|
||||
|
||||
Do (o):
|
||||
o
|
||||
|
||||
Expect (Renumber all):
|
||||
1. item1
|
||||
2.
|
||||
3. item2
|
||||
```
|
||||
echo "hello world"
|
||||
```
|
||||
4. item3
|
||||
|
||||
|
||||
################################################################################
|
||||
Execute (Log):
|
||||
Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)'
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Given vimwiki (Void):
|
||||
|
||||
Execute (conceal):
|
||||
set conceallevel=1
|
||||
let g:vimwiki_global_vars['conceallevel']=2
|
||||
|
||||
Log ' ConcealLevel is set to vimwiki for a .md'
|
||||
call SetSyntax('markdown')
|
||||
file main.md
|
||||
edit
|
||||
AssertEqual &ft, 'vimwiki'
|
||||
AssertEqual @%, 'main.md'
|
||||
if exists('+conceallevel')
|
||||
AssertEqual &conceallevel, 2
|
||||
endif
|
||||
|
||||
Log ' ConcealLevel is set to vim for a no_ext'
|
||||
edit no_ext
|
||||
AssertEqual &ft, ''
|
||||
if exists('+conceallevel')
|
||||
AssertEqual &conceallevel, 1
|
||||
endif
|
||||
|
||||
Log ' Again ConcealLevel is set to vimwiki for a .md (just for fun)'
|
||||
let g:vimwiki_global_vars['conceallevel']=0
|
||||
edit new.md
|
||||
AssertEqual &ft, 'vimwiki'
|
||||
AssertEqual @%, 'new.md'
|
||||
if exists('+conceallevel')
|
||||
AssertEqual &conceallevel, 0
|
||||
endif
|
||||
|
||||
|
||||
################################################################################
|
||||
Execute (Log):
|
||||
Log 'PR #528: Add option |g:vimwiki_create_link| to prevent link creation'
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Given vimwiki (Link):
|
||||
Link
|
||||
|
||||
Do (Enter):
|
||||
\<CR>
|
||||
|
||||
# TODO should be Link.md, revise the test
|
||||
Expect (Link):
|
||||
[Link](Link)
|
||||
|
||||
Do (<CR><CR>):
|
||||
\<CR>\<CR>
|
||||
:AssertEqual expand('%:t'), 'Link.md'\<CR>
|
||||
|
||||
Given vimwiki (Link):
|
||||
Link
|
||||
|
||||
Do (No link: <CR><CR>):
|
||||
:call vimwiki#vars#set_global('markdown_create_link', 0)
|
||||
\<CR>\<CR>
|
||||
:AssertEqual expand('%:t'), 'main.md'\<CR>
|
||||
|
||||
Expect (Link):
|
||||
[Link](Link)
|
||||
|
||||
Execute (wipeout):
|
||||
" This solves many things
|
||||
file /testplugin/[Vader-workbench]
|
||||
@@ -0,0 +1,51 @@
|
||||
# See Issue #580
|
||||
|
||||
Given vimwiki (Void):
|
||||
Tabnext
|
||||
|
||||
Execute (Set fold method):
|
||||
let g:vimwiki_folding = 'expr:quick'
|
||||
call ReloadVimwiki()
|
||||
|
||||
Execute (Expect < 0.5 second delay: Issue #580):
|
||||
let mode = mode(1)
|
||||
Log 'Mode : ' .mode
|
||||
if mode ==# 'ce' || mode ==# 'cv' " -es (silent ex mode)
|
||||
Log 'Skiped: Tabedit and tabnext are not working weel with -Es'
|
||||
else
|
||||
Log 'Prepare: Edit: mode: ' . mode
|
||||
edit /testplugin/test/resources/delay.wiki
|
||||
Log 'Prepare: Assert'
|
||||
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
|
||||
Log 'Prepare: Goto 50%'
|
||||
normal! 50%
|
||||
# "TODO set ft and set wiki syntax or this error (no fold found)
|
||||
# "normal! zozo
|
||||
|
||||
Log 'Run: tabedit'
|
||||
let start = reltime()
|
||||
tabedit
|
||||
let end = str2float(reltimestr(reltime(start)))
|
||||
|
||||
Log 'Verify redraw'
|
||||
Log 'Elapsed time Tabedit = ' . string(end)
|
||||
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
|
||||
|
||||
Log 'Run: redraw'
|
||||
let start = reltime()
|
||||
tabprev
|
||||
redraw
|
||||
let end = str2float(reltimestr(reltime(start)))
|
||||
|
||||
Log 'Verify redraw'
|
||||
Log 'Elapsed time redraw = ' . string(end)
|
||||
Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
|
||||
endif
|
||||
|
||||
Execute (Reset variables):
|
||||
call DeleteFile('/testplugin/test/resources/delay.wiki')
|
||||
let g:vimwiki_folding = ''
|
||||
call ReloadVimwiki()
|
||||
|
||||
Expect vimwiki (Tabnext):
|
||||
Tabnext
|
||||
@@ -0,0 +1,440 @@
|
||||
# Link internal to a file
|
||||
#
|
||||
# See: generate_toc.vim
|
||||
#
|
||||
# See issue #666 for anchor support (then internal links)
|
||||
# Preambule set file onces and for all {{{1
|
||||
# Otherwise the bash script is freezing
|
||||
|
||||
|
||||
### Wiki {{{1
|
||||
###############
|
||||
|
||||
|
||||
### Markdown {{{1
|
||||
###############
|
||||
|
||||
|
||||
Given vimwiki (a):
|
||||
a
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
file wiki_test.md
|
||||
|
||||
Expect (a):
|
||||
a
|
||||
|
||||
|
||||
Given vimwiki (VimwikiTOC with link and number {{{1):
|
||||
[link1](#i-v-p-741528)
|
||||
[link2](#i-v-p-741528-2)
|
||||
|
||||
# I [V p](h) (7.415.28)
|
||||
|
||||
# I [V p](h) 741.528
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Expect('No change'):
|
||||
[link1](#i-v-p-741528)
|
||||
[link2](#i-v-p-741528-2)
|
||||
|
||||
# I [V p](h) (7.415.28)
|
||||
|
||||
# I [V p](h) 741.528
|
||||
|
||||
Do (Enter link):
|
||||
gg\<Cr>
|
||||
A__HERE1__\<Esc>
|
||||
ggj\<Cr>
|
||||
A__HERE2__\<Esc>
|
||||
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
|
||||
|
||||
Expect(Some suffix added after headings):
|
||||
[link1](#i-v-p-741528)
|
||||
[link2](#i-v-p-741528-2)
|
||||
|
||||
# I [V p](h) (7.415.28)__HERE1__
|
||||
|
||||
# I [V p](h) 741.528__HERE2__
|
||||
|
||||
Given vimwiki (VimwikiTOC is broken against headers with link #182 {{{1):
|
||||
[A link B](#a-link-b)
|
||||
[tlink](#tlink)
|
||||
[7.4.1528](#741528)
|
||||
[link (333)](#link-333)
|
||||
|
||||
# A [link](anything here) B
|
||||
|
||||
# t[link](anything here)
|
||||
|
||||
## 7.4.1528
|
||||
|
||||
#### [link]() (333)
|
||||
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
|
||||
Do (Enter link):
|
||||
gg\<Cr>
|
||||
A__HERE1__\<Esc>
|
||||
ggj\<Cr>
|
||||
A__HERE2__\<Esc>
|
||||
ggjj\<Cr>
|
||||
A__HERE3__\<Esc>
|
||||
ggjjj\<Cr>
|
||||
A__HERE4__\<Esc>
|
||||
:AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')\<Cr>
|
||||
|
||||
|
||||
Expect vimwiki (Good anchor with link navigation):
|
||||
[A link B](#a-link-b)
|
||||
[tlink](#tlink)
|
||||
[7.4.1528](#741528)
|
||||
[link (333)](#link-333)
|
||||
|
||||
# A [link](anything here) B__HERE1__
|
||||
|
||||
# t[link](anything here)__HERE2__
|
||||
|
||||
## 7.4.1528__HERE3__
|
||||
|
||||
#### [link]() (333)__HERE4__
|
||||
|
||||
|
||||
|
||||
# Link to anchor in SetExt {{{1
|
||||
# Like that
|
||||
# -----
|
||||
# Issue: #209
|
||||
|
||||
Given vimwiki (Anchor SetExt):
|
||||
[jump](#frst-one)
|
||||
|
||||
F!rst One
|
||||
=========
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Enter link):
|
||||
\<Cr>
|
||||
A__HERE__\<Esc>
|
||||
|
||||
Expect (Cursor jumped SetExt):
|
||||
[jump](#frst-one)
|
||||
|
||||
F!rst One__HERE__
|
||||
=========
|
||||
|
||||
Given vimwiki (Bad Anchor SetExt):
|
||||
[jump](#frst-one)
|
||||
|
||||
F!rst One
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Enter link):
|
||||
\<Cr>
|
||||
A__HERE__\<Esc>
|
||||
|
||||
Expect (Cursor stayed (not jumped) SetExt):
|
||||
[jump](#frst-one)__HERE__
|
||||
|
||||
F!rst One
|
||||
|
||||
# Link to anchor with spaces {{{1
|
||||
# PR #840
|
||||
# Issues: #831
|
||||
|
||||
Given vimwiki (Internal links zith spaces):
|
||||
[Any ! apparent name @#$](#basic-heading-many-spaces)
|
||||
One line here
|
||||
|
||||
## Basic HeAding Many SpacES
|
||||
|
||||
One line here
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Enter link):
|
||||
\<Cr>
|
||||
A__HERE__\<Esc>
|
||||
|
||||
Expect (Cursor at heading position):
|
||||
[Any ! apparent name @#$](#basic-heading-many-spaces)
|
||||
One line here
|
||||
|
||||
## Basic HeAding Many SpacES__HERE__
|
||||
|
||||
One line here
|
||||
|
||||
Execute (Clear wiki jumps (alias: prev_links)):
|
||||
call vimwiki#vars#set_bufferlocal('prev_links', [])
|
||||
|
||||
|
||||
# Before {{{1
|
||||
|
||||
Given vimwiki (Internal links + one link to filenew):
|
||||
# Contents
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
|
||||
# Test1
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
- [filenew](filenew)
|
||||
|
||||
# Test2
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
- [filenew](filenew)
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
file wiki_test.md
|
||||
|
||||
Do (Navigate with <Tab>):
|
||||
A more Contents\<Esc>
|
||||
\<Tab>
|
||||
\<Enter>
|
||||
A more Test1\<Esc>
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
\<Enter>
|
||||
A more Test2\<Esc>
|
||||
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
|
||||
|
||||
Expect (Content added to titles):
|
||||
# Contents more Contents
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
|
||||
# Test1 more Test1
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
- [filenew](filenew)
|
||||
|
||||
# Test2 more Test2
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
- [filenew](filenew)
|
||||
|
||||
Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
|
||||
\<Tab>
|
||||
\<Enter>
|
||||
# Cursor at Test1
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
\<Enter>
|
||||
# Cursor at Test2
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
# Debugging
|
||||
:redir @a\<Cr>
|
||||
:nmap <Bs>\<Cr>
|
||||
:redir END\<Cr>
|
||||
# :fixdel\<Cr>
|
||||
:AssertEqual 'wiki_test.md', expand('%')\<Cr>
|
||||
# :AssertEqual 'toto', @a\<Cr>
|
||||
# Cursor at Test2/filenew
|
||||
A not yet\<Esc>\<Esc>
|
||||
# Debug
|
||||
:Log 'Debugging 1, cursor position list'\<Cr>
|
||||
:Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
|
||||
# :VimwikiGoBackLink\<Cr>
|
||||
# :call vimwiki#base#go_back_link()\<Cr>
|
||||
\<Bs>
|
||||
:Log 'Debugging 2, cursor position list'\<Cr>
|
||||
:Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
|
||||
# Cursor at Test1/test2
|
||||
A near Test1/test2
|
||||
\<Esc>
|
||||
\<Bs>
|
||||
# Cursor at Contents/test1
|
||||
A near Contents/test1
|
||||
\<Esc>
|
||||
|
||||
Expect (Vimwiki links):
|
||||
# Contents
|
||||
|
||||
- [Test1](#Test1) near Contents/test1
|
||||
- [Test2](#Test2)
|
||||
|
||||
# Test1
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2) near Test1/test2
|
||||
- [filenew](filenew)
|
||||
|
||||
# Test2
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
- [filenew](filenew) not yet
|
||||
|
||||
|
||||
###################################
|
||||
###################################
|
||||
###################################
|
||||
###################################
|
||||
# Commented out as butsetvar of the var prev_links is removing the list info at change of file for old Vim
|
||||
|
||||
|
||||
|
||||
|
||||
#Do (Navigate with <Tab> comeback with <Bs> from filenew):
|
||||
# \<Tab>
|
||||
# A first shot\<Esc>
|
||||
# 0\<Tab>
|
||||
## Cursor at Contents/test1
|
||||
# \<Cr>
|
||||
# \<Tab>
|
||||
# \<Tab>
|
||||
# A first shot\<Esc>
|
||||
# 0\<Tab>
|
||||
## Cursor at Test1/test2
|
||||
# \<Cr>
|
||||
# G
|
||||
## Cursor at Test2/filenew
|
||||
# A first shot\<Esc>
|
||||
# 0\<Tab>
|
||||
## Cursor at Test2/filenew
|
||||
# \<Cr>
|
||||
## Cursor in filenew (a new file)
|
||||
# A anything in filenew: empirically it does not count\<Esc>
|
||||
## Debug back
|
||||
# :Log 'Debugging back 1, cursor position list'\<Cr>
|
||||
# :Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
|
||||
# :Log expand('%:p')\<Cr>
|
||||
# :Log expand('/tmp/vader_wiki/testplugin/wiki_test.md')\<Cr>
|
||||
# :Log filereadable('/tmp/vader_wiki/testplugin/wiki_test.md')\<Cr>
|
||||
# \<Bs>
|
||||
# :Log 'Debugging back 2, cursor position list'\<Cr>
|
||||
# :Log vimwiki#vars#get_bufferlocal('prev_links')\<Cr>
|
||||
# :Log expand('%')\<Cr>
|
||||
## Cursor at Test2/filenew
|
||||
# \<Bs>
|
||||
## Cursor at Test1/test2
|
||||
# \<Bs>
|
||||
## Cursor at Contents/test1
|
||||
# A second shot
|
||||
#
|
||||
#Expect (Just Contents/test1 got the second shot):
|
||||
# # Contents
|
||||
#
|
||||
# - [Test1](#Test1) first shot second shot
|
||||
# - [Test2](#Test2)
|
||||
#
|
||||
# # Test1
|
||||
#
|
||||
# - [Test1](#Test1)
|
||||
# - [Test2](#Test2) first shot
|
||||
# - [filenew](filenew)
|
||||
#
|
||||
# # Test2
|
||||
#
|
||||
# - [Test1](#Test1)
|
||||
# - [Test2](#Test2)
|
||||
# - [filenew](filenew) first shot
|
||||
|
||||
Execute (Delete filenew buffer):
|
||||
call DeleteFile('/testplugin/filenew.md')
|
||||
|
||||
Do (Navigate with <Tab> comeback with <Bs> too far):
|
||||
\<Tab>
|
||||
# Cursor at Contents/test1
|
||||
\<Cr>
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
# Cursor at Test1/test2
|
||||
\<Cr>
|
||||
\<Tab>
|
||||
# Cursor at Test2/test1
|
||||
\<Cr>
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
# Cursor at Test1/test2
|
||||
\<Cr>
|
||||
A first test2\<Esc>
|
||||
\<Tab>
|
||||
# Cursor at Test2/test1
|
||||
\<Cr>
|
||||
A first test1\<Esc>
|
||||
# Back
|
||||
\<Bs>
|
||||
# Cursor at Test2/test1
|
||||
A second test2/test1\<Esc>
|
||||
\<Bs>
|
||||
# Cursor at Test1/test2
|
||||
A second test1/test2\<Esc>
|
||||
\<Bs>
|
||||
# Cursor at Test2/test1
|
||||
\<Bs>
|
||||
# Cursor at Test1/test2
|
||||
\<Bs>
|
||||
# Cursor at Contents/test1
|
||||
# Finished
|
||||
\<Bs>
|
||||
\<Bs>
|
||||
\<Bs>
|
||||
\<Bs>
|
||||
A 1\<Esc>
|
||||
\<Bs>
|
||||
A 2\<Esc>
|
||||
\<Bs>
|
||||
A 3\<Esc>
|
||||
\<Bs>
|
||||
A 4\<Esc>
|
||||
|
||||
Expect (After too many <Bs>, cursor stays at the first <Cr> spot in first file: Contents/test1):
|
||||
# Contents
|
||||
|
||||
- [Test1](#Test1) 1 2 3 4
|
||||
- [Test2](#Test2)
|
||||
|
||||
# Test1 first test1
|
||||
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2) second test1/test2
|
||||
- [filenew](filenew)
|
||||
|
||||
# Test2 first test2
|
||||
|
||||
- [Test1](#Test1) second test2/test1
|
||||
- [Test2](#Test2)
|
||||
- [filenew](filenew)
|
||||
|
||||
Given vimwiki (link to self):
|
||||
- [Bad link](Very bad.html)
|
||||
- [My own file](wiki_test)
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
|
||||
Do (Follow link to self and append chars):
|
||||
\<Tab>
|
||||
\<Tab>
|
||||
\<Cr>
|
||||
a this_is_18_chars \<Esc>
|
||||
|
||||
Expect (Some chars appended at self link):
|
||||
- [Bad link](Very bad.html)
|
||||
- [ this_is_18_chars My own file](wiki_test)
|
||||
- [Test1](#Test1)
|
||||
- [Test2](#Test2)
|
||||
|
||||
# vim: foldmethod=marker foldlevel=30 sw=2
|
||||
@@ -0,0 +1,475 @@
|
||||
# Link creation: my favorite (tinmarino)
|
||||
# You know, when pressing Enter:
|
||||
# in mode normal, visual
|
||||
# in OS windows, linux
|
||||
# Seems easy but tests are reaaly needed here
|
||||
|
||||
# Links Renaming inside #1138 {{{1
|
||||
|
||||
Given vimwiki (Link with toto):
|
||||
[if nothing goes right, go left](www.the_bad_jokes.com)
|
||||
|
||||
Do(Rename description):
|
||||
# Change in bracket
|
||||
ci[
|
||||
new description
|
||||
\<Esc>
|
||||
|
||||
Expect(New description):
|
||||
[new description](www.the_bad_jokes.com)
|
||||
|
||||
Do(Rename url):
|
||||
# Move to (
|
||||
%l
|
||||
# Change in parenthesis
|
||||
ci(
|
||||
www.new_url.com
|
||||
|
||||
Expect(New URL):
|
||||
[if nothing goes right, go left](www.new_url.com)
|
||||
|
||||
|
||||
# Links with dot {{{1
|
||||
# Issue #924
|
||||
# See for spec: https://github.com/vimwiki/vimwiki/issues/924#issuecomment-672837685
|
||||
####################
|
||||
|
||||
Given vimwiki (filename filename.dot):
|
||||
filename
|
||||
filename.dot
|
||||
|
||||
Do (Press filename):
|
||||
:call SetSyntax('default')\<CR>
|
||||
\<CR>\<CR>
|
||||
:AssertEqual 'filename.wiki', expand('%:t')\<CR>
|
||||
:call DeleteFile('%')\<CR>
|
||||
|
||||
Do (Press filename.dot):
|
||||
j
|
||||
\<CR>\<CR>
|
||||
:AssertEqual 'filename.dot.wiki', expand('%:t')\<CR>
|
||||
:call DeleteFile('%')\<CR>
|
||||
|
||||
Expect (Nothing left):
|
||||
|
||||
|
||||
# Linkify function {{{1
|
||||
# Issue #994
|
||||
####################
|
||||
|
||||
Given vimwiki (abc def ghi jkl):
|
||||
https://github.com/vimwiki/vimwiki
|
||||
|
||||
Do(wiki: call linkify):
|
||||
:if v:version >= 704\<CR>
|
||||
call vimwiki#base#linkify()\<CR>
|
||||
else\<CR>
|
||||
let stg = '[[https://github.com/vimwiki/vimwiki|GitHub - vimwiki/vimwiki: Personal Wiki for Vim]]'\<CR>
|
||||
0put =stg\<CR>
|
||||
$d\<CR>
|
||||
endif\<CR>
|
||||
# else\<CR>
|
||||
# endif\<CR>
|
||||
|
||||
Expect(Wiki link):
|
||||
[[https://github.com/vimwiki/vimwiki|GitHub - vimwiki/vimwiki: Personal Wiki for Vim]]
|
||||
|
||||
Do(md: call linkify):
|
||||
:call SetSyntax('markdown')\<CR>
|
||||
:if v:version >= 704\<CR>
|
||||
call vimwiki#base#linkify()\<CR>
|
||||
else\<CR>
|
||||
0put ='[GitHub - vimwiki/vimwiki: Personal Wiki for Vim](https://github.com/vimwiki/vimwiki)'\<CR>
|
||||
$d\<CR>
|
||||
endif\<CR>
|
||||
|
||||
Expect(Markdown link):
|
||||
[GitHub - vimwiki/vimwiki: Personal Wiki for Vim](https://github.com/vimwiki/vimwiki)
|
||||
|
||||
# Link Normalisation {{{1
|
||||
# And configuration
|
||||
# Issues: #892
|
||||
####################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Markdown change Link1 : Pressing enter to create a [[double bracket]] #892'
|
||||
|
||||
Given vimwiki (abc def ghi jkl):
|
||||
abc def ghi jkl
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
call SetSyntax('markdown')
|
||||
let save_link = g:vimwiki_syntaxlocal_vars.markdown.Link1
|
||||
let g:vimwiki_syntaxlocal_vars.markdown.Link1 = vimwiki#vars#get_global('WikiLinkTemplate1')
|
||||
|
||||
Do (vee<CR>):
|
||||
vee\<CR>
|
||||
|
||||
Expect (append md suffix):
|
||||
[[abc def]] ghi jkl
|
||||
|
||||
Execute (restore):
|
||||
let g:vimwiki_syntaxlocal_vars.markdown.Link1 = save_link
|
||||
|
||||
|
||||
# vimwiki_markdown_link_ext {{{1
|
||||
####################
|
||||
|
||||
Execute (Log):
|
||||
Log 'vimwiki_markdown_link_ext'
|
||||
|
||||
Given vimwiki (abc def ghi jkl):
|
||||
abc def ghi jkl
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
Log '>> Visual creation, markdown syntax'
|
||||
file wiki_test.md
|
||||
let g:vimwiki_markdown_link_ext = 1
|
||||
call ReloadVars()
|
||||
call SetSyntax('markdown')
|
||||
AssertEqual vimwiki#vars#get_wikilocal('syntax'), 'markdown'
|
||||
AssertEqual vimwiki#vars#get_wikilocal('markdown_link_ext'), 1
|
||||
|
||||
Do (vee<CR>):
|
||||
vee\<CR>
|
||||
|
||||
Expect (append md suffix):
|
||||
[abc def](abc def.md) ghi jkl
|
||||
|
||||
Execute (Restore variable g:vimwiki_markdown_link_ext):
|
||||
unlet g:vimwiki_markdown_link_ext
|
||||
call ReloadVars()
|
||||
|
||||
|
||||
# Visual Creation {{{1
|
||||
# Issues: #382
|
||||
####################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Visual Creation'
|
||||
|
||||
# For markdown {{{2
|
||||
# ------------------
|
||||
|
||||
Given vimwiki (abc def ghi jkl):
|
||||
abc def ghi jkl
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
Log '>> Visual creation, markdown syntax'
|
||||
file wiki_test.md
|
||||
call SetSyntax('markdown')
|
||||
AssertEqual vimwiki#vars#get_wikilocal('syntax'), 'markdown'
|
||||
|
||||
Do (v3e):
|
||||
v3e\<Cr>
|
||||
|
||||
Expect (3 Words []()):
|
||||
[abc def ghi](abc def ghi) jkl
|
||||
|
||||
Do (v3e):
|
||||
wv2e\<Cr>
|
||||
|
||||
Expect (2 Words []()):
|
||||
abc [def ghi](def ghi) jkl
|
||||
|
||||
Do (selection=exclusive v3e):
|
||||
:set selection=exclusive\<Cr>
|
||||
wv2e\<Cr>
|
||||
|
||||
Expect (2 Words []()):
|
||||
abc [def ghi](def ghi) jkl
|
||||
|
||||
Do (selection=exclusive wv$):
|
||||
:set selection=exclusive\<Cr>
|
||||
wv$\<Cr>
|
||||
|
||||
Expect (3 Words []()):
|
||||
abc [def ghi jkl](def ghi jkl)
|
||||
|
||||
|
||||
# For Wiki {{{2
|
||||
# ------------------
|
||||
|
||||
Given vimwiki (abc def ghi jkl):
|
||||
abc def ghi jkl
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
Log '>> Visual creation, wiki syntax'
|
||||
file wiki_test.wiki
|
||||
call SetSyntax('default')
|
||||
|
||||
Do (v3e):
|
||||
v3e\<Cr>
|
||||
|
||||
Expect (3 Words []()):
|
||||
[[abc def ghi]] jkl
|
||||
|
||||
Do (v3e):
|
||||
wv2e\<Cr>
|
||||
|
||||
Expect (2 Words []()):
|
||||
abc [[def ghi]] jkl
|
||||
|
||||
Do (selection=exclusive v3e):
|
||||
:set selection=exclusive\<Cr>
|
||||
wv2e\<Cr>
|
||||
|
||||
Expect (2 Words []()):
|
||||
abc [[def ghi]] jkl
|
||||
|
||||
Do (selection=exclusive wv$):
|
||||
:set selection=exclusive\<Cr>
|
||||
wv$\<Cr>
|
||||
|
||||
Expect (3 Words []()):
|
||||
abc [[def ghi jkl]]
|
||||
|
||||
|
||||
# Absolute links {{{1
|
||||
####################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Absolute links: full paths and in-wiki'
|
||||
|
||||
# For markdown {{{2
|
||||
# ------------------
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
Log '>> Absolute link, markdown syntax'
|
||||
file wiki_test.md
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Given vimwiki(some wiki link):
|
||||
[test1](//$HOME/in_home1)
|
||||
[test2](//~/in_home2)
|
||||
[test3](///tmp/in_tmp)
|
||||
[test4](/in_current_wiki)
|
||||
|
||||
Do (Check in_home1):
|
||||
\<Cr>
|
||||
:AssertEqual expand('%'), $HOME.'/in_home1.md'\<Cr>
|
||||
|
||||
Do (Check in_home2):
|
||||
j\<Cr>
|
||||
:AssertEqual expand('%'), $HOME.'/in_home2.md'\<Cr>
|
||||
|
||||
Do (Check in_tmp):
|
||||
jj\<Cr>
|
||||
:AssertEqual expand('%'), '/tmp/in_tmp.md'\<Cr>
|
||||
|
||||
# Here, assuming that "current wiki" means the working directory, since
|
||||
# no wiki is currently defined:
|
||||
Do (Check in_current_wiki):
|
||||
jjj\<Cr>
|
||||
:AssertEqual expand('%'), '/testplugin/in_current_wiki.md'\<Cr>
|
||||
|
||||
# For Wiki {{{2
|
||||
# ------------------
|
||||
|
||||
Execute (Set filename wiki_test.wiki):
|
||||
Log '>> Absolute link, wiki syntax'
|
||||
file wiki_test.wiki
|
||||
call SetSyntax('default')
|
||||
|
||||
Given vimwiki(some wiki link):
|
||||
[[//$HOME/in_home1]]
|
||||
[[//~/in_home2]]
|
||||
[[///tmp/in_tmp]]
|
||||
[[/in_current_wiki]]
|
||||
|
||||
Do (Check in_home1):
|
||||
\<Cr>
|
||||
:AssertEqual expand('%'), $HOME.'/in_home1.wiki'\<Cr>
|
||||
|
||||
Do (Check in_home2):
|
||||
j\<Cr>
|
||||
:AssertEqual expand('%'), $HOME.'/in_home2.wiki'\<Cr>
|
||||
|
||||
Do (Check in_tmp):
|
||||
jj\<Cr>
|
||||
:AssertEqual expand('%'), '/tmp/in_tmp.wiki'\<Cr>
|
||||
|
||||
# Here, assuming that "current wiki" means the working directory, since
|
||||
# no wiki is currently defined:
|
||||
Do (Check in_current_wiki):
|
||||
jjj\<Cr>
|
||||
:AssertEqual expand('%'), '/testplugin/in_current_wiki.wiki'\<Cr>
|
||||
|
||||
Execute(Clean: temporary):
|
||||
call ReloadVimwiki()
|
||||
call DeleteFile('$HOME/in_home1.md')
|
||||
call DeleteFile('~/in_home2.md')
|
||||
call DeleteFile('/tmp/in_tmp.md')
|
||||
|
||||
# Link with dot {{{1
|
||||
####################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Link with dot'
|
||||
|
||||
Given vimwiki (filenames with dots):
|
||||
part1.part2.part3
|
||||
part1.part2.part3.md
|
||||
noext
|
||||
|
||||
Execute (Set filename wiki_test.md):
|
||||
file wiki_test.md
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Linkify all):
|
||||
\<Cr>
|
||||
j\<Cr>
|
||||
j\<Cr>
|
||||
|
||||
Expect (Full Words are made as links, no extension addded . -> space):
|
||||
[part1 part2 part3](part1.part2.part3)
|
||||
[part1 part2 part3](part1.part2.part3.md)
|
||||
[noext](noext)
|
||||
|
||||
Given vimwiki (filnames with dots):
|
||||
part1.part2.part3
|
||||
part1.part2.part3.md
|
||||
noext
|
||||
|
||||
Do (Follow link witout markdown):
|
||||
\<Cr>\<Cr>
|
||||
" See issue #950 always adding the extension
|
||||
:AssertEqual 'part1.part2.part3.md', expand('%:t')\<Cr>
|
||||
|
||||
Do (Follow link with .md extension):
|
||||
j\<Cr>\<Cr>
|
||||
:AssertEqual 'part1.part2.part3.md', expand('%:t')\<Cr>
|
||||
|
||||
|
||||
# Rest {{{1
|
||||
##########################
|
||||
|
||||
Execute (Log):
|
||||
Log 'And more'
|
||||
|
||||
Given vimwiki (Text that is not a wikilink):
|
||||
test
|
||||
www.google.com
|
||||
https://www.google.com
|
||||
multiple words
|
||||
let's
|
||||
let's
|
||||
file.wiki
|
||||
file.md
|
||||
file.mw
|
||||
|
||||
Execute (Set syntax to default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Do (Create links default syntax):
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
|
||||
Expect (Vimwiki links):
|
||||
[[test]]
|
||||
[[www.google.com]]
|
||||
[[https://www.google.com]]
|
||||
[[multiple words]]
|
||||
[[let's]]
|
||||
[[let]]'s
|
||||
[[file.wiki]]
|
||||
[[file.md]]
|
||||
[[file.mw]]
|
||||
|
||||
Execute (Set syntax to markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Create links markdown syntax):
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
|
||||
Expect (Markdown links):
|
||||
[test](test)
|
||||
[www.google.com](www.google.com)
|
||||
[https://www.google.com](https://www.google.com)
|
||||
[multiple words](multiple words)
|
||||
[let's](let's)
|
||||
[let](let)'s
|
||||
[file wiki](file.wiki)
|
||||
[file](file.md)
|
||||
[file mw](file.mw)
|
||||
|
||||
Execute (Set syntax to mediawiki):
|
||||
call SetSyntax('media')
|
||||
|
||||
Do (Create links mediawiki syntax):
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
v$
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
j
|
||||
\<Enter>
|
||||
|
||||
Expect (Mediawiki links):
|
||||
[[test]]
|
||||
[[www.google.com]]
|
||||
[[https://www.google.com]]
|
||||
[[multiple words]]
|
||||
[[let's]]
|
||||
[[let]]'s
|
||||
[[file.wiki]]
|
||||
[[file.md]]
|
||||
[[file.mw]]
|
||||
|
||||
Execute(Clean: Icreated many temporary wiki):
|
||||
call ReloadVimwiki()
|
||||
|
||||
# vim: foldmethod=marker foldlevel=30
|
||||
@@ -0,0 +1,262 @@
|
||||
# Automatic link generation
|
||||
# Related to:
|
||||
# - wiki file discovery
|
||||
# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
|
||||
|
||||
|
||||
Execute (Reset sw to default (due to batch)):
|
||||
set sw=8
|
||||
|
||||
# 1 VimwikiGenerateLinks {{{1
|
||||
##########################
|
||||
# Wiki Syntax (no caption, default) {{{2
|
||||
#################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Wiki Syntax (no caption, default)'
|
||||
call ReloadVimwiki()
|
||||
AssertEqual '-1_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
|
||||
|
||||
Given (Void):
|
||||
|
||||
Execute (VimwikiGenerateLinks):
|
||||
edit $HOME/testwiki/Test.wiki
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (The links with a header):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
- [[buzz_bozz]]
|
||||
- [[index]]
|
||||
- [[link_syntax]]
|
||||
- [[link_syntax/nested]]
|
||||
|
||||
Execute (VimwikiGenerateLinks x 2):
|
||||
edit $HOME/testwiki/Test.wiki
|
||||
VimwikiGenerateLinks
|
||||
call append('$', 'Last Line')
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (The links with a header (bis)):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
- [[buzz_bozz]]
|
||||
- [[index]]
|
||||
- [[link_syntax]]
|
||||
- [[link_syntax/nested]]
|
||||
|
||||
Last Line
|
||||
|
||||
Execute (Clean Test.wiki):
|
||||
call DeleteFile('$HOME/testwiki/Test.wiki')
|
||||
|
||||
# Wiki Syntax (with caption) {{{2
|
||||
#################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Wiki Syntax (with caption)'
|
||||
let vimwiki_default.generated_links_caption = 1
|
||||
call ReloadVimwiki()
|
||||
AssertEqual '-1_margin', vimwiki#vars#get_wikilocal('list_margin') . '_margin'
|
||||
|
||||
Given (Void):
|
||||
|
||||
Execute (VimwikiGenerateLinks):
|
||||
edit $HOME/testwiki/Test.wiki
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (The links with a header):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
- [[buzz_bozz|Buzz Bozz]]
|
||||
- [[index|Test Wiki]]
|
||||
- [[link_syntax]]
|
||||
- [[link_syntax/nested]]
|
||||
|
||||
Execute (VimwikiGenerateLinks x 2):
|
||||
edit $HOME/testwiki/Test.wiki
|
||||
VimwikiGenerateLinks
|
||||
call append('$', 'Last Line')
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (The links with a header (bis)):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
- [[buzz_bozz|Buzz Bozz]]
|
||||
- [[index|Test Wiki]]
|
||||
- [[link_syntax]]
|
||||
- [[link_syntax/nested]]
|
||||
|
||||
Last Line
|
||||
|
||||
Execute (Clean Test.wiki):
|
||||
call DeleteFile('$HOME/testwiki/Test.wiki')
|
||||
|
||||
# Markdown Syntax {{{2
|
||||
#################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Markdown Syntax'
|
||||
|
||||
Given (Void):
|
||||
|
||||
Execute (Goto markdown resource wiki):
|
||||
VimwikiIndex 2
|
||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
|
||||
Execute (Edit Test file / VimwikiGenerateLinks):
|
||||
edit $HOME/testmarkdown/Test.md
|
||||
AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
|
||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (The links with a header):
|
||||
|
||||
|
||||
# Generated Links
|
||||
|
||||
- [Buzz Bozz](buzz_bozz)
|
||||
- [Test Wiki](index)
|
||||
- [link_syntax](link_syntax)
|
||||
- [link_syntax/nested](link_syntax/nested)
|
||||
|
||||
Do (Save Test.md && Re-GenerateLinks):
|
||||
:edit $HOME/testmarkdown/Test.md\<CR>
|
||||
:call WriteMe()\<CR>
|
||||
:VimwikiGenerateLinks\<CR>
|
||||
:VimwikiGenerateLinks\<CR>
|
||||
|
||||
Expect (The links with a header with file Test):
|
||||
|
||||
|
||||
# Generated Links
|
||||
|
||||
- [Generated Links](Test)
|
||||
- [Buzz Bozz](buzz_bozz)
|
||||
- [Test Wiki](index)
|
||||
- [link_syntax](link_syntax)
|
||||
- [link_syntax/nested](link_syntax/nested)
|
||||
|
||||
Execute (Clean: Remove Test.md):
|
||||
call DeleteFile('$HOME/testmarkdown/Test.md')
|
||||
|
||||
|
||||
# 2 VimwikiDiaryGenerateLinks {{{1
|
||||
#############################
|
||||
|
||||
# Wiki Syntax {{{1
|
||||
#################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Wiki Syntax'
|
||||
|
||||
Do (Create diary files):
|
||||
:edit $HOME/testwiki/diary/2019-12-10.wiki\<Cr>
|
||||
:call append('$', 'Content')\<Cr>
|
||||
:call WriteMe()\<Cr>
|
||||
:edit $HOME/testwiki/diary/2019-07-13.wiki\<Cr>
|
||||
:call append('$', 'Content')\<Cr>
|
||||
:call WriteMe()\<Cr>
|
||||
:edit $HOME/testwiki/diary/2019-03-01.wiki\<Cr>
|
||||
:call append('$', 'Content')\<Cr>
|
||||
:call WriteMe()\<Cr>
|
||||
|
||||
Do (Edit diary.wiki && GenerateDiaryLinks):
|
||||
:edit $HOME/testwiki/diary/diary.wiki\<CR>
|
||||
:VimwikiDiaryGenerateLinks\<CR>
|
||||
|
||||
Expect (diary index generated):
|
||||
= Diary =
|
||||
== 2020 ==
|
||||
|
||||
=== July ===
|
||||
- [[2020-07-25|day 4]]
|
||||
- [[2020-07-24|day 3]]
|
||||
- [[2020-07-23|Day 2]]
|
||||
- [[2020-07-22]]
|
||||
|
||||
== 2019 ==
|
||||
|
||||
=== December ===
|
||||
- [[2019-12-10]]
|
||||
|
||||
=== July ===
|
||||
- [[2019-07-13]]
|
||||
|
||||
=== March ===
|
||||
- [[2019-03-01]]
|
||||
|
||||
Execute (Clean):
|
||||
Log "End: Clean"
|
||||
call DeleteFile('$HOME/testwiki/diary/2019-12-10.wiki')
|
||||
call DeleteFile('$HOME/testwiki/diary/2019-07-13.wiki')
|
||||
call DeleteFile('$HOME/testwiki/diary/2019-03-01.wiki')
|
||||
Log "End: Reset shiftwidth to the default: 8"
|
||||
|
||||
# Wiki Markdown {{{1
|
||||
#################
|
||||
|
||||
Execute (Log):
|
||||
Log 'Markdown Syntax'
|
||||
|
||||
Execute (New Command):
|
||||
Log "2. Testing VimwikiDiaryGenerateLinks TODO"
|
||||
set sw=4
|
||||
AssertEqual 4, &sw
|
||||
|
||||
Do (Edit diary/2019-12-10):
|
||||
:edit $HOME/testmarkdown/diary/2019-12-10.md\<CR>
|
||||
iinformative content\<Esc>
|
||||
:call WriteMe()\<CR>
|
||||
|
||||
Do (Edit and save diary/2019-07-13):
|
||||
:edit $HOME/testmarkdown/diary/2019-07-13.md\<CR>
|
||||
i# informative title\<Esc>
|
||||
:call WriteMe()\<CR>
|
||||
|
||||
Do (Edit and save diary/2018-03-01):
|
||||
:edit $HOME/testmarkdown/diary/2019-03-01.md\<CR>
|
||||
:call WriteMe()\<CR>
|
||||
|
||||
|
||||
Do (Edit diary.md && GenerateDiaryLinks):
|
||||
:edit $HOME/testmarkdown/diary/diary.md\<CR>
|
||||
:VimwikiDiaryGenerateLinks\<CR>
|
||||
|
||||
Expect (diary index generated):
|
||||
# Diary
|
||||
|
||||
## 2020
|
||||
|
||||
### July
|
||||
|
||||
- [2020-07-22](2020-07-22)
|
||||
|
||||
## 2019
|
||||
|
||||
### December
|
||||
|
||||
- [2019-12-10](2019-12-10)
|
||||
|
||||
### July
|
||||
|
||||
- [informative title](2019-07-13)
|
||||
|
||||
### March
|
||||
|
||||
- [2019-03-01](2019-03-01)
|
||||
|
||||
|
||||
Execute (Clean):
|
||||
call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
|
||||
call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
|
||||
call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')
|
||||
Log "End: Reset shiftwidth to the default: 8"
|
||||
set sw&
|
||||
|
||||
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
|
||||
@@ -0,0 +1,300 @@
|
||||
# VimwikiRenameFile
|
||||
# Related to link, file navigation
|
||||
# Many commands are made with Do: They block with Execute
|
||||
|
||||
|
||||
# Create directories I remove at end {{{1
|
||||
##########################################
|
||||
|
||||
Execute (Mkdir dir1 dir2 dir11 dir12):
|
||||
call system("mkdir $HOME/testmarkdown/dir1")
|
||||
call system("mkdir $HOME/testmarkdown/dir1/dir11")
|
||||
call system("mkdir $HOME/testmarkdown/dir1/dir12")
|
||||
call system("mkdir $HOME/testmarkdown/dir2")
|
||||
|
||||
|
||||
|
||||
Do(Link with / are relative to root #617):
|
||||
:edit $HOME/testmarkdown/test.md\<Cr>
|
||||
:Log 'Is this wiki 2'\<Cr>
|
||||
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<Cr>
|
||||
:Log 'Editing'\<Cr>
|
||||
i/dir1/old_name\<Esc>
|
||||
\<CR>\<CR>
|
||||
:AssertEqual 'old_name', expand('%:t:r')\<Cr>
|
||||
:call WriteMe()\<Cr>
|
||||
:VimwikiRenameFile new_name\<Cr>
|
||||
:AssertEqual 'new_name', expand('%:t:r')\<Cr>
|
||||
:edit $HOME/testmarkdown/test.md\<Cr>
|
||||
:AssertEqual '[dir1 old_name](/dir1/new_name)', getline(1)\<Cr>
|
||||
|
||||
|
||||
# TEST TRANSDIRECTORY AND ARGUMENT {{{1
|
||||
# NEW FEATURE #926
|
||||
|
||||
# Create smaller unit {{{2
|
||||
|
||||
# we stick all along with these 3 files,
|
||||
# Follow them !
|
||||
Execute (Create 3 files):
|
||||
edit $HOME/testmarkdown/Test-Rename-zzz.md
|
||||
call WriteMe()
|
||||
edit $HOME/testmarkdown/dir1/dir11/Test-Rename.md
|
||||
call WriteMe()
|
||||
edit $HOME/testmarkdown/Test-Rename-Completion.md
|
||||
call WriteMe()
|
||||
|
||||
|
||||
Do (Testing Old buffer has been wiped out {{{2):
|
||||
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
|
||||
:Log 'Get current Buffer'\<Cr>
|
||||
:let buf_old = bufnr('%')\<Cr>
|
||||
:Log 'Is this wiki 2'\<Cr>
|
||||
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<Cr>
|
||||
:Log 'Delete for loosers'\<Cr>
|
||||
:call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')\<Cr>
|
||||
:Log 'Rewrite ...'\<Cr>
|
||||
:call WriteMe()\<Cr>
|
||||
:Log 'Rename 1'\<Cr>
|
||||
:VimwikiRenameFile Test-Rename-new1\<Cr>
|
||||
:Log 'Assert 1'\<Cr>
|
||||
:AssertEqual 'Test-Rename-new1', expand('%:t:r')\<Cr>
|
||||
:Log 'Rename 2'\<Cr>
|
||||
:VimwikiRenameFile Test-Rename-Completion\<Cr>
|
||||
:Log 'Assert 2'\<Cr>
|
||||
:AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
|
||||
|
||||
Do (Testing Completion {{{2):
|
||||
# Rename and test (zzz)
|
||||
:VimwikiRenameFile Test-Rename-z\<C-l>1\<Cr>
|
||||
:AssertEqual $HOME . '/testmarkdown/Test-Rename-zzz1.md', expand('%')\<CR>\<Esc>
|
||||
# Restore old name
|
||||
:call WriteMe()\<Cr>
|
||||
:VimwikiRenameFile Test-Rename-zzz\<Cr>
|
||||
|
||||
|
||||
Do (Testing transforward {{{2):
|
||||
:Log 'Forward: root -> dir1/dir11 {{{3'\<Cr>
|
||||
# Create dir1/dir11/Test-Rename and link to it
|
||||
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
|
||||
ggdG
|
||||
idir1/dir11/Test-Rename.md\<Esc>
|
||||
\<Cr>\<Cr>
|
||||
:VimwikiRenameFile ../Test-Rename-2\<Cr>
|
||||
:AssertEqual expand('%'), $HOME . '/testmarkdown/dir1/Test-Rename-2.md'\<CR>\<Esc>
|
||||
|
||||
# See what happend in root
|
||||
:call WriteMe()\<Cr>
|
||||
:edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
|
||||
:AssertEqual getline(1), '[dir1 dir11 Test Rename](dir1/Test-Rename-2.md)'\<Cr>
|
||||
|
||||
:Log 'Backward dir1/dir11 -> root {{{3'\<Cr>
|
||||
# See what happend in dir1/dir11
|
||||
# I am in root so pressing Enter sends me to dir1/dir11
|
||||
\<Cr>
|
||||
# Write forward path
|
||||
dd
|
||||
i../Test-Rename-Completion\<Esc>
|
||||
# Convert it to link
|
||||
0\<Cr>\<Cr>
|
||||
|
||||
# Now in root
|
||||
:AssertEqual $HOME . '/testmarkdown/Test-Rename-Completion.md', expand('%')\<Cr>
|
||||
:VimwikiRenameFile dir1/Test-Rename-Completion-2\<Cr>
|
||||
:Log 'Rename -> dir1/Test...{{{3'\<Cr>
|
||||
:AssertEqual $HOME . '/testmarkdown/dir1/Test-Rename-Completion-2.md', expand('%')\<Cr>
|
||||
|
||||
|
||||
Execute (Delete smaller unit changed {{{2):
|
||||
call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')
|
||||
call DeleteFile('$HOME/testmarkdown/Test-Rename-zzz.md')
|
||||
call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-Completion_2.md')
|
||||
call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md')
|
||||
|
||||
|
||||
# VimwikiRename Test same directory {{{1
|
||||
# Old big conf, from bad unit test design
|
||||
# Changing file in a single dir
|
||||
# Feel free to modify but as long as it works
|
||||
# I delay the cleaning
|
||||
####################################
|
||||
|
||||
Given vimwiki (Void):
|
||||
|
||||
|
||||
Execute (Create Test-Rename -> dir1/dir11/in_dir11.md and dir1/dir12/in_dir12.md and dir2/in_dir2.md):
|
||||
edit $HOME/testmarkdown/Test-Rename.md
|
||||
AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')
|
||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
call append(0, ['# Test Rename', 'in_root.md', 'dir1/dir11/in_dir11.md', 'dir1/dir12/in_dir12.md', 'dir2/in_dir2.md'])
|
||||
call WriteMe()
|
||||
|
||||
Do (Create in_root):
|
||||
:Log 'Open Test-Rename.md'\<CR>
|
||||
:edit $HOME/testmarkdown/Test-Rename.md\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')\<CR>\<Esc>
|
||||
|
||||
:Log 'Delete last line (easyer latter checks without trailing spaces)'\<CR>
|
||||
Gdd
|
||||
|
||||
:Log 'Open in_root.md'\<CR>
|
||||
gg
|
||||
j\<CR>
|
||||
j\<CR>
|
||||
j\<CR>
|
||||
j\<CR>
|
||||
ggj0y$
|
||||
:AssertEqual '[in_root](in_root.md)', @"\<CR>
|
||||
0\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
|
||||
|
||||
:Log 'Add link in_root.md -> dir1/dir11/in_dir11'\<CR>
|
||||
ggi# Title in root\<CR>\<Esc>
|
||||
idir1/dir11/in_dir11\<Esc>
|
||||
:call WriteMe()\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
|
||||
|
||||
:Log 'Open in_dir11.md: creating dirs'\<CR>
|
||||
ggj"ay$
|
||||
:AssertEqual 'reg dir1/dir11/in_dir11', 'reg ' . @a\<CR>
|
||||
0\<CR>\<CR>
|
||||
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
|
||||
|
||||
|
||||
|
||||
# TODO this does break for old Vim for the buffer local prev_links list is deleted => Cannot change file
|
||||
|
||||
|
||||
# :Log 'One backspace for fun'\<CR>
|
||||
# \<BS>
|
||||
# :AssertEqual 'file ' . $HOME . '/testmarkdown/in_root.md', 'file ' . expand('%')\<CR>
|
||||
|
||||
|
||||
Do (Create dir_11 -> dir_11):
|
||||
:edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md\<CR>
|
||||
|
||||
:Log 'Add link in_dir11_fix.md -> in_dir11'\<CR>
|
||||
ggi# Title in dir11 fix\<CR>\<Esc>
|
||||
iin_dir11\<Esc>
|
||||
:call WriteMe()\<CR>
|
||||
|
||||
:Log 'Open in_dir11.md: creating dirs'\<CR>
|
||||
ggj"ay$
|
||||
:AssertEqual 'reg in_dir11', 'reg ' . @a\<CR>
|
||||
0\<CR>\<CR>
|
||||
y\<CR>
|
||||
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
|
||||
|
||||
:Log 'One backspace for fun'\<CR>
|
||||
\<BS>
|
||||
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11_fix.md', 'file ' . expand('%')\<CR>
|
||||
|
||||
|
||||
Execute (Fill in_dir11 content):
|
||||
edit $HOME/testmarkdown/dir1/dir11/in_dir11.md
|
||||
call append(0, ['# Title in_dir11', '[dir2 link](../../dir2/in_dir2.md)'])
|
||||
call WriteMe()
|
||||
|
||||
|
||||
# Rename local {{{1
|
||||
###################
|
||||
|
||||
Do (RenameLink in_dir11 -> in_dir11_new):
|
||||
:edit $HOME/testmarkdown/dir1/dir11/in_dir11.md\<CR>
|
||||
:AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
|
||||
:AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<CR>
|
||||
|
||||
:Log 'Rename'\<CR>
|
||||
:call WriteMe()\<CR>
|
||||
:VimwikiRenameFile\<CR>
|
||||
y\<CR>
|
||||
in_dir11_new\<CR>
|
||||
:call WriteMe()\<Cr>
|
||||
|
||||
:Log 'Append filename'\<CR>
|
||||
:call append('$', [expand('%')])\<CR>
|
||||
|
||||
|
||||
Expect(With new filename at the end):
|
||||
# Title in_dir11
|
||||
[dir2 link](../../dir2/in_dir2.md)
|
||||
|
||||
/home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
|
||||
|
||||
|
||||
Execute (edit in_dir11_fix):
|
||||
edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md
|
||||
|
||||
Expect(Link to in_dir11_new):
|
||||
# Title in dir11 fix
|
||||
[in_dir11](in_dir11_new)
|
||||
|
||||
|
||||
Execute (edit Test-Rename.md):
|
||||
edit $HOME/testmarkdown/Test-Rename.md
|
||||
|
||||
|
||||
Expect (Link to in_dir11_new):
|
||||
# Test Rename
|
||||
[in_root](in_root.md)
|
||||
[dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
|
||||
[dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
|
||||
[dir2 in_dir2](dir2/in_dir2.md)
|
||||
|
||||
|
||||
Do (in_dir2 -> in_dir2_new):
|
||||
:edit $HOME/testmarkdown/dir2/in_dir2.md\<CR>
|
||||
|
||||
:Log 'Append filename'\<CR>
|
||||
:call append('$', [expand('%')])\<CR>
|
||||
|
||||
:Log 'Rename'\<CR>
|
||||
:call WriteMe()\<CR>
|
||||
:VimwikiRenameFile\<CR>
|
||||
y\<CR>
|
||||
in_dir2_new\<CR>
|
||||
:call WriteMe()\<Cr>
|
||||
|
||||
:Log 'Append filename'\<CR>
|
||||
:call append('$', [expand('%')])\<CR>
|
||||
|
||||
|
||||
Expect (old and new filenames):
|
||||
|
||||
/home/vimtest/testmarkdown/dir2/in_dir2.md
|
||||
/home/vimtest/testmarkdown/dir2/in_dir2_new.md
|
||||
|
||||
Execute (edit Test-Rename.md):
|
||||
edit $HOME/testmarkdown/Test-Rename.md
|
||||
|
||||
|
||||
Expect (Link to in_dir11_new):
|
||||
# Test Rename
|
||||
[in_root](in_root.md)
|
||||
[dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
|
||||
[dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
|
||||
[dir2 in_dir2](dir2/in_dir2_new.md)
|
||||
|
||||
|
||||
Execute (edit in_dir11.md):
|
||||
edit $HOME/testmarkdown/dir1/dir11/in_dir11_new.md
|
||||
|
||||
|
||||
Expect (Link to in_dir2_new):
|
||||
# Title in_dir11
|
||||
[dir2 link](../../dir2/in_dir2_new.md)
|
||||
|
||||
/home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
|
||||
|
||||
|
||||
Execute (Clean dir1 and dir2):
|
||||
Log "End: Clean"
|
||||
call DeleteHiddenBuffers()
|
||||
call system('rm $HOME/testmarkdown/Test-Rename.md')
|
||||
call system('rm $HOME/testmarkdown/in_root.md')
|
||||
call system('rm -r $HOME/testmarkdown/dir1')
|
||||
call system('rm -r $HOME/testmarkdown/dir2')
|
||||
|
||||
|
||||
# vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#
|
||||
@@ -0,0 +1,122 @@
|
||||
# Test resolution of as many link types as possible in Markdown syntax
|
||||
|
||||
# This relies on the line numbers for each type of link in link_syntax.md and
|
||||
# link_syntax/nested.md, which seems primitive, but does seem to work.
|
||||
|
||||
# Links in a top-level page {{{
|
||||
|
||||
Execute (Assure link_syntax.md exists):
|
||||
Log "Testing links in a top-level page with native syntax."
|
||||
VimwikiIndex 2
|
||||
VimwikiGoto link_syntax
|
||||
AssertEqual $HOME . '/testmarkdown/link_syntax.md', expand('%')
|
||||
|
||||
Do (Check plain wiki page link to index):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:1\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
|
||||
|
||||
Do (Check absolute-in-wiki page link to index with leading slash):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:2\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
|
||||
|
||||
# //foo "absolute" links - these are also checked in link_generation.vader:
|
||||
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:3\<CR>
|
||||
\<CR>
|
||||
:AssertEqual '/tmp/some_page.md', expand('%')\<CR>
|
||||
|
||||
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:4\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
|
||||
|
||||
Do (Check diary link):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:5\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/2020-07-22.md', expand('%')\<CR>
|
||||
|
||||
Do (Check link to nested page):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:6\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
|
||||
|
||||
Do (Check relative link to nested page with ./link_syntax/nested):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:7\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
|
||||
|
||||
# }}}
|
||||
|
||||
# Links in a nested file {{{
|
||||
|
||||
Execute (Assure link_syntax/nested.md exists):
|
||||
Log "Testing links in a nested page with native syntax."
|
||||
VimwikiIndex 2
|
||||
VimwikiGoto link_syntax/nested
|
||||
AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')
|
||||
|
||||
Do (Nested: Check plain wiki page link to self - link_syntax/nested.md):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:1\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/link_syntax/nested.md', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:2\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
|
||||
|
||||
# //foo "absolute" links - these are also checked in link_generation.vader:
|
||||
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:3\<CR>
|
||||
\<CR>
|
||||
:AssertEqual '/tmp/some_page.md', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:4\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check diary link):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:5\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/2020-07-22.md', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check relative link to page in parent directory):
|
||||
:VimwikiIndex 2\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:6\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/link_syntax.md', expand('%')\<CR>
|
||||
|
||||
# }}}
|
||||
|
||||
# To be perfectly honest I don't know why or if this is necessary, but without
|
||||
# it I was getting leftover tabs for the last file visited here. -- brennen
|
||||
Execute (Clean):
|
||||
call ReloadVimwiki()
|
||||
@@ -0,0 +1,122 @@
|
||||
# Test resolution of as many link types as possible in VimWiki syntax
|
||||
|
||||
# This relies on the line numbers for each type of link in link_syntax.wiki and
|
||||
# link_syntax/nested.wiki, which seems primitive, but does seem to work.
|
||||
|
||||
# Links in a top-level page {{{
|
||||
|
||||
Execute (Assure link_syntax.wiki exists):
|
||||
Log "Testing links in a top-level page with native syntax."
|
||||
VimwikiIndex 1
|
||||
VimwikiGoto link_syntax
|
||||
AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')
|
||||
|
||||
Do (Check plain wiki page link to index):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:1\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Check absolute-in-wiki page link to index with leading slash):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:2\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
|
||||
|
||||
# //foo "absolute" links - these are also checked in link_generation.vader:
|
||||
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:3\<CR>
|
||||
\<CR>
|
||||
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:4\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Check diary link):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:5\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Check link to nested page):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:6\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Check relative link to nested page with ./link_syntax/nested):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax\<CR>
|
||||
:7\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
|
||||
|
||||
# }}}
|
||||
|
||||
# Links in a nested file {{{
|
||||
|
||||
Execute (Assure link_syntax/nested.wiki exists):
|
||||
Log "Testing links in a nested page with native syntax."
|
||||
VimwikiIndex 1
|
||||
VimwikiGoto link_syntax/nested
|
||||
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')
|
||||
|
||||
Do (Nested: Check plain wiki page link to self - link_syntax/nested.wiki):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:1\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:2\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
|
||||
|
||||
# //foo "absolute" links - these are also checked in link_generation.vader:
|
||||
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:3\<CR>
|
||||
\<CR>
|
||||
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:4\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check diary link):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:5\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
|
||||
|
||||
Do (Nested: Check relative link to page in parent directory):
|
||||
:VimwikiIndex 1\<CR>
|
||||
:VimwikiGoto link_syntax/nested\<CR>
|
||||
:6\<CR>
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')\<CR>
|
||||
|
||||
# }}}
|
||||
|
||||
# To be perfectly honest I don't know why or if this is necessary, but without
|
||||
# it I was getting leftover tabs for the last file visited here. -- brennen
|
||||
Execute (Clean):
|
||||
call ReloadVimwiki()
|
||||
@@ -0,0 +1,413 @@
|
||||
# VimwikiTOC {{{1
|
||||
#
|
||||
# Just generate the TOC
|
||||
# See: link_* for link movement and creation
|
||||
#
|
||||
# TODO (10min) test if g:vimwiki_to_header well readen
|
||||
# TODO (10min) test vimviki_toc_link_format
|
||||
# TODO (1h) test if really wiki dependant (for 2 diffrent wikis)
|
||||
# TODO if link in heading
|
||||
|
||||
Given vimwiki (Wiki with spaces {{{1):
|
||||
= h1 h2 h3 h4 =
|
||||
|
||||
Execute (Toc and enter (alpha)):
|
||||
call SetSyntax('default')
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
AssertEqual -1, vimwiki#vars#get_wikilocal('list_margin')
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Toc alpha):
|
||||
= Contents =
|
||||
- [[#h1 h2 h3 h4]]
|
||||
|
||||
= h1 h2 h3 h4 =
|
||||
|
||||
Given vimwiki (Wiki with bad characters {{{1):
|
||||
= h!@$%^&() =
|
||||
|
||||
Execute (Toc and beta):
|
||||
call SetSyntax('default')
|
||||
file wiki.wiki
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Toc and jumpes well):
|
||||
= Contents =
|
||||
- [[#h!@$%^&()]]
|
||||
|
||||
= h!@$%^&() =
|
||||
|
||||
|
||||
Given vimwiki (One word headings (#981) {{{1):
|
||||
= head1 =
|
||||
== head2 ==
|
||||
=== head3 ===
|
||||
|
||||
Execute (Wiki: toc_link_format=1 (to restore) VimwikiTOC x 1):
|
||||
set sw=2
|
||||
let vimwiki_toc_link_format = 1
|
||||
call ReloadVimwiki()
|
||||
call SetSyntax('default')
|
||||
VimwikiTOC
|
||||
|
||||
|
||||
Expect(Headinds TOC one word (1)):
|
||||
= Contents =
|
||||
- [[#head1|head1]]
|
||||
- [[#head1#head2|head2]]
|
||||
- [[#head1#head2#head3|head3]]
|
||||
|
||||
= head1 =
|
||||
== head2 ==
|
||||
=== head3 ===
|
||||
|
||||
Execute (Wiki: toc_link_format=0 (restoring default) VimwikiTOC x 1):
|
||||
let vimwiki_toc_link_format = 0
|
||||
call ReloadVimwiki()
|
||||
call SetSyntax('default')
|
||||
VimwikiTOC
|
||||
|
||||
Expect(Headinds TOC one word (0)):
|
||||
= Contents =
|
||||
- [[#head1]]
|
||||
- [[#head2]]
|
||||
- [[#head3]]
|
||||
|
||||
= head1 =
|
||||
== head2 ==
|
||||
=== head3 ===
|
||||
|
||||
|
||||
Execute (Clean wiki TOC):
|
||||
|
||||
|
||||
Given vimwiki (One heading: May delete last line (#910) {{{1):
|
||||
# Basic-title
|
||||
|
||||
|
||||
Execute (VimwikiTOC x 1):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
VimwikiTOC
|
||||
|
||||
|
||||
Expect(Good content with 1 item x 1):
|
||||
# Contents
|
||||
|
||||
- [Basic-title](#basic-title)
|
||||
|
||||
# Basic-title
|
||||
|
||||
Execute (VimwikiTOC x 2):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
VimwikiTOC
|
||||
VimwikiTOC
|
||||
|
||||
Expect(Good content with 1 item x 1):
|
||||
# Contents
|
||||
|
||||
- [Basic-title](#basic-title)
|
||||
|
||||
# Basic-title
|
||||
|
||||
|
||||
Given vimwiki (With link header (#182) {{{1):
|
||||
# A [link](anything here) B
|
||||
# t[link](anything here)
|
||||
|
||||
## 7.4.1528
|
||||
|
||||
Execute (VimwikiTOC: Set syntax markdown && Set sw=8):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
VimwikiTOC
|
||||
|
||||
Expect vimwiki (With link header (#182) {{{1):
|
||||
# Contents
|
||||
|
||||
- [A link B](#a-link-b)
|
||||
- [tlink](#tlink)
|
||||
- [7.4.1528](#741528)
|
||||
|
||||
# A [link](anything here) B
|
||||
# t[link](anything here)
|
||||
|
||||
## 7.4.1528
|
||||
|
||||
|
||||
|
||||
Given vimwiki (Underline header (SetExt) (#209) {{{1):
|
||||
First with spaces
|
||||
=====
|
||||
|
||||
toto
|
||||
|
||||
Second
|
||||
-------
|
||||
toto
|
||||
|
||||
Third
|
||||
-----
|
||||
toto
|
||||
|
||||
Four
|
||||
=====
|
||||
toto
|
||||
Last
|
||||
----
|
||||
|
||||
Execute (Set syntax markdown && Set sw=8):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Heading SetExt created):
|
||||
# Contents
|
||||
|
||||
- [First with spaces](#first-with-spaces)
|
||||
- [Second](#second)
|
||||
- [Third](#third)
|
||||
- [Four](#four)
|
||||
- [Last](#last)
|
||||
|
||||
First with spaces
|
||||
=====
|
||||
|
||||
toto
|
||||
|
||||
Second
|
||||
-------
|
||||
toto
|
||||
|
||||
Third
|
||||
-----
|
||||
toto
|
||||
|
||||
Four
|
||||
=====
|
||||
toto
|
||||
Last
|
||||
----
|
||||
|
||||
|
||||
|
||||
Given vimwiki (Two same heading (#968) {{{1):
|
||||
# One
|
||||
toto
|
||||
# ONE
|
||||
like
|
||||
## oNe
|
||||
you
|
||||
|
||||
Execute (Set syntax markdown && Set sw=8):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Suffix -2 and -3):
|
||||
# Contents
|
||||
|
||||
- [One](#one)
|
||||
- [ONE](#one-2)
|
||||
- [oNe](#one-3)
|
||||
|
||||
# One
|
||||
toto
|
||||
# ONE
|
||||
like
|
||||
## oNe
|
||||
you
|
||||
|
||||
|
||||
Given vimwiki (Heading with many bad caracters {{{1):
|
||||
# One !@#@#(!%#&$^(!@
|
||||
## Two !!~!!:"@!>@!>?<
|
||||
|
||||
Execute (Set syntax markdown && VimwikiTOC):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Bad characters are removed):
|
||||
# Contents
|
||||
|
||||
- [One !@#@#(!%#&$^(!@](#one-)
|
||||
- [Two !!~!!:"@!>@!>?<](#two-)
|
||||
|
||||
# One !@#@#(!%#&$^(!@
|
||||
## Two !!~!!:"@!>@!>?<
|
||||
|
||||
|
||||
# Large previous tests {{{1
|
||||
|
||||
Execute (Reset TOC header to default):
|
||||
call vimwiki#vars#set_wikilocal('toc_header', 'Contents')
|
||||
|
||||
Given vimwiki (Headings):
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
Execute (Set syntax markdown && Set sw=8):
|
||||
call SetSyntax('markdown')
|
||||
set sw=8
|
||||
|
||||
Execute (VimwikiTOC):
|
||||
VimwikiTOC
|
||||
|
||||
Expect (With a TOC sw=8):
|
||||
# Contents
|
||||
|
||||
- [Header 1](#header-1)
|
||||
- [Header 1.1](#header-11)
|
||||
- [Header 1.1.1](#header-111)
|
||||
- [Header 2](#header-2)
|
||||
- [Header 2.1.1](#header-211)
|
||||
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
Execute (Set sw=4 && VimwikiTOC):
|
||||
set sw=4
|
||||
VimwikiTOC
|
||||
|
||||
Expect (With a TOC sw=4):
|
||||
# Contents
|
||||
|
||||
- [Header 1](#header-1)
|
||||
- [Header 1.1](#header-11)
|
||||
- [Header 1.1.1](#header-111)
|
||||
- [Header 2](#header-2)
|
||||
- [Header 2.1.1](#header-211)
|
||||
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
Do (Destroy some stuff):
|
||||
jj
|
||||
dd
|
||||
jj
|
||||
dd
|
||||
|
||||
Execute (VimwikiTOC):
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Brand new TOC):
|
||||
# Contents
|
||||
|
||||
- [Header 1](#header-1)
|
||||
- [Header 1.1](#header-11)
|
||||
- [Header 1.1.1](#header-111)
|
||||
- [Header 2](#header-2)
|
||||
- [Header 2.1.1](#header-211)
|
||||
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
|
||||
Execute (Let toc_header = Sommaire && VimwikiTOC):
|
||||
call vimwiki#vars#set_wikilocal('toc_header', 'Sommaire')
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Append a Sommaire && Leave Contents alone):
|
||||
# Sommaire
|
||||
|
||||
- [Header 1](#header-1)
|
||||
- [Header 1.1](#header-11)
|
||||
- [Header 1.1.1](#header-111)
|
||||
- [Header 2](#header-2)
|
||||
- [Header 2.1.1](#header-211)
|
||||
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
Do (Destroy some stuff):
|
||||
jj
|
||||
dd
|
||||
jj
|
||||
dd
|
||||
|
||||
Execute (VimwikiTOC):
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Brand new TOC with sommaire):
|
||||
# Sommaire
|
||||
|
||||
- [Header 1](#header-1)
|
||||
- [Header 1.1](#header-11)
|
||||
- [Header 1.1.1](#header-111)
|
||||
- [Header 2](#header-2)
|
||||
- [Header 2.1.1](#header-211)
|
||||
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
|
||||
Execute (call vimwiki#vars#set_global('toc_header_level', 6):
|
||||
call vimwiki#vars#set_wikilocal('toc_header_level', 6)
|
||||
VimwikiTOC
|
||||
# Reset default
|
||||
call vimwiki#vars#set_wikilocal('toc_header_level', 1)
|
||||
|
||||
Expect (Content prepended):
|
||||
###### Sommaire
|
||||
|
||||
- [Header 1](#header-1)
|
||||
- [Header 1.1](#header-11)
|
||||
- [Header 1.1.1](#header-111)
|
||||
- [Header 2](#header-2)
|
||||
- [Header 2.1.1](#header-211)
|
||||
|
||||
# Header 1
|
||||
random text
|
||||
## Header 1.1
|
||||
random text
|
||||
### Header 1.1.1
|
||||
random text
|
||||
|
||||
# Header 2
|
||||
### Header 2.1.1
|
||||
|
||||
" vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#
|
||||
@@ -0,0 +1,196 @@
|
||||
# Task List with commands
|
||||
|
||||
Given vimwiki (simple list):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
* [X] Done 2
|
||||
* [ ] Todo 2
|
||||
|
||||
Execute (Set syntax to default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Do (clean done, without recursion):
|
||||
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
|
||||
|
||||
Expect (two removed):
|
||||
* [ ] Todo 1
|
||||
* [ ] Todo 2
|
||||
|
||||
Given vimwiki (simple list):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
* [X] Done 2
|
||||
* [ ] Todo 2
|
||||
|
||||
Do (clean done with recursion, function):
|
||||
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
|
||||
|
||||
Expect (two removed):
|
||||
* [ ] Todo 1
|
||||
* [ ] Todo 2
|
||||
|
||||
Given vimwiki (simple list):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
* [X] Done 2
|
||||
* [ ] Todo 2
|
||||
|
||||
Do (clean done with recursion, command):
|
||||
:VimwikiRemoveDone\<Enter>
|
||||
|
||||
Expect (two removed):
|
||||
* [ ] Todo 1
|
||||
* [ ] Todo 2
|
||||
|
||||
Given vimwiki (with sub items):
|
||||
* [X] Done 1
|
||||
* [X] Subdone 1
|
||||
* [ ] Todo 1
|
||||
* [o] Done 2
|
||||
* [X] Subdone1
|
||||
* [ ] Subtodo
|
||||
* [ ] Todo 2
|
||||
|
||||
Do (clean done, without recursion):
|
||||
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
|
||||
|
||||
Expect (first removed):
|
||||
* [ ] Todo 1
|
||||
* [o] Done 2
|
||||
* [X] Subdone1
|
||||
* [ ] Subtodo
|
||||
* [ ] Todo 2
|
||||
|
||||
Given vimwiki (with sub items):
|
||||
* [ ] Todo 1
|
||||
* [o] Done 2
|
||||
* [X] Subdone1
|
||||
* [ ] Subtodo
|
||||
* [ ] Todo 2
|
||||
|
||||
Do (clean done, with recursion):
|
||||
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
|
||||
|
||||
Expect (all removed):
|
||||
* [ ] Todo 1
|
||||
* [ ] Done 2
|
||||
* [ ] Subtodo
|
||||
* [ ] Todo 2
|
||||
|
||||
Given vimwiki (nested list with space and code):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
|
||||
* [ ] Todo Post space
|
||||
* [X] Done Post space
|
||||
|
||||
* [ ] Todo code
|
||||
{{{code
|
||||
* [X] print "hello, world"
|
||||
}}}
|
||||
|
||||
* [ ] Post code Todo
|
||||
* [X] Done Sub-child
|
||||
* [X] Sub-sub-child
|
||||
* Without cb
|
||||
* [X] Post code Done
|
||||
* [X] Done Sub-child
|
||||
* [X] Sub-sub-child
|
||||
* Without cb
|
||||
|
||||
Do (clean done, without recursion):
|
||||
:call vimwiki#lst#remove_done_in_current_list(0)\<Enter>
|
||||
|
||||
Expect (removed):
|
||||
* [ ] Todo 1
|
||||
|
||||
* [ ] Todo Post space
|
||||
|
||||
* [ ] Todo code
|
||||
{{{code
|
||||
* [X] print "hello, world"
|
||||
}}}
|
||||
|
||||
* [ ] Post code Todo
|
||||
* [X] Done Sub-child
|
||||
* [X] Sub-sub-child
|
||||
* Without cb
|
||||
|
||||
Given vimwiki (nested list with space and code):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
|
||||
* [ ] Todo Post space
|
||||
* [X] Done Post space
|
||||
|
||||
* [ ] Todo code
|
||||
{{{code
|
||||
* [X] print "hello, world"
|
||||
}}}
|
||||
|
||||
* [ ] Post code Todo
|
||||
* [X] Done Sub-child
|
||||
* [X] Sub-sub-child
|
||||
* Without cb
|
||||
* [X] Post code Done
|
||||
* [X] Done Sub-child
|
||||
* [X] Sub-sub-child
|
||||
* Without cb
|
||||
|
||||
Do (clean done, with recursion):
|
||||
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
|
||||
|
||||
Expect (removed):
|
||||
* [ ] Todo 1
|
||||
|
||||
* [ ] Todo Post space
|
||||
|
||||
* [ ] Todo code
|
||||
{{{code
|
||||
* [X] print "hello, world"
|
||||
}}}
|
||||
|
||||
* [ ] Post code Todo
|
||||
|
||||
Given vimwiki (two lists):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
|
||||
Line in between.
|
||||
|
||||
* [ ] Todo Post space
|
||||
* [X] Done Post space
|
||||
|
||||
Do (clean done, with recursion):
|
||||
:call vimwiki#lst#remove_done_in_current_list(1)\<Enter>
|
||||
|
||||
Expect (only first is removed):
|
||||
* [ ] Todo 1
|
||||
|
||||
Line in between.
|
||||
|
||||
* [ ] Todo Post space
|
||||
* [X] Done Post space
|
||||
|
||||
Given vimwiki (list):
|
||||
* [X] Done 1
|
||||
* [ ] Todo 1
|
||||
|
||||
Line in between.
|
||||
|
||||
* [X] Done 2
|
||||
* [X] Done 3
|
||||
* [ ] Todo 2
|
||||
* [X] Done 4
|
||||
|
||||
Do (clean done, with range):
|
||||
:1,6VimwikiRemoveDone\<Enter>
|
||||
|
||||
Expect (only first is removed):
|
||||
* [ ] Todo 1
|
||||
|
||||
Line in between.
|
||||
|
||||
* [X] Done 3
|
||||
* [ ] Todo 2
|
||||
* [X] Done 4
|
||||
@@ -0,0 +1,112 @@
|
||||
# List indentation <= shiftwidth
|
||||
|
||||
Execute (Create temp directory):
|
||||
silent execute '!mkdir -p $HOME/list_margin/'
|
||||
cd $HOME/list_margin
|
||||
|
||||
Execute (Create wiki files):
|
||||
write page1.wiki
|
||||
write page2.wiki
|
||||
write page3.wiki
|
||||
write page1.mw
|
||||
write page2.mw
|
||||
write page3.mw
|
||||
write page1.md
|
||||
write page2.md
|
||||
write page3.md
|
||||
|
||||
Given vimwiki (Scratch file):
|
||||
|
||||
Execute (Set syntax default):
|
||||
set shiftwidth=8
|
||||
AssertEqual 8, &shiftwidth
|
||||
call SetSyntax('default')
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Execute (Generate Links):
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (Links with default margin):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
- [[page1]]
|
||||
- [[page2]]
|
||||
- [[page3]]
|
||||
|
||||
Execute (Set list margin == 2):
|
||||
call vimwiki#vars#set_wikilocal('list_margin', 2, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with margin == 2):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
- [[page1]]
|
||||
- [[page2]]
|
||||
- [[page3]]
|
||||
|
||||
Execute (Set syntax media):
|
||||
call SetSyntax('media')
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Execute (Generate Links):
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with default margin):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
* [[page1]]
|
||||
* [[page2]]
|
||||
* [[page3]]
|
||||
|
||||
Execute (Set list margin == 1):
|
||||
call vimwiki#vars#set_wikilocal('list_margin', 1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with margin == 1):
|
||||
|
||||
|
||||
= Generated Links =
|
||||
* [[page1]]
|
||||
* [[page2]]
|
||||
* [[page3]]
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
" list margin should default to 0 for markdown
|
||||
|
||||
Execute (Generate Links):
|
||||
VimwikiGenerateLinks
|
||||
|
||||
Expect (Links with default margin):
|
||||
|
||||
|
||||
# Generated Links
|
||||
|
||||
- [page1](page1)
|
||||
- [page2](page2)
|
||||
- [page3](page3)
|
||||
|
||||
Execute (Set list margin == 5):
|
||||
call vimwiki#vars#set_wikilocal('list_margin', 5, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with margin == 5):
|
||||
|
||||
|
||||
# Generated Links
|
||||
|
||||
- [page1](page1)
|
||||
- [page2](page2)
|
||||
- [page3](page3)
|
||||
|
||||
Execute (Return to default location & cleanup):
|
||||
cd /testplugin
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,45 @@
|
||||
# Move and edit a list (autocommand, config_
|
||||
|
||||
# Test J {{{1
|
||||
############################################################
|
||||
|
||||
Given vimwiki (Markdown * [ ] list {{{2):
|
||||
* [ ] Top Level
|
||||
* [o] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
* [X] Post space
|
||||
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (JJJJ):
|
||||
JJJJ
|
||||
0y$
|
||||
:call AssertIfVersion(704, '* [ ] Top Level Child 1 Child 2 Post space', @")\<Cr>
|
||||
|
||||
|
||||
|
||||
Given vimwiki (Markdown * and - list {{{2):
|
||||
* one
|
||||
* two
|
||||
- three
|
||||
- for
|
||||
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (JjJ):
|
||||
JjJ
|
||||
gg
|
||||
0y$
|
||||
:call AssertIfVersion(704, '* one two', @")\<Cr>
|
||||
G
|
||||
0y$
|
||||
:call AssertIfVersion(704, '- three for', @")\<Cr>
|
||||
|
||||
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,379 @@
|
||||
# Testting <CR> keypress in insert mode on list item
|
||||
#
|
||||
# Note: some trailing spaces are necessary at the end of list items like `1.`
|
||||
# better read this file with `set list`
|
||||
#
|
||||
# Warning: Foldmethod dependant (and foldlevel ...)
|
||||
|
||||
|
||||
Execute (Save State):
|
||||
let msg = 'Error: foldmethod must be manual for theses tests to work,'
|
||||
let msg .= ' it is the default, so please restore it in the test that changed it'
|
||||
AssertEqual &foldmethod, 'manual', msg
|
||||
|
||||
Given vimwiki (List Blockquote (Issue #55) {{{2):
|
||||
1. Outer Item 1
|
||||
1. Inner Item 1
|
||||
|
||||
> quote 1
|
||||
|
||||
2. Inner Item 2
|
||||
2. Outer Item 2
|
||||
|
||||
> quote 2
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (o):
|
||||
o
|
||||
toto
|
||||
|
||||
Expect (Good number 1):
|
||||
1. Outer Item 1
|
||||
2. toto
|
||||
1. Inner Item 1
|
||||
|
||||
> quote 1
|
||||
|
||||
2. Inner Item 2
|
||||
3. Outer Item 2
|
||||
|
||||
> quote 2
|
||||
|
||||
Do (jo):
|
||||
jo
|
||||
toto
|
||||
|
||||
Expect (Good number 2):
|
||||
1. Outer Item 1
|
||||
1. Inner Item 1
|
||||
2. toto
|
||||
|
||||
> quote 1
|
||||
|
||||
3. Inner Item 2
|
||||
2. Outer Item 2
|
||||
|
||||
> quote 2
|
||||
|
||||
|
||||
Given vimwiki (List will hard wrap (Issue #991) {{{2):
|
||||
- one two three four five six seven
|
||||
|
||||
Execute (Change textwith):
|
||||
let textwidth = &textwidth
|
||||
let linebreak = &linebreak
|
||||
Log 'Textwidth, Linebreak was: ' . textwidth . ', ' . linebreak
|
||||
set textwidth=40
|
||||
set linebreak
|
||||
|
||||
Do (Insert more than tw and press return):
|
||||
A indented line 1
|
||||
\<Cr>
|
||||
indented line 2
|
||||
|
||||
Expect (Indentation after autowrap and <CR>):
|
||||
- one two three four five six seven
|
||||
indented line 1
|
||||
indented line 2
|
||||
|
||||
Do (o new item):
|
||||
A indented line 1
|
||||
\<Esc>o
|
||||
new item
|
||||
|
||||
Expect (New item created):
|
||||
- one two three four five six seven
|
||||
indented line 1
|
||||
- new item
|
||||
|
||||
Do (VimwikiReturn 3 5):
|
||||
A indented line 1\<Esc>
|
||||
:VimwikiReturn 3 5\<Cr>
|
||||
new item
|
||||
|
||||
Expect (New item created):
|
||||
- one two three four five six seven
|
||||
indented line 1
|
||||
- new item
|
||||
|
||||
Execute (Restore textwith):
|
||||
let &textwidth = textwidth
|
||||
let &linebreak = linebreak
|
||||
|
||||
Given vimwiki (List with hard wraps):
|
||||
- Item 1
|
||||
- Item 2
|
||||
- Item 3 that is split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
- Item 4
|
||||
- Sub item 1
|
||||
- Sub item split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
- Item 5
|
||||
|
||||
Execute (Map CR):
|
||||
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 3 5<CR>
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
|
||||
Do (Extend list):
|
||||
4j
|
||||
A\<CR>Another item\<Esc>
|
||||
5j
|
||||
A\<CR>New sub item\<Esc>
|
||||
|
||||
Expect (Extended list):
|
||||
- Item 1
|
||||
- Item 2
|
||||
- Item 3 that is split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
- Another item
|
||||
- Item 4
|
||||
- Sub item 1
|
||||
- Sub item split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
- New sub item
|
||||
- Item 5
|
||||
|
||||
Given vimwiki (List with code block):
|
||||
- Item 1
|
||||
- Item 2
|
||||
- Item 3 that is split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
- Item 4
|
||||
- Sub item 1
|
||||
- Sub item split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
```
|
||||
int x = 2 + 2;
|
||||
return 0;
|
||||
```
|
||||
- Item 5
|
||||
```c
|
||||
int x = 2 + 2;
|
||||
return 0;
|
||||
```
|
||||
- Item 6 that is split
|
||||
Across multiple lines.
|
||||
Done.
|
||||
|
||||
Do (CR and CR in code block):
|
||||
4j
|
||||
A\<CR>Another item\<Esc>
|
||||
6j
|
||||
A\<CR>int y = 1;\<Esc>
|
||||
1j
|
||||
A\<CR>x = x + y;\<Esc>
|
||||
4j
|
||||
A\<CR>int y = 2;\<Esc>
|
||||
3j
|
||||
A\<CR>A new bullet doesn't get added here, oh well.\<Esc>
|
||||
3j
|
||||
A\<CR>Done and Done\<Esc>
|
||||
|
||||
Expect (No list continuation in code block):
|
||||
- Item 1
|
||||
- Item 2
|
||||
- Item 3 that is split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
- Another item
|
||||
- Item 4
|
||||
- Sub item 1
|
||||
- Sub item split across multiple lines
|
||||
This is the second line.
|
||||
This is the third line.
|
||||
```
|
||||
int y = 1;
|
||||
int x = 2 + 2;
|
||||
x = x + y;
|
||||
return 0;
|
||||
```
|
||||
- Item 5
|
||||
```c
|
||||
int y = 2;
|
||||
int x = 2 + 2;
|
||||
return 0;
|
||||
```
|
||||
A new bullet doesn't get added here, oh well.
|
||||
- Item 6 that is split
|
||||
Across multiple lines.
|
||||
Done.
|
||||
- Done and Done
|
||||
|
||||
Given vimwiki (List from help file):
|
||||
1. item
|
||||
---
|
||||
|
||||
1. item
|
||||
continue
|
||||
|
||||
---
|
||||
1.
|
||||
|
||||
---
|
||||
1.
|
||||
|
||||
---
|
||||
Execute (Map CR):
|
||||
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 1<CR>
|
||||
|
||||
Do (List ops):
|
||||
A\<CR>\<Esc>
|
||||
4j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
|
||||
# Note: trailing space <- autoindent
|
||||
Expect (List per VimwikiReturn 1 1):
|
||||
1. item
|
||||
2.
|
||||
---
|
||||
|
||||
1. item
|
||||
continue
|
||||
|
||||
|
||||
---
|
||||
1.
|
||||
2.
|
||||
|
||||
---
|
||||
1.
|
||||
2.
|
||||
|
||||
---
|
||||
Execute (Map CR):
|
||||
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 2 2<CR>
|
||||
|
||||
Do (List ops):
|
||||
A\<CR>\<Esc>
|
||||
4j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
|
||||
# Note: some trailing space added
|
||||
Expect (List per VimwikiReturn 2 2):
|
||||
1. item
|
||||
|
||||
---
|
||||
|
||||
1. item
|
||||
continue
|
||||
2.
|
||||
|
||||
---
|
||||
|
||||
1.
|
||||
|
||||
---
|
||||
|
||||
1.
|
||||
|
||||
---
|
||||
Execute (Map CR):
|
||||
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 3 3<CR>
|
||||
|
||||
Do (List ops):
|
||||
A\<CR>\<Esc>
|
||||
4j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
|
||||
|
||||
Expect (List per VimwikiReturn 3 3):
|
||||
1. item
|
||||
2.
|
||||
---
|
||||
|
||||
1. item
|
||||
continue
|
||||
2.
|
||||
|
||||
---
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
---
|
||||
Execute (Map CR):
|
||||
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 4 4<CR>
|
||||
|
||||
Do (List ops):
|
||||
A\<CR>\<Esc>
|
||||
4j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
|
||||
Expect (List per VimwikiReturn 4 4):
|
||||
1. item
|
||||
|
||||
---
|
||||
|
||||
1. item
|
||||
continue
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
Execute (Map CR):
|
||||
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 3 5<CR>
|
||||
|
||||
Do (List ops):
|
||||
A\<CR>\<Esc>
|
||||
4j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
3j
|
||||
A\<CR>\<Esc>
|
||||
|
||||
Expect (List per VimwikiReturn 3 5):
|
||||
1. item
|
||||
2.
|
||||
---
|
||||
|
||||
1. item
|
||||
continue
|
||||
2.
|
||||
|
||||
---
|
||||
|
||||
|
||||
---
|
||||
1.
|
||||
|
||||
---
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,249 @@
|
||||
# Todo lists
|
||||
|
||||
Given vimwiki (Todo list):
|
||||
* [ ] Chap1
|
||||
* [ ] Section1.1
|
||||
* [ ] Section1.2
|
||||
* [ ] Section1.3
|
||||
* [ ] Section1.4
|
||||
* [ ] Section1.5
|
||||
* [ ] Section1.6
|
||||
* [ ] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Toogle Chap2: <C-Space>):
|
||||
Gk\<C-Space>
|
||||
|
||||
Expect (Toogle Chap2):
|
||||
* [ ] Chap1
|
||||
* [ ] Section1.1
|
||||
* [ ] Section1.2
|
||||
* [ ] Section1.3
|
||||
* [ ] Section1.4
|
||||
* [ ] Section1.5
|
||||
* [ ] Section1.6
|
||||
* [ ] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [ ] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle Chap1: <C-Space>):
|
||||
\<C-Space>
|
||||
|
||||
Expect (Remove nested [ ] -> [X]):
|
||||
* [X] Chap1
|
||||
* [X] Section1.1
|
||||
* [X] Section1.2
|
||||
* [X] Section1.3
|
||||
* [X] Section1.4
|
||||
* [X] Section1.5
|
||||
* [X] Section1.6
|
||||
* [X] Section1.7
|
||||
* [X] Section1.8
|
||||
* [X] Section1.9
|
||||
* [X] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle sub 1):
|
||||
j\<C-Space>
|
||||
|
||||
Expect (Completing [ ] -> [.]):
|
||||
* [.] Chap1
|
||||
* [X] Section1.1
|
||||
* [ ] Section1.2
|
||||
* [ ] Section1.3
|
||||
* [ ] Section1.4
|
||||
* [ ] Section1.5
|
||||
* [ ] Section1.6
|
||||
* [ ] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle sub4):
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
|
||||
Expect (Completing [ ] -> [.]):
|
||||
* [o] Chap1
|
||||
* [X] Section1.1
|
||||
* [X] Section1.2
|
||||
* [X] Section1.3
|
||||
* [X] Section1.4
|
||||
* [ ] Section1.5
|
||||
* [ ] Section1.6
|
||||
* [ ] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle sub7):
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
|
||||
Expect (Completing [ ] -> [.]):
|
||||
* [O] Chap1
|
||||
* [X] Section1.1
|
||||
* [X] Section1.2
|
||||
* [X] Section1.3
|
||||
* [X] Section1.4
|
||||
* [X] Section1.5
|
||||
* [X] Section1.6
|
||||
* [X] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle sub10):
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
j\<C-Space>
|
||||
|
||||
Expect (Completing [ ] -> [.]):
|
||||
* [X] Chap1
|
||||
* [X] Section1.1
|
||||
* [X] Section1.2
|
||||
* [X] Section1.3
|
||||
* [X] Section1.4
|
||||
* [X] Section1.5
|
||||
* [X] Section1.6
|
||||
* [X] Section1.7
|
||||
* [X] Section1.8
|
||||
* [X] Section1.9
|
||||
* [X] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle delete todo box [gl]):
|
||||
gl\<Space>
|
||||
|
||||
Expect (Chap1 no checkbox):
|
||||
* Chap1
|
||||
* [ ] Section1.1
|
||||
* [ ] Section1.2
|
||||
* [ ] Section1.3
|
||||
* [ ] Section1.4
|
||||
* [ ] Section1.5
|
||||
* [ ] Section1.6
|
||||
* [ ] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Toogle delete todo boxes [gL<Space>]):
|
||||
jgL\<Space>
|
||||
|
||||
Expect (Chap1.x no checkbox):
|
||||
* [ ] Chap1
|
||||
* Section1.1
|
||||
* Section1.2
|
||||
* Section1.3
|
||||
* Section1.4
|
||||
* Section1.5
|
||||
* Section1.6
|
||||
* Section1.7
|
||||
* Section1.8
|
||||
* Section1.9
|
||||
* Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
Do (Visual toogl [v<C-Space>]):
|
||||
jvjjj\<C-Space>
|
||||
|
||||
|
||||
Expect (4 items toogled):
|
||||
* [o] Chap1
|
||||
* [X] Section1.1
|
||||
* [X] Section1.2
|
||||
* [X] Section1.3
|
||||
* [X] Section1.4
|
||||
* [ ] Section1.5
|
||||
* [ ] Section1.6
|
||||
* [ ] Section1.7
|
||||
* [ ] Section1.8
|
||||
* [ ] Section1.9
|
||||
* [ ] Section1.10
|
||||
* [X] Chap2
|
||||
End
|
||||
|
||||
################################################################################
|
||||
# Todo list with text above
|
||||
|
||||
Given vimwiki (TODO list):
|
||||
Some other text
|
||||
|
||||
- [ ] Todo Item
|
||||
|
||||
Execute (:VimwikiNextTask):
|
||||
:execute "VimwikiNextTask" | execute 'normal yyp'
|
||||
|
||||
Expect (Introduce new todo item):
|
||||
Some other text
|
||||
|
||||
- [ ] Todo Item
|
||||
- [ ] Todo Item
|
||||
|
||||
################################################################################
|
||||
# Numbered Todo list
|
||||
|
||||
Given vimwiki (Number TODO list):
|
||||
1. [ ] Chap1
|
||||
2. [ ] Chap2
|
||||
|
||||
Do (Go):
|
||||
Go
|
||||
|
||||
# Note the space at the end of 3
|
||||
Expect (Introduce new Number todo item):
|
||||
1. [ ] Chap1
|
||||
2. [ ] Chap2
|
||||
3. [ ]
|
||||
|
||||
Do (New item and ident):
|
||||
o\<C-t>Chap1.1
|
||||
|
||||
# Note the tab
|
||||
Expect (Introduce Chap1.1):
|
||||
1. [ ] Chap1
|
||||
1. [ ] Chap1.1
|
||||
2. [ ] Chap2
|
||||
|
||||
Do (Toogle <C-Space>):
|
||||
\<C-Space>
|
||||
|
||||
Expect (Chap1 Done):
|
||||
1. [X] Chap1
|
||||
2. [ ] Chap2
|
||||
@@ -0,0 +1,191 @@
|
||||
# Task list update
|
||||
|
||||
Given vimwiki (Sample nested list, vimwiki syntax):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
|
||||
* [ ] Post space
|
||||
|
||||
{{{code
|
||||
* [ ] print "hello, world"
|
||||
}}}
|
||||
|
||||
{{{morecode
|
||||
print "hello again"
|
||||
}}}
|
||||
|
||||
* [ ] Post code
|
||||
* [ ] Sub-child
|
||||
|
||||
* [ ] Sub-sub-child
|
||||
|
||||
Execute (Set syntax to default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Do (Toggle top-level):
|
||||
\<C-Space>
|
||||
|
||||
Expect (All tree toggled):
|
||||
* [X] Top Level
|
||||
* [X] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
* [X] Post space
|
||||
|
||||
{{{code
|
||||
* [ ] print "hello, world"
|
||||
}}}
|
||||
|
||||
{{{morecode
|
||||
print "hello again"
|
||||
}}}
|
||||
|
||||
* [X] Post code
|
||||
* [X] Sub-child
|
||||
|
||||
* [X] Sub-sub-child
|
||||
|
||||
Do (Toggle child):
|
||||
j
|
||||
\<C-Space>
|
||||
|
||||
Expect (Child toggled, top updated):
|
||||
* [.] Top Level
|
||||
* [X] Child 1
|
||||
* [ ] Child 2
|
||||
|
||||
* [ ] Post space
|
||||
|
||||
{{{code
|
||||
* [ ] print "hello, world"
|
||||
}}}
|
||||
|
||||
{{{morecode
|
||||
print "hello again"
|
||||
}}}
|
||||
|
||||
* [ ] Post code
|
||||
* [ ] Sub-child
|
||||
|
||||
* [ ] Sub-sub-child
|
||||
|
||||
Do (Toggle sub-child):
|
||||
G
|
||||
\<C-Space>
|
||||
|
||||
Expect (Sub-child toggled, parents updated):
|
||||
* [.] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
|
||||
* [ ] Post space
|
||||
|
||||
{{{code
|
||||
* [ ] print "hello, world"
|
||||
}}}
|
||||
|
||||
{{{morecode
|
||||
print "hello again"
|
||||
}}}
|
||||
|
||||
* [o] Post code
|
||||
* [ ] Sub-child
|
||||
|
||||
* [X] Sub-sub-child
|
||||
|
||||
Given markdown (Sample nested list, markdown syntax):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
|
||||
* [ ] Post space
|
||||
|
||||
```code
|
||||
* [ ] print "hello, world"
|
||||
```
|
||||
|
||||
```morecode
|
||||
print "hello again"
|
||||
```
|
||||
|
||||
* [ ] Post code
|
||||
* [ ] Sub-child
|
||||
|
||||
* [ ] Sub-sub-child
|
||||
|
||||
Execute (Set syntax to markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Toggle top-level):
|
||||
\<C-Space>
|
||||
|
||||
Expect (All tree toggled):
|
||||
* [X] Top Level
|
||||
* [X] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
* [X] Post space
|
||||
|
||||
```code
|
||||
* [ ] print "hello, world"
|
||||
```
|
||||
|
||||
```morecode
|
||||
print "hello again"
|
||||
```
|
||||
|
||||
* [X] Post code
|
||||
* [X] Sub-child
|
||||
|
||||
* [X] Sub-sub-child
|
||||
|
||||
Do (Toggle child):
|
||||
j
|
||||
\<C-Space>
|
||||
|
||||
Expect (Child toggled, top updated):
|
||||
* [.] Top Level
|
||||
* [X] Child 1
|
||||
* [ ] Child 2
|
||||
|
||||
* [ ] Post space
|
||||
|
||||
```code
|
||||
* [ ] print "hello, world"
|
||||
```
|
||||
|
||||
```morecode
|
||||
print "hello again"
|
||||
```
|
||||
|
||||
* [ ] Post code
|
||||
* [ ] Sub-child
|
||||
|
||||
* [ ] Sub-sub-child
|
||||
|
||||
Do (Toggle sub-child):
|
||||
G
|
||||
\<C-Space>
|
||||
|
||||
Expect (Sub-child toggled, parents updated):
|
||||
* [.] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
|
||||
* [ ] Post space
|
||||
|
||||
```code
|
||||
* [ ] print "hello, world"
|
||||
```
|
||||
|
||||
```morecode
|
||||
print "hello again"
|
||||
```
|
||||
|
||||
* [o] Post code
|
||||
* [ ] Sub-child
|
||||
|
||||
* [X] Sub-sub-child
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,87 @@
|
||||
# Task list update, propagation disabled
|
||||
|
||||
Given vimwiki (Sample nested list, vimwiki syntax):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Execute (Set syntax to default):
|
||||
set sw=2
|
||||
call SetSyntax('default')
|
||||
call vimwiki#vars#set_wikilocal('listsyms_propagate', 0)
|
||||
|
||||
Do (Toggle top-level):
|
||||
\<C-Space>
|
||||
|
||||
Expect vimwiki (Only top updated):
|
||||
* [X] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Do (Toggle child 1):
|
||||
j
|
||||
\<C-Space>
|
||||
|
||||
Expect vimwiki (Only child 1 updated):
|
||||
* [ ] Top Level
|
||||
* [X] Child 1
|
||||
* [ ] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Do (Toggle all children):
|
||||
j
|
||||
\<C-Space>
|
||||
j
|
||||
\<C-Space>
|
||||
j
|
||||
\<C-Space>
|
||||
|
||||
Expect vimwiki (Only children updated):
|
||||
* [ ] Top Level
|
||||
* [X] Child 1
|
||||
* [X] Child 2
|
||||
* [X] Child 3
|
||||
|
||||
Given vimwiki (Deeply nested list, vimwiki syntax):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
Do (Indent child 2):
|
||||
jj
|
||||
a\<C-D>
|
||||
|
||||
Expect vimwiki (Child 2 indent changed, checkmarks unchanged):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
Do (Add child 3):
|
||||
jj
|
||||
o
|
||||
Child 3
|
||||
|
||||
Expect vimwiki (Child 3 added, checkmarks unchanged):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Do (Add and indent child 3):
|
||||
jj
|
||||
o
|
||||
\<C-T>
|
||||
Child 3
|
||||
|
||||
Expect vimwiki (Child 3 added, checkmarks unchanged):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Execute (Clean):
|
||||
set sw&
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -0,0 +1,654 @@
|
||||
# Maps
|
||||
# TODO make it without side effects
|
||||
# -- Use the normal vimwiki or reset it
|
||||
|
||||
|
||||
# 0 Configure {{{1
|
||||
##################
|
||||
|
||||
Execute (VimwikiIndex):
|
||||
call SetSyntax('markdown')
|
||||
VimwikiIndex 2
|
||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
AssertEqual 'vimwiki', &filetype
|
||||
AssertEqual $HOME . '/testmarkdown/', vimwiki_wikilocal_vars[1]['path']
|
||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
|
||||
Execute (Open buzz bozz):
|
||||
edit $HOME/testmarkdown/buzz_bozz.md
|
||||
AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
|
||||
|
||||
# 1 Global {{{1
|
||||
###############
|
||||
|
||||
Execute (===========================================================):
|
||||
Log "Checking global map"
|
||||
|
||||
Do (,ww -> open index [Assert]):
|
||||
,ww
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
Do (,wt -> open index in tab [Assert]):
|
||||
,wt
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(2)
|
||||
\<CR>
|
||||
|
||||
Do (,w,w -> open diary [Assert]):
|
||||
,w,w
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
Do (,w,t -> open diary in tab [Assert]):
|
||||
,w,t
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(2)
|
||||
\<CR>
|
||||
|
||||
Do (,ws -> list and select wiki [Assert]):
|
||||
,ws
|
||||
1
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
Do (,wi -> open diary index [Assert]):
|
||||
,wi
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/diary.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
Do (,w,y -> open yesterday [Assert]):
|
||||
,w,y
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() - 60*60*24) . '.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
Do (,w,m -> open tomorrow [Assert]):
|
||||
,wm
|
||||
:AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() + 60*60*24) . '.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
|
||||
# 2 Local {{{1
|
||||
##############
|
||||
|
||||
#Execute (===========================================================):
|
||||
# Log "Checking local map"
|
||||
#
|
||||
#
|
||||
## 2.3 Font color {{{2
|
||||
Given (Some paragraphs):
|
||||
Some paragraph with some words 1
|
||||
Some paragraph with some words 2
|
||||
Some paragraph with some words 3
|
||||
Some paragraph with some words 4
|
||||
|
||||
Execute(Colorize1: Current line):
|
||||
set ft=vimwiki
|
||||
call SetSyntax('markdown')
|
||||
AssertEqual 3, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
AssertEqual 'vimwiki', &ft
|
||||
"AssertEqual ',', mapleader
|
||||
" Returns: Undefeind mapleader
|
||||
VimwikiColorize red
|
||||
|
||||
Expect (Some paragraphs):
|
||||
<span style="color:#cc241d;">Some paragraph with some words 1</span>
|
||||
Some paragraph with some words 2
|
||||
Some paragraph with some words 3
|
||||
Some paragraph with some words 4
|
||||
|
||||
Execute(Colorize2: 2 lines):
|
||||
2,3VimwikiColorize red
|
||||
|
||||
Expect (Some paragraphs):
|
||||
Some paragraph with some words 1
|
||||
<span style="color:#cc241d;">Some paragraph with some words 2
|
||||
Some paragraph with some words 3</span>
|
||||
Some paragraph with some words 4
|
||||
|
||||
Do(,wc):
|
||||
\wc1\<Cr>\<Cr>
|
||||
|
||||
Expect (Some paragraphs):
|
||||
<span style="background:#458588;">Some paragraph with some words 1</span>
|
||||
Some paragraph with some words 2
|
||||
Some paragraph with some words 3
|
||||
Some paragraph with some words 4
|
||||
|
||||
Do(User leave menu):
|
||||
,wc\<Esc>
|
||||
|
||||
Expect (Some paragraphs, nothing changed):
|
||||
Some paragraph with some words 1
|
||||
Some paragraph with some words 2
|
||||
Some paragraph with some words 3
|
||||
Some paragraph with some words 4
|
||||
|
||||
Do(v,wc):
|
||||
jwll
|
||||
v
|
||||
jjllll
|
||||
\wc14\<Cr>
|
||||
|
||||
Expect (Some paragraphs):
|
||||
Some paragraph with some words 1
|
||||
Some pa<span style="color:#cc241d;">ragraph with some words 2
|
||||
Some paragraph with some words 3
|
||||
Some paragra</span>ph with some words 4
|
||||
|
||||
Do(With emoji):
|
||||
Go
|
||||
🤥 abcdefghi 🤥 🤥\<Cr>
|
||||
🤥 abcdefghi 🤥 🤥\<Cr>
|
||||
🤥 abcdefghi 🤥 🤥\<Esc>
|
||||
/abc\<Cr>
|
||||
ll
|
||||
\<esc>\<C-v>
|
||||
jjllll
|
||||
\wc1\<Cr>
|
||||
|
||||
Expect (Some paragraphs):
|
||||
Some paragraph with some words 1
|
||||
Some paragraph with some words 2
|
||||
Some paragraph with some words 3
|
||||
Some paragraph with some words 4
|
||||
🤥 ab<span style="background:#458588;">cdefghi 🤥 🤥
|
||||
🤥 abcdefghi 🤥 🤥
|
||||
🤥 abcdefg</span>hi 🤥 🤥
|
||||
|
||||
# 2.1 Heading {{{2
|
||||
##############
|
||||
|
||||
|
||||
Do (,wn -> Create new wiki [Assert]):
|
||||
,wn
|
||||
new_file1
|
||||
\<CR>
|
||||
:AssertEqual $HOME . '/testmarkdown/new_file1.md', expand('%')
|
||||
\<CR>
|
||||
:call AssertTab(1)
|
||||
\<CR>
|
||||
|
||||
Do (,wd -> Delete wiki yes [Assert]):
|
||||
:edit $HOME . '/testmarkdown/file_new1.md'
|
||||
\<CR>
|
||||
|
||||
,wn
|
||||
new_file2
|
||||
\<CR>
|
||||
ithis is content 2
|
||||
\<Esc>
|
||||
|
||||
,wd
|
||||
yes
|
||||
\<CR>
|
||||
|
||||
:AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
\<CR>
|
||||
|
||||
Do (,wd -> Delete wiki no [Assert]):
|
||||
:edit $HOME . '/testmarkdown/file_new1.md'
|
||||
\<CR>
|
||||
|
||||
,wn
|
||||
new_file2
|
||||
\<CR>
|
||||
ithis is content 1
|
||||
\<Esc>
|
||||
|
||||
,wd
|
||||
no
|
||||
\<CR>
|
||||
|
||||
:AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
|
||||
\<CR>
|
||||
|
||||
Do (,wn -> Rename wiki [Assert]):
|
||||
,wn
|
||||
new_file1
|
||||
\<CR>
|
||||
ithis is content 1
|
||||
\<Esc>
|
||||
|
||||
,wn
|
||||
new_file2
|
||||
\<CR>
|
||||
|
||||
:AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
|
||||
\<CR>
|
||||
|
||||
Given (Some headings):
|
||||
# Head 1
|
||||
## Head 1.1
|
||||
content 1
|
||||
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
Execute (file .md):
|
||||
file toto.md
|
||||
edit!
|
||||
AssertEqual 'vimwiki', &ft
|
||||
|
||||
Do (= -> add header level):
|
||||
=
|
||||
|
||||
Expect (Inc header level):
|
||||
## Head 1
|
||||
## Head 1.1
|
||||
content 1
|
||||
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
Do (- -> Dec header level):
|
||||
j
|
||||
-
|
||||
|
||||
Expect (Dec header level):
|
||||
# Head 1
|
||||
# Head 1.1
|
||||
content 1
|
||||
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
# TODO fix for vim_7.3.429
|
||||
# Do ([[ -> Go to the previous header):
|
||||
# G
|
||||
# k
|
||||
# [[
|
||||
# A placeholder
|
||||
#
|
||||
# Expect (placeholder):
|
||||
# # Head 1
|
||||
# ## Head 1.1 placeholder
|
||||
# content 1
|
||||
#
|
||||
# # Head2
|
||||
# content 2
|
||||
#
|
||||
# Do (]] -> Go to the next header):
|
||||
# ]]
|
||||
# A placeholder
|
||||
#
|
||||
# Expect (placeholder):
|
||||
# # Head 1
|
||||
# ## Head 1.1 placeholder
|
||||
# content 1
|
||||
#
|
||||
# # Head2
|
||||
# content 2
|
||||
#
|
||||
# Do ([= -> Go to the previous header which has the same level):
|
||||
# G
|
||||
# k
|
||||
# [=
|
||||
# A placeholder
|
||||
#
|
||||
# Expect (placeholder):
|
||||
# # Head 1 placeholder
|
||||
# ## Head 1.1
|
||||
# content 1
|
||||
#
|
||||
# # Head2
|
||||
# content 2
|
||||
#
|
||||
# Do (]= -> Go to the next header which has the same level):
|
||||
# ]=
|
||||
# A placeholder
|
||||
#
|
||||
# Expect (placeholder):
|
||||
# # Head 1
|
||||
# ## Head 1.1
|
||||
# content 1
|
||||
#
|
||||
# # Head2 placeholder
|
||||
# content 2
|
||||
#
|
||||
# Do (]u Go one level up):
|
||||
# j
|
||||
# ]u
|
||||
# A placeholder
|
||||
#
|
||||
# Expect (placeholder):
|
||||
# # Head 1 placeholder
|
||||
# ## Head 1.1
|
||||
# content 1
|
||||
#
|
||||
# # Head2
|
||||
# content 2
|
||||
#
|
||||
# Do ([u Go one level up):
|
||||
# j
|
||||
# [u
|
||||
# A placeholder
|
||||
#
|
||||
# Expect (placeholder):
|
||||
# # Head 1 placeholder
|
||||
# ## Head 1.1
|
||||
# content 1
|
||||
#
|
||||
# # Head2
|
||||
# content 2
|
||||
|
||||
|
||||
# 2.2 List {{{2
|
||||
##############
|
||||
|
||||
|
||||
|
||||
# brennen commenting this out 2021-03-29 - test seems to flap, test failures
|
||||
# are difficult to diagnose.
|
||||
#
|
||||
# Given vimwiki (Completion list #813 {{{3):
|
||||
# complete1
|
||||
# complete2
|
||||
# complete3
|
||||
#
|
||||
# Do (Insert a list item and complete):
|
||||
# Go
|
||||
# * comp\<C-n>\<C-n>\<Cr>\<Esc>
|
||||
# # -Es -> Delete trailing *
|
||||
# :let mode = mode(1)\<Cr>
|
||||
# :Log 'Mode : ' .mode\<Cr>
|
||||
# :if mode ==# 'ce' || mode ==# 'cv' || v:version < 704\<Cr>
|
||||
# Log 'Cheating'\<Cr>
|
||||
# try\<Cr>
|
||||
# g/^\* \?$/d\<Cr>
|
||||
# endtry\<Cr>
|
||||
# endif\<Cr>
|
||||
#
|
||||
# Expect (With a completion but no new list item):
|
||||
# complete1
|
||||
# complete2
|
||||
# complete3
|
||||
# * complete2
|
||||
#
|
||||
|
||||
Given (Number list):
|
||||
1. I
|
||||
1. Relly
|
||||
2. Love
|
||||
1. Very
|
||||
1. Much
|
||||
3. You
|
||||
|
||||
Execute (file .md):
|
||||
file toto.md
|
||||
edit!
|
||||
AssertEqual 'vimwiki', &ft
|
||||
set sw=2
|
||||
|
||||
Do (gll):
|
||||
gll
|
||||
|
||||
Expect (Increase):
|
||||
1. I
|
||||
2. Relly
|
||||
1. Love
|
||||
1. Very
|
||||
1. Much
|
||||
2. You
|
||||
|
||||
Do (gLl):
|
||||
gLl
|
||||
|
||||
Expect (Increase self + child):
|
||||
1. I
|
||||
1. Relly
|
||||
1. Love
|
||||
1. Very
|
||||
1. Much
|
||||
2. You
|
||||
|
||||
Do (glh):
|
||||
jjj
|
||||
glh
|
||||
|
||||
Expect (Decrease):
|
||||
1. I
|
||||
1. Relly
|
||||
2. Love
|
||||
3. Very
|
||||
1. Much
|
||||
4. You
|
||||
|
||||
Do (gLh):
|
||||
jjj
|
||||
gLh
|
||||
|
||||
Expect (Decrease self + child):
|
||||
1. I
|
||||
1. Relly
|
||||
2. Love
|
||||
3. Very
|
||||
1. Much
|
||||
4. You
|
||||
|
||||
Do (glr):
|
||||
\<C-A>\<C-A>
|
||||
glr
|
||||
|
||||
Expect (Renumber):
|
||||
1. I
|
||||
1. Relly
|
||||
2. Love
|
||||
1. Very
|
||||
1. Much
|
||||
3. You
|
||||
|
||||
|
||||
# New launch
|
||||
#
|
||||
Given (Number list):
|
||||
1. I
|
||||
1. Relly
|
||||
2. Love
|
||||
1. Very
|
||||
1. Much
|
||||
3. You
|
||||
|
||||
Execute (file .md):
|
||||
file toto.md
|
||||
edit!
|
||||
AssertEqual 'vimwiki', &ft
|
||||
set sw=2
|
||||
|
||||
Do (gl*):
|
||||
gl*
|
||||
|
||||
Expect (item -> *):
|
||||
* I
|
||||
1. Relly
|
||||
1. Love
|
||||
1. Very
|
||||
1. Much
|
||||
2. You
|
||||
|
||||
Do (gL*):
|
||||
gL*
|
||||
|
||||
Expect (list -> *):
|
||||
* I
|
||||
1. Relly
|
||||
* Love
|
||||
1. Very
|
||||
1. Much
|
||||
* You
|
||||
|
||||
# New launch
|
||||
#
|
||||
Given (Bulleted list):
|
||||
* I
|
||||
- Relly
|
||||
* Love
|
||||
- Very
|
||||
+ Much
|
||||
* You
|
||||
|
||||
Execute (file .md):
|
||||
set sw=2
|
||||
file toto.md
|
||||
edit!
|
||||
let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
|
||||
let g:vimwiki_syntaxlocal_vars['markdown']['bullet_types'] = ['*', '-', '+']
|
||||
AssertEqual 'vimwiki', &ft
|
||||
|
||||
Do (gLl):
|
||||
gLl
|
||||
|
||||
Expect (Increase):
|
||||
- I
|
||||
+ Relly
|
||||
* Love
|
||||
- Very
|
||||
+ Much
|
||||
* You
|
||||
|
||||
Do (3glh):
|
||||
gLh
|
||||
|
||||
Expect (Decrease):
|
||||
* I
|
||||
- Relly
|
||||
* Love
|
||||
- Very
|
||||
+ Much
|
||||
* You
|
||||
|
||||
Given (Bulleted list 2):
|
||||
* Love
|
||||
- Very
|
||||
- Much
|
||||
|
||||
Do (Go):
|
||||
Go
|
||||
|
||||
Expect (New item):
|
||||
* Love
|
||||
- Very
|
||||
- Much
|
||||
-
|
||||
|
||||
|
||||
# New launch
|
||||
#
|
||||
Given (List ->):
|
||||
* Item1
|
||||
|
||||
Execute (file toto.md):
|
||||
" Note: let s:markdown_syntax.bullet_types = ['*', '-', '+']
|
||||
file toto.md
|
||||
edit!
|
||||
Log "Cycle bullets"
|
||||
let g:vimwiki_syntaxlocal_vars['bullet_types'] = ['*', '-']
|
||||
let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
|
||||
AssertEqual g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'], 1
|
||||
AssertEqual 'vimwiki', &ft
|
||||
set sw=2
|
||||
set expandtab " Otherwise, getting some tab before some items, when enought space
|
||||
|
||||
Do (o):
|
||||
oItem2
|
||||
|
||||
Expect (Good bullet type):
|
||||
* Item1
|
||||
* Item2
|
||||
|
||||
# TODO test more, (see real cycle, but do not work with low vim)
|
||||
Do (o + <C-t>):
|
||||
o2
|
||||
\<C-t>\<Esc>
|
||||
o3
|
||||
\<C-t>\<Esc>
|
||||
|
||||
Expect (Good bullet type):
|
||||
* Item1
|
||||
- 2
|
||||
+ 3
|
||||
|
||||
Do (o + <Cr>):
|
||||
A1\<Cr>
|
||||
2\<C-t>\<Cr>
|
||||
3\<C-t>
|
||||
|
||||
Expect (Good nested bullet type):
|
||||
* Item11
|
||||
- 2
|
||||
+ 3
|
||||
|
||||
|
||||
# TODO test: let g:vimwiki_bullet_types = ['-', '•', '→', '*']
|
||||
|
||||
|
||||
# 3 Text Object {{{1
|
||||
####################
|
||||
|
||||
Execute (===========================================================):
|
||||
Log "Checking text object"
|
||||
|
||||
# 3.1 HEading Object {{{2
|
||||
####################
|
||||
|
||||
|
||||
Given (Some headings):
|
||||
# Head 1
|
||||
## Head 1.1
|
||||
content 1
|
||||
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
Do (ah):
|
||||
j
|
||||
dah
|
||||
|
||||
Expect (Change A header including its content up to the next header):
|
||||
# Head 1
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
Do (ih):
|
||||
j
|
||||
dih
|
||||
|
||||
Expect (The content under a header):
|
||||
# Head 1
|
||||
## Head 1.1
|
||||
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
Do (aH):
|
||||
daH
|
||||
|
||||
Expect (A header including all of its subheaders):
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
Do (iH):
|
||||
diH
|
||||
|
||||
Expect (Like 'aH', but excluding the header itself):
|
||||
# Head 1
|
||||
|
||||
# Head2
|
||||
content 2
|
||||
|
||||
# vim: foldmethod=marker foldlevel=30 sw=2
|
||||
@@ -0,0 +1,3 @@
|
||||
set runtimepath+=/tmp/vader_wiki/home/vimtest/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,/tmp/vader_wiki/home/vimtest/vim/after
|
||||
execute 'set rtp+='.join(filter(split(expand('/tmp/vader_wiki/home/vimtest/plugins/*')), 'isdirectory(v:val)'), ',')
|
||||
set runtimepath+=/tmp/vader_wiki/testplugin
|
||||
@@ -0,0 +1,3 @@
|
||||
# Buzz Bozz
|
||||
|
||||
Cras nisl dolor, mattis condimentum neque ac, cursus tristique est. Sed vel imperdiet ipsum. Curabitur non dictum tortor. Donec massa justo, cursus at suscipit ornare, tempus a tellus. Praesent at orci mi. Praesent sed odio in leo pulvinar vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed eu leo dui. Fusce vitae laoreet massa. Donec ac tempor lectus. Curabitur eget ligula vel purus efficitur congue. Fusce ut pellentesque magna, eget facilisis nunc.
|
||||
@@ -0,0 +1,59 @@
|
||||
# Test Wiki
|
||||
|
||||
This test wiki exists to test various features of VimWiki.
|
||||
|
||||
VimWiki Developers: Feel free to *add* to this wiki for additional test features.
|
||||
|
||||
Foo bar
|
||||
foo bar
|
||||
biz baz
|
||||
foo\bar
|
||||
baz{13} <--- this is for testing a literal "baz{13}"
|
||||
buzzzzz <--- this is for testing regex /buz{5}/
|
||||
|
||||
# Links
|
||||
|
||||
1. [[buzz_bozz|l_Buzz Bozz]]
|
||||
2. [l_Buzz_Bozz](buzz_bozz)
|
||||
3. [l_Flashy](#Typefaces#Flashy)
|
||||
4. [l_Test Wiki](#Test Wiki)
|
||||
|
||||
# Typefaces
|
||||
|
||||
## Generic
|
||||
|
||||
~~strikeout text~~
|
||||
`code (no syntax) text`
|
||||
super^script^
|
||||
sub,,script,,
|
||||
|
||||
## Markdown
|
||||
|
||||
**bold text** or __bold text__
|
||||
*italic text* or _italic text_
|
||||
***bold_italic text*** or ___italic_bold text___
|
||||
|
||||
## Flashy
|
||||
TODO, DONE, STARTED, FIXME, FIXED, XXX.
|
||||
|
||||
# More
|
||||
|
||||
## Lorem ipsum dolor ==
|
||||
|
||||
Sit amet, consectetur adipiscing elit. Etiam sed efficitur lectus, sit amet consectetur purus. Vestibulum pulvinar, magna et fermentum aliquet, diam libero blandit ex, quis iaculis dui metus sit amet nulla. Mauris auctor massa magna, eu aliquam neque consequat a. Duis lorem nunc, tempus eu dignissim a, euismod sit amet ex. Duis nec condimentum libero. Nulla iaculis fringilla ante, in posuere lorem maximus vel. Nam pulvinar quis diam non ultrices. Vivamus maximus ipsum a placerat rutrum. Nam et consectetur erat, sodales hendrerit ligula.
|
||||
|
||||
# Etiam dapibus iaculis
|
||||
|
||||
Sed tincidunt vestibulum nunc, in dapibus eros dictum in. Nullam ut dolor nisi.
|
||||
|
||||
* blandit nulla mi
|
||||
* at gravida magna
|
||||
* maximus eu
|
||||
|
||||
### Morbi id sodales sem
|
||||
|
||||
Nulla id malesuada velit. Mauris ac nisl orci. Donec maximus ex in sapien fringilla mollis. Praesent eu felis bibendum, auctor justo eget, bibendum purus. Nullam egestas, diam et eleifend tempus, ipsum libero auctor mi, quis rutrum neque metus ac tortor. Vestibulum porttitor tempus vulputate.
|
||||
|
||||
## Praesent tempor turpis est
|
||||
|
||||
Nunc scelerisque placerat auctor. Donec vel iaculis risus, non commodo nisl. Duis pretium nisi nibh, ac faucibus metus condimentum nec. Aliquam eu euismod lorem. Aenean sit amet tellus sed massa luctus dignissim. Nam tempor sapien quis felis hendrerit fermentum. Nunc vitae vehicula enim.
|
||||
@@ -0,0 +1,7 @@
|
||||
[index](index)
|
||||
[/index](/index)
|
||||
[///tmp/some_page](///tmp/some_page)
|
||||
[//~/testmarkdown/index](//~/testmarkdown/index)
|
||||
[diary:2020-07-22](diary:2020-07-22)
|
||||
[link_syntax/nested](link_syntax/nested)
|
||||
[./link_syntax/nested](./link_syntax/nested)
|
||||
@@ -0,0 +1,6 @@
|
||||
[nested](nested)
|
||||
[/index](/index)
|
||||
[///tmp/some_page](///tmp/some_page)
|
||||
[//~/testmarkdown/index](//~/testmarkdown/index)
|
||||
[diary:2020-07-22](diary:2020-07-22)
|
||||
[../link_syntax](../link_syntax)
|
||||
@@ -0,0 +1,3 @@
|
||||
= Buzz Bozz =
|
||||
|
||||
Cras nisl dolor, mattis condimentum neque ac, cursus tristique est. Sed vel imperdiet ipsum. Curabitur non dictum tortor. Donec massa justo, cursus at suscipit ornare, tempus a tellus. Praesent at orci mi. Praesent sed odio in leo pulvinar vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed eu leo dui. Fusce vitae laoreet massa. Donec ac tempor lectus. Curabitur eget ligula vel purus efficitur congue. Fusce ut pellentesque magna, eget facilisis nunc.
|
||||
@@ -0,0 +1,30 @@
|
||||
= Space Path Wiki =
|
||||
|
||||
This test wiki exists to test various features of VimWiki.
|
||||
|
||||
VimWiki Developers: Feel free to *add* to this wiki for additional test features.
|
||||
|
||||
Foo bar foo bar biz baz.
|
||||
|
||||
[[buzz_bozz|Buzz Bozz]]
|
||||
|
||||
== Lorem ipsum dolor ==
|
||||
|
||||
Sit amet, consectetur adipiscing elit. Etiam sed efficitur lectus, sit amet consectetur purus. Vestibulum pulvinar, magna et fermentum aliquet, diam libero blandit ex, quis iaculis dui metus sit amet nulla. Mauris auctor massa magna, eu aliquam neque consequat a. Duis lorem nunc, tempus eu dignissim a, euismod sit amet ex. Duis nec condimentum libero. Nulla iaculis fringilla ante, in posuere lorem maximus vel. Nam pulvinar quis diam non ultrices. Vivamus maximus ipsum a placerat rutrum. Nam et consectetur erat, sodales hendrerit ligula.
|
||||
|
||||
== Etiam dapibus iaculis ==
|
||||
|
||||
Sed tincidunt vestibulum nunc, in dapibus eros dictum in. Nullam ut dolor nisi.
|
||||
|
||||
* blandit nulla mi
|
||||
* at gravida magna
|
||||
* maximus eu
|
||||
|
||||
=== Morbi id sodales sem ===
|
||||
|
||||
Nulla id malesuada velit. Mauris ac nisl orci. Donec maximus ex in sapien fringilla mollis. Praesent eu felis bibendum, auctor justo eget, bibendum purus. Nullam egestas, diam et eleifend tempus, ipsum libero auctor mi, quis rutrum neque metus ac tortor. Vestibulum porttitor tempus vulputate.
|
||||
|
||||
== Praesent tempor turpis est ==
|
||||
|
||||
Nunc scelerisque placerat auctor. Donec vel iaculis risus, non commodo nisl. Duis pretium nisi nibh, ac faucibus metus condimentum nec. Aliquam eu euismod lorem. Aenean sit amet tellus sed massa luctus dignissim. Nam tempor sapien quis felis hendrerit fermentum. Nunc vitae vehicula enim.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
= Buzz Bozz =
|
||||
|
||||
Cras nisl dolor, mattis condimentum neque ac, cursus tristique est. Sed vel imperdiet ipsum. Curabitur non dictum tortor. Donec massa justo, cursus at suscipit ornare, tempus a tellus. Praesent at orci mi. Praesent sed odio in leo pulvinar vulputate. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed eu leo dui. Fusce vitae laoreet massa. Donec ac tempor lectus. Curabitur eget ligula vel purus efficitur congue. Fusce ut pellentesque magna, eget facilisis nunc.
|
||||
@@ -0,0 +1 @@
|
||||
example diary entry for day 1.
|
||||
@@ -0,0 +1,3 @@
|
||||
= Day 2 =
|
||||
|
||||
another diary entry
|
||||
@@ -0,0 +1,5 @@
|
||||
%nohtml
|
||||
|
||||
== day 3 ==
|
||||
|
||||
and yet *another* diary entry.
|
||||
@@ -0,0 +1,17 @@
|
||||
= day 4 =
|
||||
|
||||
== subsection 1 ==
|
||||
|
||||
here is some code:
|
||||
|
||||
{{{
|
||||
#!/bin/sh
|
||||
echo "hello world"
|
||||
}}}
|
||||
|
||||
== subsection 2 ==
|
||||
|
||||
an important list:
|
||||
|
||||
* point 1
|
||||
* point 2
|
||||
@@ -0,0 +1,35 @@
|
||||
= Test Wiki =
|
||||
|
||||
This test wiki exists to test various features of VimWiki.
|
||||
|
||||
VimWiki Developers: Feel free to *add* to this wiki for additional test features.
|
||||
|
||||
Foo bar
|
||||
foo bar
|
||||
biz baz
|
||||
foo\bar
|
||||
baz{13} <--- this is for testing a literal "baz{13}"
|
||||
buzzzzz <--- this is for testing regex /buz{5}/
|
||||
|
||||
[[buzz_bozz|Buzz Bozz]]
|
||||
|
||||
== Lorem ipsum dolor ==
|
||||
|
||||
Sit amet, consectetur adipiscing elit. Etiam sed efficitur lectus, sit amet consectetur purus. Vestibulum pulvinar, magna et fermentum aliquet, diam libero blandit ex, quis iaculis dui metus sit amet nulla. Mauris auctor massa magna, eu aliquam neque consequat a. Duis lorem nunc, tempus eu dignissim a, euismod sit amet ex. Duis nec condimentum libero. Nulla iaculis fringilla ante, in posuere lorem maximus vel. Nam pulvinar quis diam non ultrices. Vivamus maximus ipsum a placerat rutrum. Nam et consectetur erat, sodales hendrerit ligula.
|
||||
|
||||
== Etiam dapibus iaculis ==
|
||||
|
||||
Sed tincidunt vestibulum nunc, in dapibus eros dictum in. Nullam ut dolor nisi.
|
||||
|
||||
* blandit nulla mi
|
||||
* at gravida magna
|
||||
* maximus eu
|
||||
|
||||
=== Morbi id sodales sem ===
|
||||
|
||||
Nulla id malesuada velit. Mauris ac nisl orci. Donec maximus ex in sapien fringilla mollis. Praesent eu felis bibendum, auctor justo eget, bibendum purus. Nullam egestas, diam et eleifend tempus, ipsum libero auctor mi, quis rutrum neque metus ac tortor. Vestibulum porttitor tempus vulputate.
|
||||
|
||||
== Praesent tempor turpis est ==
|
||||
|
||||
Nunc scelerisque placerat auctor. Donec vel iaculis risus, non commodo nisl. Duis pretium nisi nibh, ac faucibus metus condimentum nec. Aliquam eu euismod lorem. Aenean sit amet tellus sed massa luctus dignissim. Nam tempor sapien quis felis hendrerit fermentum. Nunc vitae vehicula enim.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[[index]]
|
||||
[[/index]]
|
||||
[[///tmp/some_page]]
|
||||
[[//~/testwiki/index]]
|
||||
[[diary:2020-07-22]]
|
||||
[[link_syntax/nested]]
|
||||
[[./link_syntax/nested]]
|
||||
@@ -0,0 +1,6 @@
|
||||
[[nested]]
|
||||
[[/index]]
|
||||
[[///tmp/some_page]]
|
||||
[[//~/testwiki/index]]
|
||||
[[diary:2020-07-22]]
|
||||
[[../link_syntax]]
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<div class="content">
|
||||
<p><small>Last updated on %date%</small></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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"
|
||||
@@ -0,0 +1,428 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2155 # Declare and assign separately to avoid masking return values
|
||||
|
||||
: '
|
||||
Vimwiki vader test script
|
||||
|
||||
Credit: https://github.com/w0rp/ale for script ideas and the color vader output function.
|
||||
'
|
||||
|
||||
# Capture start time now
|
||||
declare -g start_time=$(date +%s)
|
||||
|
||||
|
||||
printHelp() {
|
||||
: 'Print usage to stdout'
|
||||
cat << ' EOF' | sed -e 's/^ //'
|
||||
Usage: bash run_tests.sh [OPTIONS]
|
||||
|
||||
Runs Vimwiki Vader tests or Vint in a Docker container
|
||||
|
||||
-h (Help) Print help message
|
||||
|
||||
-n (versioN) Specify vim/nvim version to run tests for.
|
||||
Specify "local" to run on your current vim install
|
||||
for example on Windows.
|
||||
Multiple versions can be specified by quoting the value and
|
||||
separating versions with a space. E.g. -n "vim1 vim2".
|
||||
Default is all available versions.
|
||||
|
||||
-f (File) Space separated list of tests to run.
|
||||
E.g. -o "list_* z_success"
|
||||
|
||||
-l (List) list available versions that can be used with the '-n' option
|
||||
|
||||
-t (Type) Select test type: 'vader', 'vint', or 'all'
|
||||
|
||||
-v (Verbose) Turn on verbose output.
|
||||
|
||||
E.g. On Linux without with local Vim
|
||||
bash run_tests.sh -v -t vader -n local -f link_creation.vader issue_markdown.vader
|
||||
|
||||
E.g. On Linux
|
||||
bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader issue_markdown.vader
|
||||
|
||||
E.g. On Windows
|
||||
bash run_tests.sh -v -t vader -n local -f z_success.vader | cat
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
run_test(){
|
||||
: 'Main function'
|
||||
local -i res=0
|
||||
|
||||
# Hi
|
||||
echo -en "Starting $(basename "$0") for VimWiki\n"
|
||||
|
||||
# Hook ctrl-c or ctrl-z to stop tests
|
||||
trap exit 1 SIGINT SIGTERM
|
||||
|
||||
# For windows: Cmder bash is appending busybox to the path and
|
||||
# and a smlll vim is included, so that override the windows path vim
|
||||
if [[ -v OLD_PATH ]]; then
|
||||
echo "Setting path from OLD_PATH : $OLD_PATH"
|
||||
export PATH="$OLD_PATH"
|
||||
fi
|
||||
|
||||
# WORK
|
||||
parse_argument "$@"; ((res |= $?))
|
||||
execute_test_argument; ((res |= $?))
|
||||
|
||||
# Print ellapsed time (after calculate it)
|
||||
end_time=$(date +%s)
|
||||
sec_time=$((end_time - start_time))
|
||||
printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
|
||||
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $res\n\n"
|
||||
|
||||
return "$res"
|
||||
}
|
||||
|
||||
|
||||
parse_argument(){
|
||||
: 'Parse user argument'
|
||||
# Declare color helper
|
||||
declare -g red='\033[0;31m'
|
||||
declare -g green='\033[0;32m'
|
||||
declare -g nc='\033[0m'
|
||||
|
||||
# Declare: Path of the script, supposing no spaces
|
||||
declare -g g_script_file=$(dirname "$0")
|
||||
declare -g g_script_path=$(realpath "$g_script_file")
|
||||
declare -g g_wiki_path=$(realpath "$g_script_path/..")
|
||||
declare -g g_tmp_dir=$(dirname "$(mktemp -u)")
|
||||
|
||||
# Declare: list of vim/nvim versions
|
||||
declare -g g_vers="$(print_versions)"
|
||||
|
||||
# Declare: type of tests to run - vader/vint/all
|
||||
declare -g g_type="all"
|
||||
|
||||
# Declare: verbose output flag
|
||||
declare -g g_verbose=0
|
||||
|
||||
# Declare: only run these tests
|
||||
declare -g g_file_test=""
|
||||
|
||||
# Declare: docker flags
|
||||
declare -g flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
||||
|
||||
# Parse all argument options
|
||||
while getopts ":hvn:lt:f:" opt; do
|
||||
case ${opt} in
|
||||
h)
|
||||
printHelp
|
||||
;;
|
||||
n)
|
||||
g_vers="$OPTARG"
|
||||
;;
|
||||
v)
|
||||
g_verbose=1
|
||||
;;
|
||||
l)
|
||||
print_versions
|
||||
;;
|
||||
t)
|
||||
g_type="$OPTARG"
|
||||
;;
|
||||
f)
|
||||
g_file_test="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: $OPTARG" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Invalid option: $OPTARG requires an argument" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Shift out parameters already processed
|
||||
shift $((OPTIND -1))
|
||||
|
||||
# Handle error for non-option arguments
|
||||
if [[ $# -ne 0 ]]; then
|
||||
echo "Error: Got $# non-option arguments." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
execute_test_argument(){
|
||||
: 'Execute test according to global variable'
|
||||
# Global error return of the script
|
||||
local -i res=0 ret=0
|
||||
|
||||
# Select and run tests
|
||||
case $g_type in
|
||||
vader)
|
||||
run_vader; ret=$?
|
||||
echo "Main Vader: returned $ret"
|
||||
((res |= ret))
|
||||
;;
|
||||
vint)
|
||||
run_vint; ret=$?
|
||||
echo "Main Vint: returned $ret"
|
||||
((res |= ret))
|
||||
;;
|
||||
all)
|
||||
run_vint; ret=$?
|
||||
echo "Main Vint: returned $ret"
|
||||
((res |= ret))
|
||||
run_vader; ret=$?
|
||||
echo "Main Vader: returned $ret"
|
||||
((res |= ret))
|
||||
;;
|
||||
*)
|
||||
echo "Error: invalid type - '$g_type'" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
return "$res"
|
||||
}
|
||||
|
||||
|
||||
print_versions() {
|
||||
: 'Print the names of all vim/nvim versions'
|
||||
# Get all possible version <- Dockerfile
|
||||
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
run_vader() {
|
||||
: 'Run Vader tests'
|
||||
echo -e "\nStarting Vader tests."
|
||||
local -i res=0
|
||||
local opt='' current_test=''
|
||||
|
||||
echo "Tin 1 $g_file_test"
|
||||
# Parse tests files to execute
|
||||
if [[ -z "$g_file_test" ]]; then
|
||||
opt="test/*"
|
||||
else
|
||||
read -ra TEST <<< "$g_file_test"
|
||||
for current_test in "${TEST[@]}"; do
|
||||
# Remove quotes
|
||||
current_test=${current_test#\'}
|
||||
current_test=${current_test%\'}
|
||||
if [[ "$current_test" == *"*"* ]]; then
|
||||
opt+=" test/${current_test}"
|
||||
elif [[ -f "$current_test" ]]; then
|
||||
opt+=" test/${current_test}"
|
||||
elif [[ -f "${current_test}.vader" ]]; then
|
||||
opt+=" test/${current_test}.vader"
|
||||
else
|
||||
printf "WARNING: Test \"%s\" not found.\n", "$current_test"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "Tin 2 $opt"
|
||||
|
||||
# Run tests for each specified version
|
||||
for v in $g_vers; do
|
||||
echo -e "\n\nRunning version: $v"
|
||||
echo -e "============================="
|
||||
|
||||
# Set local environment variables
|
||||
if [[ "$v" == "local" ]]; then
|
||||
# Save HOME var
|
||||
home_save="$HOME"
|
||||
|
||||
# Create temporary root
|
||||
mkdir -p "$g_tmp_dir/vader_wiki"
|
||||
mkdir -p "$g_tmp_dir/vader_wiki/home"
|
||||
mkdir -p "$g_tmp_dir/vader_wiki/home/test"
|
||||
mkdir -p "$g_tmp_dir/vader_wiki/testplugin"
|
||||
|
||||
# Set vars
|
||||
export ROOT="$g_tmp_dir/vader_wiki/"
|
||||
export HOME="$g_tmp_dir/vader_wiki/home"
|
||||
vim="vim"
|
||||
vim_opt="-u ~/test/vimrc"
|
||||
else
|
||||
# Only set dockerized vars
|
||||
export ROOT="/" # So no if in vimrc
|
||||
vim="/vim-build/bin/$v"
|
||||
vim_opt="-u test/vimrc"
|
||||
fi
|
||||
|
||||
# Too talkative TODO make a verbose level 1..10 an 1 is not taking vim
|
||||
#if [[ "$verbose" != 0 ]]; then
|
||||
# vim_opt+=' -V1'
|
||||
#fi
|
||||
# IDK why vim with -Es is returning ! and make fail:
|
||||
# -- tabnext profiling
|
||||
# -- map.vim
|
||||
vim_opt+=' -i NONE -Es '
|
||||
|
||||
# set -o pipefail
|
||||
|
||||
# Copy the resources to temporary directory
|
||||
if [[ "$v" == "local" ]]; then
|
||||
# flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
||||
echo -e "\nCopying resources to $ROOT"
|
||||
# Copy testplugin
|
||||
cp -rf "$g_wiki_path/"* "$ROOT/testplugin/"
|
||||
# Copy home
|
||||
cp -rf "$g_script_path/"* "$HOME/test/"
|
||||
# Copy rtp.vim
|
||||
cp -rf "$g_script_path/resources/rtp_local.vim" "$ROOT/rtp.vim"
|
||||
# Copy vader <- internet
|
||||
echo 'Cloning Vader (git, do not care the fatal)'
|
||||
git clone --depth 10 https://github.com/junegunn/vader.vim /tmp/vader_wiki/vader 2>&1
|
||||
fi
|
||||
|
||||
# Run batch of tests
|
||||
# shellcheck disable=SC2086,SC2206
|
||||
if [[ "$opt" != "" ]]; then
|
||||
if [[ "$v" == "local" ]]; then
|
||||
pushd "$g_tmp_dir/vader_wiki/testplugin" \
|
||||
|| echo 'Warning pushd testplugin failed'
|
||||
|
||||
# Run the tests
|
||||
fcmd(){
|
||||
$vim $vim_opt "+Vader! ${opt}" 2>&1 \
|
||||
| vader_filter | vader_color
|
||||
return ${PIPESTATUS[1]}
|
||||
}
|
||||
echo -e "\nStarting Batch Vim/Vader:\n<- $opt\n"
|
||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
||||
fcmd; ret=$?
|
||||
echo -e "\nReturned Batch Vim/Vader -> $ret"
|
||||
(( res |= ret ))
|
||||
|
||||
popd || echo 'Warning popd failed'
|
||||
else
|
||||
# In docker
|
||||
fcmd() {
|
||||
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
|
||||
"${flags[@]}" "$v" $vim_opt "+Vader! ${opt}" 2>&1 \
|
||||
| vader_filter | vader_color
|
||||
return ${PIPESTATUS[1]}
|
||||
}
|
||||
echo -e "\nStarting Batch Vim/Vader with: $opt\n"
|
||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
||||
fcmd; ret=$?
|
||||
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
|
||||
(( res |= ret ))
|
||||
fi
|
||||
fi
|
||||
|
||||
#set +o pipefail
|
||||
|
||||
# Restore what must (I know it should be refactored in a while)
|
||||
if [[ "$v" == local ]]; then
|
||||
export HOME=$home_save
|
||||
fi
|
||||
done
|
||||
return "$res"
|
||||
}
|
||||
|
||||
|
||||
run_vint() {
|
||||
: 'Run Vint test'
|
||||
local -i res=0
|
||||
|
||||
local cmd="vint -s . && vint -s test/vimrc"
|
||||
|
||||
if echo "$g_vers" | grep "local" > /dev/null; then
|
||||
echo -e "\nRunning Vint: $cmd : in $g_wiki_path"
|
||||
pushd "$g_wiki_path" > /dev/null \
|
||||
|| echo 'Warning pushd wiki_path failed'
|
||||
$cmd
|
||||
res=$(( res | $? ))
|
||||
popd > /dev/null \
|
||||
|| echo 'Warning popd also failed'
|
||||
else
|
||||
echo -e "\nStarting Docker container and running Vint: $cmd"
|
||||
docker run -a stdout "${flags[@]}" bash -c "$cmd"
|
||||
res=$(( res | $? ))
|
||||
fi
|
||||
|
||||
return "$res"
|
||||
}
|
||||
|
||||
|
||||
vader_filter() {
|
||||
: 'Pipe Helper: Filter Vader Stdout'
|
||||
local -i res=0
|
||||
# Keep indentation
|
||||
local IFS=''
|
||||
|
||||
while read -r REPLY; do
|
||||
# Print only possible error cases
|
||||
if [[ "$REPLY" = *'docker:'* ]] || \
|
||||
[[ "$REPLY" = *'Starting Vader:'* ]] || \
|
||||
[[ "$REPLY" = *'Vader error:'* ]] || \
|
||||
[[ "$REPLY" = *'Vim: Error '* ]]; then
|
||||
echo "$REPLY"
|
||||
elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
|
||||
[[ "$REPLY" = *'[ DO] (X)'* ]] || \
|
||||
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
|
||||
echo -e "$red$REPLY$nc"
|
||||
res=1
|
||||
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
|
||||
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
|
||||
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
|
||||
if [ "$success" -lt "$total" ]; then
|
||||
res=1
|
||||
fi
|
||||
echo "$REPLY"
|
||||
elif [[ "$g_verbose" != 0 ]]; then
|
||||
# just print everything
|
||||
echo "$REPLY"
|
||||
fi
|
||||
done
|
||||
|
||||
if (( res == 1 )); then
|
||||
echo -e "\033[0;31m"
|
||||
echo -e "!---------Failed tests detected---------!"
|
||||
echo -e "Run with the '-v' flag for verbose output"
|
||||
echo -e "\033[0m"
|
||||
fi
|
||||
|
||||
return "$res"
|
||||
}
|
||||
|
||||
|
||||
vader_color() {
|
||||
: 'Pipe Helper: Filter to add color to Vader'
|
||||
while read -r; do
|
||||
if [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
|
||||
[[ "$REPLY" = *'[ EXPECT] (X)'* ]] || \
|
||||
[[ "$REPLY" = *'Vim: Error '* ]] || \
|
||||
[[ "$REPLY" = *'Vader error:'* ]]; then
|
||||
echo -en "$red"
|
||||
elif [[ "$REPLY" = *'[EXECUTE]'* ]] || [[ "$REPLY" = *'[ GIVEN]'* ]]; then
|
||||
echo -en "$nc"
|
||||
fi
|
||||
|
||||
if [[ "$REPLY" = *'Success/Total'* ]]; then
|
||||
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
|
||||
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
|
||||
|
||||
if [ "$success" -lt "$total" ]; then
|
||||
echo -en "$red"
|
||||
else
|
||||
echo -en "$green"
|
||||
fi
|
||||
|
||||
echo "$REPLY"
|
||||
echo -en "$nc"
|
||||
else
|
||||
echo "$REPLY"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -en "$nc"
|
||||
}
|
||||
|
||||
|
||||
if ! (return 0 2>/dev/null); then
|
||||
run_test "$@"; exit $?
|
||||
fi
|
||||
@@ -0,0 +1,73 @@
|
||||
Execute (Setup search testing wrapper):
|
||||
function! TestSearch(search_command, test_name)
|
||||
" Note: after each search, the location list of the current window (0)
|
||||
" will contain the search results. A non-empty list indicates success.
|
||||
" Search for a single word (a pattern with no spaces)
|
||||
if v:version < 704
|
||||
Log 'Cheating for old vim version, do not want to reverse bug'
|
||||
return
|
||||
endif
|
||||
|
||||
" Execute command and grab output
|
||||
redir => output
|
||||
silent execute a:search_command
|
||||
redir END
|
||||
|
||||
" The location list should not be empty
|
||||
Assert !empty(getloclist(0)), a:test_name.": no location list result"
|
||||
|
||||
" The location list should contains entries
|
||||
Assert match(output, '\d of \d') > -1, a:test_name.": no result message"
|
||||
|
||||
" Tests that VimwikiSearch is quoting the pattern correctly.
|
||||
" If not, Vim will see anything after the first space in the pattern
|
||||
" as a file name and attempt to open it.
|
||||
Assert match(output, 'Cannot open file') == -1, "'open file': unquoted pattern?"
|
||||
|
||||
return output
|
||||
endfunction
|
||||
|
||||
Execute (Search test wiki):
|
||||
" Open test wiki
|
||||
edit test/resources/testwiki/index.wiki
|
||||
|
||||
" Make sure we opened the test wiki successfully by checking the
|
||||
" title (first line) and filetype.
|
||||
AssertEqual "= Test Wiki =", getline(1)
|
||||
AssertEqual "vimwiki", &filetype
|
||||
|
||||
call TestSearch('VimwikiSearch foo', 'pattern with no spaces')
|
||||
call TestSearch('VimwikiSearch foo bar', 'pattern with spaces')
|
||||
call TestSearch('VimwikiSearch foo\bar', 'pattern with ''\''')
|
||||
call TestSearch('VimwikiSearch baz{13}', 'pattern with literal {}')
|
||||
call TestSearch('VimwikiSearch /\vbuz{5}/', 'proper regex')
|
||||
call TestSearch('VWS foo bar', 'use VWS abbreviation')
|
||||
|
||||
Execute (Search space path wiki):
|
||||
" Open wiki with spaces in path to test fname escaping
|
||||
edit test/resources/testwiki\ space/index.wiki
|
||||
|
||||
" Make sure we opened the space path wiki successfully
|
||||
AssertEqual "= Space Path Wiki =", getline(1)
|
||||
|
||||
call TestSearch('VimwikiSearch foo', 'simple search in space path wiki')
|
||||
|
||||
Execute (Search failure message):
|
||||
" Important note: No search tests will succeed after this.
|
||||
" The failed search will cause a Vim error to be thrown and
|
||||
" any search with lvimgrep within Vader will result in an
|
||||
" empty location list and empty messages queue. It is
|
||||
" difficult to tell if the search itself is failing or if it
|
||||
" is just an inability to view the results.
|
||||
|
||||
" Open test wiki again
|
||||
edit test/resources/testwiki/index.wiki
|
||||
|
||||
" Now test a negative search and make sure we are returning
|
||||
" the expected VimWiki error.
|
||||
redir => output
|
||||
silent VimwikiSearch not_exist
|
||||
redir END
|
||||
if v:version > 703
|
||||
Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"
|
||||
endif
|
||||
@@ -0,0 +1,839 @@
|
||||
# Syntax and Highlight
|
||||
|
||||
|
||||
# 0 Escape {{{1
|
||||
#################
|
||||
|
||||
Given vimwiki (Most easy typeface):
|
||||
1. 567890123
|
||||
2. __bold__
|
||||
3. *Italic*
|
||||
4. ***Bold Italic***
|
||||
5. ~~Strikethrough~~
|
||||
6. <sub>Subscript</sub>
|
||||
7. <sup>Superscript</sup>
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax basic typeface):
|
||||
AssertEqual '1' , SyntaxAt(1, 9) . 1
|
||||
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 9) . 2
|
||||
AssertEqual 'VimwikiItalic3' , SyntaxAt(3, 9) . 3
|
||||
AssertEqual 'VimwikiBoldItalic4' , SyntaxAt(4, 9) . 4
|
||||
AssertEqual 'VimwikiDelText5' , SyntaxAt(5, 9) . 5
|
||||
AssertEqual 'VimwikiSubScript6' , SyntaxAt(6, 9) . 6
|
||||
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 9) . 7
|
||||
|
||||
Given vimwiki (Markdown typeface with escape sequence #1044: _ __ * ** {{{2):
|
||||
This is 14 | 1
|
||||
__bold from begining__ 2
|
||||
\__not bold even from begin \__ 3
|
||||
and __t \__ is still bold__ Bold 4
|
||||
and _ita\_ alic continues and end_ Italic 5
|
||||
*this\* \* is italic also* Italic 6
|
||||
a ^taa is supperscrit^ Sup 7
|
||||
,,subaaa subscript end,, Sub 8
|
||||
a ~~staaill deleted~~ Del 9
|
||||
$$Eq\$$ uation follows$ Math 10
|
||||
`code \` not finished inline` Code 11
|
||||
012345678901234567890
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax of escape typeface):
|
||||
AssertEqual '1' , SyntaxAt(1, 14) . 1
|
||||
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 14) . 2
|
||||
AssertEqual '3' , SyntaxAt(3, 14) . 3
|
||||
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
|
||||
AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
|
||||
" See: #1303 where an escape start can close the region
|
||||
" Fixed removing vars.vim::expand_delimiter
|
||||
AssertEqual 'VimwikiItalic6' , SyntaxAt(6, 14) . 6
|
||||
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 14) . 7
|
||||
AssertEqual 'VimwikiSubScript8' , SyntaxAt(8, 14) . 8
|
||||
AssertEqual 'VimwikiDelText9' , SyntaxAt(9, 14) . 9
|
||||
AssertEqual 'VimwikiMath10' , SyntaxAt(10, 14) . 10
|
||||
AssertEqual 'textSnipTEX11' , SyntaxAt(11, 14) . 11
|
||||
|
||||
Given vimwiki (Markdown pre with escape sequence #1044: _ __ * ** {{{2):
|
||||
```
|
||||
pre
|
||||
\```
|
||||
pre
|
||||
```
|
||||
|
||||
Execute (Assert Syntax of escape pre):
|
||||
AssertEqual 'VimwikiPreDelim1' , SyntaxAt(1, 1) . 1
|
||||
AssertEqual 'VimwikiPre2' , SyntaxAt(2, 1) . 2
|
||||
AssertEqual 'VimwikiPre3' , SyntaxAt(3, 1) . 3
|
||||
AssertEqual 'VimwikiPre4' , SyntaxAt(4, 1) . 4
|
||||
AssertEqual 'VimwikiPreDelim5' , SyntaxAt(5, 1) . 5
|
||||
|
||||
# 1 Typeface {{{1
|
||||
#################
|
||||
|
||||
Given vimwiki (Markdown with punctuation #340 {{{2):
|
||||
__bold__, not bold
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax (alpha)):
|
||||
AssertEqual 'VimwikiBold1' , SyntaxAt(1, 5) . 1
|
||||
AssertEqual '2' , SyntaxAt(1, 16) . 2
|
||||
|
||||
Given vimwiki (Markdown bad __this_not_it__ {{{2):
|
||||
See here 14 |
|
||||
s2n_error 2
|
||||
s*n*er_r_ 3
|
||||
n4rmal_aaaaaaaaaaaaaaaaaaaa_text_ 4
|
||||
n5t_italiccccccccccccccccccccc_no 5
|
||||
n6t_italiccccccccccccccccccccccno 6
|
||||
n7t*italiccccccccccccccccccccc*si 7
|
||||
n8taitalicccccccccccccccccccccasi 8
|
||||
__not_italicccccccccc_but_boldd__ 9
|
||||
_a_asdasda_asdas_asdas_asdasda_a_ 10
|
||||
_jitaliccccccccccccccccccccccccc_ 11
|
||||
n12ormalllllllllllllllllllllllll_ 12
|
||||
_italic if at end of file unfortunately
|
||||
Note: The decision to start a region is only based on a matching start
|
||||
pattern. There is no check for a matching end pattern. This does NOT
|
||||
work: (:h syn-region)
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax (bravo)):
|
||||
AssertEqual 'VimwikiError2' , SyntaxAt(2, 4) . 2
|
||||
" See: #1303 where the * is now accepted in the middle of the words
|
||||
" So no more trick like in _
|
||||
" syn match VimwikiError "\w\@<=_\w\@=" remove the *
|
||||
AssertEqual 'VimwikiDelimiter3' , SyntaxAt(3, 4) . 3
|
||||
AssertEqual '4' , SyntaxAt(4, 14) . 4
|
||||
AssertEqual '5' , SyntaxAt(5, 14) . 5
|
||||
AssertEqual '6' , SyntaxAt(6, 14) . 6
|
||||
AssertEqual 'VimwikiItalic7' , SyntaxAt(7, 14) . 7
|
||||
AssertEqual '8' , SyntaxAt(8, 14) . 8
|
||||
AssertEqual 'VimwikiBold9' , SyntaxAt(9, 14) . 9
|
||||
AssertEqual '10' , SyntaxAt(10, 14) . 10
|
||||
AssertEqual 'VimwikiItalic11' , SyntaxAt(11, 14) . 11
|
||||
AssertEqual '12' , SyntaxAt(12, 14) . 12
|
||||
AssertEqual 'VimwikiItalic13' , SyntaxAt(13, 14) . 13
|
||||
|
||||
Given vimwiki (bold and pre {{{2):
|
||||
__startbold
|
||||
```
|
||||
pre
|
||||
```
|
||||
__endbold
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax (charlie)):
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(3, 1)
|
||||
|
||||
# Emphasis stricker {{{2
|
||||
# See: https://github.github.com/gfm/#emphasis-and-strong-emphasis
|
||||
Given vimwiki (Emphasis and not):
|
||||
this __bold__ ok 1
|
||||
this _italic_ ok 2
|
||||
t__ no bold __ t 3
|
||||
t_ no ital _ t 4
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax (delta)):
|
||||
AssertEqual 'VimwikiBold1' , SyntaxAt(1, 9) . 1
|
||||
AssertEqual 'VimwikiItalic2' , SyntaxAt(2, 9) . 2
|
||||
AssertEqual '3' , SyntaxAt(3, 9) . 3
|
||||
AssertEqual '4' , SyntaxAt(4, 9) . 4
|
||||
|
||||
# With vimwiki_hl_cb_checked {{{2
|
||||
Given vimwiki (task list with code):
|
||||
Normal syntax
|
||||
- [X] Lorem __sit__ `sed do eiusmod
|
||||
tempor` incididunt ut labore et dolore magna aliqua
|
||||
Normal syntax
|
||||
|
||||
Execute (let g:vimwiki_hl_cb_checked = 1):
|
||||
let g:vimwiki_hl_cb_checked = 1
|
||||
unlet g:vimwiki_syntaxlocal_vars
|
||||
call vimwiki#vars#init()
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Done Syntax 1):
|
||||
AssertEqual '' , SyntaxAt(1, 7)
|
||||
AssertEqual 'VimwikiCheckBoxDone', SyntaxAt(2, 7)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(3, 7)
|
||||
AssertEqual '' , SyntaxAt(4, 7)
|
||||
|
||||
Given vimwiki (task list with code):
|
||||
Normal syntax
|
||||
- [X] Lorem __sit__ `sed do eiusmod
|
||||
tempor` incididunt ut labore et dolore magna aliqua
|
||||
Normal syntax
|
||||
|
||||
Execute (let g:vimwiki_hl_cb_checked = 2):
|
||||
let g:vimwiki_hl_cb_checked = 2
|
||||
unlet g:vimwiki_syntaxlocal_vars
|
||||
call vimwiki#vars#init()
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Done Syntax 2):
|
||||
AssertEqual '' , SyntaxAt(1, 7)
|
||||
AssertEqual 'VimwikiCheckBoxDone', SyntaxAt(2, 7)
|
||||
AssertEqual 'VimwikiCheckBoxDone', SyntaxAt(3, 7)
|
||||
AssertEqual '' , SyntaxAt(4, 7)
|
||||
|
||||
|
||||
# Extended types {{{2
|
||||
|
||||
Given vimwiki (Extended Types mono):
|
||||
`code `
|
||||
~~ strike ~~
|
||||
$equation$
|
||||
^superscript ^
|
||||
,, subscript ,,
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax extended types x 1):
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(1, 8)
|
||||
AssertEqual 'VimwikiDelText' , SyntaxAt(2, 8)
|
||||
AssertEqual 'textSnipTEX' , SyntaxAt(3, 8)
|
||||
AssertEqual 'VimwikiSuperScript' , SyntaxAt(4, 8)
|
||||
AssertEqual 'VimwikiSubScript' , SyntaxAt(5, 8)
|
||||
|
||||
|
||||
Given vimwiki (Extended Types nested in basic):
|
||||
From __bold `code in bold ` end of bold__ morF
|
||||
From _it and ~~ strieout in i~~ end of it_ morF
|
||||
From __bold $equation$ end bold __
|
||||
**bold ^superscript ^ end of bold morF**
|
||||
From normal ,, subscript ,, still normal morF
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax extended types x 2):
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(1, 23)
|
||||
AssertEqual 'VimwikiDelText' , SyntaxAt(2, 23)
|
||||
AssertEqual 'textSnipTEX' , SyntaxAt(3, 23)
|
||||
AssertEqual 'VimwikiSuperScript' , SyntaxAt(4, 23)
|
||||
AssertEqual 'VimwikiSubScript' , SyntaxAt(5, 23)
|
||||
|
||||
Given vimwiki (Extended Types nested in extended):
|
||||
From ^super to`code this ` is crazy but^ morF
|
||||
From ,,sub to~~ strike ~~why not,, morF
|
||||
From ~~strike $eequationeeeee$ end of strike~~morF
|
||||
From $eq to ^super ^ Just inline morF$
|
||||
From ^super t,,sub ,, end super eol ^
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax extended types nested in extended):
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(1, 23)
|
||||
AssertEqual 'VimwikiDelText' , SyntaxAt(2, 23)
|
||||
AssertEqual 'textSnipTEX' , SyntaxAt(3, 23)
|
||||
AssertEqual 'textSnipTEX' , SyntaxAt(4, 23)
|
||||
AssertEqual 'VimwikiSubScript' , SyntaxAt(5, 23)
|
||||
|
||||
Given vimwiki (Basic Types nested in extended):
|
||||
From ^super __bold __ is crazy but^ morF
|
||||
From ,,sub _italic with en_ aaaaaaa,, morF
|
||||
From $eq to **boldboldboldbo** aaaaaaaaa$ $
|
||||
From ^super *italic aaaaaaa*aaaaaaaaaaaaaaaaaaaaa
|
||||
From ~~strik __bbbbbbbbbbbbb__ssssssssssssssssss~~
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax basic types nested in extended):
|
||||
AssertEqual 'VimwikiBold1' , SyntaxAt(1, 23) . 1
|
||||
AssertEqual 'VimwikiItalic2' , SyntaxAt(2, 23) . 2
|
||||
AssertEqual 'textSnipTEX3' , SyntaxAt(3, 23) . 3
|
||||
AssertEqual 'VimwikiItalic4' , SyntaxAt(4, 23) . 4
|
||||
AssertEqual 'VimwikiBold5' , SyntaxAt(5, 23) . 5
|
||||
|
||||
Given vimwiki (Try to nest in code):
|
||||
From `codeto__no onenest in code__ end`
|
||||
From `codeto _no onenest in code_ end`
|
||||
From `codeto ^no onenest in code^ end`
|
||||
From `codeto ~~no onenest in code~~ end`
|
||||
From `codeto ___no onenest in code___ end`
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax extended types nested in extended):
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(1, 23)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(2, 23)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(3, 23)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(4, 23)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(5, 23)
|
||||
|
||||
|
||||
Given vimwiki (Multiline Typfaces Basic and extended):
|
||||
__and bold
|
||||
multiline__
|
||||
|
||||
_and it
|
||||
mutliline_
|
||||
|
||||
~~and mutltie
|
||||
strikeout~~
|
||||
`
|
||||
and mutli
|
||||
path
|
||||
`
|
||||
but no $ multi
|
||||
equation
|
||||
$
|
||||
^ but no multi
|
||||
sup ^
|
||||
,,
|
||||
but no multi
|
||||
sub ,,
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Multiline syantax but not sup and sub):
|
||||
AssertEqual 'VimwikiBold' , SyntaxAt(2, 1)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(5, 1)
|
||||
AssertEqual 'VimwikiDelText' , SyntaxAt(8, 1)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(11, 1)
|
||||
AssertEqual '' , SyntaxAt(14, 1)
|
||||
AssertEqual '' , SyntaxAt(17, 1)
|
||||
AssertEqual '' , SyntaxAt(20, 1)
|
||||
|
||||
|
||||
|
||||
# HTML types {{{2
|
||||
# Rememner Bold > Italic > Underline (my convention [tinmarino])
|
||||
|
||||
Given vimwiki (Typeface for Italic var_with_underscore):
|
||||
var_with_underscore
|
||||
_this is
|
||||
italic_
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax for typeface 1):
|
||||
AssertEqual '' , SyntaxAt(1, 1)
|
||||
AssertEqual 'VimwikiError' , SyntaxAt(1, 4)
|
||||
AssertEqual '' , SyntaxAt(1, 5)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(2, 2)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(3, 2)
|
||||
|
||||
Given vimwiki (Typeface for html 1 like italic):
|
||||
<b> ---- this is bold text 1 ---- </b>
|
||||
<strong> - this is bold 2 - </strong>
|
||||
<i> Italic 1 --cacacacacacacaca-- </i>
|
||||
<em> Italic 2 -cacacacacacacaca- </em>
|
||||
<u> Underline -cacacacacc acaca- </u>
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax for typeface 1):
|
||||
AssertEqual 'VimwikiBold' , SyntaxAt(1, 15)
|
||||
AssertEqual 'VimwikiBold' , SyntaxAt(2, 15)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(3, 15)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(4, 15)
|
||||
AssertEqual 'VimwikiUnderline' , SyntaxAt(5, 15)
|
||||
|
||||
Given vimwiki (Typeface for html 2 like italicUnderline):
|
||||
<b> bold this is bold<i>bold italic ---------</i> text 1 ---- </b>
|
||||
<strong> - this is bo<u>bold underline ------</u>d 2 - </strong>
|
||||
<i> Italic 1 --cacaca<b>bold italic----------</b>acacacaca-- </i>
|
||||
<em> Italic 2 -cacaca<u>italic underline-----</u>cacacaca- </em>
|
||||
<u> Underline -cacaca<b>bold underline-------</b>asacc acaca- </u>
|
||||
<u> Underline -cacaca<i>italic underline-----</i>asdacacc acaca- </u>
|
||||
|
||||
Execute (Assert Syntax for typeface 2):
|
||||
AssertEqual 'VimwikiBoldItalic' , GetSyntaxGroup(1, 30)
|
||||
AssertEqual 'VimwikiBoldUnderline' , GetSyntaxGroup(2, 30)
|
||||
AssertEqual 'VimwikiBoldItalic' , GetSyntaxGroup(3, 30)
|
||||
AssertEqual 'VimwikiItalicUnderline', GetSyntaxGroup(4, 30)
|
||||
AssertEqual 'VimwikiBoldUnderline' , GetSyntaxGroup(5, 30)
|
||||
AssertEqual 'VimwikiItalicUnderline', GetSyntaxGroup(6, 30)
|
||||
|
||||
Given vimwiki (Typeface for html 3 like boldItalicUnderline):
|
||||
<b><i><u> bold italic underline </u></i></b>
|
||||
<b><u><i> bold italic underline </i></u></b>
|
||||
<i><b><u> bold italic underline </u></b></i>
|
||||
<i><u><b> bold italic underline </b></u></i>
|
||||
<u><b> <i> bold italic underline </i> </b></u>
|
||||
<u><i><b> bold italic underline </b></i></u>
|
||||
|
||||
Execute (Assert Syntax for typeface 3):
|
||||
AssertEqual 'VimwikiBoldItalicUnderline1', GetSyntaxGroup(1, 22).1
|
||||
AssertEqual 'VimwikiBoldItalicUnderline2', GetSyntaxGroup(2, 22).2
|
||||
AssertEqual 'VimwikiBoldItalicUnderline3', GetSyntaxGroup(3, 22).3
|
||||
AssertEqual 'VimwikiBoldItalicUnderline4', GetSyntaxGroup(4, 22).4
|
||||
AssertEqual 'VimwikiBoldItalicUnderline5', GetSyntaxGroup(5, 22).5
|
||||
AssertEqual 'VimwikiBoldItalicUnderline6', GetSyntaxGroup(6, 22).6
|
||||
|
||||
# Keyword uppercase {{{2
|
||||
|
||||
Given vimwiki (TODO, XXX):
|
||||
TODO
|
||||
DONE
|
||||
STARTED
|
||||
FIXME
|
||||
FIXED
|
||||
XXX
|
||||
|
||||
Execute (Assert Syntax VimwikiTodo):
|
||||
AssertEqual SyntaxAt(1, 1), 'VimwikiTodo'
|
||||
AssertEqual SyntaxAt(2, 1), 'VimwikiTodo'
|
||||
AssertEqual SyntaxAt(3, 1), 'VimwikiTodo'
|
||||
AssertEqual SyntaxAt(4, 1), 'VimwikiTodo'
|
||||
AssertEqual SyntaxAt(5, 1), 'VimwikiTodo'
|
||||
AssertEqual SyntaxAt(6, 1), 'VimwikiTodo'
|
||||
|
||||
Given vimwiki (custom TODO words):
|
||||
NOW
|
||||
LATER
|
||||
DONE
|
||||
TODO
|
||||
|
||||
Execute (set custom syntax):
|
||||
call vimwiki#vars#set_wikilocal('rx_todo', '\C\<\%(NOW\|LATER\|DONE\)\>', vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax VimwikiTodo):
|
||||
AssertEqual 'VimwikiTodo1', SyntaxAt(1, 1) . 1
|
||||
AssertEqual 'VimwikiTodo2', SyntaxAt(2, 1) . 2
|
||||
AssertEqual 'VimwikiTodo3', SyntaxAt(3, 1) . 3
|
||||
AssertEqual '4' , SyntaxAt(4, 1) . 4
|
||||
|
||||
Execute (Restore VimwikiTodo):
|
||||
call vimwiki#vars#init()
|
||||
call SetSyntax('markdown')
|
||||
|
||||
|
||||
# Mardown types {{{2
|
||||
|
||||
Given vimwiki (Typeface for markdown like italic):
|
||||
**bold text 1**
|
||||
__bold text 2__
|
||||
*italic text 1*
|
||||
_italic text 2_
|
||||
***bold italic text 1***
|
||||
___bold italic text 2___
|
||||
~~strikeout text~~
|
||||
`code (no syntax) text`
|
||||
sp^script^
|
||||
sb,,script,,
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax for typeface):
|
||||
AssertEqual 'VimwikiBold' , SyntaxAt(1, 5)
|
||||
AssertEqual 'VimwikiBold' , SyntaxAt(2, 5)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(3, 5)
|
||||
AssertEqual 'VimwikiItalic' , SyntaxAt(4, 5)
|
||||
AssertEqual 'VimwikiBoldItalic' , SyntaxAt(5, 5)
|
||||
AssertEqual 'VimwikiBoldItalic' , SyntaxAt(6, 5)
|
||||
AssertEqual 'VimwikiDelText' , SyntaxAt(7, 5)
|
||||
AssertEqual 'VimwikiCode' , SyntaxAt(8, 5)
|
||||
AssertEqual 'VimwikiSuperScript' , SyntaxAt(9, 5)
|
||||
AssertEqual 'VimwikiSubScript' , SyntaxAt(10, 5)
|
||||
|
||||
|
||||
# 2 Links {{{1
|
||||
#################
|
||||
|
||||
Given vimwiki (Wiki Links):
|
||||
Plain link: >
|
||||
[[This is a link]]
|
||||
With description: >
|
||||
[[This is a link source|Description of the link]]
|
||||
Interwiki1: >
|
||||
[[wiki1:This is a link]]
|
||||
Interwiki2: >
|
||||
[[wn.My Name:This is a link]]
|
||||
Interwiki3: >
|
||||
[[wn.MyWiki:This is a link source|Description of the link]]
|
||||
Diary: >
|
||||
[[diary:2012-03-05]]
|
||||
Anchor1: >
|
||||
[[Todo List#Tomorrow|Tasks for tomorrow]]
|
||||
Anchor2: >
|
||||
[[#Tomorrow]]
|
||||
Raw1: >
|
||||
https://github.com/vimwiki/vimwiki.git
|
||||
Raw2: >
|
||||
mailto:habamax@gmail.com
|
||||
Raw3: >
|
||||
ftp://vim.org
|
||||
File1: >
|
||||
[[file:/home/somebody/a/b/c/music.mp3]]
|
||||
File2: >
|
||||
[[file:C:/Users/somebody/d/e/f/music.mp3]]
|
||||
File3: >
|
||||
[[file:~/a/b/c/music.mp3]]
|
||||
File4: >
|
||||
[[file:../assets/data.csv|Important Data]]
|
||||
File5: >
|
||||
[[local:C:/Users/somebody/d/e/f/music.mp3]]
|
||||
File6: >
|
||||
[[file:/home/user/documents/|Link to a directory]]
|
||||
Thumbnail links: >
|
||||
[[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]]
|
||||
|
||||
Execute (Assert Syntax link):
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(2, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(4, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(6, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(8, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(10, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(12, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(14, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(16, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(18, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(20, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(22, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(24, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(26, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(28, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(30, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(32, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(34, 6)
|
||||
AssertEqual 'VimwikiLink', SyntaxAt(36, 6)
|
||||
|
||||
Given vimwiki (Markdown Links):
|
||||
Inline link: >
|
||||
[Looks like this](URL)
|
||||
|
||||
Image link: >
|
||||

|
||||
|
||||
Reference-style links: >
|
||||
a) [Link Name][Id]
|
||||
b) [Id][], using the "implicit link name" shortcut
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax link):
|
||||
AssertEqual 'VimwikiWeblink1' , SyntaxAt(2, 8)
|
||||
AssertEqual 'VimwikiImage' , SyntaxAt(5, 8)
|
||||
AssertEqual 'VimwikiWikiLink1' , SyntaxAt(8, 8)
|
||||
AssertEqual 'VimwikiWikiLink1' , SyntaxAt(9, 8)
|
||||
|
||||
|
||||
# 3 Header {{{1
|
||||
###############
|
||||
Given vimwiki (Markdown SetExt Headers):
|
||||
One
|
||||
===
|
||||
two
|
||||
---
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Syntax Header SetExt):
|
||||
AssertEqual 'VimwikiHeader1', SyntaxAt(1, 1)
|
||||
AssertEqual 'VimwikiHeader1', SyntaxAt(2, 1)
|
||||
AssertEqual 'VimwikiHeader2', SyntaxAt(3, 1)
|
||||
AssertEqual 'VimwikiHeader2', SyntaxAt(4, 1)
|
||||
|
||||
Given vimwiki (Wiki Headers):
|
||||
= Header level 1 =
|
||||
== Header level 2 ==
|
||||
=== Header level 3 ===
|
||||
==== Header level 4 ====
|
||||
===== Header level 5 =====
|
||||
====== Header level 6 ======
|
||||
|
||||
Execute (Set syntax default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Execute (Assert Wiki Syntax Header):
|
||||
AssertEqual 'VimwikiHeader1', SyntaxAt(1, 10)
|
||||
AssertEqual 'VimwikiHeader2', SyntaxAt(2, 10)
|
||||
AssertEqual 'VimwikiHeader3', SyntaxAt(3, 10)
|
||||
AssertEqual 'VimwikiHeader4', SyntaxAt(4, 10)
|
||||
AssertEqual 'VimwikiHeader5', SyntaxAt(5, 10)
|
||||
AssertEqual 'VimwikiHeader6', SyntaxAt(6, 10)
|
||||
|
||||
Given vimwiki (Markdown Headers):
|
||||
# Header level 1
|
||||
## Header level 2
|
||||
### Header level 3
|
||||
#### Header level 4
|
||||
##### Header level 5
|
||||
###### Header level 6
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert Markdown Syntax Header):
|
||||
Log "Syntax of first heading: " . string(GetSyntaxStack())
|
||||
Log "Regex of rxListWithoutCb: " . vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
||||
Log "Bullet types: " . string(vimwiki#vars#get_wikilocal('bullet_types'))
|
||||
AssertEqual 'VimwikiHeader1' , SyntaxAt(1, 10)
|
||||
AssertEqual 'VimwikiHeader2' , SyntaxAt(2, 10)
|
||||
AssertEqual 'VimwikiHeader3' , SyntaxAt(3, 10)
|
||||
AssertEqual 'VimwikiHeader4' , SyntaxAt(4, 10)
|
||||
AssertEqual 'VimwikiHeader5' , SyntaxAt(5, 10)
|
||||
AssertEqual 'VimwikiHeader6' , SyntaxAt(6, 10)
|
||||
|
||||
|
||||
# 4 Blockquote {{{1
|
||||
# Issues: #55
|
||||
###############
|
||||
|
||||
|
||||
#### 4.1 Blokquotes markdown
|
||||
Given vimwiki (BlockQuote restarts list numbering #55 {{{3):
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
Block Quote
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Gototo):
|
||||
Gototo
|
||||
|
||||
Expect (Good numbering):
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
Block Quote
|
||||
3. toto
|
||||
|
||||
# 9 Comment {{{1
|
||||
###############
|
||||
|
||||
Given vimwiki (%%):
|
||||
%% This is a line comment
|
||||
%% This is also a comment
|
||||
|
||||
Execute (Set syntax default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Execute (Assert Syntax VimwikiComment):
|
||||
AssertEqual 'VimwikiComment' , SyntaxAt(1, 1)
|
||||
AssertEqual 'VimwikiComment' , SyntaxAt(2, 4)
|
||||
|
||||
Given vimwiki (%%+, +%%):
|
||||
%%+ This
|
||||
is a
|
||||
multiline
|
||||
comment +%%
|
||||
%%+ This is a comment on one line +%%
|
||||
%%+ One +%% Not a comment %%+ Two +%% Not a comment
|
||||
|
||||
Execute (Set syntax default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Execute (Assert Syntax VimwikiMultilineComment):
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(1, 1)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(1, 8)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(2, 1)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(3, 1)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(4, 1)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(5, 1)
|
||||
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 1)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 11)
|
||||
AssertEqual '' , SyntaxAt(6, 12)
|
||||
AssertEqual '' , SyntaxAt(6, 26)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 27)
|
||||
AssertEqual 'VimwikiMultilineComment' , SyntaxAt(6, 37)
|
||||
AssertEqual '' , SyntaxAt(6, 38)
|
||||
AssertEqual '' , SyntaxAt(6, 51)
|
||||
|
||||
# 10 Code {{{1
|
||||
# 10.1 Code Indent (4 spaces) {{{2
|
||||
#################################
|
||||
|
||||
Given vimwiki (Code indent):
|
||||
this is markdown
|
||||
this is code
|
||||
|
||||
Execute (Assert Syntax normal (i.e. no hi)):
|
||||
AssertEqual SyntaxAt(1, 5), ''
|
||||
AssertEqual SyntaxAt(2, 5), ''
|
||||
|
||||
|
||||
# 10.2 Code Inline (1 backtick) {{{2
|
||||
###################################
|
||||
|
||||
Given vimwiki (Code inline):
|
||||
Well use the `man`
|
||||
|
||||
Execute (Assert Syntax Code):
|
||||
AssertEqual SyntaxAt(1, 16), 'VimwikiCode'
|
||||
|
||||
|
||||
# 10.3 Code Block (3 backtiks) {{{2
|
||||
##################################
|
||||
|
||||
Given vimwiki (Markdown, Text and Vim):
|
||||
this is markdown
|
||||
this is TODO
|
||||
|
||||
```
|
||||
this is text
|
||||
```
|
||||
|
||||
```vim
|
||||
" this is vim
|
||||
set hlsearch
|
||||
```
|
||||
|
||||
`````vim
|
||||
" this is vim
|
||||
set hlsearch
|
||||
`````
|
||||
|
||||
~~~vim
|
||||
" this is vim
|
||||
set hlsearch
|
||||
~~~
|
||||
|
||||
~~~~~vim
|
||||
" this is vim
|
||||
set hlsearch
|
||||
~~~~~~~~~~~
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
let g:vimwiki_global_vars['vimwiki_automatic_nested_syntaxes'] = 1
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert ft, normal syntax and VimwikiTodo):
|
||||
AssertEqual &ft, 'vimwiki'
|
||||
AssertEqual '', SyntaxAt(1, 1)
|
||||
AssertEqual 'VimwikiTodo', SyntaxAt(2, 9)
|
||||
|
||||
Execute (Assert Code syntax):
|
||||
AssertEqual 'VimwikiPreDelim', SyntaxAt(4, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(5, 1)
|
||||
AssertEqual 'vimLineComment' , SyntaxAt(9, 1)
|
||||
AssertEqual 'vimCommand' , SyntaxAt(10, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(13, 1)
|
||||
AssertEqual 'vimLineComment' , SyntaxAt(14, 1)
|
||||
AssertEqual 'vimCommand' , SyntaxAt(15, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(16, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(18, 1)
|
||||
AssertEqual 'vimLineComment' , SyntaxAt(19, 1)
|
||||
AssertEqual 'vimCommand' , SyntaxAt(20, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(21, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(23, 1)
|
||||
AssertEqual 'vimLineComment' , SyntaxAt(24, 1)
|
||||
AssertEqual 'vimCommand' , SyntaxAt(25, 1)
|
||||
AssertEqual 'VimwikiPre' , SyntaxAt(26, 1)
|
||||
|
||||
|
||||
# 11 Math {{{1
|
||||
# 11.1 Math Markdown {{{2
|
||||
#######################
|
||||
|
||||
Given vimwiki (Math markdown):
|
||||
math inline: $aaaaaaaaaaaaaaa \sum_i a_i^2 = 1 end$
|
||||
|
||||
math block:
|
||||
$$
|
||||
\sum_i a_i^2
|
||||
=
|
||||
1
|
||||
$$
|
||||
|
||||
math block env:
|
||||
$$%align%
|
||||
\sum_i a_i^2 &= 1 + 1 \\
|
||||
&= 2.
|
||||
$$
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Execute (Assert math syntax 1):
|
||||
AssertEqual 'textSnipTEX', SyntaxAt(1, 18)
|
||||
let syntax_5 = SyntaxAt(5, 1)
|
||||
Assert syntax_5 == 'texStatement' || syntax_5 == 'texMathSymbol'
|
||||
let syntax_12 = SyntaxAt(12, 1)
|
||||
Assert syntax_12 == 'texStatement' || syntax_5 == 'texMathSymbol'
|
||||
|
||||
|
||||
# 11.2 Math Wiki {{{2
|
||||
##############################
|
||||
|
||||
Given vimwiki (Math wiki):
|
||||
math inline: $aaaaaaaaaaaaaaaaaaaaaaaaaa \sum_i a_i^2 = 1$
|
||||
|
||||
math block:
|
||||
{{$
|
||||
\sum_i a_i^2
|
||||
=
|
||||
1
|
||||
}}$
|
||||
|
||||
math block env:
|
||||
{{$%align%
|
||||
\sum_i a_i^2 &= 1 + 1 \\
|
||||
&= 2.
|
||||
}}$
|
||||
|
||||
Execute (Set syntax default):
|
||||
call SetSyntax('default')
|
||||
|
||||
Execute (Assert math syntax 2):
|
||||
AssertEqual 'textSnipTEX', SyntaxAt(1, 18)
|
||||
let syntax_5 = SyntaxAt(5, 1)
|
||||
Assert syntax_5 == 'texStatement' || syntax_5 == 'texMathSymbol'
|
||||
let syntax_12 = SyntaxAt(12, 1)
|
||||
Assert syntax_12 == 'texStatement' || syntax_5 == 'texMathSymbol'
|
||||
|
||||
# 21 Highlight {{{1
|
||||
##################
|
||||
Given vimwiki (One line):
|
||||
content
|
||||
|
||||
# GetHighlightTerm relies on execute(), which isn't available in all 7.4
|
||||
# versions. Just test this for 8.0 and up to keep things simple:
|
||||
Execute (Assert highlight typeface 1):
|
||||
" Typeface 1
|
||||
call AssertIfVersion(800, ['bold'], GetHighlightTerm('VimwikiBold', 'term'))
|
||||
call AssertIfVersion(800, ['bold'], GetHighlightTerm('VimwikiBold', 'cterm'))
|
||||
call AssertIfVersion(800, ['bold'], GetHighlightTerm('VimwikiBold', 'gui'))
|
||||
call AssertIfVersion(800, ['italic'], GetHighlightTerm('VimwikiItalic', 'cterm'))
|
||||
call AssertIfVersion(800, ['underline'], GetHighlightTerm('VimwikiUnderline', 'gui'))
|
||||
|
||||
Execute (Assert highlight typeface 2):
|
||||
" Bold > Italic > Underline
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', '1']), sort(add(GetHighlightTerm('VimwikiBoldItalic', 'gui'), '1')))
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', '2']), sort(add(GetHighlightTerm('VimwikiBoldItalic', 'term'), '2')))
|
||||
|
||||
call AssertIfVersion(800, sort(['bold', 'underline', '3']), sort(add(GetHighlightTerm('VimwikiBoldUnderline', 'cterm'), '3')))
|
||||
call AssertIfVersion(800, sort(['bold', 'underline', '4']), sort(add(GetHighlightTerm('VimwikiUnderlineBold', 'term'), '4')))
|
||||
|
||||
call AssertIfVersion(800, sort(['italic', 'underline', '5']), sort(add(GetHighlightTerm('VimwikiItalicUnderline', 'cterm'), '5')))
|
||||
|
||||
Execute (Assert highlight typeface 3):
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '1']), sort(add(GetHighlightTerm('VimwikiBoldItalicUnderline', 'gui'), '1')))
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '2']), sort(add(GetHighlightTerm('VimwikiBoldUnderlineItalic', 'cterm'), '2')))
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '3']), sort(add(GetHighlightTerm('VimwikiItalicBoldUnderline', 'term'), '3')))
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '4']), sort(add(GetHighlightTerm('VimwikiItalicUnderlineBold', 'gui'), '4')))
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '5']), sort(add(GetHighlightTerm('VimwikiUnderlineBoldItalic', 'cterm'), '5')))
|
||||
call AssertIfVersion(800, sort(['bold', 'italic', 'underline', '6']), sort(add(GetHighlightTerm('VimwikiUnderlineItalicBold', 'term'), '6')))
|
||||
|
||||
Expect (One line):
|
||||
content
|
||||
|
||||
|
||||
# vim: foldmethod=marker foldlevel=30 sw=2
|
||||
@@ -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
|
||||
@@ -0,0 +1,88 @@
|
||||
# Table autoformating
|
||||
# Very configurable: read doc/design_notes.md
|
||||
|
||||
# Move <Tab> at end of row if next row is badly formated {{{1
|
||||
# See #1126
|
||||
##########################
|
||||
Given vimwiki (Header ok but 1 row bad):
|
||||
| Service to be Build | Build Tag | Service to Deploy | Deploy Tag | Comments |
|
||||
|---------------------|-----------|-------------------|------------|----------|
|
||||
|||Provision/Core/Keycloak|release-3.8.0_RC9|This was done as part of release-3.7.0 hotfix and is not required if you are already on Keycloak 7|
|
||||
|||Provision/DataPipeline/AnalyticsSpark|release-3.8.0_RC6||
|
||||
|||OpsAdministration/Core/ESMapping|release-3.8.0_RC9|Choose `userv1,orgv2` for jenkins job parameter `indices_name`|
|
||||
|
||||
Do (i<tab> at end of first line):
|
||||
$i\<Tab>
|
||||
|
||||
Expect(Crash (List required)):
|
||||
# E714: List required <= tbl#goto_next_col, line 9
|
||||
| Service to be Build | Build Tag | Service to Deploy | Deploy Tag | Comments |
|
||||
|---------------------|-----------|-------------------|------------|----------|
|
||||
|||Provision/Core/Keycloak|release-3.8.0_RC9|This was done as part of release-3.7.0 hotfix and is not required if you are already on Keycloak 7|
|
||||
|||Provision/DataPipeline/AnalyticsSpark|release-3.8.0_RC6||
|
||||
|||OpsAdministration/Core/ESMapping|release-3.8.0_RC9|Choose `userv1,orgv2` for jenkins job parameter `indices_name`|
|
||||
|
||||
|
||||
# Move <Tab> and <S-Tab> map {{{1
|
||||
# See #1048
|
||||
##########################
|
||||
|
||||
Given vimwiki (Table Number):
|
||||
| A | B | C |
|
||||
|---|---|---|
|
||||
| 1 | 2 | 3 |
|
||||
| 4 | 5 | 6 |
|
||||
|
||||
Execute (testmap):
|
||||
imap testmap1 <Plug>VimwikiTableNextCell
|
||||
imap testmap2 <Plug>VimwikiTablePrevCell
|
||||
|
||||
Do (2 x Next):
|
||||
gga
|
||||
testmap1
|
||||
testmap1
|
||||
\<Del>Z
|
||||
|
||||
Expect (One Z in B):
|
||||
| A | Z | C |
|
||||
|---|---|---|
|
||||
| 1 | 2 | 3 |
|
||||
| 4 | 5 | 6 |
|
||||
|
||||
Do (4 X Next):
|
||||
gga
|
||||
testmap1
|
||||
testmap1
|
||||
testmap1
|
||||
testmap1
|
||||
\<Del>Z
|
||||
|
||||
Expect (One Z in 1):
|
||||
| A | B | C |
|
||||
|---|---|---|
|
||||
| Z | 2 | 3 |
|
||||
| 4 | 5 | 6 |
|
||||
|
||||
Do (4 X Next + 1 X Prev):
|
||||
gga
|
||||
testmap1
|
||||
testmap1
|
||||
testmap1
|
||||
testmap1
|
||||
testmap1
|
||||
testmap2
|
||||
\<Del>Z
|
||||
|
||||
Expect (One Z in 1):
|
||||
| A | B | C |
|
||||
|---|---|---|
|
||||
| Z | 2 | 3 |
|
||||
| 4 | 5 | 6 |
|
||||
|
||||
|
||||
Execute (Clean #1048):
|
||||
iunmap testmap1
|
||||
iunmap testmap2
|
||||
|
||||
|
||||
# vim: foldmethod=marker foldlevel=30
|
||||