42 Commits
v2.2 ... v2.3

Author SHA1 Message Date
129c281810 Update changelog 2016-03-31 12:10:27 +02:00
722d6e4b9a '+' on a raw url surrounds it with brackets
Fix #188
2016-03-21 09:02:22 +01:00
0001b3cda9 Copy CSS file also with :Vimwiki2HTML 2016-03-19 22:01:25 +01:00
68cdfe36df Unify all messages to the user 2016-03-19 21:29:42 +01:00
4956976bb6 Some fixes in the doc 2016-03-19 19:55:08 +01:00
4c2e13a284 Skip preformatted and math text while scanning for headers
Fix #191
2016-03-18 15:18:23 +01:00
4bd0690a52 Simplify some regexes 2016-03-18 15:16:59 +01:00
128581babc Merge remote-tracking branch 'optik-aper/master' into dev 2016-03-01 10:46:29 +01:00
c2d1869227 Escape tilde (~) in path names otherwise regex comparison gets upset 2016-02-29 16:12:56 -05:00
6f579711ab Merge pull request #186 from lotabout/master
fix #64: markdown style link support
2016-02-22 11:42:42 +01:00
6d96516ab4 enhance #64: generate same link type for visual mode and normal mode 2016-02-22 16:00:37 +08:00
0ea8d85b7f Sort links in the list generated by VimwikiGenerateTags
Fix #192
2016-02-19 11:32:58 +01:00
5f9dbca89c Small cleanup of the merged PR
Ref #187
2016-01-28 10:52:40 +01:00
2aeaea5f0d Merge pull request #187 from mMontu/nested
Dynamically detect nested syntaxes (fix #128)
2016-01-28 10:29:53 +01:00
a2888692fd Option for automatic detection of nested syntaxes 2016-01-27 13:30:30 -02:00
fc947523b0 Dynamically detect nested syntaxes (fix #128) 2016-01-27 10:14:49 -02:00
91a004bc23 Remove superfluous debug message 2016-01-25 13:47:41 +01:00
78cef05fa3 Fix HTML conversion of headers containing links
Fix #183
2016-01-22 13:32:01 +01:00
1db5924271 Update the changelog 2016-01-21 13:27:43 +01:00
ff90e980de Locate the .tags file correctly on windows
Ref #184
2016-01-21 13:27:08 +01:00
bb3026dba8 Include subdir in wiki page name when rebuilding tags
Ref #184
2016-01-21 13:25:04 +01:00
b0cc6ff0de fix #64: markdown style link support 2016-01-18 16:51:08 +08:00
949b29b694 Fix tags file path when 'path' contains spaces
Fix #176
2015-12-14 10:36:16 +01:00
f31550badb Merge pull request #165 from Tomsod/dev
Add command for opening yesterday's diary
2015-12-11 11:49:45 +01:00
3bd3d9b860 Update changelog 2015-12-10 16:19:26 +01:00
e0d72759a6 Remember kids: always use :normal! with the bang in plugins
Fix #175
2015-12-10 16:07:36 +01:00
f9045a40e0 Merge pull request #169 from t7ko/bugfix/tags-sorted-in-wrong-order
Fix sorting order of tags.
2015-12-08 16:31:01 +03:00
9be96884ba Remove g:VimwikiLog and the timing stuff
For profiling, there is Vim's :profile command
2015-12-07 12:29:25 +01:00
2a70e1517e Remove g:vimwiki_debug, which probably nobody used 2015-12-07 12:27:32 +01:00
c565b38bb6 Remove some unreachable code 2015-12-07 12:25:17 +01:00
37aae9c3ce Merge pull request #170 from t7ko/bugfix/cursor-moves-on-toc-update
Bugfix: cursor moves on TOC update, TOC fold gets closed.
2015-12-04 14:36:26 +03:00
c2b0fd843b Fix bug: saving a page would err out trying to open fold if folds are disabled or are configured differently. 2015-12-04 15:33:03 +04:00
77fca9080c Fix code review notes on 'norm zo':
- Only issue 'zo' if there is any fold at all.
        - Correct possible bug, code was using 'start_lnum' var, but it
          was changed/incremented which could lead to wrong results.
        - Use bang with norm, to prevent user re-mapping interfere with
          standard ones.
2015-12-01 22:41:50 +03:00
3eb20a6c98 Fix regression bug: Normalize paths if settings changed after startup
Fix #171
2015-11-30 13:33:22 +01:00
7124a9be97 Add a note to the change log
Hopefully not too late.
Ref #173
2015-11-30 13:13:06 +01:00
5247de4a0b Prevent scrolling of large folds while filesave updates TOC.
During TOC update, screen sometimes scrolls -- most often I've seen this
when I'm working inside large enough fold (does not fit in one screen).

Fix uses winsaveview()/winrestview() instead of getpos()/setpos().
Winview pair would also manage scroll position on screen, not just
cursor position in text.
2015-11-27 03:20:44 +03:00
0d3f526a88 Preserve fold open/close status of the TOC on save.
Since TOC is completely recreated, Vim loses its fold open/close status.
If your TOC was open, after you save it gets closed.

Fix will save fold status, and restore it after TOC is updated.
2015-11-27 03:13:25 +03:00
d265df42f5 Prevent cursor moving up/down when TOC changes.
getpos()/setpos() combination does not account for changes of lines
count.  So if you do getpos, then remove lines _above_ it, then do
setpos -- it's going to be off.

The fix calculates the "diff", and adjusts saved position for that diff
(if any).
2015-11-27 03:05:39 +03:00
7df0405c4e Fix sorting order of tags.
Before the fix, tags file sorting was done alphabetically.  That would
treat line numbers as strings, and so, for example, if the same tag was
placed on the same page on lines, say, 9 and 114, the order you would
get, 114 would go first, instead of 9.

Fix adds proper entries comparison to the sort function.
2015-11-27 01:50:41 +03:00
8231433bad Merge pull request #168 from hiberabyss/macurl
follow url silently in mac
2015-11-26 09:32:51 +01:00
399e9a4512 follow url silently in mac 2015-11-26 11:54:32 +08:00
64f71bc785 Add :VimwikiMakeYesterdayDiaryNote command
Opens diary for yesterday.
For when you stay up past midnight.
2015-10-29 01:00:00 +03:00
14 changed files with 390 additions and 343 deletions

View File

@ -141,18 +141,12 @@ endfunction " }}}
" vimwiki#base#cache_buffer_state " vimwiki#base#cache_buffer_state
function! vimwiki#base#cache_buffer_state() "{{{ function! vimwiki#base#cache_buffer_state() "{{{
if !exists('g:vimwiki_current_idx') && g:vimwiki_debug
echo "[Vimwiki Internal Error]: Missing global state variable: 'g:vimwiki_current_idx'"
endif
let b:vimwiki_idx = g:vimwiki_current_idx let b:vimwiki_idx = g:vimwiki_current_idx
endfunction "}}} endfunction "}}}
" vimwiki#base#recall_buffer_state " vimwiki#base#recall_buffer_state
function! vimwiki#base#recall_buffer_state() "{{{ function! vimwiki#base#recall_buffer_state() "{{{
if !exists('b:vimwiki_idx') if !exists('b:vimwiki_idx')
if g:vimwiki_debug
echo "[Vimwiki Internal Error]: Missing buffer state variable: 'b:vimwiki_idx'"
endif
return 0 return 0
else else
let g:vimwiki_current_idx = b:vimwiki_idx let g:vimwiki_current_idx = b:vimwiki_idx
@ -191,7 +185,6 @@ endfunction "}}}
" vimwiki#base#subdir " vimwiki#base#subdir
"FIXME TODO slow and faulty "FIXME TODO slow and faulty
function! vimwiki#base#subdir(path, filename) "{{{ function! vimwiki#base#subdir(path, filename) "{{{
let g:VimwikiLog.subdir += 1 "XXX
let path = a:path let path = a:path
" ensure that we are not fooled by a symbolic link " ensure that we are not fooled by a symbolic link
"FIXME if we are not "fooled", we end up in a completely different wiki? "FIXME if we are not "fooled", we end up in a completely different wiki?
@ -380,7 +373,7 @@ function! vimwiki#base#system_open_link(url) "{{{
execute 'silent ! start "Title" /B ' . url execute 'silent ! start "Title" /B ' . url
endfunction endfunction
function! s:macunix_handler(url) function! s:macunix_handler(url)
execute '!open ' . shellescape(a:url, 1) call system('open ' . shellescape(a:url).' &')
endfunction endfunction
function! s:linux_handler(url) function! s:linux_handler(url)
call system('xdg-open ' . shellescape(a:url).' &') call system('xdg-open ' . shellescape(a:url).' &')
@ -397,19 +390,15 @@ function! vimwiki#base#system_open_link(url) "{{{
return return
endif endif
endtry endtry
echomsg 'Default Vimwiki link handler was unable to open the HTML file!' echomsg 'Vimwiki Error: Default Vimwiki link handler was unable to open the HTML file!'
endfunction "}}} endfunction "}}}
" vimwiki#base#open_link " vimwiki#base#open_link
function! vimwiki#base#open_link(cmd, link, ...) "{{{ function! vimwiki#base#open_link(cmd, link, ...) "{{{
let link_infos = vimwiki#base#resolve_link(a:link) let link_infos = vimwiki#base#resolve_link(a:link)
if g:vimwiki_debug
echom 'open_link:' string(link_infos)
endif
if link_infos.filename == '' if link_infos.filename == ''
echom 'Vimwiki Error: Unable to resolve link!' echomsg 'Vimwiki Error: Unable to resolve link!'
return return
endif endif
@ -516,7 +505,7 @@ function! vimwiki#base#backlinks() "{{{
endfor endfor
if empty(locations) if empty(locations)
echom 'vimwiki: no other file links to this file' echomsg 'Vimwiki: No other file links to this file'
else else
call setloclist(0, locations, 'r') call setloclist(0, locations, 'r')
lopen lopen
@ -834,7 +823,7 @@ function! vimwiki#base#check_links() "{{{
endfor endfor
if empty(errors) if empty(errors)
echom 'Vimwiki: all links are OK' echomsg 'Vimwiki: All links are OK'
else else
call setqflist(errors, 'r') call setqflist(errors, 'r')
copen copen
@ -857,8 +846,8 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) "{{{
let ok = vimwiki#path#mkdir(dir, 1) let ok = vimwiki#path#mkdir(dir, 1)
if !ok if !ok
echom ' ' echomsg ' '
echom 'Vimwiki: Unable to edit file in non-existent directory: '.dir echomsg 'Vimwiki Error: Unable to edit file in non-existent directory: '.dir
return return
endif endif
@ -891,7 +880,7 @@ endfunction " }}}
function! vimwiki#base#search_word(wikiRx, cmd) "{{{ function! vimwiki#base#search_word(wikiRx, cmd) "{{{
let match_line = search(a:wikiRx, 's'.a:cmd) let match_line = search(a:wikiRx, 's'.a:cmd)
if match_line == 0 if match_line == 0
echomsg 'vimwiki: Wiki link not found.' echomsg 'Vimwiki: Wiki link not found'
endif endif
endfunction " }}} endfunction " }}}
@ -1143,27 +1132,47 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
return return
endif endif
let old_cursor_pos = getpos('.') let winview_save = winsaveview()
let cursor_line = winview_save.lnum
let is_cursor_after_listing = 0
let is_fold_closed = 1
let lines_diff = 0
if already_there if already_there
let is_fold_closed = ( foldclosed(start_lnum) > -1 )
" delete the old listing " delete the old listing
let whitespaces_in_first_line = matchstr(getline(start_lnum), '\m^\s*') let whitespaces_in_first_line = matchstr(getline(start_lnum), '\m^\s*')
let end_lnum = start_lnum + 1 let end_lnum = start_lnum + 1
while end_lnum <= line('$') && getline(end_lnum) =~# a:content_regex while end_lnum <= line('$') && getline(end_lnum) =~# a:content_regex
let end_lnum += 1 let end_lnum += 1
endwhile endwhile
let is_cursor_after_listing = ( cursor_line >= end_lnum )
" We'll be removing a range. But, apparently, if folds are enabled, Vim
" won't let you remove a range that overlaps with closed fold -- the entire
" fold gets deleted. So we temporarily disable folds, and then reenable
" them right back.
let foldenable_save = &l:foldenable
setlo nofoldenable
silent exe start_lnum.','.string(end_lnum - 1).'delete _' silent exe start_lnum.','.string(end_lnum - 1).'delete _'
let &l:foldenable = foldenable_save
let lines_diff = 0 - (end_lnum - start_lnum)
else else
let start_lnum = a:default_lnum let start_lnum = a:default_lnum
let is_cursor_after_listing = ( cursor_line > a:default_lnum )
let whitespaces_in_first_line = '' let whitespaces_in_first_line = ''
endif endif
let start_of_listing = start_lnum
" write new listing " write new listing
let new_header = whitespaces_in_first_line let new_header = whitespaces_in_first_line
\ . substitute(g:vimwiki_rxH1_Template, \ . substitute(g:vimwiki_rxH1_Template,
\ '__Header__', '\='."'".a:start_header."'", '') \ '__Header__', '\='."'".a:start_header."'", '')
call append(start_lnum - 1, new_header) call append(start_lnum - 1, new_header)
let start_lnum += 1 let start_lnum += 1
let lines_diff += 1 + len(a:strings)
for string in a:strings for string in a:strings
call append(start_lnum - 1, string) call append(start_lnum - 1, string)
let start_lnum += 1 let start_lnum += 1
@ -1171,9 +1180,19 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
" append an empty line if there is not one " append an empty line if there is not one
if start_lnum <= line('$') && getline(start_lnum) !~# '\m^\s*$' if start_lnum <= line('$') && getline(start_lnum) !~# '\m^\s*$'
call append(start_lnum - 1, '') call append(start_lnum - 1, '')
let lines_diff += 1
endif endif
call setpos('.', old_cursor_pos) " Open fold, if needed
if !is_fold_closed && ( foldclosed(start_of_listing) > -1 )
exe start_of_listing
norm! zo
endif
if is_cursor_after_listing
let winview_save.lnum += lines_diff
endif
call winrestview(winview_save)
endfunction "}}} endfunction "}}}
" WIKI link following functions {{{ " WIKI link following functions {{{
@ -1262,7 +1281,7 @@ endfunction " }}}
" vimwiki#base#goto_index " vimwiki#base#goto_index
function! vimwiki#base#goto_index(wnum, ...) "{{{ function! vimwiki#base#goto_index(wnum, ...) "{{{
if a:wnum > len(g:vimwiki_list) if a:wnum > len(g:vimwiki_list)
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!" echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
return return
endif endif
@ -1280,10 +1299,7 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{
let cmd = 'edit' let cmd = 'edit'
endif endif
if g:vimwiki_debug == 3 call Validate_wiki_options(idx)
echom "--- Goto_index g:curr_idx=".g:vimwiki_current_idx." ww_idx=".idx.""
endif
call vimwiki#base#edit_file(cmd, call vimwiki#base#edit_file(cmd,
\ VimwikiGet('path', idx).VimwikiGet('index', idx). \ VimwikiGet('path', idx).VimwikiGet('index', idx).
\ VimwikiGet('ext', idx), \ VimwikiGet('ext', idx),
@ -1303,7 +1319,7 @@ function! vimwiki#base#delete_link() "{{{
try try
call delete(fname) call delete(fname)
catch /.*/ catch /.*/
echomsg 'vimwiki: Cannot delete "'.expand('%:t:r').'"!' echomsg 'Vimwiki Error: Cannot delete "'.expand('%:t:r').'"!'
return return
endtry endtry
@ -1324,7 +1340,7 @@ function! vimwiki#base#rename_link() "{{{
" there is no file (new one maybe) " there is no file (new one maybe)
if glob(expand('%:p')) == '' if glob(expand('%:p')) == ''
echomsg 'vimwiki: Cannot rename "'.expand('%:p'). echomsg 'Vimwiki Error: Cannot rename "'.expand('%:p').
\'". It does not exist! (New file? Save it before renaming.)' \'". It does not exist! (New file? Save it before renaming.)'
return return
endif endif
@ -1338,13 +1354,13 @@ function! vimwiki#base#rename_link() "{{{
if new_link =~# '[/\\]' if new_link =~# '[/\\]'
" It is actually doable but I do not have free time to do it. " It is actually doable but I do not have free time to do it.
echomsg 'vimwiki: Cannot rename to a filename with path!' echomsg 'Vimwiki Error: Cannot rename to a filename with path!'
return return
endif endif
" check new_fname - it should be 'good', not empty " check new_fname - it should be 'good', not empty
if substitute(new_link, '\s', '', 'g') == '' if substitute(new_link, '\s', '', 'g') == ''
echomsg 'vimwiki: Cannot rename to an empty filename!' echomsg 'Vimwiki Error: Cannot rename to an empty filename!'
return return
endif endif
@ -1359,19 +1375,19 @@ function! vimwiki#base#rename_link() "{{{
" do not rename if file with such name exists " do not rename if file with such name exists
let fname = glob(new_fname) let fname = glob(new_fname)
if fname != '' if fname != ''
echomsg 'vimwiki: Cannot rename to "'.new_fname. echomsg 'Vimwiki Error: Cannot rename to "'.new_fname.
\ '". File with that name exist!' \ '". File with that name exist!'
return return
endif endif
" rename wiki link file " rename wiki link file
try try
echomsg "Renaming ".VimwikiGet('path').old_fname." to ".new_fname echomsg 'Vimwiki: Renaming '.VimwikiGet('path').old_fname.' to '.new_fname
let res = rename(expand('%:p'), expand(new_fname)) let res = rename(expand('%:p'), expand(new_fname))
if res != 0 if res != 0
throw "Cannot rename!" throw "Cannot rename!"
end end
catch /.*/ catch /.*/
echomsg 'vimwiki: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"' echomsg 'Vimwiki Error: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"'
return return
endtry endtry
@ -1412,7 +1428,7 @@ function! vimwiki#base#rename_link() "{{{
\ cur_buffer[1]]) \ cur_buffer[1]])
" execute 'bwipeout '.escape(cur_buffer[0], ' ') " execute 'bwipeout '.escape(cur_buffer[0], ' ')
echomsg old_fname." is renamed to ".new_fname echomsg 'Vimwiki: '.old_fname.' is renamed to '.new_fname
let &more = setting_more let &more = setting_more
endfunction " }}} endfunction " }}}
@ -1720,10 +1736,27 @@ endfunction " }}}
" a:create == 0: update if TOC exists " a:create == 0: update if TOC exists
function! vimwiki#base#table_of_contents(create) function! vimwiki#base#table_of_contents(create)
" collect new headers " collect new headers
let is_inside_pre_or_math = 0 " 1: inside pre, 2: inside math, 0: outside
let headers = [] let headers = []
let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]] let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
for lnum in range(1, line('$')) for lnum in range(1, line('$'))
let line_content = getline(lnum) let line_content = getline(lnum)
if (is_inside_pre_or_math == 1 && line_content =~# g:vimwiki_rxPreEnd) ||
\ (is_inside_pre_or_math == 2 && line_content =~# g:vimwiki_rxMathEnd)
let is_inside_pre_or_math = 0
continue
endif
if is_inside_pre_or_math > 0
continue
endif
if line_content =~# g:vimwiki_rxPreStart
let is_inside_pre_or_math = 1
continue
endif
if line_content =~# g:vimwiki_rxMathStart
let is_inside_pre_or_math = 2
continue
endif
if line_content !~# g:vimwiki_rxHeader if line_content !~# g:vimwiki_rxHeader
continue continue
endif endif
@ -1878,9 +1911,6 @@ function! s:normalize_link_syntax_n() " {{{
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr, \ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
\ g:vimwiki_WikiLinkTemplate2) \ g:vimwiki_WikiLinkTemplate2)
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink, sub) call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink, sub)
if g:vimwiki_debug > 1
echomsg "WikiLink: ".lnk." Sub: ".sub
endif
return return
endif endif
@ -1888,9 +1918,15 @@ function! s:normalize_link_syntax_n() " {{{
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl) let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl)
if !empty(lnk) if !empty(lnk)
" NO-OP !! " NO-OP !!
if g:vimwiki_debug > 1 return
echomsg "WikiIncl: ".lnk." Sub: ".lnk endif
endif
" try Weblink
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWeblink)
if !empty(lnk)
let sub = vimwiki#base#normalize_link_helper(lnk,
\ lnk, '', g:vimwiki_WikiLinkTemplate2)
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWeblink, sub)
return return
endif endif
@ -1907,9 +1943,6 @@ function! s:normalize_link_syntax_n() " {{{
\ g:vimwiki_WikiLinkTemplate1) \ g:vimwiki_WikiLinkTemplate1)
endif endif
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub) call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
if g:vimwiki_debug > 1
echomsg "Word: ".lnk." Sub: ".sub
endif
return return
endif endif
@ -1958,6 +1991,18 @@ function! vimwiki#base#normalize_link(is_visual_mode) "{{{
endif endif
endfunction "}}} endfunction "}}}
" vimwiki#base#detect_nested_syntax
function! vimwiki#base#detect_nested_syntax() "{{{
let last_word = '\v.*<(\w+)\s*$'
let lines = map(filter(getline(1, "$"), 'v:val =~ "{{{" && v:val =~ last_word'),
\ 'substitute(v:val, last_word, "\\=submatch(1)", "")')
let dict = {}
for elem in lines
let dict[elem] = elem
endfor
return dict
endfunction "}}}
" }}} " }}}
" Command completion functions {{{ " Command completion functions {{{

View File

@ -83,7 +83,7 @@ fun! s:read_captions(files) "{{{
return result return result
endfun "}}} endfun "}}}
fun! s:get_diary_links(...) "{{{ fun! s:get_diary_links() "{{{
let rx = '^\d\{4}-\d\d-\d\d' let rx = '^\d\{4}-\d\d-\d\d'
let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext')) let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext'))
let files = split(s_files, '\n') let files = split(s_files, '\n')
@ -92,9 +92,6 @@ fun! s:get_diary_links(...) "{{{
" remove backup files (.wiki~) " remove backup files (.wiki~)
call filter(files, 'v:val !~# ''.*\~$''') call filter(files, 'v:val !~# ''.*\~$''')
if a:0
call add(files, a:1)
endif
let links_with_captions = s:read_captions(files) let links_with_captions = s:read_captions(files)
return links_with_captions return links_with_captions
@ -129,14 +126,10 @@ function! s:sort(lst) "{{{
endif endif
endfunction "}}} endfunction "}}}
function! s:format_diary(...) "{{{ function! s:format_diary() "{{{
let result = [] let result = []
if a:0 let g_files = s:group_links(s:get_diary_links())
let g_files = s:group_links(s:get_diary_links(a:1))
else
let g_files = s:group_links(s:get_diary_links())
endif
for year in s:sort(keys(g_files)) for year in s:sort(keys(g_files))
call add(result, '') call add(result, '')
@ -168,7 +161,7 @@ endfunction "}}}
function! vimwiki#diary#make_note(wnum, ...) "{{{ function! vimwiki#diary#make_note(wnum, ...) "{{{
if a:wnum > len(g:vimwiki_list) if a:wnum > len(g:vimwiki_list)
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!" echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
return return
endif endif
@ -198,7 +191,7 @@ endfunction "}}}
function! vimwiki#diary#goto_diary_index(wnum) "{{{ function! vimwiki#diary#goto_diary_index(wnum) "{{{
if a:wnum > len(g:vimwiki_list) if a:wnum > len(g:vimwiki_list)
echom "vimwiki: Wiki ".a:wnum." is not registered in g:vimwiki_list!" echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in g:vimwiki_list!'
return return
endif endif
@ -261,7 +254,7 @@ function! vimwiki#diary#generate_diary_section() "{{{
call vimwiki#base#update_listing_in_buffer(s:format_diary(), call vimwiki#base#update_listing_in_buffer(s:format_diary(),
\ VimwikiGet('diary_header'), content_rx, line('$')+1, 1) \ VimwikiGet('diary_header'), content_rx, line('$')+1, 1)
else else
echom "vimwiki: You can generate diary links only in a diary index page!" echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
endif endif
endfunction "}}} endfunction "}}}

