Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
129c281810 | |||
722d6e4b9a | |||
0001b3cda9 | |||
68cdfe36df | |||
4956976bb6 | |||
4c2e13a284 | |||
4bd0690a52 | |||
128581babc | |||
c2d1869227 | |||
6f579711ab | |||
6d96516ab4 | |||
0ea8d85b7f | |||
5f9dbca89c | |||
2aeaea5f0d | |||
a2888692fd | |||
fc947523b0 | |||
91a004bc23 | |||
78cef05fa3 | |||
1db5924271 | |||
ff90e980de | |||
bb3026dba8 | |||
b0cc6ff0de | |||
949b29b694 | |||
f31550badb | |||
3bd3d9b860 | |||
e0d72759a6 | |||
f9045a40e0 | |||
9be96884ba | |||
2a70e1517e | |||
c565b38bb6 | |||
37aae9c3ce | |||
c2b0fd843b | |||
77fca9080c | |||
3eb20a6c98 | |||
7124a9be97 | |||
5247de4a0b | |||
0d3f526a88 | |||
d265df42f5 | |||
7df0405c4e | |||
8231433bad | |||
399e9a4512 | |||
64f71bc785 |
@ -141,18 +141,12 @@ endfunction " }}}
|
||||
|
||||
" 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
|
||||
endfunction "}}}
|
||||
|
||||
" vimwiki#base#recall_buffer_state
|
||||
function! vimwiki#base#recall_buffer_state() "{{{
|
||||
if !exists('b:vimwiki_idx')
|
||||
if g:vimwiki_debug
|
||||
echo "[Vimwiki Internal Error]: Missing buffer state variable: 'b:vimwiki_idx'"
|
||||
endif
|
||||
return 0
|
||||
else
|
||||
let g:vimwiki_current_idx = b:vimwiki_idx
|
||||
@ -191,7 +185,6 @@ endfunction "}}}
|
||||
" vimwiki#base#subdir
|
||||
"FIXME TODO slow and faulty
|
||||
function! vimwiki#base#subdir(path, filename) "{{{
|
||||
let g:VimwikiLog.subdir += 1 "XXX
|
||||
let path = a:path
|
||||
" ensure that we are not fooled by a symbolic link
|
||||
"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
|
||||
endfunction
|
||||
function! s:macunix_handler(url)
|
||||
execute '!open ' . shellescape(a:url, 1)
|
||||
call system('open ' . shellescape(a:url).' &')
|
||||
endfunction
|
||||
function! s:linux_handler(url)
|
||||
call system('xdg-open ' . shellescape(a:url).' &')
|
||||
@ -397,19 +390,15 @@ function! vimwiki#base#system_open_link(url) "{{{
|
||||
return
|
||||
endif
|
||||
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 "}}}
|
||||
|
||||
" vimwiki#base#open_link
|
||||
function! vimwiki#base#open_link(cmd, 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 == ''
|
||||
echom 'Vimwiki Error: Unable to resolve link!'
|
||||
echomsg 'Vimwiki Error: Unable to resolve link!'
|
||||
return
|
||||
endif
|
||||
|
||||
@ -516,7 +505,7 @@ function! vimwiki#base#backlinks() "{{{
|
||||
endfor
|
||||
|
||||
if empty(locations)
|
||||
echom 'vimwiki: no other file links to this file'
|
||||
echomsg 'Vimwiki: No other file links to this file'
|
||||
else
|
||||
call setloclist(0, locations, 'r')
|
||||
lopen
|
||||
@ -834,7 +823,7 @@ function! vimwiki#base#check_links() "{{{
|
||||
endfor
|
||||
|
||||
if empty(errors)
|
||||
echom 'Vimwiki: all links are OK'
|
||||
echomsg 'Vimwiki: All links are OK'
|
||||
else
|
||||
call setqflist(errors, 'r')
|
||||
copen
|
||||
@ -857,8 +846,8 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) "{{{
|
||||
let ok = vimwiki#path#mkdir(dir, 1)
|
||||
|
||||
if !ok
|
||||
echom ' '
|
||||
echom 'Vimwiki: Unable to edit file in non-existent directory: '.dir
|
||||
echomsg ' '
|
||||
echomsg 'Vimwiki Error: Unable to edit file in non-existent directory: '.dir
|
||||
return
|
||||
endif
|
||||
|
||||
@ -891,7 +880,7 @@ endfunction " }}}
|
||||
function! vimwiki#base#search_word(wikiRx, cmd) "{{{
|
||||
let match_line = search(a:wikiRx, 's'.a:cmd)
|
||||
if match_line == 0
|
||||
echomsg 'vimwiki: Wiki link not found.'
|
||||
echomsg 'Vimwiki: Wiki link not found'
|
||||
endif
|
||||
endfunction " }}}
|
||||
|
||||
@ -1143,27 +1132,47 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
|
||||
return
|
||||
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
|
||||
let is_fold_closed = ( foldclosed(start_lnum) > -1 )
|
||||
" delete the old listing
|
||||
let whitespaces_in_first_line = matchstr(getline(start_lnum), '\m^\s*')
|
||||
let end_lnum = start_lnum + 1
|
||||
while end_lnum <= line('$') && getline(end_lnum) =~# a:content_regex
|
||||
let end_lnum += 1
|
||||
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 _'
|
||||
let &l:foldenable = foldenable_save
|
||||
let lines_diff = 0 - (end_lnum - start_lnum)
|
||||
else
|
||||
let start_lnum = a:default_lnum
|
||||
let is_cursor_after_listing = ( cursor_line > a:default_lnum )
|
||||
let whitespaces_in_first_line = ''
|
||||
endif
|
||||
|
||||
let start_of_listing = start_lnum
|
||||
|
||||
" write new listing
|
||||
let new_header = whitespaces_in_first_line
|
||||
\ . substitute(g:vimwiki_rxH1_Template,
|
||||
\ '__Header__', '\='."'".a:start_header."'", '')
|
||||
call append(start_lnum - 1, new_header)
|
||||
let start_lnum += 1
|
||||
let lines_diff += 1 + len(a:strings)
|
||||
for string in a:strings
|
||||
call append(start_lnum - 1, string)
|
||||
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
|
||||
if start_lnum <= line('$') && getline(start_lnum) !~# '\m^\s*$'
|
||||
call append(start_lnum - 1, '')
|
||||
let lines_diff += 1
|
||||
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 "}}}
|
||||
|
||||
" WIKI link following functions {{{
|
||||
@ -1262,7 +1281,7 @@ endfunction " }}}
|
||||
" vimwiki#base#goto_index
|
||||
function! vimwiki#base#goto_index(wnum, ...) "{{{
|
||||
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
|
||||
endif
|
||||
|
||||
@ -1280,10 +1299,7 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{
|
||||
let cmd = 'edit'
|
||||
endif
|
||||
|
||||
if g:vimwiki_debug == 3
|
||||
echom "--- Goto_index g:curr_idx=".g:vimwiki_current_idx." ww_idx=".idx.""
|
||||
endif
|
||||
|
||||
call Validate_wiki_options(idx)
|
||||
call vimwiki#base#edit_file(cmd,
|
||||
\ VimwikiGet('path', idx).VimwikiGet('index', idx).
|
||||
\ VimwikiGet('ext', idx),
|
||||
@ -1303,7 +1319,7 @@ function! vimwiki#base#delete_link() "{{{
|
||||
try
|
||||
call delete(fname)
|
||||
catch /.*/
|
||||
echomsg 'vimwiki: Cannot delete "'.expand('%:t:r').'"!'
|
||||
echomsg 'Vimwiki Error: Cannot delete "'.expand('%:t:r').'"!'
|
||||
return
|
||||
endtry
|
||||
|
||||
@ -1324,7 +1340,7 @@ function! vimwiki#base#rename_link() "{{{
|
||||
|
||||
" there is no file (new one maybe)
|
||||
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.)'
|
||||
return
|
||||
endif
|
||||
@ -1338,13 +1354,13 @@ function! vimwiki#base#rename_link() "{{{
|
||||
|
||||
if new_link =~# '[/\\]'
|
||||
" 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
|
||||
endif
|
||||
|
||||
" check new_fname - it should be 'good', not empty
|
||||
if substitute(new_link, '\s', '', 'g') == ''
|
||||
echomsg 'vimwiki: Cannot rename to an empty filename!'
|
||||
echomsg 'Vimwiki Error: Cannot rename to an empty filename!'
|
||||
return
|
||||
endif
|
||||
|
||||
@ -1359,19 +1375,19 @@ function! vimwiki#base#rename_link() "{{{
|
||||
" do not rename if file with such name exists
|
||||
let fname = glob(new_fname)
|
||||
if fname != ''
|
||||
echomsg 'vimwiki: Cannot rename to "'.new_fname.
|
||||
echomsg 'Vimwiki Error: Cannot rename to "'.new_fname.
|
||||
\ '". File with that name exist!'
|
||||
return
|
||||
endif
|
||||
" rename wiki link file
|
||||
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))
|
||||
if res != 0
|
||||
throw "Cannot rename!"
|
||||
end
|
||||
catch /.*/
|
||||
echomsg 'vimwiki: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"'
|
||||
echomsg 'Vimwiki Error: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"'
|
||||
return
|
||||
endtry
|
||||
|
||||
@ -1412,7 +1428,7 @@ function! vimwiki#base#rename_link() "{{{
|
||||
\ cur_buffer[1]])
|
||||
" 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
|
||||
endfunction " }}}
|
||||
@ -1720,10 +1736,27 @@ endfunction " }}}
|
||||
" a:create == 0: update if TOC exists
|
||||
function! vimwiki#base#table_of_contents(create)
|
||||
" collect new headers
|
||||
let is_inside_pre_or_math = 0 " 1: inside pre, 2: inside math, 0: outside
|
||||
let headers = []
|
||||
let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
|
||||
for lnum in range(1, line('$'))
|
||||
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
|
||||
continue
|
||||
endif
|
||||
@ -1878,9 +1911,6 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
|
||||
\ g:vimwiki_WikiLinkTemplate2)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -1888,9 +1918,15 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl)
|
||||
if !empty(lnk)
|
||||
" NO-OP !!
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiIncl: ".lnk." Sub: ".lnk
|
||||
endif
|
||||
return
|
||||
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
|
||||
endif
|
||||
|
||||
@ -1907,9 +1943,6 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
\ g:vimwiki_WikiLinkTemplate1)
|
||||
endif
|
||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "Word: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -1958,6 +1991,18 @@ function! vimwiki#base#normalize_link(is_visual_mode) "{{{
|
||||
endif
|
||||
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 {{{
|
||||
|
@ -83,7 +83,7 @@ fun! s:read_captions(files) "{{{
|
||||
return result
|
||||
endfun "}}}
|
||||
|
||||
fun! s:get_diary_links(...) "{{{
|
||||
fun! s:get_diary_links() "{{{
|
||||
let rx = '^\d\{4}-\d\d-\d\d'
|
||||
let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext'))
|
||||
let files = split(s_files, '\n')
|
||||
@ -92,9 +92,6 @@ fun! s:get_diary_links(...) "{{{
|
||||
" remove backup files (.wiki~)
|
||||
call filter(files, 'v:val !~# ''.*\~$''')
|
||||
|
||||
if a:0
|
||||
call add(files, a:1)
|
||||
endif
|
||||
let links_with_captions = s:read_captions(files)
|
||||
|
||||
return links_with_captions
|
||||
@ -129,14 +126,10 @@ function! s:sort(lst) "{{{
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:format_diary(...) "{{{
|
||||
function! s:format_diary() "{{{
|
||||
let result = []
|
||||
|
||||
if a:0
|
||||
let g_files = s:group_links(s:get_diary_links(a:1))
|
||||
else
|
||||
let g_files = s:group_links(s:get_diary_links())
|
||||
endif
|
||||
let g_files = s:group_links(s:get_diary_links())
|
||||
|
||||
for year in s:sort(keys(g_files))
|
||||
call add(result, '')
|
||||
@ -168,7 +161,7 @@ endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#make_note(wnum, ...) "{{{
|
||||
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
|
||||
endif
|
||||
|
||||
@ -198,7 +191,7 @@ endfunction "}}}
|
||||
|
||||
function! vimwiki#diary#goto_diary_index(wnum) "{{{
|
||||
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
|
||||
endif
|
||||
|
||||
@ -261,7 +254,7 @@ function! vimwiki#diary#generate_diary_section() "{{{
|
||||
call vimwiki#base#update_listing_in_buffer(s:format_diary(),
|
||||
\ VimwikiGet('diary_header'), content_rx, line('$')+1, 1)
|
||||
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
|
||||
endfunction "}}}
|
||||
|
||||
|
@ -80,9 +80,10 @@ function! s:create_default_CSS(path) " {{{
|
||||
if default_css != ''
|
||||
let lines = readfile(default_css)
|
||||
call writefile(lines, css_full_name)
|
||||
echomsg "Default style.css has been created."
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! s:template_full_name(name) "{{{
|
||||
@ -112,7 +113,7 @@ function! s:get_html_template(template) "{{{
|
||||
let lines = readfile(template_name)
|
||||
return lines
|
||||
catch /E484/
|
||||
echomsg 'vimwiki: html template '.template_name.
|
||||
echomsg 'Vimwiki: HTML template '.template_name.
|
||||
\ ' does not exist!'
|
||||
endtry
|
||||
endif
|
||||
@ -171,7 +172,7 @@ function! s:delete_html_files(path) "{{{
|
||||
try
|
||||
call delete(fname)
|
||||
catch
|
||||
echomsg 'vimwiki: Cannot delete '.fname
|
||||
echomsg 'Vimwiki Error: Cannot delete '.fname
|
||||
endtry
|
||||
endfor
|
||||
endfunction "}}}
|
||||
@ -396,11 +397,6 @@ function! s:tag_wikiincl(value) "{{{
|
||||
|
||||
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'
|
||||
let url = vimwiki#path#relpath(fnamemodify(s:current_html_file, ':h'),
|
||||
\ link_infos.filename)
|
||||
@ -455,12 +451,6 @@ function! s:tag_wikilink(value) "{{{
|
||||
let html_link = link_infos.filename
|
||||
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 != ''
|
||||
let anchor = substitute(link_infos.anchor, '#', '-', 'g')
|
||||
let html_link .= '#'.anchor
|
||||
@ -1057,6 +1047,8 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let h_part .= '>'
|
||||
endif
|
||||
|
||||
let h_text = s:process_inline_tags(h_text, a:id)
|
||||
|
||||
let line = h_part.h_text.'</h'.h_level.'></div>'
|
||||
|
||||
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.para = s:close_tag_para(state.para, res_lines)
|
||||
|
||||
let line = s:process_inline_tags(line, state.header_ids)
|
||||
|
||||
call add(res_lines, line)
|
||||
endif
|
||||
endif
|
||||
@ -1377,10 +1367,7 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
|
||||
\ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-'))
|
||||
endfunction " }}}
|
||||
|
||||
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
|
||||
let starttime = reltime() " start the clock
|
||||
|
||||
function! s:convert_file(path_html, wikifile) "{{{
|
||||
let done = 0
|
||||
|
||||
let wikifile = fnamemodify(a:wikifile, ":p")
|
||||
@ -1403,10 +1390,6 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
let lsource = readfile(wikifile)
|
||||
let ldest = []
|
||||
|
||||
"if g:vimwiki_debug
|
||||
" echo 'Generating HTML ... '
|
||||
"endif
|
||||
|
||||
call vimwiki#path#mkdir(path_html)
|
||||
|
||||
" nohtml placeholder -- to skip html generation.
|
||||
@ -1474,13 +1457,13 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
|
||||
if nohtml
|
||||
echon "\r"."%nohtml placeholder found"
|
||||
return
|
||||
return ''
|
||||
endif
|
||||
|
||||
call s:remove_blank_lines(ldest)
|
||||
|
||||
"" process end of file
|
||||
"" close opened tags if any
|
||||
" process end of file
|
||||
" close opened tags if any
|
||||
let lines = []
|
||||
call s:close_tag_quote(state.quote, 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")')
|
||||
|
||||
let html_lines = s:html_insert_contents(html_lines, ldest) " %contents%
|
||||
|
||||
"" make html file.
|
||||
|
||||
call writefile(html_lines, path_html.htmlfile)
|
||||
let done = 1
|
||||
|
||||
endif
|
||||
|
||||
if done == 0
|
||||
echomsg 'vimwiki: conversion to HTML is not supported for this syntax!!!'
|
||||
return
|
||||
echomsg 'Vimwiki Error: Conversion to HTML is not supported for this syntax'
|
||||
return ''
|
||||
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
|
||||
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) "{{{
|
||||
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
|
||||
endif
|
||||
|
||||
echomsg 'Saving vimwiki files...'
|
||||
echomsg 'Vimwiki: Saving Vimwiki files ...'
|
||||
let save_eventignore = &eventignore
|
||||
let &eventignore = "all"
|
||||
let cur_buf = bufname('%')
|
||||
@ -1551,10 +1533,10 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
|
||||
let path_html = expand(a: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)
|
||||
|
||||
echomsg 'Converting wiki to html files...'
|
||||
echomsg 'Vimwiki: Converting wiki to html files ...'
|
||||
let setting_more = &more
|
||||
setlocal nomore
|
||||
|
||||
@ -1572,20 +1554,23 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
|
||||
call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir))
|
||||
|
||||
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
|
||||
echomsg 'Skipping '.wikifile
|
||||
echomsg 'Vimwiki: Skipping '.wikifile
|
||||
endif
|
||||
endfor
|
||||
" reset 'subdir' state variable
|
||||
call VimwikiSet('subdir', current_subdir)
|
||||
call VimwikiSet('invsubdir', current_invsubdir)
|
||||
|
||||
call s:create_default_CSS(path_html)
|
||||
echomsg 'HTML exported to '.path_html
|
||||
echomsg 'Done!'
|
||||
let created = s:create_default_CSS(path_html)
|
||||
if created
|
||||
echomsg 'Vimwiki: Default style.css has been created'
|
||||
endif
|
||||
echomsg 'Vimwiki: HTML exported to '.path_html
|
||||
echomsg 'Vimwiki: Done!'
|
||||
|
||||
let &more = setting_more
|
||||
endfunction "}}}
|
||||
|
@ -376,10 +376,10 @@ endfunction "}}}
|
||||
"If there is no second argument, 0 is returned at a header, otherwise the
|
||||
"header is skipped
|
||||
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
|
||||
while cur_ln <= line('$') &&
|
||||
\ getline(cur_ln) !~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
|
||||
\ getline(cur_ln) !~# g:vimwiki_rxPreEnd
|
||||
let cur_ln += 1
|
||||
endwhile
|
||||
let next_line = cur_ln
|
||||
@ -404,10 +404,10 @@ endfunction "}}}
|
||||
function! s:get_prev_line(lnum) "{{{
|
||||
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
|
||||
while 1
|
||||
if cur_ln == 0 || getline(cur_ln) =~# '^\s*'.g:vimwiki_rxPreStart
|
||||
if cur_ln == 0 || getline(cur_ln) =~# g:vimwiki_rxPreStart
|
||||
break
|
||||
endif
|
||||
let cur_ln -= 1
|
||||
|
@ -108,6 +108,8 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
|
||||
if lnk != ""
|
||||
if !VimwikiLinkHandler(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)
|
||||
endif
|
||||
endif
|
||||
@ -133,9 +135,6 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl)
|
||||
if !empty(lnk)
|
||||
" NO-OP !!
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiIncl: ".lnk." Sub: ".lnk
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -146,9 +145,6 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
|
||||
\ g:vimwiki_WikiLink1Template2)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink0, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -159,9 +155,6 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
\ g:vimwiki_rxWikiLinkMatchUrl, g:vimwiki_rxWikiLinkMatchDescr,
|
||||
\ g:vimwiki_WikiLinkTemplate2)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWikiLink1, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WikiLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -172,9 +165,6 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
\ g:vimwiki_rxWeblinkMatchUrl, g:vimwiki_rxWeblinkMatchDescr,
|
||||
\ g:vimwiki_Weblink1Template)
|
||||
call vimwiki#base#replacestr_at_cursor(g:vimwiki_rxWeblink, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "WebLink: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -185,11 +175,8 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
if !empty(lnk)
|
||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||
\ g:vimwiki_rxWord, '',
|
||||
\ g:vimwiki_WikiLinkTemplate1)
|
||||
\ g:vimwiki_Weblink1Template)
|
||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
||||
if g:vimwiki_debug > 1
|
||||
echomsg "Word: ".lnk." Sub: ".sub
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
@ -207,9 +194,10 @@ function! s:normalize_link_syntax_v() " {{{
|
||||
try
|
||||
norm! gvy
|
||||
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
|
||||
norm! `>pgvd
|
||||
|
@ -148,3 +148,22 @@ function! vimwiki#path#is_absolute(path) "{{{
|
||||
return a:path =~# '\m^/\|\~/'
|
||||
endif
|
||||
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
|
||||
|
@ -41,12 +41,14 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files) "{{{
|
||||
call s:write_tags_metadata(metadata)
|
||||
else " full rebuild
|
||||
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 =
|
||||
\ getftime(vimwiki#tags#metadata_file_path())
|
||||
let metadata = s:load_tags_metadata()
|
||||
for file in files
|
||||
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 metadata = s:remove_page_from_tags(metadata, page_name)
|
||||
let metadata = s:merge_tags(metadata, page_name, tags)
|
||||
@ -139,7 +141,7 @@ endfunction " }}}
|
||||
" vimwiki#tags#metadata_file_path
|
||||
" Returns tags metadata file path
|
||||
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 " }}}
|
||||
|
||||
" s:load_tags_metadata
|
||||
@ -213,6 +215,38 @@ function! s:merge_tags(metadata, pagename, file_metadata) "{{{
|
||||
return metadata
|
||||
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
|
||||
" Saves metadata object into a file. Throws exceptions in case of problems.
|
||||
function! s:write_tags_metadata(metadata) "{{{
|
||||
@ -234,7 +268,7 @@ function! s:write_tags_metadata(metadata) "{{{
|
||||
\)
|
||||
endfor
|
||||
endfor
|
||||
call sort(tags)
|
||||
call sort(tags, "s:tags_entry_cmp")
|
||||
call insert(tags, "!_TAG_FILE_SORTED\t1\t")
|
||||
call writefile(tags, metadata_path)
|
||||
endfunction " }}}
|
||||
@ -283,7 +317,7 @@ function! vimwiki#tags#generate_tags(...) abort "{{{
|
||||
\ '',
|
||||
\ substitute(g:vimwiki_rxH2_Template, '__Header__', tagname, ''),
|
||||
\ '' ])
|
||||
for taglink in tags_entries[tagname]
|
||||
for taglink in sort(tags_entries[tagname])
|
||||
call add(lines, bullet .
|
||||
\ substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', taglink, ''))
|
||||
endfor
|
||||
|
@ -415,7 +415,6 @@ function! vimwiki#tbl#goto_prev_col() "{{{
|
||||
let newcol = s:get_indent(lnum)
|
||||
let max_lens = s:get_cell_max_lens(lnum)
|
||||
let prev_cell_len = 0
|
||||
echom string(max_lens)
|
||||
for cell_len in values(max_lens)
|
||||
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
|
||||
if newcol + delta > curcol-1
|
||||
|
@ -32,18 +32,13 @@ function! vimwiki#u#is_macos()
|
||||
return os == 'Darwin' || os == 'Mac'
|
||||
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) "{{{
|
||||
let first_sym = matchstr(a:line, '\S')
|
||||
return len(matchstr(a:line, first_sym.'\+'))
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#u#escape(string) "{{{
|
||||
return escape(a:string, '.*[]\^$')
|
||||
return escape(a:string, '~.*[]\^$')
|
||||
endfunction "}}}
|
||||
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
|
254
doc/vimwiki.txt
254
doc/vimwiki.txt
@ -9,7 +9,7 @@
|
||||
|___| |___| |_| |_||__| |__||___| |___| |_||___| ~
|
||||
|
||||
|
||||
Version: 2.2
|
||||
Version: 2.3
|
||||
|
||||
==============================================================================
|
||||
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,
|
||||
'Tasks' will become '[[Tasks]]' -- a Vimwiki link. Press Enter again to
|
||||
open it. Edit the file, save it, and then press Backspace to jump back to your
|
||||
index.
|
||||
open it. Edit the file, save it, and then press Backspace to jump back to
|
||||
your index.
|
||||
|
||||
A Vimwiki link can be constructed from more than one word. Just visually
|
||||
select the words to be linked and press Enter. Try it with 'Project
|
||||
@ -196,6 +196,24 @@ See also |:VimwikiMakeDiaryNote|
|
||||
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
|
||||
|
||||
@ -358,70 +376,72 @@ gLr Renumber list items in all numbered lists in the whole
|
||||
:nmap <c-r> <Plug>VimwikiRenumberAllLists
|
||||
<
|
||||
*vimwiki_glstar* *vimwiki_gLstar*
|
||||
gl* Make a list item out of normal line or change the symbol
|
||||
of the current item to *.
|
||||
gl* Make a list item out of a normal line or change the
|
||||
symbol of the current item to *.
|
||||
gL* Change the symbol of the current list to *.
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo *<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo *<CR>
|
||||
<
|
||||
*vimwiki_gl#* *vimwiki_gL#*
|
||||
gl# Make a list item out of normal line or change the symbol
|
||||
of the current item to #.
|
||||
gl# Make a list item out of a normal line or change the
|
||||
symbol of the current item to #.
|
||||
gL# Change the symbol of the current list to #.
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo #<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo #<CR>
|
||||
<
|
||||
*vimwiki_gl-* *vimwiki_gL-*
|
||||
gl- Make a list item out of normal line or change the symbol
|
||||
of the current item to -.
|
||||
gl- Make a list item out of a normal line or change the
|
||||
symbol of the current item to -.
|
||||
gL- Change the symbol of the current list to -.
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo -<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo -<CR>
|
||||
<
|
||||
*vimwiki_gl1* *vimwiki_gL1*
|
||||
gl1 Make a list item out of normal line or change the symbol
|
||||
of the current item to 1., the numbering is adjusted
|
||||
according to the surrounding list items.
|
||||
gl1 Make a list item out of a normal line or change the
|
||||
symbol of the current item to 1., the numbering is
|
||||
adjusted according to the surrounding list items.
|
||||
gL1 Change the symbol of the current list to 1. 2. 3. ...
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo 1.<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo 1.<CR>
|
||||
<
|
||||
*vimwiki_gla* *vimwiki_gLa*
|
||||
gla Make a list item out of normal line or change the symbol
|
||||
of the current item to a), the numbering is adjusted
|
||||
according to the surrounding list items.
|
||||
gla Make a list item out of a normal line or change the
|
||||
symbol of the current item to a), the numbering is
|
||||
adjusted according to the surrounding list items.
|
||||
gLa Change the symbol of the current list to a) b) c) ...
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo a)<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo a)<CR>
|
||||
<
|
||||
*vimwiki_glA* *vimwiki_gLA*
|
||||
glA Make a list item out of normal line or change the symbol
|
||||
of the current item to A), the numbering is adjusted
|
||||
according to the surrounding list items.
|
||||
glA Make a list item out of a normal line or change the
|
||||
symbol of the current item to A), the numbering is
|
||||
adjusted according to the surrounding list items.
|
||||
gLA Change the symbol of the current list to A) B) C) ...
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo A)<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo A)<CR>
|
||||
<
|
||||
*vimwiki_gli* *vimwiki_gLi*
|
||||
gli Make a list item out of normal line or change the symbol
|
||||
of the current item to i), the numbering is adjusted
|
||||
according to the surrounding list items.
|
||||
gLi Change the symbol of the current list to i) ii) iii) ...
|
||||
gli Make a list item out of a normal line or change the
|
||||
symbol of the current item to i), the numbering is
|
||||
adjusted according to the surrounding list items.
|
||||
gLi Change the symbol of the current list to
|
||||
i) ii) iii) ...
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo i)<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo i)<CR>
|
||||
<
|
||||
*vimwiki_glI* *vimwiki_gLI*
|
||||
glI Make a list item out of normal line or change the symbol
|
||||
of the current item to I), the numbering is adjusted
|
||||
according to the surrounding list items.
|
||||
gLI Change the symbol of the current list to I) II) III) ...
|
||||
glI Make a list item out of a normal line or change the
|
||||
symbol of the current item to I), the numbering is
|
||||
adjusted according to the surrounding list items.
|
||||
gLI Change the symbol of the current list to
|
||||
I) II) III) ...
|
||||
To remap: >
|
||||
noremap glo :VimwikiChangeSymbolTo I)<CR>
|
||||
noremap glO :VimwikiChangeSymbolInListTo I)<CR>
|
||||
@ -567,6 +587,9 @@ il A single list item.
|
||||
*:VimwikiTabMakeDiaryNote*
|
||||
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*
|
||||
@ -793,8 +816,8 @@ identify wikilinks whose targets are not found.
|
||||
|
||||
Interwiki:~
|
||||
|
||||
If you maintain more than one wiki, you can create interwiki links between them
|
||||
by adding a numbered prefix "wikiX:" in front of a link: >
|
||||
If you maintain more than one wiki, you can create interwiki links between
|
||||
them by adding a numbered prefix "wikiX:" in front of a link: >
|
||||
[[wiki1:This is a link]]
|
||||
or: >
|
||||
[[wiki1:This is a link source|Description of the link]]
|
||||
@ -873,7 +896,7 @@ in HTML: >
|
||||
alt="Vimwiki"/>
|
||||
|
||||
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: >
|
||||
<img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
|
||||
alt="cool stuff" style="width:150px; height:120px"/>
|
||||
@ -914,7 +937,7 @@ Reference-style links: >
|
||||
a) [Link Name][Id]
|
||||
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 "]".
|
||||
|
||||
|
||||
@ -1149,7 +1172,7 @@ E.g.:
|
||||
}}$
|
||||
|
||||
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
|
||||
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).
|
||||
|
||||
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).
|
||||
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.
|
||||
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 use Vim's built-in tag search functionality (see |tagsrch.txt|) or
|
||||
@ -1290,7 +1313,7 @@ Hit |zr| one more time:
|
||||
* [ ] Do stuff 3~
|
||||
|
||||
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.
|
||||
|
||||
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*
|
||||
== Knitting club ==
|
||||
=== Knitting projects ===
|
||||
- [ ] a funny *pig*
|
||||
- [ ] a scary *dog*
|
||||
- [ ] a *funny pig*
|
||||
- [ ] a *scary dog*
|
||||
|
||||
Then, to jump from your index.wiki directly to your knitting projects, use: >
|
||||
[[Todo#Knitting projects]]
|
||||
|
||||
Or, to jump to an individual project, use this link: >
|
||||
[[Todo#pig]]
|
||||
[[Todo#funny pig]]
|
||||
|
||||
Or, to jump to a tag, use this link: >
|
||||
[[Todo#todo-lists]]
|
||||
|
||||
If there are multiple instances of an anchor, you can use the long form which
|
||||
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
|
||||
|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.
|
||||
|
||||
@ -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.
|
||||
@ -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*
|
||||
------------------------------------------------------------------------------
|
||||
Key Default value~
|
||||
@ -2075,7 +2120,7 @@ Key Default value~
|
||||
list_margin -1
|
||||
|
||||
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
|
||||
|:VimwikiGenerateLinks|), the Table of contents (|vimwiki-toc|) 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.
|
||||
|
||||
Value Description~
|
||||
'' Disable folding.
|
||||
'expr' Folding based on expression (folds sections and code blocks).
|
||||
'syntax' Folding based on syntax (folds sections; slower than 'expr').
|
||||
'list' Folding based on expression (folds list subitems; much slower).
|
||||
'' Disable folding
|
||||
'expr' Folding based on expression (folds sections and code blocks)
|
||||
'syntax' Folding based on syntax (folds sections; slower than 'expr')
|
||||
'list' Folding based on expression (folds list subitems; much slower)
|
||||
|
||||
Default: ''
|
||||
|
||||
@ -2311,7 +2356,7 @@ A second example handles a new scheme, "vfile:", which behaves similar to
|
||||
endif
|
||||
let link_infos = vimwiki#base#resolve_link(link)
|
||||
if link_infos.filename == ''
|
||||
echom 'Vimwiki Error: Unable to resolve link!'
|
||||
echomsg 'Vimwiki Error: Unable to resolve link!'
|
||||
return 0
|
||||
else
|
||||
exe 'tabnew ' . fnameescape(link_infos.filename)
|
||||
@ -2406,7 +2451,7 @@ Default: 1
|
||||
------------------------------------------------------------------------------
|
||||
*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.
|
||||
|
||||
If you have 'enc=utf-8' and set up >
|
||||
@ -2432,7 +2477,7 @@ Value Description~
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@ -2519,9 +2564,9 @@ Default: '' (empty)
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_valid_html_tags*
|
||||
|
||||
Case-insensitive comma separated list of HTML tags that can be used in Vimwiki.
|
||||
When converting to HTML, these tags are left as they are, while every other
|
||||
tag is escaped.
|
||||
Case-insensitive comma separated list of HTML tags that can be used in
|
||||
Vimwiki. When converting to HTML, these tags are left as they are, while
|
||||
every other tag is escaped.
|
||||
|
||||
Default: 'b,i,s,u,sub,sup,kbd,br,hr'
|
||||
|
||||
@ -2544,10 +2589,10 @@ they would not be deleted after |:VimwikiAll2HTML|.
|
||||
------------------------------------------------------------------------------
|
||||
*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 sets |conceallevel| to g:vimwiki_conceallevel every time a Vimwiki
|
||||
Vimwiki sets 'conceallevel' to g:vimwiki_conceallevel every time a Vimwiki
|
||||
buffer is entered.
|
||||
|
||||
With default settings, Vimwiki conceals one-character markers, shortens long
|
||||
@ -2559,7 +2604,7 @@ Default: 2
|
||||
------------------------------------------------------------------------------
|
||||
*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.
|
||||
|
||||
Value Description~
|
||||
@ -2594,19 +2639,6 @@ Note:
|
||||
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*
|
||||
|
||||
@ -2696,29 +2728,74 @@ Old homepage: http://code.google.com/p/vimwiki/
|
||||
|
||||
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
|
||||
- Stuart Andrews (tub78)
|
||||
- Stuart Andrews (@tub78)
|
||||
- Tomas Pospichal
|
||||
- Daniel Schemala (EinfachToll) as current maintainer
|
||||
- Larry Hynes (larryhynes)
|
||||
- Hector Arciga (harciga)
|
||||
- Alexey Radkov (lyokha)
|
||||
- Aaron Franks (af)
|
||||
- Dan Bernier (danbernier)
|
||||
- Carl Helmertz (chelmertz)
|
||||
- Karl Yngve Lervåg (lervag)
|
||||
- Patrick Davey (patrickdavey)
|
||||
- Ivan Tishchenko (t7ko)
|
||||
- 修昊 (Svtter)
|
||||
- Marcelo D Montu (mMontu)
|
||||
- Daniel Schemala (@EinfachToll) as current maintainer
|
||||
- Larry Hynes (@larryhynes)
|
||||
- Hector Arciga (@harciga)
|
||||
- Alexey Radkov (@lyokha)
|
||||
- Aaron Franks (@af)
|
||||
- Dan Bernier (@danbernier)
|
||||
- Carl Helmertz (@chelmertz)
|
||||
- Karl Yngve Lervåg (@lervag)
|
||||
- Patrick Davey (@patrickdavey)
|
||||
- Ivan Tishchenko (@t7ko)
|
||||
- 修昊 (@Svtter)
|
||||
- Marcelo D Montu (@mMontu)
|
||||
- John Kaul
|
||||
- Hongbo Liu (@hiberabyss)
|
||||
- @Tomsod
|
||||
- @wangzq
|
||||
- Jinzhou Zhang (@lotabout)
|
||||
- Michael Riley (@optik-aper)
|
||||
|
||||
|
||||
==============================================================================
|
||||
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:~
|
||||
* Support for anchors, see |vimwiki-anchors|
|
||||
@ -2732,7 +2809,7 @@ New:~
|
||||
* more key maps for list manipulation, see |vimwiki-list-manipulation|
|
||||
* improved automatic adjustment of checkboxes
|
||||
* 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_map_prefix|
|
||||
* Support for wiki links absolute to the wiki root
|
||||
@ -2740,10 +2817,12 @@ New:~
|
||||
* Issue #24: Basic support for remote directories via netrw
|
||||
* Issue #50: in HTML, tables can now be embedded in lists
|
||||
* 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
|
||||
|
||||
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
|
||||
vimwiki#base#resolve_link() (relevant if you have a custom
|
||||
|VimwikiLinkHandler| which used this function)
|
||||
@ -2785,11 +2864,6 @@ Fixed:~
|
||||
* Corrected website links in documentation. code.google is dead, long live
|
||||
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~
|
||||
|
||||
* Concealing of links can be turned off - set |g:vimwiki_url_maxsave| to 0.
|
||||
|
@ -31,7 +31,7 @@ execute 'setlocal suffixesadd='.VimwikiGet('ext')
|
||||
setlocal isfname-=[,]
|
||||
" gf}}}
|
||||
|
||||
exe "setlocal tags+=" . vimwiki#tags#metadata_file_path()
|
||||
exe "setlocal tags+=" . escape(vimwiki#tags#metadata_file_path(), ' \|"')
|
||||
|
||||
" MISC }}}
|
||||
|
||||
@ -173,9 +173,9 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
if line =~# g:vimwiki_rxHeader
|
||||
return '>'.vimwiki#u#count_first_sym(line)
|
||||
" Code block folding...
|
||||
elseif line =~# '^\s*'.g:vimwiki_rxPreStart
|
||||
elseif line =~# g:vimwiki_rxPreStart
|
||||
return 'a1'
|
||||
elseif line =~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
|
||||
elseif line =~# g:vimwiki_rxPreEnd
|
||||
return 's1'
|
||||
else
|
||||
return "="
|
||||
@ -221,7 +221,7 @@ function! VimwikiFoldText() "{{{
|
||||
let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
|
||||
let fold_len = v:foldend - v:foldstart + 1
|
||||
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)
|
||||
return main_text.len_text
|
||||
else
|
||||
|
@ -11,18 +11,6 @@ let g:loaded_vimwiki = 1
|
||||
let s:old_cpo = &cpo
|
||||
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 {{{
|
||||
function! s:default(varname, value) "{{{
|
||||
@ -36,14 +24,12 @@ function! s:path_html(idx) "{{{
|
||||
if !empty(path_html)
|
||||
return path_html
|
||||
else
|
||||
let g:VimwikiLog.path_html += 1 "XXX
|
||||
let path = VimwikiGet('path', a:idx)
|
||||
return substitute(path, '[/\\]\+$', '', '').'_html/'
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:normalize_path(path) "{{{
|
||||
let g:VimwikiLog.normalize_path += 1 "XXX
|
||||
" resolve doesn't work quite right with symlinks ended with / or \
|
||||
let path = substitute(a:path, '[/\\]\+$', '', '')
|
||||
if path !~# '^scp:'
|
||||
@ -71,16 +57,10 @@ function! s:vimwiki_idx() " {{{
|
||||
endfunction " }}}
|
||||
|
||||
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'
|
||||
" cache global vars of current state XXX: SLOW!?
|
||||
call vimwiki#base#cache_buffer_state()
|
||||
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
|
||||
|
||||
@ -91,16 +71,9 @@ function! s:setup_buffer_leave() "{{{
|
||||
endfunction "}}}
|
||||
|
||||
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.
|
||||
let path = expand('%:p:h')
|
||||
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
|
||||
return
|
||||
@ -124,24 +97,12 @@ function! s:setup_filetype() "{{{
|
||||
endif
|
||||
" initialize and cache global vars of current state
|
||||
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
|
||||
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 "}}}
|
||||
|
||||
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()
|
||||
" Find what wiki current buffer belongs to.
|
||||
" 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 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
|
||||
" extension to be global -- Do not add new wiki.
|
||||
if idx == -1 && g:vimwiki_global_ext == 0
|
||||
@ -176,9 +134,6 @@ function! s:setup_buffer_enter() "{{{
|
||||
endif
|
||||
" initialize and cache global vars of current state
|
||||
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
|
||||
|
||||
@ -188,22 +143,15 @@ function! s:setup_buffer_enter() "{{{
|
||||
" au GUIEnter * nested VimwikiIndex
|
||||
if &filetype == ''
|
||||
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'
|
||||
" to force a rescan of the filesystem which may have changed
|
||||
" and update VimwikiLinks syntax group that depends on it;
|
||||
" b:vimwiki_fs_rescan indicates that setup_filetype() has not been run
|
||||
if exists("b:vimwiki_fs_rescan") && VimwikiGet('maxhi')
|
||||
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
|
||||
let b:vimwiki_fs_rescan = 1
|
||||
endif
|
||||
let time1 = vimwiki#u#time(time0) "XXX
|
||||
|
||||
" 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
|
||||
@ -221,7 +169,7 @@ function! s:setup_buffer_enter() "{{{
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
else
|
||||
setlocal fdm=manual
|
||||
exe "normal zE"
|
||||
normal! zE
|
||||
endif
|
||||
|
||||
" And conceal level too.
|
||||
@ -233,21 +181,13 @@ function! s:setup_buffer_enter() "{{{
|
||||
if g:vimwiki_menu != ""
|
||||
exe 'nmenu enable '.g:vimwiki_menu.'.Table'
|
||||
endif
|
||||
"let time2 = vimwiki#u#time(time0) "XXX
|
||||
call VimwikiLog_extend('timing',['plugin:setup_buffer_enter:time1',time1])
|
||||
endfunction "}}}
|
||||
|
||||
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()
|
||||
" Do not repeat work of s:setup_buffer_enter() and s:setup_filetype()
|
||||
" Once should be enough ...
|
||||
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")
|
||||
let s:vimwiki_autowriteall = &autowriteall
|
||||
endif
|
||||
@ -394,6 +334,7 @@ let s:vimwiki_defaults.template_default = 'default'
|
||||
let s:vimwiki_defaults.template_ext = '.tpl'
|
||||
|
||||
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_toc = 0
|
||||
" 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('conceallevel', 2)
|
||||
call s:default('url_maxsave', 15)
|
||||
call s:default('debug', 0)
|
||||
|
||||
call s:default('diary_months',
|
||||
\ {
|
||||
@ -525,6 +465,8 @@ command! -count=1 VimwikiMakeDiaryNote
|
||||
\ call vimwiki#diary#make_note(v:count1)
|
||||
command! -count=1 VimwikiTabMakeDiaryNote
|
||||
\ 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
|
||||
\ call vimwiki#diary#generate_diary_section()
|
||||
@ -567,6 +509,12 @@ endif
|
||||
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
|
||||
\ :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 {{{
|
||||
|
@ -10,14 +10,12 @@ elseif exists("b:current_syntax")
|
||||
endif
|
||||
|
||||
"TODO do nothing if ...? (?)
|
||||
let g:starttime = reltime() " start the clock
|
||||
if VimwikiGet('maxhi')
|
||||
let b:existing_wikifiles =
|
||||
\ vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 1)
|
||||
let b:existing_wikidirs =
|
||||
\ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx)
|
||||
endif
|
||||
let s:timescans = vimwiki#u#time(g:starttime) "XXX
|
||||
"let b:xxx = 1
|
||||
"TODO ? update wikilink syntax group here if really needed (?) for :e and such
|
||||
"if VimwikiGet('maxhi')
|
||||
@ -47,8 +45,6 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
||||
|
||||
call vimwiki#u#reload_regexes()
|
||||
|
||||
let s:time0 = vimwiki#u#time(g:starttime) "XXX
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
" LINKS: setup wikilink regexps {{{
|
||||
@ -177,9 +173,6 @@ let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{
|
||||
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 suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match '.a:type.'T `'
|
||||
@ -189,9 +182,6 @@ function! s:add_target_syntax_ON(target, type) " {{{
|
||||
endfunction "}}}
|
||||
|
||||
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 suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
@ -252,16 +242,12 @@ if VimwikiGet('maxhi')
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl)
|
||||
|
||||
" 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()
|
||||
let s:time02 = vimwiki#u#time(g:starttime) "XXX
|
||||
else
|
||||
let s:time01 = vimwiki#u#time(g:starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink')
|
||||
" WikiIncl
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink')
|
||||
let s:time02 = vimwiki#u#time(g:starttime) "XXX
|
||||
endif
|
||||
|
||||
" 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 " {{{
|
||||
let s:conceal = exists("+conceallevel") ? ' conceal' : ''
|
||||
|
||||
@ -344,14 +336,6 @@ execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'.s:
|
||||
" }}}
|
||||
|
||||
" 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
|
||||
" 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
|
||||
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/'
|
||||
|
||||
execute 'syntax region VimwikiPre start=/^\s*'.g:vimwiki_rxPreStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxPreEnd.'\s*$/ contains=@Spell'
|
||||
execute 'syntax region VimwikiPre start=/'.g:vimwiki_rxPreStart.
|
||||
\ '/ end=/'.g:vimwiki_rxPreEnd.'/ contains=@Spell'
|
||||
|
||||
execute 'syntax region VimwikiMath start=/^\s*'.g:vimwiki_rxMathStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxMathEnd.'\s*$/ contains=@Spell'
|
||||
execute 'syntax region VimwikiMath start=/'.g:vimwiki_rxMathStart.
|
||||
\ '/ end=/'.g:vimwiki_rxMathEnd.'/ contains=@Spell'
|
||||
|
||||
|
||||
" placeholders
|
||||
@ -610,23 +594,23 @@ let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
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)
|
||||
for [s:hl_syntax, s:vim_syntax] in items(s:nested)
|
||||
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*'.g:vimwiki_rxPreEnd, 'VimwikiPre')
|
||||
\ g:vimwiki_rxPreEnd, 'VimwikiPre')
|
||||
endfor
|
||||
endif
|
||||
" LaTeX
|
||||
call vimwiki#base#nested_syntax('tex',
|
||||
\ '^\s*'.g:vimwiki_rxMathStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ g:vimwiki_rxMathStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ '\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*'.g:vimwiki_rxMathEnd, 'VimwikiMath')
|
||||
\ g:vimwiki_rxMathEnd, 'VimwikiMath')
|
||||
"}}}
|
||||
|
||||
|
||||
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])
|
||||
|
@ -204,9 +204,6 @@ let g:vimwiki_rxMkdRefMatchUrl = '\['.g:vimwiki_rxWikiLinkDescr.']:\%(\s\+\|\n\)
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{
|
||||
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 suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match '.a:type.'T `'
|
||||
@ -216,9 +213,6 @@ function! s:add_target_syntax_ON(target, type) " {{{
|
||||
endfunction "}}}
|
||||
|
||||
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 suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
@ -291,14 +285,10 @@ if VimwikiGet('maxhi')
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
|
||||
" 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()
|
||||
let s:time02 = vimwiki#u#time(g:starttime) "XXX
|
||||
else
|
||||
let s:time01 = vimwiki#u#time(g:starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
let s:time02 = vimwiki#u#time(g:starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
@ -340,13 +330,6 @@ endif
|
||||
|
||||
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
|
||||
" is present) and may be concealed
|
||||
let s:options = ' contained transparent contains=NONE'
|
||||
|
Reference in New Issue
Block a user