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.
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
Problem:
The loading of a .md file was slow due to multiple nested lookback.
It is advised in vim help to prefer \zs, see :h /\@<
Anyway, it is useless to nest them.
089.080 000.085 000.085: sourcing /home/mtourneb/.vim/after/syntax/vimwiki.vim
089.264 005.184: opening buffers
089.322 000.058: BufEnter autocommands
089.323 000.001: editing files in windows
089.414 000.091: VimEnter autocommands
089.415 000.001: before starting main loop
303.698 214.283: first screen update
303.700 000.002: --- VIM STARTED ---
Solution:
Remove the function s:expand_delimiter in vars.vim.
It was doing a duplicate job with vimwiki#u#hi_expand_regex
And ... well avoid lookback as much as possible
091.784 000.087 000.087: sourcing /home/mtourneb/.vim/after/syntax/vimwiki.vim
091.991 006.034: opening buffers
092.050 000.059: BufEnter autocommands
092.052 000.002: editing files in windows
092.172 000.120: VimEnter autocommands
092.173 000.001: before starting main loop
112.574 020.401: first screen update
112.578 000.004: --- VIM STARTED ---
Setting a global for g:vimwiki_version doesn't seem too egregious, and
lets us reference it cleanly elsewhere.
Removes version header from vimwiki.txt and hardcoding in tagfile
generation.
There's still one instance of that left in test/tag.vader that we should
clean up eventually.
This:
- Changes version number everywhere I could find it.
- Reworks get_version() to dispense with stable / dev division.
- Rewrites CONTRIBUTING.md to describe a new release workflow.
The development/release workflow stuff could use some thought. It's
clunky at best. There's sort of an inherent tension between semver-style
version numbers and the rolling release thing - maybe we should just use
commit hash or something date-based?
Still, it's a start.
Hopefully this solves #1084, "Page links with leading slash lead to a
file in working directory, not a page at the root of the wiki", introduced
in 850aace.
It also adds a set of tests for different kinds of wiki links:
- api_base_resolve_link.vader
- link_syntax_markdown.vader
- link_syntax_vimwiki.vader
Includes some fixes for locally-failing tests, removes a test from
test/map.vader and comments out test/config_vars.vader entirely for the
moment.
Code by : Brennen Bearnes <code@p1k3.com>
Problem: I noticed that running :Vimwiki2HTML for a file with a `"` in
the `%title` line would error out. For example, a title like:
%title this will die: "
Causes:
Error detected while processing function vimwiki#html#Wiki2HTML[1]..<SNR>177_convert_file[15]..<SNR>177_convert_file_to_lines
_template:
line 8:
E116: Invalid arguments for function substitute(v:val, "%title%", "this will die: "", "g")
Solution: It seems like the string concatenation here was unnecessary.
At least on my vim 8.1, the evaluated code seems to have access to the
correct variables.
I'm sure there are bigger problems with the HTML generation here, but this
allows my ~2000 pages with titles to render without throwing errors.
Also adds a brief test and removes some unnecessary DeleteFile() calls
from html_convert_default.vader.
Co-authored-by: Brennen Bearnes <code@p1k3.com>
Enable the user to conveniently set the regular expression used for the
`VimwikiTodo` syntax group, instead of the defaults which might be
more suitable to code.
This setting is now also local per wiki.
Signed-off-by: Amit Beka <--->
Co-authored-by: Amit Beka <--->