View File

@ -80,9 +80,10 @@ function! s:create_default_CSS(path) " {{{
if default_css != '' if default_css != ''
let lines = readfile(default_css) let lines = readfile(default_css)
call writefile(lines, css_full_name) call writefile(lines, css_full_name)
echomsg "Default style.css has been created." return 1
endif endif
endif endif
return 0
endfunction "}}} endfunction "}}}
function! s:template_full_name(name) "{{{ function! s:template_full_name(name) "{{{
@ -112,7 +113,7 @@ function! s:get_html_template(template) "{{{
let lines = readfile(template_name) let lines = readfile(template_name)
return lines return lines
catch /E484/ catch /E484/
echomsg 'vimwiki: html template '.template_name. echomsg 'Vimwiki: HTML template '.template_name.
\ ' does not exist!' \ ' does not exist!'
endtry endtry
endif endif
@ -171,7 +172,7 @@ function! s:delete_html_files(path) "{{{
try try
call delete(fname) call delete(fname)
catch catch
echomsg 'vimwiki: Cannot delete '.fname echomsg 'Vimwiki Error: Cannot delete '.fname
endtry endtry
endfor endfor
endfunction "}}} endfunction "}}}
@ -396,11 +397,6 @@ function! s:tag_wikiincl(value) "{{{
let link_infos = vimwiki#base#resolve_link(url_0) let link_infos = vimwiki#base#resolve_link(url_0)
" TODO: migrate non-essential debugging messages into g:VimwikiLog
if g:vimwiki_debug > 1
echom string(link_infos)
endif
if link_infos.scheme =~# '\mlocal\|wiki\d\+\|diary' if link_infos.scheme =~# '\mlocal\|wiki\d\+\|diary'
let url = vimwiki#path#relpath(fnamemodify(s:current_html_file, ':h'), let url = vimwiki#path#relpath(fnamemodify(s:current_html_file, ':h'),
\ link_infos.filename) \ link_infos.filename)
@ -455,12 +451,6 @@ function! s:tag_wikilink(value) "{{{
let html_link = link_infos.filename let html_link = link_infos.filename
endif endif
" generate html output
" TODO: migrate non-essential debugging messages into g:VimwikiLog
if g:vimwiki_debug > 1
echom string(link_infos)
endif
if link_infos.anchor != '' if link_infos.anchor != ''
let anchor = substitute(link_infos.anchor, '#', '-', 'g') let anchor = substitute(link_infos.anchor, '#', '-', 'g')
let html_link .= '#'.anchor let html_link .= '#'.anchor
@ -1057,6 +1047,8 @@ function! s:process_tag_h(line, id) "{{{
let h_part .= '>' let h_part .= '>'
endif endif
let h_text = s:process_inline_tags(h_text, a:id)
let line = h_part.h_text.'</h'.h_level.'></div>' let line = h_part.h_text.'</h'.h_level.'></div>'
let processed = 1 let processed = 1
@ -1263,8 +1255,6 @@ function! s:parse_line(line, state) " {{{
let state.quote = s:close_tag_quote(state.quote, res_lines) let state.quote = s:close_tag_quote(state.quote, res_lines)
let state.para = s:close_tag_para(state.para, res_lines) let state.para = s:close_tag_para(state.para, res_lines)
let line = s:process_inline_tags(line, state.header_ids)
call add(res_lines, line) call add(res_lines, line)
endif endif
endif endif
@ -1377,10 +1367,7 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
\ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-')) \ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-'))
endfunction " }}} endfunction " }}}
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{ function! s:convert_file(path_html, wikifile) "{{{
let starttime = reltime() " start the clock
let done = 0 let done = 0
let wikifile = fnamemodify(a:wikifile, ":p") let wikifile = fnamemodify(a:wikifile, ":p")
@ -1403,10 +1390,6 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
let lsource = readfile(wikifile) let lsource = readfile(wikifile)
let ldest = [] let ldest = []
"if g:vimwiki_debug
" echo 'Generating HTML ... '
"endif
call vimwiki#path#mkdir(path_html) call vimwiki#path#mkdir(path_html)
" nohtml placeholder -- to skip html generation. " nohtml placeholder -- to skip html generation.
@ -1474,13 +1457,13 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
if nohtml if nohtml
echon "\r"."%nohtml placeholder found" echon "\r"."%nohtml placeholder found"
return return ''
endif endif
call s:remove_blank_lines(ldest) call s:remove_blank_lines(ldest)
"" process end of file " process end of file
"" close opened tags if any " close opened tags if any
let lines = [] let lines = []
call s:close_tag_quote(state.quote, lines) call s:close_tag_quote(state.quote, lines)
call s:close_tag_para(state.para, lines) call s:close_tag_para(state.para, lines)
@ -1511,36 +1494,35 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
call map(html_lines, 'substitute(v:val, "%encoding%", "'. enc .'", "g")') call map(html_lines, 'substitute(v:val, "%encoding%", "'. enc .'", "g")')
let html_lines = s:html_insert_contents(html_lines, ldest) " %contents% let html_lines = s:html_insert_contents(html_lines, ldest) " %contents%
"" make html file.
call writefile(html_lines, path_html.htmlfile) call writefile(html_lines, path_html.htmlfile)
let done = 1 let done = 1
endif endif
if done == 0 if done == 0
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!' echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
return return ''
endif endif
" measure the elapsed time
let time1 = vimwiki#u#time(starttime) "XXX
call VimwikiLog_extend('html',[htmlfile,time1])
"if g:vimwiki_debug
" echon "\r".htmlfile.' written (time: '.time1.'s)'
"endif
return path_html.htmlfile return path_html.htmlfile
endfunction "}}} endfunction "}}}
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
let result = s:convert_file(a:path_html, a:wikifile)
if result != ''
call s:create_default_CSS(a:path_html)
endif
return result
endfunction "}}}
function! vimwiki#html#WikiAll2HTML(path_html) "{{{ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
if !s:syntax_supported() && !s:use_custom_wiki2html() if !s:syntax_supported() && !s:use_custom_wiki2html()
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!' echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
return return
endif endif
echomsg 'Saving vimwiki files...' echomsg 'Vimwiki: Saving Vimwiki files ...'
let save_eventignore = &eventignore let save_eventignore = &eventignore
let &eventignore = "all" let &eventignore = "all"
let cur_buf = bufname('%') let cur_buf = bufname('%')
@ -1551,10 +1533,10 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
let path_html = expand(a:path_html) let path_html = expand(a:path_html)
call vimwiki#path#mkdir(path_html) call vimwiki#path#mkdir(path_html)
echomsg 'Deleting non-wiki html files...' echomsg 'Vimwiki: Deleting non-wiki html files ...'
call s:delete_html_files(path_html) call s:delete_html_files(path_html)
echomsg 'Converting wiki to html files...' echomsg 'Vimwiki: Converting wiki to html files ...'
let setting_more = &more let setting_more = &more
setlocal nomore setlocal nomore
@ -1572,20 +1554,23 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir)) call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir))
if !s:is_html_uptodate(wikifile) if !s:is_html_uptodate(wikifile)
echomsg 'Processing '.wikifile echomsg 'Vimwiki: Processing '.wikifile
call vimwiki#html#Wiki2HTML(path_html, wikifile) call s:convert_file(path_html, wikifile)
else else
echomsg 'Skipping '.wikifile echomsg 'Vimwiki: Skipping '.wikifile
endif endif
endfor endfor
" reset 'subdir' state variable " reset 'subdir' state variable
call VimwikiSet('subdir', current_subdir) call VimwikiSet('subdir', current_subdir)
call VimwikiSet('invsubdir', current_invsubdir) call VimwikiSet('invsubdir', current_invsubdir)
call s:create_default_CSS(path_html) let created = s:create_default_CSS(path_html)
echomsg 'HTML exported to '.path_html if created
echomsg 'Done!' echomsg 'Vimwiki: Default style.css has been created'
endif
echomsg 'Vimwiki: HTML exported to '.path_html
echomsg 'Vimwiki: Done!'
let &more = setting_more let &more = setting_more
endfunction "}}} endfunction "}}}

