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