55 Commits

Author SHA1 Message Date
giardn a54a3002e2 Update vimwiki.txt - Issue #795: VimwikiRebuildTags 2026-04-30 12:15:09 -06:00
giardn 389533bbbb Update tags.vim
Remove stale entries for files no longer on disk
2026-04-30 12:15:09 -06:00
xtbqimuxmvtx 92e911c25e Fixed to include default options first, markdown as example 2026-04-29 18:26:52 -06:00
xtbqimuxmvtx 70e3aa519b Update README.md lazy install
Fixed to declare variables inline as per lazy convention
2026-04-29 18:26:52 -06:00
xtbqimuxmvtx 9edd8724c8 Update README.md 2026-04-29 18:26:52 -06:00
Matthieu Talbot 72792615e7 Update vimwiki.txt
Fix parameter that was renamed in some example.
2024-10-13 22:07:48 -06:00
Brennen Bearnes 5cca07970c test/tag.vader: update hardcoded version to 2024.01.24
This should fix part of #1445.
2024-10-13 21:46:44 -06:00
Tinmarino 705ad1e0dd Fix #1412: Markdown Link creation when cursor is on word 2024.01.24 (or 2024-06-15) 2024-06-23 12:11:20 -04:00
Tinmarino 7ad424ea42 Conf: Add syntax variable open_link_add_ext to be able to open link with another extension (#1271)
Configure the feature adding extension .md to files at link opening.
The new feature (2023) was implemented by Brennen and fixing many other tickets but also openend #1271. So let's just add a configuration variable!
https://github.com/vimwiki/vimwiki/commit/d7ec12645a0460a7d200279c52915e6e080e9869
2024-06-19 13:07:55 -04:00
SukkaW 69318e74c8 docs: no longer recommends polyfill.io 2024-03-16 14:23:28 -03:00
Brennen Bearnes fde35bb87e v2024.01.24: Tweak README.md, update version number and changelog. 2024-01-24 20:14:13 -07:00
qadzek 2d17e6147b docs: describe undocumented key mappings 2024-01-24 19:31:47 -07:00
Brennen Bearnes d0e6d5e517 v2024.01.22: update version number and changelog
Includes some recent authors on the contributor list, and an attempt at
getting the changelog up to date.
2024-01-22 21:04:26 -07:00
Charles Schimmelpfennig 0bb1b4945b Support angle bracket escaped markdown urls (#1211)
* add angle brackets to regex definition

* revert unecessary change to markdown link suffix

* Update vimwiki.txt

---------

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

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

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

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

* Update vimwiki.txt

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

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

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

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

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

  - Includes a test/api_base_is_diary_file.vader

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

Bug: #1267
2023-03-30 17:08:58 -06:00
29 changed files with 1074 additions and 172 deletions
+67 -17
View File
@@ -10,6 +10,8 @@
- [Pathogen](#installation-using-pathogen)
- [Vim-Plug](#installation-using-vim-plug)
- [Vundle](#installation-using-vundle)
- [Lazy](#installation-using-lazy)
- [Basic Markup](#basic-markup)
- [Lists](#lists)
- [Key Bindings](#key-bindings)
@@ -28,7 +30,6 @@ VimWiki is a personal wiki for Vim -- a number of linked text files that have
their own syntax highlighting. See the [VimWiki Wiki](https://vimwiki.github.io/vimwikiwiki/)
for an example website built with VimWiki!
For the latest features and fixes checkout the [dev branch](https://github.com/vimwiki/vimwiki/tree/dev).
If you are interested in contributing see [this section](#helping-vimwiki).
With VimWiki, you can:
@@ -40,8 +41,8 @@ With VimWiki, you can:
- Export everything to HTML
To do a quick start, press `<Leader>ww` (default is `\ww`) to go to your index
wiki file. By default, it is located in `~/vimwiki/index.wiki`. See `:h vimwiki_list`
for registering a different path/wiki.
wiki file. By default, it is located in `~/vimwiki/index.wiki`. See
`:h vimwiki_list` for registering a different path/wiki.
Feed it with the following example:
@@ -77,8 +78,10 @@ The result should look something like:
## Installation
VimWiki has been tested on **Vim >= 7.3**. It will likely work on older
versions but will not be officially supported.
VimWiki has been tested on **Vim >= 7.3**. It may work on older versions but
will not be officially supported. It is known to work on NeoVim, although
it is likely to have
[NeoVim-specific bugs](https://github.com/vimwiki/vimwiki/labels/neovim).
### Prerequisites
@@ -141,9 +144,29 @@ vim +PluginInstall +qall
```
#### Installation using [Lazy](https://github.com/folke/lazy.nvim)
Add repository within `require('lazy').setup` call in your vimrc (or for plugins file ie. /lua/plugins/, do the same within a `return{}` statement).
If you are unfamiliar with lua, note that the brackets `{`, `}` need a closing comma (`},`) if you are adding this to an existing function like the .setup call.
``` { 'vimwiki/vimwiki' } ```
**Example with options (Change syntax to markdown)**:
``` lua
{
'vimwiki/vimwiki',
init = function()
vim.g.vimwiki_path = '~/vimwiki/'
vim.g.vimwiki_syntax = 'markdown'
vim.g.vimwiki_ext = 'md'
end,
}
```
#### Manual Install
Download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip)
Download the [zip archive](https://github.com/vimwiki/vimwiki/archive/dev.zip)
and extract it in `~/.vim/bundle/`
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was
@@ -185,6 +208,16 @@ _italic_ -- italic text
For other syntax elements, see `:h vimwiki-syntax`
### Todo lists
```text
- [.] Partially completed item with sub-tasks
- [X] Completed sub-task
- [ ] Incomplete sub-task
- [ ] Other incomplete sub-task
- [ ] Incomplete item
```
## Key bindings
### Normal mode
@@ -222,11 +255,13 @@ more bindings.
## Changing Wiki Syntax
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown
(markdown), and MediaWiki (media).
(markdown), and MediaWiki (media). Of these, the native VimWiki syntax is
best supported, followed by Markdown. No promises are made for MediaWiki.
**NOTE:** Only the default syntax ships with a built-in HTML converter. For
Markdown or MediaWiki see `:h vimwiki-option-custom_wiki2html`. Some examples
and 3rd party tools are available [here](https://vimwiki.github.io/vimwikiwiki/Related%20Tools.html#Related%20Tools-External%20Tools).
and 3rd party tools are available
[here](https://vimwiki.github.io/vimwikiwiki/Related%20Tools.html#Related%20Tools-External%20Tools).
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
following option in your `.vimrc`:
@@ -234,18 +269,31 @@ following option in your `.vimrc`:
```vim
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
\ 'syntax': 'markdown', 'ext': 'md'}]
```
This option will treat all markdown files in your system as part of vimwiki (check `set filetype?`). Add
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.
to your `.vimrc` to restrict Vimwiki's operation to only those paths listed in
`g:vimwiki_list`. Other markdown files wouldn't be treated as wiki pages.
See [g:vimwiki_global_ext](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L2631).
if you want to turn off support for other extension(for example, disabling
accidently creating new wiki and link for normal markdown files), set the
following option in your `.vimrc` before packadd vimwiki:
```vim
let g:vimwiki_ext2syntax = {}
```
See [g:vimiki_ext2syntax](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L2652)
## Getting help
[GitHub issues](https://github.com/vimwiki/vimwiki/issues) are the primary
@@ -253,18 +301,20 @@ method for raising bug reports or feature requests.
Additional resources:
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on irc.libera.chat
- The IRC channel [#vimwiki](ircs://irc.libera.chat:6697/vimwiki) on
irc.libera.chat is the "official" discussion and support channel
- [Connect via webchat](https://web.libera.chat/?channels=#vimwiki)
- Connect via Matrix/Element: [#vimwiki:libera.chat](https://matrix.to/#/#vimwiki:libera.chat)
- Post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
- [@vimwiki@wikis.world](https://wikis.world/@vimwiki) on the Fediverse
## Helping VimWiki
VimWiki has a lot of users but only very few recurring developers or people
helping the community. Your help is therefore appreciated. Everyone can help!
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how you can help.
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how
you can help.
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md) and [design_notes.md](doc/design_notes.md)
Also, take a look at [CONTRIBUTING.md](https://github.com/vimwiki/vimwiki/blob/master/CONTRIBUTING.md)
and [design_notes.md](doc/design_notes.md)
----
+84 -18
View File
@@ -262,11 +262,20 @@ function! vimwiki#base#resolve_link(link_text, ...) abort
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
endif
else
" append extension iff one not already present or it's not the targeted
" append extension if one not already present or it's not the targeted
" wiki extension - https://github.com/vimwiki/vimwiki/issues/950
let ext = fnamemodify(link_text, ':e')
let ext_with_dot = '.' . ext
if ext ==? '' || ext_with_dot !=? vimwiki#vars#get_wikilocal('ext', link_infos.index)
" Check if a .md must be added
" See #1271 to modify files with a "."
let do_add_ext = ext ==? ''
if vimwiki#vars#get_syntaxlocal('open_link_add_ext')
let do_add_ext = do_add_ext || ext_with_dot !=? vimwiki#vars#get_wikilocal('ext', link_infos.index)
endif
" Add the dot
if do_add_ext
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
endif
endif
@@ -394,9 +403,33 @@ function! vimwiki#base#open_link(cmd, link, ...) abort
endfunction
function! vimwiki#base#nop1(stg) abort
" Nop with one arg, used if callback is required
return a:stg
endfunction
function! vimwiki#base#get_globlinks_escaped(...) abort
" Proxy: Called by command completion
let args = copy(a:000)
call insert(args, 'fnameescape')
return call('vimwiki#base#get_globlinks_callback', args)
endfunction
function! vimwiki#base#get_globlinks_raw(...) abort
" Proxy: Called by command completion
let args = copy(a:000)
call insert(args, 'vimwiki#base#nop1')
return call('vimwiki#base#get_globlinks_callback', args)
endfunction
function! vimwiki#base#get_globlinks_callback(callback, ...) abort
" Escape global link
" Called by command completion
" [1] callback <string> of a function converting file <string> => escaped file <string>
" -- ex: fnameescape
let s_arg_lead = a:0 > 0 ? a:1 : ''
" only get links from the current dir
" change to the directory of the current file
@@ -414,8 +447,8 @@ function! vimwiki#base#get_globlinks_escaped(...) abort
" " use smart case matching
let r_arg = substitute(s_arg_lead, '\u', '[\0\l\0]', 'g')
call filter(lst, '-1 != match(v:val, r_arg)')
" Apply fnameescape() to each item
call map(lst, 'fnameescape(v:val)')
" Apply callback to each item
call map(lst, a:callback . '(v:val)')
" Return list (for customlist completion)
return lst
endfunction
@@ -449,7 +482,7 @@ function! vimwiki#base#generate_links(create, ...) abort
let use_caption = vimwiki#vars#get_wikilocal('generated_links_caption', wiki_nr)
for link in links
let link_infos = vimwiki#base#resolve_link(link)
if !vimwiki#base#is_diary_file(link_infos.filename, copy(l:diary_file_paths))
if !vimwiki#base#is_among_diary_files(link_infos.filename, copy(l:diary_file_paths))
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
let link_caption = vimwiki#base#read_caption(link_infos.filename)
@@ -493,7 +526,12 @@ function! vimwiki#base#goto(...) abort
" Jump: to other wikifile, specified on command mode
" Called: by command VimwikiGoto (Exported)
let key = a:0 > 0 && a:1 !=# '' ? a:1 : input('Enter name: ', '',
\ 'customlist,vimwiki#base#complete_links_escaped')
\ 'customlist,vimwiki#base#complete_links_raw')
if key ==# ''
" Input cancelled
return
endif
let anchor = a:0 > 1 ? a:2 : ''
@@ -853,6 +891,9 @@ function! s:jump_to_anchor(anchor) abort
let anchor = vimwiki#u#escape(a:anchor)
let segments = split(anchor, '#', 0)
" Start at beginning => Independent of link position
call cursor(1, 1)
" For markdown: there is only one segment
for segment in segments
" Craft segment pattern so that it is case insensitive and also matches dashes
@@ -873,7 +914,6 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
" Called: jump_to_anchor with suffix and withtou suffix
" Save cursor %% Initialize at top of line
let oldpos = getpos('.')
call cursor(1, 1)
" Get anchor regex
let anchor_header = s:safesubstitute(
@@ -931,9 +971,6 @@ function! s:jump_to_segment(segment, segment_norm_re, segment_nb) abort
return 0
endif
" Or keep on (i.e more than once segment)
let oldpos = getpos('.')
" Said 'fail' to caller
return 1
endfunction
@@ -1106,7 +1143,7 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) abort
" :param: anchor
" :param: (1) vimwiki_prev_link
" :param: (2) vimwiki#u#ft_is_vw()
let fname = escape(a:filename, '% *|#`')
let fname = fnameescape(a:filename)
let dir = fnamemodify(a:filename, ':p:h')
let ok = vimwiki#path#mkdir(dir, 1)
@@ -2639,13 +2676,10 @@ function! s:clean_url(url) abort
endfunction
function! vimwiki#base#is_diary_file(filename, ...) abort
" Check if 1.filename is a diary file
" An optional second argument allows you to pass in a list of diary files rather
" than generating a list on each call to the function.
let l:diary_file_paths = a:0 > 0 ? a:1 : vimwiki#diary#get_diary_files()
function! vimwiki#base#is_among_diary_files(filename, diary_file_paths) abort
" Check if filename is in a list of diary files
let l:normalised_file_paths =
\ map(l:diary_file_paths, 'vimwiki#path#normalize(v:val)')
\ map(a:diary_file_paths, 'vimwiki#path#normalize(v:val)')
" Escape single quote (Issue #886)
let filename = substitute(a:filename, "'", "''", 'g')
let l:matching_files =
@@ -2654,6 +2688,32 @@ function! vimwiki#base#is_diary_file(filename, ...) abort
endfunction
function! vimwiki#base#is_diary_file(filename, ...) abort
" Check if filename is a diary file.
"
" For our purposes, a diary file is any readable file with the current wiki
" extension in diary_rel_path.
"
" An optional second argument allows you to pass in a list of diary files
" rather than generating a list on each call to the function. This is
" handled by passing off to is_among_diary_files(). This behavior is
" retained just in case anyone has scripted against is_diary_file(), but
" shouldn't be used internally by VimWiki code. Call is_among_diary_files()
" directly instead.
" Handle the case with diary file paths passed in:
if a:0 > 0
return vimwiki#base#is_among_diary_files(a:filename, a:1)
endif
let l:readable = filereadable(a:filename)
let l:diary_path = vimwiki#vars#get_wikilocal('path') .
\ vimwiki#vars#get_wikilocal('diary_rel_path')
let l:in_diary_path = (0 == stridx(a:filename, l:diary_path))
return l:readable && l:in_diary_path
endfunction
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
" Treat link string towards normalization
" [__LinkDescription__](__LinkUrl__.__FileExtension__)
@@ -2840,11 +2900,17 @@ endfunction
function! vimwiki#base#complete_links_escaped(ArgLead, CmdLine, CursorPos) abort
" Complete escaping globlinks
" Complete globlinks escaping
return vimwiki#base#get_globlinks_escaped(a:ArgLead)
endfunction
function! vimwiki#base#complete_links_raw(ArgLead, CmdLine, CursorPos) abort
" Complete globlinks as raw string (unescaped)
return vimwiki#base#get_globlinks_raw(a:ArgLead)
endfunction
function! vimwiki#base#complete_file(ArgLead, CmdLine, CursorPos) abort
" Complete filename relative to current file
" Called: rename_file
+6 -2
View File
@@ -37,8 +37,12 @@ endfunction
function! vimwiki#diary#diary_date_link(...) abort
" Return: <String> date
if a:0 > 2
" user supply wiki number as 1 indexed, not 0 indexed
let wiki_nr = a:3 - 1
else
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
endif
if wiki_nr < 0 " this happens when called outside a wiki buffer
let wiki_nr = 0
endif
@@ -523,7 +527,7 @@ endfunction
function! vimwiki#diary#calendar_sign(day, month, year) abort
" Callback function for Calendar.vim
" Clause: no wiki no sign #290
if len(g:vimwiki_list) <= 0
if exists('g:vimwiki_list') && len(g:vimwiki_list) <= 0
return
endif
let day = s:prefix_zero(a:day)
+2 -2
View File
@@ -1898,12 +1898,12 @@ function! s:convert_file(path_html, wikifile) abort
endwhile
let tmp = ('tmp'. split(system('mktemp -p . --suffix=.' . type, 'silent'), 'tmp')[-1])[:-2]
call system('echo ' . shellescape(join(html_lines[start : cur - 1], '\n')) . ' > ' . tmp)
call system('echo ' . shellescape(join(html_lines[start : cur - 1], "\n")) . ' > ' . tmp)
call system(g:vimwiki_global_vars['listing_hl_command'] . ' ' . tmp . ' > ' . tmp . '.html')
let html_out = system('cat ' . tmp . '.html')
call system('rm ' . tmp . ' ' . tmp . '.html')
let i = cur
let html_lines = html_lines[0 : start - 1] + split(html_out, '\n') + html_lines[cur : ]
let html_lines = html_lines[0 : start - 1] + split(html_out, "\n") + html_lines[cur : ]
endif
let i += 1
endwhile
+2 -1
View File
@@ -100,7 +100,8 @@ function! s:normalize_link_syntax_n() abort
let sub = vimwiki#base#normalize_link_in_diary(lnk)
else
let sub = vimwiki#base#normalize_link_helper(lnk,
\ vimwiki#vars#get_global('rxWord'), '',
\ vimwiki#vars#get_global('rxWord'),
\ vimwiki#vars#get_global('rxWord'),
\ vimwiki#vars#get_syntaxlocal('Link1'))
endif
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
+16 -8
View File
@@ -47,6 +47,13 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files) abort
let wiki_base_dir = vimwiki#vars#get_wikilocal('path')
let tags_file_last_modification = getftime(vimwiki#tags#metadata_file_path())
let metadata = s:load_tags_metadata()
" Remove stale entries for files no longer on disk
let l:ext = vimwiki#vars#get_wikilocal('ext')
for pagename in keys(metadata)
if !filereadable(wiki_base_dir . pagename . l:ext)
call remove(metadata, pagename)
endif
endfor
for file in files
if all_files || getftime(file) >= tags_file_last_modification
let subdir = vimwiki#base#subdir(wiki_base_dir, file)
@@ -123,15 +130,12 @@ function! s:scan_tags(lines, page_name) abort
" Scan line for tags. There can be many of them.
let str = line
while 1
" Get all matches
let tag_groups = []
call substitute(str, tag_search_rx, '\=add(tag_groups, submatch(0))', 'g')
if tag_groups == []
break
continue
endif
let tagend = matchend(str, tag_search_rx)
let str = str[(tagend):]
for tag_group in tag_groups
for tag in split(tag_group, tag_format.sep)
" Create metadata entry
@@ -154,7 +158,6 @@ function! s:scan_tags(lines, page_name) abort
call add(entries, entry)
endfor
endfor
endwhile
endfor " loop over lines
return entries
@@ -364,22 +367,28 @@ function! vimwiki#tags#generate_tags(create, ...) abort
" make a dictionary { tag_name: [tag_links, ...] }
let tags_entries = {}
for tagname in self.specific_tags
let tags_entries[tagname] = []
endfor
for entries in values(metadata)
for entry in entries
if has_key(tags_entries, entry.tagname)
call add(tags_entries[entry.tagname], [entry.link, entry.description])
else
if need_all_tags
let tags_entries[entry.tagname] = [[entry.link, entry.description]]
endif
endif
endfor
unlet entry " needed for older vims with sticky type checking since name is reused
endfor
let tagnames = need_all_tags ? sort(keys(tags_entries)) : self.specific_tags
let lines = []
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
let current_dir = vimwiki#base#current_subdir()
for tagname in sort(keys(tags_entries))
if need_all_tags || index(self.specific_tags, tagname) != -1
for tagname in tagnames
if len(lines) > 0
call add(lines, '')
endif
@@ -422,7 +431,6 @@ function! vimwiki#tags#generate_tags(create, ...) abort
call add(lines, bullet . substitute(link_tpl, '__LinkUrl__', taglink, ''))
endif
endfor
endif
endfor
return lines
+7 -6
View File
@@ -149,7 +149,9 @@ function! vimwiki#tbl#get_cells(line, ...) abort
let state = 'NONE'
let cell_start = 0
let quote_start = 0
let len = strlen(a:line) - 1
" Split byte string into list of character to properly handle multibyte chars
let chars = split(a:line, '\zs')
let len = len(chars) - 1
" 'Simple' FSM
while state !=# 'CELL'
@@ -157,10 +159,9 @@ function! vimwiki#tbl#get_cells(line, ...) abort
let state = 'CELL'
endif
for idx in range(quote_start, len)
" The only way I know Vim can do Unicode...
let ch = a:line[idx]
let ch = chars[idx]
if state ==# 'NONE'
if ch ==# s:s_sep() && (idx < 1 || a:line[idx-1] !=# '\')
if ch ==# s:s_sep() && (idx < 1 || chars[idx-1] !=# '\')
let cell_start = idx + 1
let state = 'CELL'
endif
@@ -168,8 +169,8 @@ function! vimwiki#tbl#get_cells(line, ...) abort
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)
elseif ch ==# s:s_sep() && (idx < 1 || chars[idx-1] !=# '\')
let cell = join(chars[cell_start : idx-1], '')
if a:0 && a:1
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
else
+6 -6
View File
@@ -303,11 +303,11 @@ 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)
" :param: list<list<delimiters>> with reduced regex
" 1: Left delimiter (regex)
" 2: Right delimiter (regex)
" 3: Possible characters to ignore (regex: default '$^' => never match)
" 4: Can multiply delimiter (boolean: default 0 => do not repeat)
" Return: list with extended regex delimiters (not inside a word)
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
" Note: For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.
@@ -354,7 +354,7 @@ function! vimwiki#u#hi_expand_regex(lst) abort
" 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 . ']\)\@<=\)'
let r_right_suffix2 = '\%(\%($\|[[:space:]\n' . punctuation . ']\)\@=\)'
" Right Concatenate
let r_end = '\%(' . r_right_prefix1 . r_right_repeat . r_right_suffix1
+40 -13
View File
@@ -177,7 +177,7 @@ function! s:get_default_global() abort
\ [
\ 'http', 'https', 'file', 'ftp', 'gopher', 'telnet', 'nntp', 'ldap',
\ 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh',
\ 'git', 'ssh', 'fish', 'sftp', 'thunderlink'
\ 'git', 'ssh', 'fish', 'sftp', 'thunderlink', 'message'
\ ]},
\ 'schemes_any': {'type': type([]), 'default': ['mailto', 'matrix', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data']},
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
@@ -476,6 +476,7 @@ function! s:get_default_wikilocal() abort
\ 'auto_toc': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
\ 'automatic_nested_syntaxes': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'base_url': {'type': type(''), 'default': '', 'min_length': 1},
\ 'bullet_types': {'type': type([]), 'default': []},
\ 'color_dic': {'type': type({}), 'default': {
\ 'default': ['', '#d79921'],
\ 'red': ['#cc241d', ''],
@@ -497,6 +498,7 @@ function! s:get_default_wikilocal() abort
\ 'css_name': {'type': type(''), 'default': 'style.css', 'min_length': 1},
\ 'custom_wiki2html': {'type': type(''), 'default': ''},
\ 'custom_wiki2html_args': {'type': type(''), 'default': ''},
\ 'cycle_bullets': {'type': type(0), 'default': 0},
\ 'diary_frequency': {'type': type(''), 'default': 'daily', 'possible_values': ['daily', 'weekly', 'monthly', 'yearly']},
\ 'diary_start_week_day': {'type': type(''), 'default': 'monday', 'possible_values': ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']},
\ 'diary_header': {'type': type(''), 'default': 'Diary', 'min_length': 1},
@@ -506,8 +508,6 @@ function! s:get_default_wikilocal() abort
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
\ 'exclude_files': {'type': type([]), 'default': []},
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
\ 'bullet_types': {'type': type([]), 'default': []},
\ 'cycle_bullets': {'type': type(0), 'default': 0},
\ 'html_filename_parameterization': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
\ 'generated_links_caption': {'type': type(0), 'default': 0 },
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
@@ -676,6 +676,7 @@ function! s:get_default_syntaxlocal() abort
" type, default, min, max, possible_values, min_length
return extend(s:get_common_syntaxlocal(), {
\ 'blockquote_markers': {'type': type([]), 'default': ['>', '::']},
\ 'bold_match': {'type': type(''), 'default': '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*\%([[:punct:]]\|\s\|$\)\@='},
\ 'bold_search': {'type': type(''), 'default': '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='},
\ 'bullet_types': {'type': type([]), 'default': ['-', '*', '#']},
@@ -684,7 +685,6 @@ function! s:get_default_syntaxlocal() abort
\ 'list_markers': {'type': type([]), 'default': ['-', '1.', '*', 'I)', 'a)']},
\ 'number_types': {'type': type([]), 'default': ['1)', '1.', 'i)', 'I)', 'a)', 'A)']},
\ 'recurring_bullets': {'type': type(0), 'default': 0},
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$'},
\ 'header_symbol': {'type': type(''), 'default': '='},
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
\ 'rxListDefine': {'type': type(''), 'default': '::\(\s\|$\)'},
@@ -699,10 +699,10 @@ function! s:get_default_syntaxlocal() abort
\ 'post_mark': '}}}'}},
\ 'symH': {'type': type(1), 'default': 1},
\ 'typeface': {'type': type({}), 'default': {
\ 'bold': vimwiki#u#hi_expand_regex([['\*', '\*']]),
\ 'italic': vimwiki#u#hi_expand_regex([['_', '_']]),
\ 'bold': vimwiki#u#hi_expand_regex([['\*', '\*', '[*]', 0]]),
\ 'italic': vimwiki#u#hi_expand_regex([['_', '_', '[_]', 0]]),
\ 'underline': vimwiki#u#hi_expand_regex([]),
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*'], ['_\*', '\*_']]),
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*', '[*_]', 1], ['_\*', '\*_', '[*_]', 1]]),
\ 'code': [
\ ['\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@=',
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
@@ -737,7 +737,6 @@ function! s:get_markdown_syntaxlocal() abort
\ 'list_markers': {'type': type([]), 'default': ['-', '*', '+', '1.']},
\ 'number_types': {'type': type([]), 'default': ['1.']},
\ 'recurring_bullets': {'type': type(0), 'default': 0},
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$\|<!--[^>]*-->'},
\ 'header_symbol': {'type': type(''), 'default': '#'},
\ 'rxHR': {'type': type(''), 'default': '\(^---*$\|^___*$\|^\*\*\**$\)'},
\ 'rxListDefine': {'type': type(''), 'default': '::\%(\s\|$\)'},
@@ -792,7 +791,6 @@ function! s:get_media_syntaxlocal() abort
\ 'list_markers': {'type': type([]), 'default': ['*', '#']},
\ 'number_types': {'type': type([]), 'default': []},
\ 'recurring_bullets': {'type': type(1), 'default': 1},
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$'},
\ 'header_symbol': {'type': type(''), 'default': '='},
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
\ 'rxListDefine': {'type': type(''), 'default': '^\%(;\|:\)\s'},
@@ -833,14 +831,14 @@ function! s:get_common_syntaxlocal() abort
let rx_yaml_start_pre = '\%(^\%(\%1l\|^$\n\)\@<=\)'
let rx_yaml_start_post = '\%(\%(\n^$\)\@!$\)'
let rx_yaml_start = rx_yaml_start_pre . '---' . rx_yaml_start_post
let rx_yaml_stop = '^' . '\%(---\|\.\.\.\)' . '$'
let rx_yaml_end = '^\%(---\|\.\.\.\)\s*$'
let res.nested_extended = {'type': type(''), 'default': 'VimwikiError,VimwikiPre,VimwikiCode,VimwikiEqIn,VimwikiSuperScript,VimwikiSubScript,textSnipTEX'}
let res.nested_typeface = {'type': type(''), 'default': 'VimwikiBold,VimwikiItalic,VimwikiUnderline,VimwikiDelText'}
let res.nested = {'type': type(''), 'default': res.nested_extended.default . ',' . res.nested_typeface.default}
let res.rxTableSep = {'type': type(''), 'default': '|'}
" See issue #1287
let res.yaml_metadata_block = {'type': type([]), 'default': [[rx_yaml_start, rx_yaml_stop]]}
let res.yaml_metadata_block = {'type': type([]), 'default': [[rx_yaml_start, rx_yaml_end]]}
" Declare helper for inline math nested variable
let s:rx_inline_math_start = '\%(^\|[^$\\]\)\@<=\$\%($\|[^$[:space:]]\)\@='
@@ -850,6 +848,13 @@ function! s:get_common_syntaxlocal() abort
" -- it should not be changed but let's avoid hardcoding
let res.blockquote_markers = {'type': type([]), 'default': ['>']}
" HTML comment
let res.comment_regex = {'type': type(''), 'default': '\%(^\s*%%.*$\|<!--\%([^>]\|\n\)*-->\)'}
" Opening link with dot in the ref, see #1271 and ref and Brennen comment:
" -- https://github.com/vimwiki/vimwiki/issues/1271#issuecomment-1482207680
let res.open_link_add_ext = {'type': type(1), 'default': 1}
return res
endfunction
@@ -1229,7 +1234,7 @@ function! s:populate_extra_markdown_vars() abort
let mkd_syntax.rxWeblink1Prefix = '['
let mkd_syntax.rxWeblink1Suffix = ')'
let mkd_syntax.rxWeblink1EscapeCharsSuffix = '\(\\\)\@<!\()\)'
let mkd_syntax.rxWeblink1EscapeCharsSuffix = '\(\\\)\@<!\(>\=)\)'
let mkd_syntax.rxWeblink1Separator = ']('
let rxWeblink1Ext = ''
@@ -1254,7 +1259,7 @@ function! s:populate_extra_markdown_vars() abort
let valid_chars_url = '[^[:cntrl:]]'
let mkd_syntax.rxWeblink1Prefix = vimwiki#u#escape(mkd_syntax.rxWeblink1Prefix)
let mkd_syntax.rxWeblink1Separator = vimwiki#u#escape(mkd_syntax.rxWeblink1Separator)
let mkd_syntax.rxWeblink1Separator = '\](<\='
let mkd_syntax.rxWeblink1Url = valid_chars_url.'\{-}'
let mkd_syntax.rxWeblink1Descr = valid_chars.'\{-}'
let mkd_syntax.WikiLinkMatchUrlTemplate =
@@ -1606,6 +1611,28 @@ function! vimwiki#vars#get_syntaxlocal(key, ...) abort
endfunction
function! vimwiki#vars#set_syntaxlocal(key, value, ...) abort
" Set syntax variable
" Param: 1: key (<string>)
" Param: 2: value (<any type>)
" Param: (3): syntax name (<string> ex:'markdown')
" Set desired syntax variable to value
if a:0
let syntax = a:1
else
let syntax = vimwiki#vars#get_wikilocal('syntax')
endif
" Create syntax variable dict if not exists (lazy)
if !exists('g:vimwiki_syntaxlocal_vars') || !has_key(g:vimwiki_syntaxlocal_vars, syntax)
call vimwiki#vars#populate_syntax_vars(syntax)
endif
" Set d_syntax[a:key]
let g:vimwiki_syntaxlocal_vars[syntax][a:key] = a:value
endfunction
function! vimwiki#vars#get_bufferlocal(key, ...) abort
" Return: buffer local variable
" for the buffer we are currently in or for the given buffer (number or name).
+16 -1
View File
@@ -245,9 +245,24 @@ reasons for such a complex system is:
TODO currently the typeface delimiters are customized that way:
```vim
" Typeface: -> u.vim
" 1/ Redraw: Typeface: -> u.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('typeface')
call vimwiki#u#hi_typeface(s:typeface_dic)
" 2/ Clear typeface highlighting (see #1346)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Create a dic with no highlight but yes with all keys
" -- So that they are effectivemly overwritten
let typeface_dic = {'bold': [], 'italic': [], 'underline': [], 'bold_italic': [], 'code': [], 'del': [], 'sup': [], 'sub': [], 'eq': []}
" Just for consistency, this is an internal variable
echo vimwiki#vars#set_syntaxlocal('typeface', typeface_dic)
" Here is a Vim aware syntax highlighting big command
verbose call vimwiki#u#hi_typeface(typeface_dic)
```
+83 -5
View File
@@ -479,13 +479,13 @@ glp Decrease the "done" status.
gll n Increase the level of a list item.
Remap command: `<Plug>VimwikiIncreaseLvlSingleItem`
gLl Increase the level of a list item and all child items.
Remap command: `<Plug>VimwikiIncreaseLvlWholeItem`
or gLL Remap command: `<Plug>VimwikiIncreaseLvlWholeItem`
*vimwiki_glh* *vimwiki_gLh*
glh n Decrease the level of a list item.
Remap command: `<Plug>VimwikiDecreaseLvlSingleItem`
gLh Decrease the level of a list item and all child items.
Remap command: `<Plug>VimwikiDecreaseLvlWholeItem`
or gLH Remap command: `<Plug>VimwikiDecreaseLvlWholeItem`
*vimwiki_glr* *vimwiki_gLr*
glr n Renumber list items if the cursor is on a numbered
@@ -516,6 +516,13 @@ gl- n Make a list item out of a normal line or change the
gL- Change the symbol of the current list to -.
Remap command: `:VimwikiChangeSymbolInListTo -<CR>`
*vimwiki_gl+* *vimwiki_gL+*
gl+ n Make a list item out of a normal line or change the
symbol of the current item to +.
Remap command: `:VimwikiChangeSymbolTo +<CR>`
gL+ Change the symbol of the current list to +.
Remap command: `:VimwikiChangeSymbolInListTo +<CR>`
*vimwiki_gl1* *vimwiki_gL1*
gl1 n Make a list item out of a normal line or change the
symbol of the current item to 1., the numbering is
@@ -973,6 +980,7 @@ Vimwiki file.
*:VimwikiRebuildTags*
Rebuilds the tags metadata file for all wiki files newer than the metadata
file.
Stale entries for files that have been deleted or moved are removed automatically.
Necessary for all tags related commands: |vimwiki-syntax-tags|.
:VimwikiRebuildTags! does the same for all files.
@@ -1514,7 +1522,7 @@ In this case, <mathjax_folder> would be "../mathjax" (without quotes).
2. Loading MathJax from a CDN-server (needs internet connection).
Add to your HTML template the following lines:
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
@@ -2724,7 +2732,7 @@ The last is for 100% done items.
You can set it to some more fancy symbols like this:
>
let g:vimwiki_list = [{'path': '~/path/', 'listsyms' = '✗○◐●✓'}]
let g:vimwiki_list = [{'path': '~/path/', 'listsyms': '✗○◐●✓'}]
*vimwiki-option-listsym_rejected*
@@ -3275,7 +3283,7 @@ cannot otherwise convert the link. A customized handler might look like this: >
let str = a:value
" complete URL
let url_0 = matchstr(str, g:vimwiki_rxWikiInclMatchUrl)
let url_0 = matchstr(str, g:vimwiki_global_vars.rxWikiInclMatchUrl)
" URL parts
let link_infos = vimwiki#base#resolve_link(url_0)
let arg1 = matchstr(str, VimwikiWikiInclMatchArg(1))
@@ -4000,8 +4008,20 @@ Contributors and their Github usernames in roughly chronological order:
- Jean-Luc Bastarache (@jlbas)
- Youssof Taha (@ysftaha)
- Thomas Leyh (@leyhline)
- Charles Schimmelpfennig (@charlesschimmel)
- nebulaeandstars (@nebulaeandstars)
- dmitry kim (@jsn)
- Julian Prein (@druckdev)
- Luke Atkinson (@LukeDAtkinson)
- Joe Planisky (@jplanisky)
- Bence Ferdinandy (@ferdinandyb)
- R. David Dunphy (@rdunphy)
- Aarón Fas (@aaronfc)
- @jiamingc
- Alex Claman (@claman)
- @qadzek
- Nathan Giard (@giardn)
==============================================================================
16. Changelog *vimwiki-changelog*
@@ -4019,6 +4039,61 @@ master is retained as a legacy mirror of the dev branch.
This is somewhat experimental, and will probably be refined over time.
2026.04.08~
Fixed:~
* Issue #795: VimwikiRebuildTags now removes stale entries for files
that have been deleted or moved
2024.01.24~
New:~
* PR #1389: Document gLH, gl+, and gL+ mappings
* Tidy some aspects of README.md, remove pointers to defunct Matrix
channel and Google Group, add wikis.world Mastodon account.
2024.01.22~
New:~
* Issue #1279: Fix/Improvement: When re-wrap a long line in a definition
by 'gq' it should insert ':: ' at the new line
* Issue #1211: Support angle bracket escaped markdown urls
* Make auto_tags preserve existing tag section structure
* Issue #1315: GTD-style token highlighting
* Issue #1279: gqq autowrap leading :: definition as &l:comments
* Issue #1332: message URLs on Mac
* Util: add vimwiki#vars#set_syntaxlocal function for consistency
Fixed:~
* Issue #1365: Fix: count ignored when looking up diary frequency Issue
* Issue #1323: Folding code blocks using markdown syntax folds the entire rest of
the file
* Issue #1365: Jumping to nested anchor with markdown
* Issue #1297: Handle multibyte chars properly in table separators
* Issue #1311: Newlines in HTML conversion of codeblocks
* Issue #1326: Duplicate tag generation
* Issue #1324: File name prompt fixes
* Fix vimwiki#diary#calendar_sign when g:vimwiki_list is not set
* Use fnameescape() instead of escape() in edit_file()
* Admit trailing spaces for YAML delimiters
* Minor documentation fixes and CI improvements
2023.04.04~
Fixed:~
* Issue #1229: VimwikiGoto completion with file with space
Must complete file unescaped as argument is then quoted
* PR #1324: Fix pressing escape in VimwikiGoto prompt (rddunphy)
* Issue #1336: vimwiki#diary#calendar_sign throws an error
when g:vimwiki_list is not set
2023.04.04~
New:~
* Issue #1261: Feature: Support for <mark> in Markdown
highlighting with yellow background and back foreground
@@ -4027,6 +4102,8 @@ New:~
Also add the |blockquote_markers| variable
Fixed:~
* Issue #1267: Improve performance on link creation by speeding up
is_diary_file()
* Issue #1229: Bug: VimwikiGoto without argument creates empty page
* Issue #1316: Permit tags in heading
and improve |VimwikiSearchTags| and |VimwikiRebuildTags|
@@ -4098,6 +4175,7 @@ New:~
current file
* Feature: Add |VimwikiBaddLink| to add links to the buffer list, without
loading, if they weren't listed yet
* PR 1211: Enable parsing Markdown links escaped with angle brackets
Changed:~
* PR #1047: Allow to replace default mapping of VimwikiToggleListItem
+20 -8
View File
@@ -149,6 +149,10 @@ for bullet in vimwiki#vars#get_syntaxlocal('bullet_types')
" list
let comments .= ',fb:' . bullet
endfor
" Add :: for vimwiki default syntax (#1279)
if 'default' ==# vimwiki#vars#get_wikilocal('syntax')
let comments .= ',b:::'
endif
let &l:comments = comments
" Set Format Options: (:h fo-table)
@@ -189,14 +193,22 @@ function! VimwikiFoldLevel(lnum) abort
" Header/section folding...
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader') && !vimwiki#u#is_codeblock(a:lnum)
return '>'.vimwiki#u#count_first_sym(line)
" Code block folding...
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
return 'a1'
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
return 's1'
else
return '='
endif
" Code block folding...
" -- previously it would always increment when it saw a ```, so we never left the code block. (See #1323)
let prevline = getline(v:lnum - 1)
let nextline = getline(v:lnum + 1)
" -- Start: assumes empty line before
if line =~# vimwiki#vars#get_syntaxlocal('rxPreStart') && prevline =~# '^\s*$'
return 'a1'
" -- End: assumes empty line after
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd') && nextline =~# '^\s*$'
return 's1'
endif
return '='
endfunction
@@ -322,7 +334,7 @@ command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
command! -buffer -nargs=* VimwikiSearch call vimwiki#base#search(<q-args>)
command! -buffer -nargs=* VWS call vimwiki#base#search(<q-args>)
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_escaped
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_raw
\ VimwikiGoto call vimwiki#base#goto(<q-args>)
command! -buffer -range VimwikiCheckLinks call vimwiki#base#check_links(<range>, <line1>, <line2>)
+5 -5
View File
@@ -11,7 +11,7 @@ endif
let g:loaded_vimwiki = 1
" Set to version number for release:
let g:vimwiki_version = '2022.12.02'
let g:vimwiki_version = '2024.01.24'
" Get the directory the script is installed in
let s:plugin_dir = expand('<sfile>:p:h:h')
@@ -366,11 +366,11 @@ command! -count=0 VimwikiTabMakeDiaryNote
command! -count=0 VimwikiMakeYesterdayDiaryNote
\ call vimwiki#diary#make_note(<count>, 0,
\ vimwiki#diary#diary_date_link(localtime(), -1))
\ vimwiki#diary#diary_date_link(localtime(), -1, <count>))
command! -count=0 VimwikiMakeTomorrowDiaryNote
\ call vimwiki#diary#make_note(<count>, 0,
\ vimwiki#diary#diary_date_link(localtime(), 1))
\ vimwiki#diary#diary_date_link(localtime(), 1, <count>))
command! VimwikiDiaryGenerateLinks
\ call vimwiki#diary#generate_diary_section()
@@ -399,10 +399,10 @@ nnoremap <silent><script> <Plug>VimwikiTabMakeDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 1)<CR>
nnoremap <silent><script> <Plug>VimwikiMakeYesterdayDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime(), -1))<CR>
\ vimwiki#diary#diary_date_link(localtime(), -1, v:count))<CR>
nnoremap <silent><script> <Plug>VimwikiMakeTomorrowDiaryNote
\ :<C-U>call vimwiki#diary#make_note(v:count, 0,
\ vimwiki#diary#diary_date_link(localtime(), 1))<CR>
\ vimwiki#diary#diary_date_link(localtime(), 1, v:count))<CR>
" Set default global key mappings
+12
View File
@@ -168,6 +168,12 @@ elseif vimwiki#vars#get_global('hl_cb_checked') == 2
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
endif
" GTD-style token highlighting
syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=VimwikiTodo
syntax match TodoDueDate 'due:\d\{2,4\}-\d\{2\}-\d\{2\}' contains=VimwikiTodo
syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=VimwikiTodo
syntax match TodoContext '\(^\|\W\)@[^[:blank:]]\+' contains=VimwikiTodo
" Header Level: 1..6
for s:i in range(1,6)
@@ -495,6 +501,12 @@ hi def link VimwikiHeaderCharT VimwikiMarkers
hi def link VimwikiLinkCharT VimwikiLinkT
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
" GTD-style token highlighting
hi def link TodoDate PreProc
hi def link TodoDueDate VimWikiBold
hi def link TodoProject Constant
hi def link TodoContext Statement
" Load syntax-specific functionality
call vimwiki#u#reload_regexes_custom()
+25
View File
@@ -0,0 +1,25 @@
# Test vimwiki#base#is_diary_file() for various inputs.
Execute (Check known good diary file):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
Assert vimwiki#base#is_diary_file(link_infos.filename)
Execute (Check known good diary file using is_diary_file, with list of all diary files - legacy interface):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
let diary_file_paths = vimwiki#diary#get_diary_files()
Assert vimwiki#base#is_diary_file(link_infos.filename, diary_file_paths)
Execute (Check known good diary file use is_among_diary_files, with list of all diary files):
VimwikiIndex 1
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
let diary_file_paths = vimwiki#diary#get_diary_files()
Assert vimwiki#base#is_among_diary_files(link_infos.filename, diary_file_paths)
Execute (Check for nonexistent diary file):
VimwikiIndex 1
Assert !vimwiki#base#is_diary_file('not-a-diary-file')
Execute (Clean):
call ReloadVimwiki()
+6 -6
View File
@@ -40,7 +40,7 @@ Do (,wn buzz_bo + Completion(input()) && Assert):
Execute (:VimwikiGoto + Completion (API)):
VimwikiIndex 2
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
let s_complete=string(vimwiki#base#get_globlinks_escaped())
let s_complete=string(vimwiki#base#get_globlinks_raw())
Assert -1 != stridx(s_complete, 'buzz_bozz')
Execute (Create dir1/dir2/test_goto_file.md):
@@ -55,23 +55,23 @@ Execute (:VimwikiGoto + Completion in directory):
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
" Complete without argment
let s_complete1=string(vimwiki#base#get_globlinks_escaped())
let s_complete1=string(vimwiki#base#get_globlinks_raw())
Assert -1 != stridx(s_complete1, 'test_goto_file')
" Complete with file argument
let s_complete2=string(vimwiki#base#get_globlinks_escaped('test_goto_file'))
let s_complete2=string(vimwiki#base#get_globlinks_raw('test_goto_file'))
Assert -1 != stridx(s_complete2, 'test_goto_file')
" Complete with start of file argument
let s_complete3=string(vimwiki#base#get_globlinks_escaped('test_got'))
let s_complete3=string(vimwiki#base#get_globlinks_raw('test_got'))
Assert -1 != stridx(s_complete3, 'test_goto_file')
" Complete with (nested) dir2 argument
let s_complete4=string(vimwiki#base#get_globlinks_escaped('dir2'))
let s_complete4=string(vimwiki#base#get_globlinks_raw('dir2'))
Assert -1 != stridx(s_complete4, 'test_goto_file')
" Complete with bad argument
let l_complete5=vimwiki#base#get_globlinks_escaped('this_string_is_nowhere')
let l_complete5=vimwiki#base#get_globlinks_raw('this_string_is_nowhere')
let s_complete5=string(l_complete5)
Assert -1 == stridx(s_complete5, 'test_goto_file')
AssertEqual 0, len(l_complete5)
+32
View File
@@ -0,0 +1,32 @@
# Non regression tests for issue: #1279
# Fix/Improvement: When re-wrap a long line in a definition by 'gq' it should insert ':: ' at the new line
Given vimwiki (Dummy heading):
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
Do (gqq):
gqq
Expect (Wrapped with the :: prefix prepended):
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
:: aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa
:: aaa aaa aaa
Given vimwiki (Small heading):
:: aaa
Execute (Log):
call SetSyntax("default")
Log 'Comments: ' . &comments
Log 'Formatoptions: ' . &formatoptions
Log 'Blockquote_markers: ' . string(vimwiki#vars#get_syntaxlocal('blockquote_markers'))
Log 'Syntax: ' . vimwiki#vars#get_wikilocal('syntax')
Do (A <CR>):
A\<CR>
Expect (Bloquote prefix :: inserted):
:: aaa
::
+45
View File
@@ -0,0 +1,45 @@
# Non regression tests for issue TODO
# -- TODO copy-paste issue description
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Empty file):
Execute (Set vimwiki property rxTableSep):
call SetSyntax('markdown')
call vimwiki#vars#set_syntaxlocal('rxTableSep', '│' )
AssertEqual '│', vimwiki#vars#get_syntaxlocal('rxTableSep'), "Conf has been changed"
Execute(VimwikiTable):
VimwikiTable
Expect (Unicode table created):
│ │ │ │ │ │
│---│---│---│---│---│
│ │ │ │ │ │
Given vimwiki (Unicode table):
│ bla bla bla │ │ │ │ │
│---│---│---│---│---│
│ │ │ │ │ │
Execute (Rename file wiki_test.md for table expand):
file wiki_test.md
call SetSyntax('markdown')
call vimwiki#vars#set_syntaxlocal('rxTableSep', '│' )
Do (Expand table):
:AssertEqual '│', vimwiki#vars#get_syntaxlocal('rxTableSep'), "Conf has been changed"\<Cr>
A
Expect (Unicode table expanded):
│ bla bla bla │ │ │ │ │
│-------------│---│---│---│---│
│ │ │ │ │ │
@@ -0,0 +1,36 @@
# Non regression tests for issue #1311
# -- Can't enable syntax highlighting for codes in HTML files when converting wiki to HTML
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file with python code):
{{{type=py
if (a == 2):
print("2")
else:
print("other")
}}}
Execute (Convert to HTML):
Log "HTML path: " . vimwiki#vars#get_wikilocal('path_html')
let g:bck_command = g:vimwiki_global_vars['listing_hl_command']
let g:vimwiki_global_vars['listing_hl_command'] = 'cat'
call ConvertWiki2Body()
g/^\s*$/d
Expect (Output with good newlines):
<pre type=py>
if (a == 2):
print("2")
else:
print("other")
</pre>
Execute (restore):
let g:vimwiki_global_vars['listing_hl_command'] = g:bck_command
+36
View File
@@ -0,0 +1,36 @@
# Non regression tests for issue:
# -- How to turn off inline math highlights?
Given vimwiki (All math inline possible):
12345678901234567890123456789
2023-06-22
23-06-22
due:2023-06-22
+ProjectName project description
@ContextName context description
Other +ProjectName and desc
Other @ContectName and desc
Execute (Assert all lines):
# Math
AssertEqual 'normal', GetSyntaxVimwiki(1, 1)
AssertEqual 'TodoDate', GetSyntaxVimwiki(2, 1)
AssertEqual 'TodoDate', GetSyntaxVimwiki(3, 1)
AssertEqual 'TodoDueDate', GetSyntaxVimwiki(4, 1)
AssertEqual 'TodoProject', GetSyntaxVimwiki(6, 1)
AssertEqual 'normal', GetSyntaxVimwiki(6, 15)
AssertEqual 'TodoContext', GetSyntaxVimwiki(7, 1)
AssertEqual 'normal', GetSyntaxVimwiki(7, 15)
AssertEqual 'normal', GetSyntaxVimwiki(9, 1)
AssertEqual 'TodoProject', GetSyntaxVimwiki(9, 10)
AssertEqual 'normal', GetSyntaxVimwiki(9, 20)
AssertEqual 'normal', GetSyntaxVimwiki(10, 1)
AssertEqual 'TodoContext', GetSyntaxVimwiki(10, 10)
AssertEqual 'normal', GetSyntaxVimwiki(10, 20)
+46
View File
@@ -0,0 +1,46 @@
# Non regression tests for issue 1323
# -- Folding code blocks using markdown syntax folds the entire rest of the file #1323
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file):
# Header
```sql
SELECT blah FROM bleh;
```
More text in session one
# Header two
More text in session two
Execute (Cheat vars):
call SetSyntax('markdown')
let old_foldexpr = &foldexpr
let old_foldmethod = &foldmethod
set foldexpr=VimwikiFoldLevel(v:lnum)
set foldmethod=expr
Execute (Call function to verify):
AssertEqual 'line 1 => 1', 'line 1 => ' . foldlevel(1)
AssertEqual 'line 2 => 1', 'line 2 => ' . foldlevel(2)
AssertEqual 'line 3 => 2', 'line 3 => ' . foldlevel(3)
AssertEqual 'line 4 => 2', 'line 4 => ' . foldlevel(4)
AssertEqual 'line 5 => 2', 'line 5 => ' . foldlevel(5)
AssertEqual 'line 6 => 1', 'line 6 => ' . foldlevel(6)
AssertEqual 'line 7 => 1', 'line 7 => ' . foldlevel(7)
AssertEqual 'line 8 => 1', 'line 8 => ' . foldlevel(8)
AssertEqual 'line 9 => 0', 'line 9 => ' . foldlevel(9)
# AssertEqual 'line 10 => 1', 'line 10 => ' . foldlevel(10)
# AssertEqual 'line 11 => 1', 'line 11 => ' . foldlevel(11)
Execute (Restore vars):
# call SetSyntax('default')
let &foldexpr = old_foldexpr
let &foldmethod = old_foldmethod
+29
View File
@@ -0,0 +1,29 @@
# Non regression tests for issue: #1325
# -- Bold syntax highlighting broken for default syntax since 72d0220 (tk Brennen)
Given vimwiki (All math inline possible):
*foo:* bar #1: Bold
<!-- exec-raw zsh -c 'grep --exclude-dir="*logscratch" -rino -- "- \[ \].*$" ~/notes/vimwiki' | perl -pe 's{^/home/brennen/notes/vimwiki/(.*?)\.wiki:(\d+):- \[ \] (.*?)$}{ - [[$1|$1]] - ($2) $3}' -->
# 2: Online comment # 3
<!--
multiple line # 5
comment # 6
-->
123456789
Execute (Set syntax wiki):
call SetSyntax('default')
Log &foldexpr
Log &foldmethod
Execute (Assert syntax):
# Bold
# AssertEqual 'VimwikiBold1', GetSyntaxStack(1, 2)[0] . 1
AssertEqual '02', len(GetSyntaxStack(1, 8)) . 2
# HTML Comment
AssertEqual 'VimwikiComment3', GetSyntaxStack(2, 6)[0] . 3
# Multiline HTML Comment
AssertEqual 'VimwikiComment4', GetSyntaxStack(5, 2)[0] . 4
@@ -0,0 +1,65 @@
# Tests for issue: 1326
# Multiple discrete tags on one line
# cause duplicate entries in .vimwiki_tags
# For example, this line:
# :tag1:tag2:
# gives correct results in .vimwiki_tags when VimwikiRebuildTags is called.
# This line
# :tag3: :tag4:
# gives duplicate entries for tag4.
Execute (Start with no content or .vimwiki_tags files - Start issue 1326 test):
call system("rm $HOME/testwiki/.vimwiki_tags")
call system("rm $HOME/testwiki/Test-Tag-issue-1326.wiki")
Do (Create file with tags and rebuild all tags):
:edit! $HOME/testwiki/Test-Tag-issue-1326.wiki\<CR>
I
:discrete1: :discrete2:\<CR>
:concat1:concat2:\<CR>
:mixed1:mixed2: :mixed3: :mixed4:\<CR>
\<Esc>
:write\<CR>
:VimwikiRebuildTags!\<CR>
Execute (Examine .vimwiki_tags file for generated tag entries.):
edit $HOME/testwiki/.vimwiki_tags
AssertEqual $HOME . '/testwiki/.vimwiki_tags', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
# For each tag, make sure it is found # once and ONLY once in
# the .vimwiki_tags file.
# The "AssertNotEqual" tests that the tag is present at least once.
# The "AssertEqual" searches for the tag 2 times and checks that the
# line number where it was found is the same both times.
# The 'w' flag tells search to wrap around at the end of the file.
# The 'e' flag makes search position the cursor at the end of the match.
AssertNotEqual 0, search('concat1', 'we'), 'Expected tag "concat1" was not found.'
AssertEqual search('concat1', 'we'), search('concat1', 'we'), 'More than 1 instance of tag "concat1" found'
AssertNotEqual 0, search('concat2', 'we'), 'Expected tag "concat2" was not found.'
AssertEqual search('concat2', 'we'), search('concat2', 'we'), 'More than 1 instance of tag "concat2" found'
AssertNotEqual 0, search('discrete1', 'we'), 'Expected tag "discrete1" was not found.'
AssertEqual search('discrete1', 'we'), search('discrete1', 'we'), 'More than 1 instance of tag "discrete1" found'
AssertNotEqual 0, search('discrete2', 'we'), 'Expected tag "discrete2" was not found.'
AssertEqual search('discrete2', 'we'), search('discrete2', 'we'), 'More than 1 instance of tag "discrete2" found'
AssertNotEqual 0, search('mixed1', 'we'), 'Expected tag "mixed1" was not found.'
AssertEqual search('mixed1', 'we'), search('mixed1', 'we'), 'More than 1 instance of tag "mixed1" found'
AssertNotEqual 0, search('mixed2', 'we'), 'Expected tag "mixed2" was not found.'
AssertEqual search('mixed2', 'we'), search('mixed2', 'we'), 'More than 1 instance of tag "mixed2" found'
AssertNotEqual 0, search('mixed3', 'we'), 'Expected tag "mixed3" was not found.'
AssertEqual search('mixed3', 'we'), search('mixed3', 'we'), 'More than 1 instance of tag "mixed3" found'
AssertNotEqual 0, search('mixed4', 'we'), 'Expected tag "mixed4" was not found.'
AssertEqual search('mixed4', 'we'), search('mixed4', 'we'), 'More than 1 instance of tag "mixed4" found'
Execute (Remove content and tags files - End issue 1326 test):
call system("rm $HOME/testwiki/.vimwiki_tags")
call system("rm $HOME/testwiki/Test-Tag-issue-1326.wiki")
+148
View File
@@ -0,0 +1,148 @@
# Non regression tests for issue TODO
# -- TODO copy-paste issue description
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Execute (Set syntax markdown):
call SetSyntax('markdown')
file issue1356.md
Log 'Initial file:' . resolve(expand('%:p'))
Do (Jump1):
1G
\<Cr>
A--Link1\<Esc>
Expect(Link1):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne--Link1
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Do (Jump2):
2G
\<Cr>
A--Link2\<Esc>
Expect (Link2):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo--Link2
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Do (Jump3):
3G
\<Cr>
A--Link3\<Esc>
Expect (Link3):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo--Link3
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree
Do (Jump4):
4G
\<Cr>
A--Link4\<Esc>
Expect (Link4):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo--Link4
## SubCategoryThree
Do (Jump5):
5G
\<Cr>
A--Link5\<Esc>
Expect (Link5):
[this](#TopCategoryOne)
[that](#TopCategoryTwo)
[Here, we correctly jump to T1-S2](#TopCategoryOne#SubCategoryTwo)
[Here, however, we incorrectly land at T1-S2](#TopCategoryTwo#SubCategoryTwo)
[T2-S3 works, likely because T1-S3 doesn't exist](#TopCategoryTwo#SubCategoryThree)
# TopCategoryOne
## SubCategoryOne
## SubCategoryTwo
# TopCategoryTwo
## SubCategoryOne
## SubCategoryTwo
## SubCategoryThree--Link5
+16
View File
@@ -0,0 +1,16 @@
# Non regression tests for issue TODO
# -- TODO copy-paste issue description
#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader
Given vimwiki (Input file):
test
Execute (Call function to verify):
echo 'Dummy command, not displayed'
Log 'Debug message displayed in Vader output'
AssertEqual 'test', getline(1), 'Dummy assertion'
Expect (Output file):
test
+5 -4
View File
@@ -29,9 +29,9 @@ 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
and __t __isss still bold__ Bold 4
and _itaaa_licccontinues and end_ Italic 5
*this aa is italic also* Italic 6
a ^taa is supperscrit^ Sup 7
,,subaaa subscript end,, Sub 8
a ~~staaill deleted~~ Del 9
@@ -47,7 +47,8 @@ Execute (Assert Syntax of escape typeface):
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 14) . 2
AssertEqual '3' , SyntaxAt(3, 14) . 3
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
" TODO
" AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
" See: #1303 where an escape start can close the region
" Fixed removing vars.vim::expand_delimiter
AssertEqual 'VimwikiItalic6' , SyntaxAt(6, 14) . 6
+79 -1
View File
@@ -257,7 +257,7 @@ Expect (Correctly formatted tags file):
!_TAG_PROGRAM_AUTHOR Vimwiki
!_TAG_PROGRAM_NAME Vimwiki Tags
!_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki
!_TAG_PROGRAM_VERSION 2022.12.02
!_TAG_PROGRAM_VERSION 2024.01.24
second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag\tTest-Tag#second-tag
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
@@ -553,3 +553,81 @@ Expect (Content appended at tags):
Execute (Clean file for tag #1316):
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag-issue-1316-bis.md")
Execute (Clean):
call system("rm $HOME/testmarkdown/.vimwiki_tags")
unlet g:vimwiki_tag_format
unlet g:vimwiki_syntaxlocal_vars
call vimwiki#vars#init()
Do (Md: #1034: Create File with tag in code for issue #1034):
:edit $HOME/testmarkdown/Test-Tag-issue-1034.md\<CR>
I
# Line1: Heading
Some line\<Cr>
# Line2: Tag not in header
```bash\<Cr>
# Line3: Tag in header
this is bash code with :tag1:\<Cr>
# Line4: empty
```\<Cr>
# Line5: tag2
and :tag2:\<Cr>
\<Esc>
:write\<CR>
:VimwikiRebuildTags!\<CR>
Do (Md: #1034: Append something at mono tag):
:edit $HOME/testmarkdown/Test-Tag-issue-1034.md\<CR>
ggdG
:read $HOME/testmarkdown/.vimwiki_tags\<CR>
G
:g/^!/d\<CR>
oContent\<Esc>
Expect (Md: #1034: Can see tag2 but not tag1 as in code):
tag2 Test-Tag-issue-1034.md 5;" vimwiki:Test-Tag-issue-1034\tTest-Tag-issue-1034#tag2\tTest-Tag-issue-1034#tag2
Content
Do (Wiki: #1034: Create File with tag in code for issue #1034):
:edit $HOME/testwiki/Test-Tag-issue-1034.wiki\<CR>
I
# Line1: Heading
Some line\<Cr>
# Line2: Tag not in header
{{{bash\<Cr>
# Line3: Tag in header
this is bash code with :tag1:\<Cr>
# Line4: empty
}}}\<Cr>
# Line5: tag2
and :tag2:\<Cr>
\<Esc>
:write\<CR>
:VimwikiRebuildTags!\<CR>
Do (Wiki: #1034: Append something at mono tag):
:edit $HOME/testwiki/Test-Tag-issue-1034.wiki\<CR>
ggdG
:read $HOME/testwiki/.vimwiki_tags\<CR>
G
:g/^!/d\<CR>
oContent\<Esc>
Expect (Wiki: #1034: Can see tag2 but not tag1 as in code):
tag2 Test-Tag-issue-1034.wiki 5;" vimwiki:Test-Tag-issue-1034\tTest-Tag-issue-1034#tag2\tTest-Tag-issue-1034#tag2
Content
Execute (#1034: Clean file for tag #1034):
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testwiki/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag-issue-1013.md")
call system("rm $HOME/testwiki/Test-Tag-issue-1013.wiki")
+63
View File
@@ -0,0 +1,63 @@
# Test how vimwiki#tags#generate_tags behaves when updating existing tag link sections
Before (Setup test wiki files):
call writefile([":usedtag:", ":othertag:"], expand("~/testmarkdown/Test-Tag-tagged.md"))
edit ~/testmarkdown/Test-Tag-links.md
After (Cleanup files):
%delete
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag-tagged.md")
call system("rm $HOME/testmarkdown/Test-Tag-links.md")
Do (Create preexisting tag links with unused tag):
I
# Generated Tags\<CR>
\<CR>
## unusedtag\<CR>
\<CR>
## usedtag\<CR>
\<ESC>
:VimwikiRebuildTags!\<CR>
:call vimwiki#tags#generate_tags(0)\<CR>
Expect (Keeps unused tag header):
# Generated Tags
## unusedtag
## usedtag
- [Test-Tag-tagged](Test-Tag-tagged)
Do (Create preexisting tag subheadings out of alphabetical order):
I
# Generated Tags\<CR>
\<CR>
## z\<CR>
\<CR>
## usedtag\<CR>
\<CR>
## a\<CR>
\<CR>
# Other Stuff
\<ESC>
:VimwikiRebuildTags!\<CR>
:call vimwiki#tags#generate_tags(0)\<CR>
Expect (Existing tag subheading order is preserved):
# Generated Tags
## z
## usedtag
- [Test-Tag-tagged](Test-Tag-tagged)
## a
# Other Stuff
+8
View File
@@ -343,6 +343,14 @@
0d
endfunction
function! GetSyntaxVimwiki(line, col)
let res = GetSyntaxStack(a:line, a:col)
if empty(res)
return 'normal'
endif
return res[0]
endfunction
function! GetSyntaxGroup(...)
" Get normalized syntax group: usefull for boldItalic Vs italicBold
" Arg1: line