View File

@ -376,10 +376,10 @@ endfunction "}}}
"If there is no second argument, 0 is returned at a header, otherwise the "If there is no second argument, 0 is returned at a header, otherwise the
"header is skipped "header is skipped
function! s:get_next_line(lnum, ...) "{{{ function! s:get_next_line(lnum, ...) "{{{
if getline(a:lnum) =~# '^\s*'.g:vimwiki_rxPreStart if getline(a:lnum) =~# g:vimwiki_rxPreStart
let cur_ln = a:lnum + 1 let cur_ln = a:lnum + 1
while cur_ln <= line('$') && while cur_ln <= line('$') &&
\ getline(cur_ln) !~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$' \ getline(cur_ln) !~# g:vimwiki_rxPreEnd
let cur_ln += 1 let cur_ln += 1
endwhile endwhile
let next_line = cur_ln let next_line = cur_ln
@ -404,10 +404,10 @@ endfunction "}}}
function! s:get_prev_line(lnum) "{{{ function! s:get_prev_line(lnum) "{{{
let prev_line = prevnonblank(a:lnum-1) let prev_line = prevnonblank(a:lnum-1)
if getline(prev_line) =~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$' if getline(prev_line) =~# g:vimwiki_rxPreEnd
let cur_ln = a:lnum - 1 let cur_ln = a:lnum - 1
while 1 while 1
if cur_ln == 0 || getline(cur_ln) =~# '^\s*'.g:vimwiki_rxPreStart if cur_ln == 0 || getline(cur_ln) =~# g:vimwiki_rxPreStart
break break
endif endif
let cur_ln -= 1 let cur_ln -= 1

View File

@ -108,6 +108,8 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
if lnk != "" if lnk != ""
if !VimwikiLinkHandler(lnk) if !VimwikiLinkHandler(lnk)
if !vimwiki#markdown_base#open_reflink(lnk) if !vimwiki#markdown_base#open_reflink(lnk)
" remove the extension from the filename if exists
let lnk = substitute(lnk, VimwikiGet('ext').'$', '', '')
call vimwiki#base#open_link(cmd, lnk) call vimwiki#base#open_link(cmd, lnk)
endif endif
endif endif
@ -133,9 +135,6 @@ function! s:normalize_link_syntax_n() " {{{
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl) let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl)
if !empty(lnk) if !empty(lnk)
" NO-OP !! " NO-OP !!
if g:vimwiki_debug > 1
echomsg "WikiIncl: ".lnk." Sub: ".lnk
endif
return return
endif endif
@ -146,9 +145,6 @@ function! s:normalize_link_syntax_n() " {{{
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr, \ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
\ g:vimwiki_WikiLink1Template2) \ g:vimwiki_WikiLink1Template2)
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink0, sub) call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink0, sub)
if g:vimwiki_debug > 1
echomsg "WikiLink: ".lnk." Sub: ".sub
endif
return return
endif endif
@ -159,9 +155,6 @@ function! s:normalize_link_syntax_n() " {{{
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr, \ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
\ g:vimwiki_WikiLinkTemplate2) \ g:vimwiki_WikiLinkTemplate2)
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink1, sub) call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink1, sub)
if g:vimwiki_debug > 1
echomsg "WikiLink: ".lnk." Sub: ".sub
endif
return return
endif endif
@ -172,9 +165,6 @@ function! s:normalize_link_syntax_n() " {{{
\ g:vimwiki_rxWeblinkMatchUrl, g:vimwiki_rxWeblinkMatchDescr, \ g:vimwiki_rxWeblinkMatchUrl, g:vimwiki_rxWeblinkMatchDescr,
\ g:vimwiki_Weblink1Template) \ g:vimwiki_Weblink1Template)
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWeblink, sub) call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWeblink, sub)
if g:vimwiki_debug > 1
echomsg "WebLink: ".lnk." Sub: ".sub
endif
return return
endif endif
@ -185,11 +175,8 @@ function! s:normalize_link_syntax_n() " {{{
if !empty(lnk) if !empty(lnk)
let sub = vimwiki#base#normalize_link_helper(lnk, let sub = vimwiki#base#normalize_link_helper(lnk,
\ g:vimwiki_rxWord, '', \ g:vimwiki_rxWord, '',
\ g:vimwiki_WikiLinkTemplate1) \ g:vimwiki_Weblink1Template)
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub) call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
if g:vimwiki_debug > 1
echomsg "Word: ".lnk." Sub: ".sub
endif
return return
endif endif
@ -207,9 +194,10 @@ function! s:normalize_link_syntax_v() " {{{
try try
norm! gvy norm! gvy
let visual_selection = @" let visual_selection = @"
let visual_selection = substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', '\='."'".visual_selection."'", '') let link = substitute(g:vimwiki_Weblink1Template, '__LinkUrl__', '\='."'".visual_selection."'", '')
let link = substitute(link, '__LinkDescription__', '\='."'".visual_selection."'", '')
call setreg('"', visual_selection, 'v') call setreg('"', link, 'v')
" paste result " paste result
norm! `>pgvd norm! `>pgvd

View File

@ -148,3 +148,22 @@ function! vimwiki#path#is_absolute(path) "{{{
return a:path =~# '\m^/\|\~/' return a:path =~# '\m^/\|\~/'
endif endif
endfunction "}}} endfunction "}}}
" Combine a directory and a file into one path, doesn't generate duplicate
" path separator in case the directory is also having an ending / or \. This
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
" valid path.
if vimwiki#u#is_windows()
function! vimwiki#path#join_path(directory, file)
let directory = vimwiki#path#chomp_slash(a:directory)
let file = substitute(a:file, '\m^[\\/]\+', '', '')
return directory . '/' . file
endfunction
else
function! vimwiki#path#join_path(directory, file)
let directory = substitute(a:directory, '\m/\+$', '', '')
let file = substitute(a:file, '\m^/\+', '', '')
return directory . '/' . file
endfunction
endif

View File

@ -41,12 +41,14 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files) "{{{
call s:write_tags_metadata(metadata) call s:write_tags_metadata(metadata)
else " full rebuild else " full rebuild
let files = vimwiki#base#find_files(g:vimwiki_current_idx, 0) let files = vimwiki#base#find_files(g:vimwiki_current_idx, 0)
let wiki_base_dir = VimwikiGet('path', g:vimwiki_current_idx)
let tags_file_last_modification = let tags_file_last_modification =
\ getftime(vimwiki#tags#metadata_file_path()) \ getftime(vimwiki#tags#metadata_file_path())
let metadata = s:load_tags_metadata() let metadata = s:load_tags_metadata()
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 page_name = fnamemodify(file, ':t:r') let subdir = vimwiki#base#subdir(wiki_base_dir, file)
let page_name = subdir . fnamemodify(file, ':t:r')
let tags = s:scan_tags(readfile(file), page_name) let tags = s:scan_tags(readfile(file), page_name)
let metadata = s:remove_page_from_tags(metadata, page_name) let metadata = s:remove_page_from_tags(metadata, page_name)
let metadata = s:merge_tags(metadata, page_name, tags) let metadata = s:merge_tags(metadata, page_name, tags)
@ -139,7 +141,7 @@ endfunction " }}}
" vimwiki#tags#metadata_file_path " vimwiki#tags#metadata_file_path
" Returns tags metadata file path " Returns tags metadata file path
function! vimwiki#tags#metadata_file_path() abort "{{{ function! vimwiki#tags#metadata_file_path() abort "{{{
return fnamemodify(VimwikiGet('path') . '/' . s:TAGS_METADATA_FILE_NAME, ':p') return fnamemodify(vimwiki#path#join_path(VimwikiGet('path'), s:TAGS_METADATA_FILE_NAME), ':p')
endfunction " }}} endfunction " }}}
" s:load_tags_metadata " s:load_tags_metadata
@ -213,6 +215,38 @@ function! s:merge_tags(metadata, pagename, file_metadata) "{{{
return metadata return metadata
endfunction " }}} endfunction " }}}
" s:tags_entry_cmp
" Compares two actual lines from tags file. Return value is in strcmp style.
" See help on sort() -- that's what this function is going to be used for.
" See also s:write_tags_metadata below -- that's where we compose these tags
" file lines.
"
" This function is needed for tags sorting, since plain sort() compares line
" numbers as strings, not integers, and so, for example, tag at line 14
" preceeds the same tag on the same page at line 9. (Because string "14" is
" alphabetically 'less than' string "9".)
function! s:tags_entry_cmp(i1, i2) "{{{
let items = []
for orig_item in [a:i1, a:i2]
let fields = split(orig_item, "\t")
let item = {}
let item.text = fields[0]."\t".fields[1]
let item.lineno = 0 + matchstr(fields[2], '\m\d\+')
call add(items, item)
endfor
if items[0].text > items[1].text
return 1
elseif items[0].text < items[1].text
return -1
elseif items[0].lineno > items[1].lineno
return 1
elseif items[0].lineno < items[1].lineno
return -1
else
return 0
endif
endfunction " }}}
" s:write_tags_metadata " s:write_tags_metadata
" Saves metadata object into a file. Throws exceptions in case of problems. " Saves metadata object into a file. Throws exceptions in case of problems.
function! s:write_tags_metadata(metadata) "{{{ function! s:write_tags_metadata(metadata) "{{{
@ -234,7 +268,7 @@ function! s:write_tags_metadata(metadata) "{{{
\) \)
endfor endfor
endfor endfor
call sort(tags) call sort(tags, "s:tags_entry_cmp")
call insert(tags, "!_TAG_FILE_SORTED\t1\t") call insert(tags, "!_TAG_FILE_SORTED\t1\t")
call writefile(tags, metadata_path) call writefile(tags, metadata_path)
endfunction " }}} endfunction " }}}
@ -283,7 +317,7 @@ function! vimwiki#tags#generate_tags(...) abort "{{{
\ '', \ '',
\ substitute(g:vimwiki_rxH2_Template, '__Header__', tagname, ''), \ substitute(g:vimwiki_rxH2_Template, '__Header__', tagname, ''),
\ '' ]) \ '' ])
for taglink in tags_entries[tagname] for taglink in sort(tags_entries[tagname])
call add(lines, bullet . call add(lines, bullet .
\ substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', taglink, '')) \ substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', taglink, ''))
endfor endfor

View File

@ -415,7 +415,6 @@ function! vimwiki#tbl#goto_prev_col() "{{{
let newcol = s:get_indent(lnum) let newcol = s:get_indent(lnum)
let max_lens = s:get_cell_max_lens(lnum) let max_lens = s:get_cell_max_lens(lnum)
let prev_cell_len = 0 let prev_cell_len = 0
echom string(max_lens)
for cell_len in values(max_lens) for cell_len in values(max_lens)
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space> let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
if newcol + delta > curcol-1 if newcol + delta > curcol-1

View File

@ -32,18 +32,13 @@ function! vimwiki#u#is_macos()
return os == 'Darwin' || os == 'Mac' return os == 'Darwin' || os == 'Mac'
endfunction endfunction
function! vimwiki#u#time(starttime) "{{{
" measure the elapsed time and cut away miliseconds and smaller
return matchstr(reltimestr(reltime(a:starttime)),'\d\+\(\.\d\d\)\=')
endfunction "}}}
function! vimwiki#u#count_first_sym(line) "{{{ function! vimwiki#u#count_first_sym(line) "{{{
let first_sym = matchstr(a:line, '\S') let first_sym = matchstr(a:line, '\S')
return len(matchstr(a:line, first_sym.'\+')) return len(matchstr(a:line, first_sym.'\+'))
endfunction "}}} endfunction "}}}
function! vimwiki#u#escape(string) "{{{ function! vimwiki#u#escape(string) "{{{
return escape(a:string, '.*[]\^$') return escape(a:string, '~.*[]\^$')
endfunction "}}} endfunction "}}}
" Load concrete Wiki syntax: sets regexes and templates for headers and links " Load concrete Wiki syntax: sets regexes and templates for headers and links

View File

@ -9,7 +9,7 @@
|___| |___| |_| |_||__| |__||___| |___| |_||___| ~ |___| |___| |_| |_||__| |__||___| |___| |_||___| ~
Version: 2.2 Version: 2.3
============================================================================== ==============================================================================
CONTENTS *vimwiki* CONTENTS *vimwiki*
@ -78,8 +78,8 @@ Feed it with the following example:
Place your cursor on 'Tasks' and press Enter to create a link. Once pressed, Place your cursor on 'Tasks' and press Enter to create a link. Once pressed,
'Tasks' will become '[[Tasks]]' -- a Vimwiki link. Press Enter again to 'Tasks' will become '[[Tasks]]' -- a Vimwiki link. Press Enter again to
open it. Edit the file, save it, and then press Backspace to jump back to your open it. Edit the file, save it, and then press Backspace to jump back to
index. your index.
A Vimwiki link can be constructed from more than one word. Just visually A Vimwiki link can be constructed from more than one word. Just visually
select the words to be linked and press Enter. Try it with 'Project select the words to be linked and press Enter. Try it with 'Project
@ -196,6 +196,24 @@ See also |:VimwikiMakeDiaryNote|
See also |:VimwikiTabMakeDiaryNote| See also |:VimwikiTabMakeDiaryNote|
[count]<Leader>w<Leader>y or <Plug>VimwikiMakeYesterdayDiaryNote
Open diary wiki-file for yesterday of the [count]'s wiki.
<Leader>w<Leader>y opens diary wiki-file for yesterday in the first
wiki from |g:vimwiki_list|.
1<Leader>w<Leader>y as above opens diary wiki-file for yesterday in
the first wiki from |g:vimwiki_list|.
2<Leader>w<Leader>y opens diary wiki-file for yesterday in the second
wiki from |g:vimwiki_list|.
3<Leader>w<Leader>y opens diary wiki-file for yesterday in the third
wiki from |g:vimwiki_list|.
etc.
To remap: >
:nmap <Leader>dy <Plug>VimwikiMakeYesterdayDiaryNote
<
See also |:VimwikiMakeYesterdayDiaryNote|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3.2. Local mappings 3.2. Local mappings
@ -358,70 +376,72 @@ gLr Renumber list items in all numbered lists in the whole
:nmap <c-r> <Plug>VimwikiRenumberAllLists :nmap <c-r> <Plug>VimwikiRenumberAllLists
< <
*vimwiki_glstar* *vimwiki_gLstar* *vimwiki_glstar* *vimwiki_gLstar*
gl* Make a list item out of normal line or change the symbol gl* Make a list item out of a normal line or change the
of the current item to *. symbol of the current item to *.
gL* Change the symbol of the current list to *. gL* Change the symbol of the current list to *.
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo *<CR> noremap glo :VimwikiChangeSymbolTo *<CR>
noremap glO :VimwikiChangeSymbolInListTo *<CR> noremap glO :VimwikiChangeSymbolInListTo *<CR>
< <
*vimwiki_gl#* *vimwiki_gL#* *vimwiki_gl#* *vimwiki_gL#*
gl# Make a list item out of normal line or change the symbol gl# Make a list item out of a normal line or change the
of the current item to #. symbol of the current item to #.
gL# Change the symbol of the current list to #. gL# Change the symbol of the current list to #.
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo #<CR> noremap glo :VimwikiChangeSymbolTo #<CR>
noremap glO :VimwikiChangeSymbolInListTo #<CR> noremap glO :VimwikiChangeSymbolInListTo #<CR>
< <
*vimwiki_gl-* *vimwiki_gL-* *vimwiki_gl-* *vimwiki_gL-*
gl- Make a list item out of normal line or change the symbol gl- Make a list item out of a normal line or change the
of the current item to -. symbol of the current item to -.
gL- Change the symbol of the current list to -. gL- Change the symbol of the current list to -.
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo -<CR> noremap glo :VimwikiChangeSymbolTo -<CR>
noremap glO :VimwikiChangeSymbolInListTo -<CR> noremap glO :VimwikiChangeSymbolInListTo -<CR>
< <
*vimwiki_gl1* *vimwiki_gL1* *vimwiki_gl1* *vimwiki_gL1*
gl1 Make a list item out of normal line or change the symbol gl1 Make a list item out of a normal line or change the
of the current item to 1., the numbering is adjusted symbol of the current item to 1., the numbering is
according to the surrounding list items. adjusted according to the surrounding list items.
gL1 Change the symbol of the current list to 1. 2. 3. ... gL1 Change the symbol of the current list to 1. 2. 3. ...
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo 1.<CR> noremap glo :VimwikiChangeSymbolTo 1.<CR>
noremap glO :VimwikiChangeSymbolInListTo 1.<CR> noremap glO :VimwikiChangeSymbolInListTo 1.<CR>
< <
*vimwiki_gla* *vimwiki_gLa* *vimwiki_gla* *vimwiki_gLa*
gla Make a list item out of normal line or change the symbol gla Make a list item out of a normal line or change the
of the current item to a), the numbering is adjusted symbol of the current item to a), the numbering is
according to the surrounding list items. adjusted according to the surrounding list items.
gLa Change the symbol of the current list to a) b) c) ... gLa Change the symbol of the current list to a) b) c) ...
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo a)<CR> noremap glo :VimwikiChangeSymbolTo a)<CR>
noremap glO :VimwikiChangeSymbolInListTo a)<CR> noremap glO :VimwikiChangeSymbolInListTo a)<CR>
< <
*vimwiki_glA* *vimwiki_gLA* *vimwiki_glA* *vimwiki_gLA*
glA Make a list item out of normal line or change the symbol glA Make a list item out of a normal line or change the
of the current item to A), the numbering is adjusted symbol of the current item to A), the numbering is
according to the surrounding list items. adjusted according to the surrounding list items.
gLA Change the symbol of the current list to A) B) C) ... gLA Change the symbol of the current list to A) B) C) ...
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo A)<CR> noremap glo :VimwikiChangeSymbolTo A)<CR>
noremap glO :VimwikiChangeSymbolInListTo A)<CR> noremap glO :VimwikiChangeSymbolInListTo A)<CR>
< <
*vimwiki_gli* *vimwiki_gLi* *vimwiki_gli* *vimwiki_gLi*
gli Make a list item out of normal line or change the symbol gli Make a list item out of a normal line or change the
of the current item to i), the numbering is adjusted symbol of the current item to i), the numbering is
according to the surrounding list items. adjusted according to the surrounding list items.
gLi Change the symbol of the current list to i) ii) iii) ... gLi Change the symbol of the current list to
i) ii) iii) ...
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo i)<CR> noremap glo :VimwikiChangeSymbolTo i)<CR>
noremap glO :VimwikiChangeSymbolInListTo i)<CR> noremap glO :VimwikiChangeSymbolInListTo i)<CR>
< <
*vimwiki_glI* *vimwiki_gLI* *vimwiki_glI* *vimwiki_gLI*
glI Make a list item out of normal line or change the symbol glI Make a list item out of a normal line or change the
of the current item to I), the numbering is adjusted symbol of the current item to I), the numbering is
according to the surrounding list items. adjusted according to the surrounding list items.
gLI Change the symbol of the current list to I) II) III) ... gLI Change the symbol of the current list to
I) II) III) ...
To remap: > To remap: >
noremap glo :VimwikiChangeSymbolTo I)<CR> noremap glo :VimwikiChangeSymbolTo I)<CR>
noremap glO :VimwikiChangeSymbolInListTo I)<CR> noremap glO :VimwikiChangeSymbolInListTo I)<CR>
@ -567,6 +587,9 @@ il A single list item.
*:VimwikiTabMakeDiaryNote* *:VimwikiTabMakeDiaryNote*
Open diary wiki-file for today of the current wiki in a new tab. Open diary wiki-file for today of the current wiki in a new tab.
*:VimwikiMakeYesterdayDiaryNote*
Open diary wiki-file for yesterday of the current wiki.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.2. Local commands *vimwiki-local-commands* 4.2. Local commands *vimwiki-local-commands*
@ -793,8 +816,8 @@ identify wikilinks whose targets are not found.
Interwiki:~ Interwiki:~
If you maintain more than one wiki, you can create interwiki links between them If you maintain more than one wiki, you can create interwiki links between
by adding a numbered prefix "wikiX:" in front of a link: > them by adding a numbered prefix "wikiX:" in front of a link: >
[[wiki1:This is a link]] [[wiki1:This is a link]]
or: > or: >
[[wiki1:This is a link source|Description of the link]] [[wiki1:This is a link source|Description of the link]]
@ -873,7 +896,7 @@ in HTML: >
alt="Vimwiki"/> alt="Vimwiki"/>
Transclude image with alternate text and some style: > Transclude image with alternate text and some style: >
{{http://.../vimwiki_logo.png|cool stuff|style="width:150px; height: 120px;"}} {{http://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
in HTML: > in HTML: >
<img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png" <img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
alt="cool stuff" style="width:150px; height:120px"/> alt="cool stuff" style="width:150px; height:120px"/>
@ -914,7 +937,7 @@ Reference-style links: >
a) [Link Name][Id] a) [Link Name][Id]
b) [Id][], using the "implicit link name" shortcut b) [Id][], using the "implicit link name" shortcut
Reference style links must always include *two* consecutive pairs of Reference style links must always include two consecutive pairs of
[-brackets, and field entries can not use "[" or "]". [-brackets, and field entries can not use "[" or "]".
@ -1149,7 +1172,7 @@ E.g.:
}}$ }}$
Note: no matter how many lines are used in the text file, the HTML will Note: no matter how many lines are used in the text file, the HTML will
compress it to *one* line only. compress it to one line only.
Block environment is similar to block display, but is able to use specific Block environment is similar to block display, but is able to use specific
LaTeX environments, such as 'align'. The syntax is the same as for block LaTeX environments, such as 'align'. The syntax is the same as for block
@ -1164,7 +1187,7 @@ Similar compression rules for the HTML page hold (as MathJax interprets the
LaTeX code). LaTeX code).
Note: the highlighting in Vim is automatic. For the rendering in HTML, you Note: the highlighting in Vim is automatic. For the rendering in HTML, you
have two *alternative* options: have two alternative options:
1. using the MathJax server for rendering (needs internet connection). 1. using the MathJax server for rendering (needs internet connection).
Add to your HTML template the following line: Add to your HTML template the following line:
@ -1200,7 +1223,7 @@ Text which starts with 4 or more spaces is a blockquote.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
5.10. Comments *vimwiki-syntax-comments* 5.10. Comments *vimwiki-syntax-comments*
A line that starts with %% is a comment. A line that starts with %% is a comment.
E.g.: > E.g.: >
@ -1215,7 +1238,7 @@ E.g.: >
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
5.12. Tags *vimwiki-syntax-tags* 5.12. Tags *vimwiki-syntax-tags*
You can tag a wiki file, a header or an arbitrary place in a wiki file. Then, You can tag a wiki file, a header or an arbitrary place in a wiki file. Then,
you can use Vim's built-in tag search functionality (see |tagsrch.txt|) or you can use Vim's built-in tag search functionality (see |tagsrch.txt|) or
@ -1290,7 +1313,7 @@ Hit |zr| one more time:
* [ ] Do stuff 3~ * [ ] Do stuff 3~
Note: If you use the default Vimwiki syntax, folding on list items will work Note: If you use the default Vimwiki syntax, folding on list items will work
properly only if all of them are indented using the current |shiftwidth|. properly only if all of them are indented using the current 'shiftwidth'.
For MediaWiki, * or # should be in the first column. For MediaWiki, * or # should be in the first column.
To turn folding on/off check |g:vimwiki_folding|. To turn folding on/off check |g:vimwiki_folding|.
@ -1619,21 +1642,21 @@ For example, consider the following file "Todo.wiki": >
- [ ] beg for *pay rise* - [ ] beg for *pay rise*
== Knitting club == == Knitting club ==
=== Knitting projects === === Knitting projects ===
- [ ] a funny *pig* - [ ] a *funny pig*
- [ ] a scary *dog* - [ ] a *scary dog*
Then, to jump from your index.wiki directly to your knitting projects, use: > Then, to jump from your index.wiki directly to your knitting projects, use: >
[[Todo#Knitting projects]] [[Todo#Knitting projects]]
Or, to jump to an individual project, use this link: > Or, to jump to an individual project, use this link: >
[[Todo#pig]] [[Todo#funny pig]]
Or, to jump to a tag, use this link: > Or, to jump to a tag, use this link: >
[[Todo#todo-lists]] [[Todo#todo-lists]]
If there are multiple instances of an anchor, you can use the long form which If there are multiple instances of an anchor, you can use the long form which
consists of the complete header hierarchy, separated by '#': > consists of the complete header hierarchy, separated by '#': >
[[Todo#My tasks#Knitting club#Knitting projects#dog]] [[Todo#My tasks#Knitting club#Knitting projects#scary dog]]
If you don't feel like typing the whole stuff, type just [[Todo# and then If you don't feel like typing the whole stuff, type just [[Todo# and then
|i_CTRL-X_CTRL-O| to start the omni completion of anchors. |i_CTRL-X_CTRL-O| to start the omni completion of anchors.
@ -1693,7 +1716,7 @@ described in |vimwiki-temporary-wiki|. For a list of per-wiki options, see
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
12.1 Registered Wiki *g:vimwiki_list* *vimwiki-register-wiki* 12.1 Registered Wiki *g:vimwiki_list* *vimwiki-register-wiki*
One or more wikis can be registered using the |g:vimwiki_list| variable. One or more wikis can be registered using the |g:vimwiki_list| variable.
@ -1734,7 +1757,7 @@ For clarity, in your .vimrc file you can define wiki options using separate
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
12.2 Temporary Wiki *vimwiki-temporary-wiki* 12.2 Temporary Wiki *vimwiki-temporary-wiki*
The creation of temporary wikis allows you to create a wiki on the fly. The creation of temporary wikis allows you to create a wiki on the fly.
@ -1994,6 +2017,28 @@ or in: >
}}} }}}
*vimwiki-option-automatic_nested_syntaxes*
------------------------------------------------------------------------------
Key Default value~
automatic_nested_syntaxes 1
Description~
If set, the nested syntaxes (|vimwiki-option-nested_syntaxes|) are
automatically derived when opening a buffer.
Just write your preformatted text in your file like this >
{{{xxx
my preformatted text
}}}
where xxx is a Vim filetype.
Note that you may have to reload the file (|:edit|) to see the highlight.
Since every file is scanned for the markers of preformatted text when it is
opened, it can be slow when you have huge files. In this case, set this option
to 0.
*vimwiki-option-diary_rel_path* *vimwiki-option-diary_rel_path*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Key Default value~ Key Default value~
@ -2075,7 +2120,7 @@ Key Default value~
list_margin -1 list_margin -1
Description~ Description~
Width of left-hand margin for lists. When negative, the current |shiftwidth| Width of left-hand margin for lists. When negative, the current 'shiftwidth'
is used. This affects the appearance of the generated links (see is used. This affects the appearance of the generated links (see
|:VimwikiGenerateLinks|), the Table of contents (|vimwiki-toc|) and the |:VimwikiGenerateLinks|), the Table of contents (|vimwiki-toc|) and the
behavior of the list manipulation commands |:VimwikiListChangeLevel| and the behavior of the list manipulation commands |:VimwikiListChangeLevel| and the
@ -2230,10 +2275,10 @@ Enable/disable Vimwiki's folding (outline) functionality. Folding in Vimwiki
can uses either the 'expr' or the 'syntax' |foldmethod| of Vim. can uses either the 'expr' or the 'syntax' |foldmethod| of Vim.
Value Description~ Value Description~
'' Disable folding. '' Disable folding
'expr' Folding based on expression (folds sections and code blocks). 'expr' Folding based on expression (folds sections and code blocks)
'syntax' Folding based on syntax (folds sections; slower than 'expr'). 'syntax' Folding based on syntax (folds sections; slower than 'expr')
'list' Folding based on expression (folds list subitems; much slower). 'list' Folding based on expression (folds list subitems; much slower)
Default: '' Default: ''
@ -2311,7 +2356,7 @@ A second example handles a new scheme, "vfile:", which behaves similar to
endif endif
let link_infos = vimwiki#base#resolve_link(link) let link_infos = vimwiki#base#resolve_link(link)
if link_infos.filename == '' if link_infos.filename == ''
echom 'Vimwiki Error: Unable to resolve link!' echomsg 'Vimwiki Error: Unable to resolve link!'
return 0 return 0
else else
exe 'tabnew ' . fnameescape(link_infos.filename) exe 'tabnew ' . fnameescape(link_infos.filename)
@ -2406,7 +2451,7 @@ Default: 1
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_w32_dir_enc* *g:vimwiki_w32_dir_enc*
Convert directory name from current |encoding| into 'g:vimwiki_w32_dir_enc' Convert directory name from current 'encoding' into 'g:vimwiki_w32_dir_enc'
before it is created. before it is created.
If you have 'enc=utf-8' and set up > If you have 'enc=utf-8' and set up >
@ -2432,7 +2477,7 @@ Value Description~
Default: 0 Default: 0
Note: Vim 7.3 has a new function |strdisplaywidth|, so for users of an up to Note: Vim 7.3 has a new function |strdisplaywidth()|, so for users of an up to
date Vim, this option is obsolete. date Vim, this option is obsolete.
@ -2519,9 +2564,9 @@ Default: '' (empty)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_valid_html_tags* *g:vimwiki_valid_html_tags*
Case-insensitive comma separated list of HTML tags that can be used in Vimwiki. Case-insensitive comma separated list of HTML tags that can be used in
When converting to HTML, these tags are left as they are, while every other Vimwiki. When converting to HTML, these tags are left as they are, while
tag is escaped. every other tag is escaped.
Default: 'b,i,s,u,sub,sup,kbd,br,hr' Default: 'b,i,s,u,sub,sup,kbd,br,hr'
@ -2544,10 +2589,10 @@ they would not be deleted after |:VimwikiAll2HTML|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_conceallevel* *g:vimwiki_conceallevel*
In Vim 7.3 |conceallevel| is local to the current window, thus if you open a In Vim 7.3 'conceallevel' is local to the current window, thus if you open a
Vimwiki buffer in a new tab or window, it would be set to the default value. Vimwiki buffer in a new tab or window, it would be set to the default value.
Vimwiki sets |conceallevel| to g:vimwiki_conceallevel every time a Vimwiki Vimwiki sets 'conceallevel' to g:vimwiki_conceallevel every time a Vimwiki
buffer is entered. buffer is entered.
With default settings, Vimwiki conceals one-character markers, shortens long With default settings, Vimwiki conceals one-character markers, shortens long
@ -2559,7 +2604,7 @@ Default: 2
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_autowriteall* *g:vimwiki_autowriteall*
In Vim |autowriteall| is a global setting. With g:vimwiki_autowriteall Vimwiki In Vim 'autowriteall' is a global setting. With g:vimwiki_autowriteall Vimwiki
makes it local to its buffers. makes it local to its buffers.
Value Description~ Value Description~
@ -2594,19 +2639,6 @@ Note:
Default: 15 Default: 15
------------------------------------------------------------------------------
*g:vimwiki_debug*
Controls verbosity of debugging output, for example, the diagnostic
information about HTML conversion.
Value Description~
0 Do not show debug messages.
1 Show debug messages.
Default: 0
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_diary_months* *g:vimwiki_diary_months*
@ -2696,29 +2728,74 @@ Old homepage: http://code.google.com/p/vimwiki/
Contributors and their Github usernames in roughly chronological order: Contributors and their Github usernames in roughly chronological order:
- Maxim Kim (habamax) <habamax@gmail.com> as original author - Maxim Kim (@habamax) <habamax@gmail.com> as original author
- the people here: http://code.google.com/p/vimwiki/people/list - the people here: http://code.google.com/p/vimwiki/people/list
- Stuart Andrews (tub78) - Stuart Andrews (@tub78)
- Tomas Pospichal - Tomas Pospichal
- Daniel Schemala (EinfachToll) as current maintainer - Daniel Schemala (@EinfachToll) as current maintainer
- Larry Hynes (larryhynes) - Larry Hynes (@larryhynes)
- Hector Arciga (harciga) - Hector Arciga (@harciga)
- Alexey Radkov (lyokha) - Alexey Radkov (@lyokha)
- Aaron Franks (af) - Aaron Franks (@af)
- Dan Bernier (danbernier) - Dan Bernier (@danbernier)
- Carl Helmertz (chelmertz) - Carl Helmertz (@chelmertz)
- Karl Yngve Lervåg (lervag) - Karl Yngve Lervåg (@lervag)
- Patrick Davey (patrickdavey) - Patrick Davey (@patrickdavey)
- Ivan Tishchenko (t7ko) - Ivan Tishchenko (@t7ko)
- 修昊 (Svtter) - 修昊 (@Svtter)
- Marcelo D Montu (mMontu) - Marcelo D Montu (@mMontu)
- John Kaul - John Kaul
- Hongbo Liu (@hiberabyss)
- @Tomsod
- @wangzq
- Jinzhou Zhang (@lotabout)
- Michael Riley (@optik-aper)
============================================================================== ==============================================================================
15. Changelog *vimwiki-changelog* 15. Changelog *vimwiki-changelog*
2.2~
Issue numbers starting with '#' are issues from
https://github.com/vimwiki/vimwiki/issues/, all others from
http://code.google.com/p/vimwiki/issues/list. They may be accessible from
https://github.com/vimwiki-backup/vimwiki/issues.
2.3 (2016-03-31)~
New:
* Add |:VimwikiMakeYesterdayDiaryNote| command
* Issue #128: add option |vimwiki-option-automatic_nested_syntaxes|
* Issue #192: Sort links in the list generated by |:VimwikiGenerateTags|
Fixed:
* Issue #176: Fix issue when the wiki path contains spaces
* Also look for tags in wiki files in subdirectories
* Locate the .tags file correctly on Windows
* Issue #183: Fix HTML conversion of headers containing links
* Issue #64: create correct Markdown links when pressing CR on a word
* Issue #191: ignore headers inside preformatted text when creating the TOC
* Create the standard CSS file also if only one file is converted to HTML
* Fix #188: |vimwiki_+| on a raw url surrounds it with brackets
* various minor fixes
2.2.1 (2015-12-10)~
Removed:~
* Removed the option g:vimwiki_debug, which probably nobody used. If you
want it back, file an issue at Github.
Fixed:~
* Issue #175: Don't do random things when the user has remapped the z key
* Don't ask for confirmation when following an URL in MacOS
* Always jump to the first occurrence of a tag in a file
* Don't move the cursor when updating the TOC
* Fix some issues with the TOC when folding is enabled
2.2 (2015-11-25)~
New:~ New:~
* Support for anchors, see |vimwiki-anchors| * Support for anchors, see |vimwiki-anchors|
@ -2732,7 +2809,7 @@ New:~
* more key maps for list manipulation, see |vimwiki-list-manipulation| * more key maps for list manipulation, see |vimwiki-list-manipulation|
* improved automatic adjustment of checkboxes * improved automatic adjustment of checkboxes
* text objects for list items, see |vimwiki-text-objects| * text objects for list items, see |vimwiki-text-objects|
* New command |VimwikiCheckLinks| to check for broken links * New command |:VimwikiCheckLinks| to check for broken links
* New global option |g:vimwiki_auto_chdir| * New global option |g:vimwiki_auto_chdir|
* New global option |g:vimwiki_map_prefix| * New global option |g:vimwiki_map_prefix|
* Support for wiki links absolute to the wiki root * Support for wiki links absolute to the wiki root
@ -2740,10 +2817,12 @@ New:~
* Issue #24: Basic support for remote directories via netrw * Issue #24: Basic support for remote directories via netrw
* Issue #50: in HTML, tables can now be embedded in lists * Issue #50: in HTML, tables can now be embedded in lists
* When converting to HTML, show a message with the output directory * When converting to HTML, show a message with the output directory
* Add auto completion for |VimwikiGoto| * Add auto completion for |:VimwikiGoto|
* Add Chinese Readme file * Add Chinese Readme file
Changed:~ Changed:~
* Wiki files must not contain # anymore, because # is used to separate the
file from an anchor in a link.
* replace the function vimwiki#base#resolve_scheme() by * replace the function vimwiki#base#resolve_scheme() by
vimwiki#base#resolve_link() (relevant if you have a custom vimwiki#base#resolve_link() (relevant if you have a custom
|VimwikiLinkHandler| which used this function) |VimwikiLinkHandler| which used this function)
@ -2785,11 +2864,6 @@ Fixed:~
* Corrected website links in documentation. code.google is dead, long live * Corrected website links in documentation. code.google is dead, long live
Github! Github!
Issue numbers starting with '#' are issues from
https://github.com/vimwiki/vimwiki/issues/, all others from
http://code.google.com/p/vimwiki/issues/list. They may be accessible from
https://github.com/vimwiki-backup/vimwiki/issues.
2.1~ 2.1~
* Concealing of links can be turned off - set |g:vimwiki_url_maxsave| to 0. * Concealing of links can be turned off - set |g:vimwiki_url_maxsave| to 0.

View File

@ -31,7 +31,7 @@ execute 'setlocal suffixesadd='.VimwikiGet('ext')
setlocal isfname-=[,] setlocal isfname-=[,]
" gf}}} " gf}}}
exe "setlocal tags+=" . vimwiki#tags#metadata_file_path() exe "setlocal tags+=" . escape(vimwiki#tags#metadata_file_path(), ' \|"')
" MISC }}} " MISC }}}
@ -173,9 +173,9 @@ function! VimwikiFoldLevel(lnum) "{{{
if line =~# g:vimwiki_rxHeader if line =~# g:vimwiki_rxHeader
return '>'.vimwiki#u#count_first_sym(line) return '>'.vimwiki#u#count_first_sym(line)
" Code block folding... " Code block folding...
elseif line =~# '^\s*'.g:vimwiki_rxPreStart elseif line =~# g:vimwiki_rxPreStart
return 'a1' return 'a1'
elseif line =~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$' elseif line =~# g:vimwiki_rxPreEnd
return 's1' return 's1'
else else
return "=" return "="
@ -221,7 +221,7 @@ function! VimwikiFoldText() "{{{
let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '') let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
let fold_len = v:foldend - v:foldstart + 1 let fold_len = v:foldend - v:foldstart + 1
let len_text = ' ['.fold_len.'] ' let len_text = ' ['.fold_len.'] '
if line !~# '^\s*'.g:vimwiki_rxPreStart if line !~# g:vimwiki_rxPreStart
let [main_text, spare_len] = s:shorten_text(main_text, 50) let [main_text, spare_len] = s:shorten_text(main_text, 50)
return main_text.len_text return main_text.len_text
else else

View File

@ -11,18 +11,6 @@ let g:loaded_vimwiki = 1
let s:old_cpo = &cpo let s:old_cpo = &cpo
set cpo&vim set cpo&vim
" Logging and performance instrumentation "{{{
let g:VimwikiLog = {}
let g:VimwikiLog.path = 0 " # of calls to VimwikiGet with path or path_html
let g:VimwikiLog.path_html = 0 " # of calls to path_html()
let g:VimwikiLog.normalize_path = 0 " # of calls to normalize_path()
let g:VimwikiLog.subdir = 0 " # of calls to vimwiki#base#subdir()
let g:VimwikiLog.timing = [] " various timing measurements
let g:VimwikiLog.html = [] " html conversion timing
function! VimwikiLog_extend(what,...) "{{{
call extend(g:VimwikiLog[a:what],a:000)
endfunction "}}}
"}}}
" HELPER functions {{{ " HELPER functions {{{
function! s:default(varname, value) "{{{ function! s:default(varname, value) "{{{
@ -36,14 +24,12 @@ function! s:path_html(idx) "{{{
if !empty(path_html) if !empty(path_html)
return path_html return path_html
else else
let g:VimwikiLog.path_html += 1 "XXX
let path = VimwikiGet('path', a:idx) let path = VimwikiGet('path', a:idx)
return substitute(path, '[/\\]\+$', '', '').'_html/' return substitute(path, '[/\\]\+$', '', '').'_html/'
endif endif
endfunction "}}} endfunction "}}}
function! s:normalize_path(path) "{{{ function! s:normalize_path(path) "{{{
let g:VimwikiLog.normalize_path += 1 "XXX
" resolve doesn't work quite right with symlinks ended with / or \ " resolve doesn't work quite right with symlinks ended with / or \
let path = substitute(a:path, '[/\\]\+$', '', '') let path = substitute(a:path, '[/\\]\+$', '', '')
if path !~# '^scp:' if path !~# '^scp:'
@ -71,16 +57,10 @@ function! s:vimwiki_idx() " {{{
endfunction " }}} endfunction " }}}
function! s:setup_buffer_leave() "{{{ function! s:setup_buffer_leave() "{{{
if g:vimwiki_debug == 3
echom "Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
endif
if &filetype ==? 'vimwiki' if &filetype ==? 'vimwiki'
" cache global vars of current state XXX: SLOW!? " cache global vars of current state XXX: SLOW!?
call vimwiki#base#cache_buffer_state() call vimwiki#base#cache_buffer_state()
endif endif
if g:vimwiki_debug == 3
echom " Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
endif
let &autowriteall = s:vimwiki_autowriteall let &autowriteall = s:vimwiki_autowriteall
@ -91,16 +71,9 @@ function! s:setup_buffer_leave() "{{{
endfunction "}}} endfunction "}}}
function! s:setup_filetype() "{{{ function! s:setup_filetype() "{{{
if g:vimwiki_debug == 3
echom "Setup_filetype g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
endif
let time0 = reltime() " start the clock "XXX
" Find what wiki current buffer belongs to. " Find what wiki current buffer belongs to.
let path = expand('%:p:h') let path = expand('%:p:h')
let idx = vimwiki#base#find_wiki(path) let idx = vimwiki#base#find_wiki(path)
if g:vimwiki_debug == 3
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
endif
if idx == -1 && g:vimwiki_global_ext == 0 if idx == -1 && g:vimwiki_global_ext == 0
return return
@ -124,24 +97,12 @@ function! s:setup_filetype() "{{{
endif endif
" initialize and cache global vars of current state " initialize and cache global vars of current state
call vimwiki#base#setup_buffer_state(idx) call vimwiki#base#setup_buffer_state(idx)
if g:vimwiki_debug ==3
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." (reset_wiki_state) b:curr_idx=".s:vimwiki_idx().""
endif
unlet! b:vimwiki_fs_rescan unlet! b:vimwiki_fs_rescan
set filetype=vimwiki set filetype=vimwiki
if g:vimwiki_debug ==3
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." (set ft=vimwiki) b:curr_idx=".s:vimwiki_idx().""
endif
let time1 = vimwiki#u#time(time0) "XXX
call VimwikiLog_extend('timing',['plugin:setup_filetype:time1',time1])
endfunction "}}} endfunction "}}}
function! s:setup_buffer_enter() "{{{ function! s:setup_buffer_enter() "{{{
if g:vimwiki_debug ==3
echom "Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
endif
let time0 = reltime() " start the clock "XXX
if !vimwiki#base#recall_buffer_state() if !vimwiki#base#recall_buffer_state()
" Find what wiki current buffer belongs to. " Find what wiki current buffer belongs to.
" If wiki does not exist in g:vimwiki_list -- add new wiki there with " If wiki does not exist in g:vimwiki_list -- add new wiki there with
@ -150,9 +111,6 @@ function! s:setup_buffer_enter() "{{{
let path = expand('%:p:h') let path = expand('%:p:h')
let idx = vimwiki#base#find_wiki(path) let idx = vimwiki#base#find_wiki(path)
if g:vimwiki_debug ==3
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
endif
" The buffer's file is not in the path and user *does NOT* want his wiki " The buffer's file is not in the path and user *does NOT* want his wiki
" extension to be global -- Do not add new wiki. " extension to be global -- Do not add new wiki.
if idx == -1 && g:vimwiki_global_ext == 0 if idx == -1 && g:vimwiki_global_ext == 0
@ -176,9 +134,6 @@ function! s:setup_buffer_enter() "{{{
endif endif
" initialize and cache global vars of current state " initialize and cache global vars of current state
call vimwiki#base#setup_buffer_state(idx) call vimwiki#base#setup_buffer_state(idx)
if g:vimwiki_debug ==3
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (reset_wiki_state) b:curr_idx=".s:vimwiki_idx().""
endif
endif endif
@ -188,22 +143,15 @@ function! s:setup_buffer_enter() "{{{
" au GUIEnter * nested VimwikiIndex " au GUIEnter * nested VimwikiIndex
if &filetype == '' if &filetype == ''
set filetype=vimwiki set filetype=vimwiki
if g:vimwiki_debug ==3
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (set ft vimwiki) b:curr_idx=".s:vimwiki_idx().""
endif
elseif &syntax ==? 'vimwiki' elseif &syntax ==? 'vimwiki'
" to force a rescan of the filesystem which may have changed " to force a rescan of the filesystem which may have changed
" and update VimwikiLinks syntax group that depends on it; " and update VimwikiLinks syntax group that depends on it;
" b:vimwiki_fs_rescan indicates that setup_filetype() has not been run " b:vimwiki_fs_rescan indicates that setup_filetype() has not been run
if exists("b:vimwiki_fs_rescan") && VimwikiGet('maxhi') if exists("b:vimwiki_fs_rescan") && VimwikiGet('maxhi')
set syntax=vimwiki set syntax=vimwiki
if g:vimwiki_debug ==3
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (set syntax=vimwiki) b:curr_idx=".s:vimwiki_idx().""
endif
endif endif
let b:vimwiki_fs_rescan = 1 let b:vimwiki_fs_rescan = 1
endif endif
let time1 = vimwiki#u#time(time0) "XXX
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a " Settings foldmethod, foldexpr and foldtext are local to window. Thus in a
" new tab with the same buffer folding is reset to vim defaults. So we " new tab with the same buffer folding is reset to vim defaults. So we
@ -221,7 +169,7 @@ function! s:setup_buffer_enter() "{{{
setlocal foldtext=VimwikiFoldText() setlocal foldtext=VimwikiFoldText()
else else
setlocal fdm=manual setlocal fdm=manual
exe "normal zE" normal! zE
endif endif
" And conceal level too. " And conceal level too.
@ -233,21 +181,13 @@ function! s:setup_buffer_enter() "{{{
if g:vimwiki_menu != "" if g:vimwiki_menu != ""
exe 'nmenu enable '.g:vimwiki_menu.'.Table' exe 'nmenu enable '.g:vimwiki_menu.'.Table'
endif endif
"let time2 = vimwiki#u#time(time0) "XXX
call VimwikiLog_extend('timing',['plugin:setup_buffer_enter:time1',time1])
endfunction "}}} endfunction "}}}
function! s:setup_buffer_reenter() "{{{ function! s:setup_buffer_reenter() "{{{
if g:vimwiki_debug ==3
echom "Setup_buffer_reenter g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
endif
if !vimwiki#base#recall_buffer_state() if !vimwiki#base#recall_buffer_state()
" Do not repeat work of s:setup_buffer_enter() and s:setup_filetype() " Do not repeat work of s:setup_buffer_enter() and s:setup_filetype()
" Once should be enough ... " Once should be enough ...
endif endif
if g:vimwiki_debug ==3
echom " Setup_buffer_reenter g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
endif
if !exists("s:vimwiki_autowriteall") if !exists("s:vimwiki_autowriteall")
let s:vimwiki_autowriteall = &autowriteall let s:vimwiki_autowriteall = &autowriteall
endif endif
@ -394,6 +334,7 @@ let s:vimwiki_defaults.template_default = 'default'
let s:vimwiki_defaults.template_ext = '.tpl' let s:vimwiki_defaults.template_ext = '.tpl'
let s:vimwiki_defaults.nested_syntaxes = {} let s:vimwiki_defaults.nested_syntaxes = {}
let s:vimwiki_defaults.automatic_nested_syntaxes = 1
let s:vimwiki_defaults.auto_export = 0 let s:vimwiki_defaults.auto_export = 0
let s:vimwiki_defaults.auto_toc = 0 let s:vimwiki_defaults.auto_toc = 0
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki " is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki
@ -444,7 +385,6 @@ call s:default('html_header_numbering', 0)
call s:default('html_header_numbering_sym', '') call s:default('html_header_numbering_sym', '')
call s:default('conceallevel', 2) call s:default('conceallevel', 2)
call s:default('url_maxsave', 15) call s:default('url_maxsave', 15)
call s:default('debug', 0)
call s:default('diary_months', call s:default('diary_months',
\ { \ {
@ -525,6 +465,8 @@ command! -count=1 VimwikiMakeDiaryNote
\ call vimwiki#diary#make_note(v:count1) \ call vimwiki#diary#make_note(v:count1)
command! -count=1 VimwikiTabMakeDiaryNote command! -count=1 VimwikiTabMakeDiaryNote
\ call vimwiki#diary#make_note(v:count1, 1) \ call vimwiki#diary#make_note(v:count1, 1)
command! -count=1 VimwikiMakeYesterdayDiaryNote
\ call vimwiki#diary#make_note(v:count1, 0, strftime(VimwikiGet('diary_link_fmt', v:count1 - 1), localtime() - 60*60*24))
command! VimwikiDiaryGenerateLinks command! VimwikiDiaryGenerateLinks
\ call vimwiki#diary#generate_diary_section() \ call vimwiki#diary#generate_diary_section()
@ -567,6 +509,12 @@ endif
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
\ :VimwikiTabMakeDiaryNote<CR> \ :VimwikiTabMakeDiaryNote<CR>
if !hasmapto('<Plug>VimwikiMakeYesterdayDiaryNote')
exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'<Leader>y <Plug>VimwikiMakeYesterdayDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeYesterdayDiaryNote
\ :VimwikiMakeYesterdayDiaryNote<CR>
"}}} "}}}
" MENU {{{ " MENU {{{

View File

@ -10,14 +10,12 @@ elseif exists("b:current_syntax")
endif endif
"TODO do nothing if ...? (?) "TODO do nothing if ...? (?)
let g:starttime = reltime() " start the clock
if VimwikiGet('maxhi') if VimwikiGet('maxhi')
let b:existing_wikifiles = let b:existing_wikifiles =
\ vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 1) \ vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 1)
let b:existing_wikidirs = let b:existing_wikidirs =
\ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx) \ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx)
endif endif
let s:timescans = vimwiki#u#time(g:starttime) "XXX
"let b:xxx = 1 "let b:xxx = 1
"TODO ? update wikilink syntax group here if really needed (?) for :e and such "TODO ? update wikilink syntax group here if really needed (?) for :e and such
"if VimwikiGet('maxhi') "if VimwikiGet('maxhi')
@ -47,8 +45,6 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
call vimwiki#u#reload_regexes() call vimwiki#u#reload_regexes()
let s:time0 = vimwiki#u#time(g:starttime) "XXX
" LINKS: setup of larger regexes {{{ " LINKS: setup of larger regexes {{{
" LINKS: setup wikilink regexps {{{ " LINKS: setup wikilink regexps {{{
@ -177,9 +173,6 @@ let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{ " LINKS: highlighting is complicated due to "nonexistent" links feature {{{
function! s:add_target_syntax_ON(target, type) " {{{ function! s:add_target_syntax_ON(target, type) " {{{
if g:vimwiki_debug > 1
echom '[vimwiki_debug] syntax target > '.a:target
endif
let prefix0 = 'syntax match '.a:type.' `' let prefix0 = 'syntax match '.a:type.' `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match '.a:type.'T `' let prefix1 = 'syntax match '.a:type.'T `'
@ -189,9 +182,6 @@ function! s:add_target_syntax_ON(target, type) " {{{
endfunction "}}} endfunction "}}}
function! s:add_target_syntax_OFF(target) " {{{ function! s:add_target_syntax_OFF(target) " {{{
if g:vimwiki_debug > 1
echom '[vimwiki_debug] syntax target > '.a:target
endif
let prefix0 = 'syntax match VimwikiNoExistsLink `' let prefix0 = 'syntax match VimwikiNoExistsLink `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
let prefix1 = 'syntax match VimwikiNoExistsLinkT `' let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
@ -252,16 +242,12 @@ if VimwikiGet('maxhi')
call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl) call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl)
" Subsequently, links verified on vimwiki's path are highlighted as existing " Subsequently, links verified on vimwiki's path are highlighted as existing
let s:time01 = vimwiki#u#time(g:starttime) "XXX
call s:highlight_existing_links() call s:highlight_existing_links()
let s:time02 = vimwiki#u#time(g:starttime) "XXX
else else
let s:time01 = vimwiki#u#time(g:starttime) "XXX
" Wikilink " Wikilink
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink') call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink')
" WikiIncl " WikiIncl
call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink') call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink')
let s:time02 = vimwiki#u#time(g:starttime) "XXX
endif endif
" Weblink " Weblink
@ -329,6 +315,12 @@ endfor
" }}} " }}}
let g:vimwiki_rxPreStart = '^\s*'.g:vimwiki_rxPreStart
let g:vimwiki_rxPreEnd = '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
let g:vimwiki_rxMathStart = '^\s*'.g:vimwiki_rxMathStart
let g:vimwiki_rxMathEnd = '^\s*'.g:vimwiki_rxMathEnd.'\s*$'
" possibly concealed chars " {{{ " possibly concealed chars " {{{
let s:conceal = exists("+conceallevel") ? ' conceal' : '' let s:conceal = exists("+conceallevel") ? ' conceal' : ''
@ -344,14 +336,6 @@ execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'.s:
" }}} " }}}
" concealed link parts " {{{ " concealed link parts " {{{
if g:vimwiki_debug > 1
echom 'WikiLink Prefix: '.s:rx_wikilink_prefix
echom 'WikiLink Suffix: '.s:rx_wikilink_suffix
echom 'WikiLink Prefix1: '.s:rx_wikilink_prefix1
echom 'WikiLink Suffix1: '.s:rx_wikilink_suffix1
echom 'WikiIncl Prefix: '.g:vimwiki_rxWikiInclPrefix1
echom 'WikiIncl Suffix: '.g:vimwiki_rxWikiInclSuffix1
endif
" define the conceal attribute for links only if Vim is new enough to handle it " define the conceal attribute for links only if Vim is new enough to handle it
" and the user has g:vimwiki_url_maxsave > 0 " and the user has g:vimwiki_url_maxsave > 0
@ -466,11 +450,11 @@ execute 'syntax match VimwikiCodeT /'.g:vimwiki_rxCode.'/ contained contains=Vim
" <hr> horizontal rule " <hr> horizontal rule
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/' execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/'
execute 'syntax region VimwikiPre start=/^\s*'.g:vimwiki_rxPreStart. execute 'syntax region VimwikiPre start=/'.g:vimwiki_rxPreStart.
\ '/ end=/^\s*'.g:vimwiki_rxPreEnd.'\s*$/ contains=@Spell' \ '/ end=/'.g:vimwiki_rxPreEnd.'/ contains=@Spell'
execute 'syntax region VimwikiMath start=/^\s*'.g:vimwiki_rxMathStart. execute 'syntax region VimwikiMath start=/'.g:vimwiki_rxMathStart.
\ '/ end=/^\s*'.g:vimwiki_rxMathEnd.'\s*$/ contains=@Spell' \ '/ end=/'.g:vimwiki_rxMathEnd.'/ contains=@Spell'
" placeholders " placeholders
@ -610,23 +594,23 @@ let b:current_syntax="vimwiki"
" EMBEDDED syntax setup "{{{ " EMBEDDED syntax setup "{{{
let s:nested = VimwikiGet('nested_syntaxes') let s:nested = VimwikiGet('nested_syntaxes')
if VimwikiGet('automatic_nested_syntaxes')
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax())
endif
if !empty(s:nested) if !empty(s:nested)
for [s:hl_syntax, s:vim_syntax] in items(s:nested) for [s:hl_syntax, s:vim_syntax] in items(s:nested)
call vimwiki#base#nested_syntax(s:vim_syntax, call vimwiki#base#nested_syntax(s:vim_syntax,
\ '^\s*'.g:vimwiki_rxPreStart.'\%(.*[[:blank:][:punct:]]\)\?'. \ g:vimwiki_rxPreStart.'\%(.*[[:blank:][:punct:]]\)\?'.
\ s:hl_syntax.'\%([[:blank:][:punct:]].*\)\?', \ s:hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
\ '^\s*'.g:vimwiki_rxPreEnd, 'VimwikiPre') \ g:vimwiki_rxPreEnd, 'VimwikiPre')
endfor endfor
endif endif
" LaTeX " LaTeX
call vimwiki#base#nested_syntax('tex', call vimwiki#base#nested_syntax('tex',
\ '^\s*'.g:vimwiki_rxMathStart.'\%(.*[[:blank:][:punct:]]\)\?'. \ g:vimwiki_rxMathStart.'\%(.*[[:blank:][:punct:]]\)\?'.
\ '\%([[:blank:][:punct:]].*\)\?', \ '\%([[:blank:][:punct:]].*\)\?',
\ '^\s*'.g:vimwiki_rxMathEnd, 'VimwikiMath') \ g:vimwiki_rxMathEnd, 'VimwikiMath')
"}}} "}}}
syntax spell toplevel syntax spell toplevel
let s:timeend = vimwiki#u#time(g:starttime) "XXX
call VimwikiLog_extend('timing',['syntax:scans',s:timescans],['syntax:regexloaded',s:time0],['syntax:beforeHLexisting',s:time01],['syntax:afterHLexisting',s:time02],['syntax:end',s:timeend])

View File

@ -204,9 +204,6 @@ let g:vimwiki_rxMkdRefMatchUrl = '\['.g:vimwiki_rxWikiLinkDescr.']:\%(\s\+\|\n\)
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{ " LINKS: highlighting is complicated due to "nonexistent" links feature {{{
function! s:add_target_syntax_ON(target, type) " {{{ function! s:add_target_syntax_ON(target, type) " {{{
if g:vimwiki_debug > 1
echom '[vimwiki_debug] syntax target > '.a:target
endif
let prefix0 = 'syntax match '.a:type.' `' let prefix0 = 'syntax match '.a:type.' `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match '.a:type.'T `' let prefix1 = 'syntax match '.a:type.'T `'
@ -216,9 +213,6 @@ function! s:add_target_syntax_ON(target, type) " {{{
endfunction "}}} endfunction "}}}
function! s:add_target_syntax_OFF(target, type) " {{{ function! s:add_target_syntax_OFF(target, type) " {{{
if g:vimwiki_debug > 1
echom '[vimwiki_debug] syntax target > '.a:target
endif
let prefix0 = 'syntax match VimwikiNoExistsLink `' let prefix0 = 'syntax match VimwikiNoExistsLink `'
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
let prefix1 = 'syntax match VimwikiNoExistsLinkT `' let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
@ -291,14 +285,10 @@ if VimwikiGet('maxhi')
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1') call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
" Subsequently, links verified on vimwiki's path are highlighted as existing " Subsequently, links verified on vimwiki's path are highlighted as existing
let s:time01 = vimwiki#u#time(g:starttime) "XXX
call s:highlight_existing_links() call s:highlight_existing_links()
let s:time02 = vimwiki#u#time(g:starttime) "XXX
else else
let s:time01 = vimwiki#u#time(g:starttime) "XXX
" Wikilink " Wikilink
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1') call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
let s:time02 = vimwiki#u#time(g:starttime) "XXX
endif endif
" Weblink " Weblink
@ -340,13 +330,6 @@ endif
syntax spell toplevel syntax spell toplevel
if g:vimwiki_debug > 1
echom 'WikiLink1 Prefix: '.g:vimwiki_rxWikiLink1Prefix1
echom 'WikiLink1 Suffix: '.g:vimwiki_rxWikiLink1Suffix1
echom 'Weblink1 Prefix: '.g:vimwiki_rxWeblink1Prefix1
echom 'Weblink1 Suffix: '.g:vimwiki_rxWeblink1Suffix1
endif
" VimwikiWikiLink1Char is for syntax markers (and also URL when a description " VimwikiWikiLink1Char is for syntax markers (and also URL when a description
" is present) and may be concealed " is present) and may be concealed
let s:options = ' contained transparent contains=NONE' let s:options = ' contained transparent contains=NONE'