pull in vimwiki 2.1 from vim.org
This commit is contained in:
parent
aea5b41f44
commit
a0bd07e629
@ -166,9 +166,9 @@ function! vimwiki#base#validate_wiki_options(idx) " {{{ Validate wiki options
|
||||
" update normalized path & path_html
|
||||
call VimwikiSet('path', s:normalize_path(VimwikiGet('path', a:idx)), a:idx)
|
||||
call VimwikiSet('path_html', s:normalize_path(s:path_html(a:idx)), a:idx)
|
||||
call VimwikiSet('template_path',
|
||||
call VimwikiSet('template_path',
|
||||
\ s:normalize_path(VimwikiGet('template_path', a:idx)), a:idx)
|
||||
call VimwikiSet('diary_rel_path',
|
||||
call VimwikiSet('diary_rel_path',
|
||||
\ s:normalize_path(VimwikiGet('diary_rel_path', a:idx)), a:idx)
|
||||
|
||||
" XXX: It's too early to update global / buffer variables, because they are
|
||||
@ -236,7 +236,7 @@ endfunction "}}}
|
||||
|
||||
" vimwiki#base#mkdir
|
||||
" If the optional argument 'confirm' == 1 is provided,
|
||||
" vimwiki#base#mkdir will ask before creating a directory
|
||||
" vimwiki#base#mkdir will ask before creating a directory
|
||||
function! vimwiki#base#mkdir(path, ...) "{{{
|
||||
let path = expand(a:path)
|
||||
if !isdirectory(path) && exists("*mkdir")
|
||||
@ -258,7 +258,7 @@ function! vimwiki#base#file_pattern(files) "{{{ Get search regex from glob()
|
||||
" names that are compatible with any external restrictions that they
|
||||
" encounter (e.g. filesystem, wiki conventions, other syntaxes, ...).
|
||||
" See: http://code.google.com/p/vimwiki/issues/detail?id=316
|
||||
" Change / to [/\\] to allow "Windows paths"
|
||||
" Change / to [/\\] to allow "Windows paths"
|
||||
" TODO: boundary cases ...
|
||||
" e.g. "File$", "^File", "Fi]le", "Fi[le", "Fi\le", "Fi/le"
|
||||
" XXX: (remove my comment if agreed) Maxim: with \V (very nomagic) boundary
|
||||
@ -317,7 +317,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html) " {{{ Resolve scheme
|
||||
let lnk = a:lnk
|
||||
let is_schemeless = lnk !~ g:vimwiki_rxSchemeUrl
|
||||
let lnk = (is_schemeless ? 'wiki'.g:vimwiki_current_idx.':'.lnk : lnk)
|
||||
|
||||
|
||||
" Get scheme
|
||||
let scheme = matchstr(lnk, g:vimwiki_rxSchemeUrlMatchScheme)
|
||||
" Get link (without scheme)
|
||||
@ -328,7 +328,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html) " {{{ Resolve scheme
|
||||
let idx = -1
|
||||
|
||||
" do nothing if scheme is unknown to vimwiki
|
||||
if !(scheme =~ 'wiki.*' || scheme =~ 'diary' || scheme =~ 'local'
|
||||
if !(scheme =~ 'wiki.*' || scheme =~ 'diary' || scheme =~ 'local'
|
||||
\ || scheme =~ 'file')
|
||||
return [idx, scheme, path, subdir, lnk, ext, scheme.':'.lnk]
|
||||
endif
|
||||
@ -441,10 +441,10 @@ function! vimwiki#base#system_open_link(url) "{{{
|
||||
execute '!open ' . shellescape(a:url, 1)
|
||||
endfunction
|
||||
function! s:linux_handler(url)
|
||||
execute 'silent !xdg-open ' . shellescape(a:url, 1)
|
||||
call system('xdg-open ' . shellescape(a:url, 1).' &')
|
||||
endfunction
|
||||
let success = 0
|
||||
try
|
||||
try
|
||||
if vimwiki#u#is_windows()
|
||||
call s:win32_handler(a:url)
|
||||
return
|
||||
@ -461,7 +461,7 @@ endfunction "}}}
|
||||
|
||||
" vimwiki#base#open_link
|
||||
function! vimwiki#base#open_link(cmd, link, ...) "{{{
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(a:link, 0)
|
||||
|
||||
if url == ''
|
||||
@ -473,13 +473,13 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
|
||||
endif
|
||||
|
||||
let update_prev_link = (
|
||||
\ scheme == '' ||
|
||||
\ scheme =~ 'wiki' ||
|
||||
\ scheme == '' ||
|
||||
\ scheme =~ 'wiki' ||
|
||||
\ scheme =~ 'diary' ? 1 : 0)
|
||||
|
||||
let use_system_open = (
|
||||
\ scheme == '' ||
|
||||
\ scheme =~ 'wiki' ||
|
||||
\ scheme == '' ||
|
||||
\ scheme =~ 'wiki' ||
|
||||
\ scheme =~ 'diary' ? 0 : 1)
|
||||
|
||||
let vimwiki_prev_link = []
|
||||
@ -514,7 +514,7 @@ function! vimwiki#base#generate_links() "{{{only get links from the current dir
|
||||
" change to the directory of the current file
|
||||
let orig_pwd = getcwd()
|
||||
lcd! %:h
|
||||
" all path are relative to the current file's location
|
||||
" all path are relative to the current file's location
|
||||
let globlinks = glob('*'.VimwikiGet('ext'),1)."\n"
|
||||
" remove extensions
|
||||
let globlinks = substitute(globlinks, '\'.VimwikiGet('ext').'\ze\n', '', 'g')
|
||||
@ -549,7 +549,7 @@ endfunction "}}}
|
||||
function! vimwiki#base#backlinks() "{{{
|
||||
execute 'lvimgrep "\%(^\|[[:blank:][:punct:]]\)'.
|
||||
\ expand("%:t:r").
|
||||
\ '\([[:blank:][:punct:]]\|$\)" '.
|
||||
\ '\([[:blank:][:punct:]]\|$\)\C" '.
|
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
||||
endfunction "}}}
|
||||
|
||||
@ -560,7 +560,7 @@ function! vimwiki#base#get_links(pat) "{{{ return string-list for files
|
||||
|
||||
let time1 = reltime() " start the clock
|
||||
|
||||
" XXX:
|
||||
" XXX:
|
||||
" if maxhi = 1 and <leader>w<leader>w before loading any vimwiki file
|
||||
" cached 'subdir' is not set up
|
||||
try
|
||||
@ -575,18 +575,18 @@ function! vimwiki#base#get_links(pat) "{{{ return string-list for files
|
||||
" if current wiki is temporary -- was added by an arbitrary wiki file then do
|
||||
" not search wiki files in subdirectories. Or it would hang the system if
|
||||
" wiki file was created in $HOME or C:/ dirs.
|
||||
if VimwikiGet('temp')
|
||||
if VimwikiGet('temp')
|
||||
let search_dirs = ''
|
||||
else
|
||||
let search_dirs = '**/'
|
||||
endif
|
||||
" let globlinks = "\n".glob(VimwikiGet('path').search_dirs.a:pat,1)."\n"
|
||||
|
||||
|
||||
"save pwd, do lcd %:h, restore old pwd; getcwd()
|
||||
" change to the directory of the current file
|
||||
let orig_pwd = getcwd()
|
||||
|
||||
" calling from other than vimwiki file
|
||||
|
||||
" calling from other than vimwiki file
|
||||
let path_base = vimwiki#u#path_norm(vimwiki#u#chomp_slash(VimwikiGet('path')))
|
||||
let path_file = vimwiki#u#path_norm(vimwiki#u#chomp_slash(expand('%:p:h')))
|
||||
|
||||
@ -596,7 +596,7 @@ function! vimwiki#base#get_links(pat) "{{{ return string-list for files
|
||||
lcd! %:p:h
|
||||
endif
|
||||
|
||||
" all path are relative to the current file's location
|
||||
" all path are relative to the current file's location
|
||||
let globlinks = "\n".glob(invsubdir.search_dirs.a:pat,1)."\n"
|
||||
" remove extensions
|
||||
let globlinks = substitute(globlinks,'\'.VimwikiGet('ext').'\ze\n', '', 'g')
|
||||
@ -613,7 +613,7 @@ function! vimwiki#base#get_links(pat) "{{{ return string-list for files
|
||||
endfor
|
||||
" for directories: add ./ (instead of now empty) and invsubdir (if distinct)
|
||||
if a:pat == '*/'
|
||||
let globlinks = substitute(globlinks, "\n\n", "\n./\n",'')
|
||||
let globlinks = substitute(globlinks, "\n\n", "\n./\n",'')
|
||||
if invsubdir != ''
|
||||
let globlinks .= invsubdir."\n"
|
||||
else
|
||||
@ -639,7 +639,7 @@ function! vimwiki#base#edit_file(command, filename, ...) "{{{
|
||||
" then
|
||||
" [[test*file]]...
|
||||
" you'll have E77: Too many file names
|
||||
let fname = escape(a:filename, '% *|')
|
||||
let fname = escape(a:filename, '% *|#')
|
||||
let dir = fnamemodify(a:filename, ":p:h")
|
||||
if vimwiki#base#mkdir(dir, 1)
|
||||
execute a:command.' '.fname
|
||||
@ -755,9 +755,9 @@ function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
|
||||
let old_fname_r = old_fname
|
||||
let new_fname_r = new_fname
|
||||
|
||||
let old_fname_r = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
let old_fname_r = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ '\zs'.old_fname.'\ze', '.*', '').
|
||||
\ '\|'. vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ '\|'. vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ '\zs'.old_fname.'\ze', '.*', '')
|
||||
|
||||
let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n')
|
||||
@ -801,7 +801,7 @@ function! s:update_wiki_links(old_fname, new_fname) " {{{
|
||||
while idx < len(dirs_keys)
|
||||
let dir = dirs_keys[idx]
|
||||
let new_dir = dirs_vals[idx]
|
||||
call s:update_wiki_links_dir(dir,
|
||||
call s:update_wiki_links_dir(dir,
|
||||
\ new_dir.old_fname, new_dir.new_fname)
|
||||
let idx = idx + 1
|
||||
endwhile
|
||||
@ -872,12 +872,12 @@ function! vimwiki#base#nested_syntax(filetype, start, end, textSnipHl) abort "{{
|
||||
" regular one.
|
||||
" Perl syntax file has perlFunctionName which is usually has no effect due to
|
||||
" 'contained' flag. Now we have 'syntax include' that makes all the groups
|
||||
" included as 'contained' into specific group.
|
||||
" included as 'contained' into specific group.
|
||||
" Here perlFunctionName (with quite an angry regexp "\h\w*[^:]") clashes with
|
||||
" the rest syntax rules as now it has effect being really 'contained'.
|
||||
" Clear it!
|
||||
if ft =~ 'perl'
|
||||
syntax clear perlFunctionName
|
||||
syntax clear perlFunctionName
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
@ -895,7 +895,7 @@ function! vimwiki#base#find_prev_link() "{{{
|
||||
endfunction " }}}
|
||||
|
||||
" vimwiki#base#follow_link
|
||||
function! vimwiki#base#follow_link(split, ...) "{{{ Parse link at cursor and pass
|
||||
function! vimwiki#base#follow_link(split, ...) "{{{ Parse link at cursor and pass
|
||||
" to VimwikiLinkHandler, or failing that, the default open_link handler
|
||||
if exists('*vimwiki#'.VimwikiGet('syntax').'_base#follow_link')
|
||||
" Syntax-specific links
|
||||
@ -941,7 +941,7 @@ function! vimwiki#base#follow_link(split, ...) "{{{ Parse link at cursor and pas
|
||||
|
||||
if a:0 > 0
|
||||
execute "normal! ".a:1
|
||||
else
|
||||
else
|
||||
call vimwiki#base#normalize_link(0)
|
||||
endif
|
||||
endif
|
||||
@ -1051,7 +1051,7 @@ function! vimwiki#base#rename_link() "{{{
|
||||
if url != ''
|
||||
let new_link = url
|
||||
endif
|
||||
|
||||
|
||||
let new_link = subdir.new_link
|
||||
let new_fname = VimwikiGet('path').new_link.VimwikiGet('ext')
|
||||
|
||||
@ -1134,7 +1134,7 @@ function! vimwiki#base#TO_header(inner, visual) "{{{
|
||||
if !search('^\(=\+\).\+\1\s*$', 'bcW')
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
let sel_start = line("'<")
|
||||
let sel_end = line("'>")
|
||||
let block_start = line(".")
|
||||
@ -1142,7 +1142,7 @@ function! vimwiki#base#TO_header(inner, visual) "{{{
|
||||
|
||||
let level = vimwiki#u#count_first_sym(getline('.'))
|
||||
|
||||
let is_header_selected = sel_start == block_start
|
||||
let is_header_selected = sel_start == block_start
|
||||
\ && sel_start != sel_end
|
||||
|
||||
if a:visual && is_header_selected
|
||||
@ -1374,7 +1374,7 @@ function! vimwiki#base#AddHeaderLevel() "{{{
|
||||
call setline(lnum, line)
|
||||
endif
|
||||
else
|
||||
let line = substitute(line, '^\s*', '&'.rxHdr.' ', '')
|
||||
let line = substitute(line, '^\s*', '&'.rxHdr.' ', '')
|
||||
if g:vimwiki_symH
|
||||
let line = substitute(line, '\s*$', ' '.rxHdr.'&', '')
|
||||
endif
|
||||
@ -1427,7 +1427,7 @@ function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{
|
||||
let magic_chars = '.*[\^$'
|
||||
let lnk = escape(a:template, magic_chars)
|
||||
if a:rxUrl != ""
|
||||
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", '')
|
||||
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", '')
|
||||
endif
|
||||
if a:rxDesc != ""
|
||||
let lnk = substitute(lnk, '__LinkDescription__', '\='."'".a:rxDesc."'", '')
|
||||
@ -1492,7 +1492,7 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
" try WikiIncl
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiIncl)
|
||||
if !empty(lnk)
|
||||
@ -1567,7 +1567,7 @@ endfunction "}}}
|
||||
" Load syntax-specific Wiki functionality
|
||||
for syn in vimwiki#base#get_known_syntaxes()
|
||||
execute 'runtime! autoload/vimwiki/'.syn.'_base.vim'
|
||||
endfor
|
||||
endfor
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -4,7 +4,15 @@
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" XXX: This file should be refactored!
|
||||
" TODO: We need vimwiki abstract syntax tree. If properly designed it wourld
|
||||
" greatly symplify different syntax to HTML generation.
|
||||
"
|
||||
" vimwiki -- --> PDF
|
||||
" \ /
|
||||
" markdown -----> AST -----> HTML
|
||||
" / \
|
||||
" mediawiki -- --> Latex
|
||||
"
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_html_auto") || &cp
|
||||
@ -137,22 +145,12 @@ endfunction "}}}
|
||||
|
||||
function! s:safe_html(line) "{{{
|
||||
" escape & < > when producing HTML text
|
||||
" uses variables s:lt_pattern, s:gt_pattern that are
|
||||
" set in vimwiki#html#Wiki2HTML() according to g:vimwiki_valid_html_tags
|
||||
"" htmlize symbols: < > &
|
||||
|
||||
" s:lt_pattern, s:gt_pattern depend on g:vimwiki_valid_html_tags
|
||||
" and are set in vimwiki#html#Wiki2HTML()
|
||||
let line = substitute(a:line, '&', '\&', 'g')
|
||||
" the following depends on g:vimwiki_valid_html_tags
|
||||
let line = substitute(line,s:lt_pattern,'\<', 'g')
|
||||
let line = substitute(line,s:gt_pattern,'\>', 'g')
|
||||
|
||||
"let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
"let line = substitute(line,'<\%(/\?\%('
|
||||
" \.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!',
|
||||
" \'\<', 'g')
|
||||
"let line = substitute(line,'\%(</\?\%('
|
||||
" \.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>',
|
||||
" \'\>', 'g')
|
||||
return line
|
||||
endfunction "}}}
|
||||
|
||||
@ -379,8 +377,8 @@ function! vimwiki#html#linkify_link(src, descr) "{{{
|
||||
let src_str = ' href="'.a:src.'"'
|
||||
let descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','')
|
||||
let descr = (descr == "" ? a:src : descr)
|
||||
let descr_str = (descr =~ g:vimwiki_rxWikiIncl
|
||||
\ ? s:tag_wikiincl(descr)
|
||||
let descr_str = (descr =~ g:vimwiki_rxWikiIncl
|
||||
\ ? s:tag_wikiincl(descr)
|
||||
\ : descr)
|
||||
return '<a'.src_str.'>'.descr_str.'</a>'
|
||||
endfunction "}}}
|
||||
@ -415,7 +413,7 @@ function! s:tag_wikiincl(value) "{{{
|
||||
let descr = matchstr(str, vimwiki#html#incl_match_arg(1))
|
||||
let verbatim_str = matchstr(str, vimwiki#html#incl_match_arg(2))
|
||||
" resolve url
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(url_0, 1)
|
||||
" generate html output
|
||||
" TODO: migrate non-essential debugging messages into g:VimwikiLog
|
||||
@ -448,7 +446,7 @@ function! s:tag_wikilink(value) "{{{
|
||||
let descr = (substitute(descr,'^\s*\(.*\)\s*$','\1','') != '' ? descr : url)
|
||||
|
||||
" resolve url
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(url, 1)
|
||||
|
||||
" generate html output
|
||||
@ -456,11 +454,10 @@ function! s:tag_wikilink(value) "{{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[[idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.']]'
|
||||
endif
|
||||
let url = escape(url, '#')
|
||||
let line = vimwiki#html#linkify_link(url, descr)
|
||||
return line
|
||||
endfunction "}}}
|
||||
"}}} v1.3 links
|
||||
"}}}
|
||||
|
||||
|
||||
function! s:tag_remove_internal_link(value) "{{{
|
||||
@ -511,7 +508,7 @@ endfunction "}}}
|
||||
function! s:make_tag(line, regexp, func) "{{{
|
||||
" Make tags for a given matched regexp.
|
||||
" Exclude preformatted text and href links.
|
||||
" FIXME
|
||||
" FIXME
|
||||
let patt_splitter = '\(`[^`]\+`\)\|'.
|
||||
\ '\('.g:vimwiki_rxPreStart.'.\+'.g:vimwiki_rxPreEnd.'\)\|'.
|
||||
\ '\(<a href.\{-}</a>\)\|'.
|
||||
@ -612,7 +609,7 @@ endfunction "}}}
|
||||
function! s:close_tag_table(table, ldest) "{{{
|
||||
" The first element of table list is a string which tells us if table should be centered.
|
||||
" The rest elements are rows which are lists of columns:
|
||||
" ['center',
|
||||
" ['center',
|
||||
" [ CELL1, CELL2, CELL3 ],
|
||||
" [ CELL1, CELL2, CELL3 ],
|
||||
" [ CELL1, CELL2, CELL3 ],
|
||||
@ -623,7 +620,7 @@ function! s:close_tag_table(table, ldest) "{{{
|
||||
let table = a:table
|
||||
|
||||
" Get max cells
|
||||
let max_cells = 0
|
||||
let max_cells = 0
|
||||
for row in table[1:]
|
||||
let n_cells = len(row)
|
||||
if n_cells > max_cells
|
||||
@ -669,14 +666,14 @@ function! s:close_tag_table(table, ldest) "{{{
|
||||
function! s:close_tag_row(row, header, ldest) "{{{
|
||||
call add(a:ldest, '<tr>')
|
||||
|
||||
" Set tag element of columns
|
||||
" Set tag element of columns
|
||||
if a:header
|
||||
let tag_name = 'th'
|
||||
else
|
||||
let tag_name = 'td'
|
||||
end
|
||||
|
||||
" Close tag of columns
|
||||
" Close tag of columns
|
||||
for cell in a:row
|
||||
if cell.rowspan == 0 || cell.colspan == 0
|
||||
continue
|
||||
@ -859,7 +856,7 @@ function! s:process_tag_list(line, lists) "{{{
|
||||
endif
|
||||
" let completion = match(g:vimwiki_listsyms, '\C' . chk[1])
|
||||
let completion = s:get_completion_index(chk[1])
|
||||
if completion >= 0 && completion <=4
|
||||
if completion >= 0 && completion <=4
|
||||
let st_tag = '<li class="done'.completion.'">'
|
||||
endif
|
||||
endif
|
||||
@ -1028,7 +1025,7 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let h_text = vimwiki#u#trim(matchstr(line, g:vimwiki_rxHeader))
|
||||
|
||||
if g:vimwiki_html_header_numbering
|
||||
let num = matchstr(h_number,
|
||||
let num = matchstr(h_number,
|
||||
\ '^\(\d.\)\{'.(g:vimwiki_html_header_numbering-1).'}\zs.*')
|
||||
if !empty(num)
|
||||
let num .= g:vimwiki_html_header_numbering_sym
|
||||
@ -1352,13 +1349,17 @@ endfunction " }}}
|
||||
|
||||
function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
|
||||
call vimwiki#base#mkdir(a:path)
|
||||
execute '!'.VimwikiGet('custom_wiki2html'). ' '
|
||||
echomsg system(VimwikiGet('custom_wiki2html'). ' '.
|
||||
\ a:force. ' '.
|
||||
\ VimwikiGet('syntax'). ' '.
|
||||
\ strpart(VimwikiGet('ext'), 1). ' '.
|
||||
\ a:path. ' '.
|
||||
\ a:wikifile. ' '.
|
||||
\ s:default_CSS_full_name(a:path)
|
||||
\ shellescape(a:path, 1). ' '.
|
||||
\ shellescape(a:wikifile, 1). ' '.
|
||||
\ shellescape(s:default_CSS_full_name(a:path), 1). ' '.
|
||||
\ (len(VimwikiGet('template_path')) > 1 ? shellescape(expand(VimwikiGet('template_path')), 1) : '-'). ' '.
|
||||
\ (len(VimwikiGet('template_default')) > 0 ? VimwikiGet('template_default') : '-'). ' '.
|
||||
\ (len(VimwikiGet('template_ext')) > 0 ? VimwikiGet('template_ext') : '-'). ' '.
|
||||
\ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir')), 1) : '-'))
|
||||
endfunction " }}}
|
||||
|
||||
function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
@ -1369,7 +1370,7 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
|
||||
let wikifile = fnamemodify(a:wikifile, ":p")
|
||||
|
||||
let path_html = expand(a:path_html).VimwikiGet('subdir')
|
||||
let path_html = expand(a:path_html).VimwikiGet('subdir')
|
||||
let htmlfile = fnamemodify(wikifile, ":t:r").'.html'
|
||||
|
||||
if s:use_custom_wiki2html()
|
||||
@ -1415,8 +1416,8 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
let s:gt_pattern = '>'
|
||||
if g:vimwiki_valid_html_tags != ''
|
||||
let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
let s:lt_pattern = '<\%(/\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!'
|
||||
let s:gt_pattern = '\%(</\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>'
|
||||
let s:lt_pattern = '\c<\%(/\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!'
|
||||
let s:gt_pattern = '\c\%(</\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>'
|
||||
endif
|
||||
|
||||
for line in lsource
|
||||
@ -1487,7 +1488,7 @@ 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
|
||||
@ -1499,7 +1500,7 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
||||
return
|
||||
endif
|
||||
|
||||
" measure the elapsed time
|
||||
" measure the elapsed time
|
||||
let time1 = vimwiki#u#time(starttime) "XXX
|
||||
call VimwikiLog_extend('html',[htmlfile,time1])
|
||||
"if g:vimwiki_debug
|
||||
@ -1566,7 +1567,7 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:file_exists(fname) "{{{
|
||||
return !empty(getftype(a:fname))
|
||||
return !empty(getftype(expand(a:fname)))
|
||||
endfunction "}}}
|
||||
|
||||
" uses VimwikiGet('path')
|
||||
|
@ -183,7 +183,7 @@ function! s:get_child_items(lnum) "{{{
|
||||
call add(result, lnum)
|
||||
let lnum = s:next_list_item(lnum)
|
||||
endwhile
|
||||
|
||||
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
@ -207,7 +207,7 @@ function! s:get_sibling_items(lnum) "{{{
|
||||
endif
|
||||
let lnum = s:prev_list_item(lnum)
|
||||
endwhile
|
||||
|
||||
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
@ -407,12 +407,12 @@ function s:get_list_nesting_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
if getline(a:lnum) !~ s:rx_list_item()
|
||||
let level = 0
|
||||
else
|
||||
else
|
||||
let level = vimwiki#u#count_first_sym(getline(a:lnum)) - 1
|
||||
let level = level < 0 ? 0 : level
|
||||
endif
|
||||
else
|
||||
let level = indent(a:lnum)
|
||||
let level = indent(a:lnum)
|
||||
endif
|
||||
return level
|
||||
endfunction "}}}
|
||||
@ -477,7 +477,7 @@ function! vimwiki#lst#change_level(...) "{{{
|
||||
let li_bullet_and_content = strpart(line, n_nesting + n_indent)
|
||||
|
||||
" list bullet and checkbox
|
||||
let cb_bullet = matchstr(li_bullet_and_content, s:rx_list_item()).
|
||||
let cb_bullet = matchstr(li_bullet_and_content, s:rx_list_item()).
|
||||
\ matchstr(li_bullet_and_content, s:rx_cb_list_item())
|
||||
|
||||
" XXX: it could be not unicode proof --> if checkboxes are set up with unicode syms
|
||||
@ -505,18 +505,18 @@ function! vimwiki#lst#change_level(...) "{{{
|
||||
endif
|
||||
|
||||
" change level
|
||||
if cmd == '--'
|
||||
if cmd == '--'
|
||||
let cb_bullet = s:compose_cb_bullet(cb_bullet, sym)
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let sym_nest = sym
|
||||
endif
|
||||
elseif cmd == '>>'
|
||||
elseif cmd == '>>'
|
||||
if cb_bullet == ''
|
||||
let cb_bullet = sym
|
||||
else
|
||||
let n_nesting = n_nesting + list_sw
|
||||
endif
|
||||
elseif cmd == '<<'
|
||||
elseif cmd == '<<'
|
||||
let n_nesting = n_nesting - list_sw
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
if n_nesting < 0
|
||||
|
@ -21,7 +21,7 @@ function! vimwiki#markdown_base#scan_reflinks() " {{{
|
||||
catch /^Vim\%((\a\+)\)\=:E480/ " No Match
|
||||
"Ignore it, and move on to the next file
|
||||
endtry
|
||||
"
|
||||
"
|
||||
for d in getqflist()
|
||||
let matchline = join(getline(d.lnum, min([d.lnum+1, line('$')])), ' ')
|
||||
let descr = matchstr(matchline, g:vimwiki_rxMkdRefMatchDescr)
|
||||
@ -108,7 +108,7 @@ endfunction " }}}
|
||||
" vimwiki#base#find_prev_link
|
||||
|
||||
" vimwiki#base#follow_link
|
||||
function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at cursor and pass
|
||||
function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at cursor and pass
|
||||
" to VimwikiLinkHandler, or failing that, the default open_link handler
|
||||
" echom "markdown_base#follow_link"
|
||||
|
||||
@ -153,7 +153,7 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
|
||||
|
||||
if a:0 > 0
|
||||
execute "normal! ".a:1
|
||||
else
|
||||
else
|
||||
call vimwiki#base#normalize_link(0)
|
||||
endif
|
||||
endif
|
||||
@ -210,7 +210,7 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
" try WikiLink1: replace with WikiLink0
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiLink1)
|
||||
if !empty(lnk)
|
||||
@ -223,7 +223,7 @@ function! s:normalize_link_syntax_n() " {{{
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
" try Weblink
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWeblink)
|
||||
if !empty(lnk)
|
||||
|
@ -16,10 +16,13 @@ let g:loaded_vimwiki_tbl_auto = 1
|
||||
"}}}
|
||||
|
||||
let s:textwidth = &tw
|
||||
let s:rxSep = g:vimwiki_rxTableSep
|
||||
|
||||
|
||||
" Misc functions {{{
|
||||
function! s:rxSep() "{{{
|
||||
return g:vimwiki_rxTableSep
|
||||
endfunction "}}}
|
||||
|
||||
function! s:wide_len(str) "{{{
|
||||
" vim73 has new function that gives correct string width.
|
||||
if exists("*strdisplaywidth")
|
||||
@ -43,36 +46,36 @@ function! s:wide_len(str) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:cell_splitter() "{{{
|
||||
return '\s*'.s:rxSep.'\s*'
|
||||
return '\s*'.s:rxSep().'\s*'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:sep_splitter() "{{{
|
||||
return '-'.s:rxSep.'-'
|
||||
return '-'.s:rxSep().'-'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_table(line) "{{{
|
||||
return s:is_separator(a:line) || (a:line !~ s:rxSep.s:rxSep && a:line =~ '^\s*'.s:rxSep.'.\+'.s:rxSep.'\s*$')
|
||||
return s:is_separator(a:line) || (a:line !~ s:rxSep().s:rxSep() && a:line =~ '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_separator(line) "{{{
|
||||
return a:line =~ '^\s*'.s:rxSep.'\(--\+'.s:rxSep.'\)\+\s*$'
|
||||
return a:line =~ '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_separator_tail(line) "{{{
|
||||
return a:line =~ '^\{-1}\%(\s*\|-*\)\%('.s:rxSep.'-\+\)\+'.s:rxSep.'\s*$'
|
||||
return a:line =~ '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_last_column(lnum, cnum) "{{{
|
||||
let line = strpart(getline(a:lnum), a:cnum - 1)
|
||||
"echomsg "DEBUG is_last_column> ".(line =~ s:rxSep.'\s*$' && line !~ s:rxSep.'.*'.s:rxSep.'\s*$')
|
||||
return line =~ s:rxSep.'\s*$' && line !~ s:rxSep.'.*'.s:rxSep.'\s*$'
|
||||
|
||||
"echomsg "DEBUG is_last_column> ".(line =~ s:rxSep().'\s*$' && line !~ s:rxSep().'.*'.s:rxSep().'\s*$')
|
||||
return line =~ s:rxSep().'\s*$' && line !~ s:rxSep().'.*'.s:rxSep().'\s*$'
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_first_column(lnum, cnum) "{{{
|
||||
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
|
||||
"echomsg "DEBUG is_first_column> ".(line =~ '^\s*'.s:rxSep && line !~ '^\s*'.s:rxSep.'.*'.s:rxSep)
|
||||
return line =~ '^\s*$' || (line =~ '^\s*'.s:rxSep && line !~ '^\s*'.s:rxSep.'.*'.s:rxSep)
|
||||
"echomsg "DEBUG is_first_column> ".(line =~ '^\s*'.s:rxSep() && line !~ '^\s*'.s:rxSep().'.*'.s:rxSep())
|
||||
return line =~ '^\s*$' || (line =~ '^\s*'.s:rxSep() && line !~ '^\s*'.s:rxSep().'.*'.s:rxSep())
|
||||
endfunction "}}}
|
||||
|
||||
function! s:count_separators_up(lnum) "{{{
|
||||
@ -100,8 +103,8 @@ function! s:count_separators_down(lnum) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_empty_row(cols) "{{{
|
||||
let row = s:rxSep
|
||||
let cell = " ".s:rxSep
|
||||
let row = s:rxSep()
|
||||
let cell = " ".s:rxSep()
|
||||
|
||||
for c in range(a:cols)
|
||||
let row .= cell
|
||||
@ -111,8 +114,8 @@ function! s:create_empty_row(cols) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_row_sep(cols) "{{{
|
||||
let row = s:rxSep
|
||||
let cell = "---".s:rxSep
|
||||
let row = s:rxSep()
|
||||
let cell = "---".s:rxSep()
|
||||
|
||||
for c in range(a:cols)
|
||||
let row .= cell
|
||||
@ -274,10 +277,10 @@ function! s:cur_column() "{{{
|
||||
" TODO: do we need conditional: if s:is_separator(line)
|
||||
|
||||
let curs_pos = col('.')
|
||||
let mpos = match(line, s:rxSep, 0)
|
||||
let mpos = match(line, s:rxSep(), 0)
|
||||
let col = -1
|
||||
while mpos < curs_pos && mpos != -1
|
||||
let mpos = match(line, s:rxSep, mpos+1)
|
||||
let mpos = match(line, s:rxSep(), mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
endif
|
||||
@ -301,7 +304,7 @@ function! s:fmt_cell(cell, max_len) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_row(line, max_lens, col1, col2) "{{{
|
||||
let new_line = s:rxSep
|
||||
let new_line = s:rxSep()
|
||||
let cells = vimwiki#tbl#get_cells(a:line)
|
||||
for idx in range(len(cells))
|
||||
if idx == a:col1
|
||||
@ -310,12 +313,12 @@ function! s:fmt_row(line, max_lens, col1, col2) "{{{
|
||||
let idx = a:col1
|
||||
endif
|
||||
let value = cells[idx]
|
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep
|
||||
let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep()
|
||||
endfor
|
||||
|
||||
let idx = len(cells)
|
||||
while idx < len(a:max_lens)
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep()
|
||||
let idx += 1
|
||||
endwhile
|
||||
return new_line
|
||||
@ -330,14 +333,14 @@ function! s:fmt_cell_sep(max_len) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_sep(max_lens, col1, col2) "{{{
|
||||
let new_line = s:rxSep
|
||||
let new_line = s:rxSep()
|
||||
for idx in range(len(a:max_lens))
|
||||
if idx == a:col1
|
||||
let idx = a:col2
|
||||
elseif idx == a:col2
|
||||
let idx = a:col1
|
||||
endif
|
||||
let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep
|
||||
let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep()
|
||||
endfor
|
||||
return new_line
|
||||
endfunction "}}}
|
||||
@ -349,10 +352,10 @@ function! s:kbd_create_new_row(cols, goto_first) "{{{
|
||||
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
|
||||
let cmd .= "\<ESC>0"
|
||||
if a:goto_first
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
|
||||
else
|
||||
let cmd .= (col('.')-1)."l"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
endif
|
||||
let cmd .= "a"
|
||||
|
||||
@ -361,16 +364,16 @@ endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_next_row() "{{{
|
||||
let cmd = "\<ESC>j"
|
||||
let cmd .= ":call search('.\\(".s:rxSep."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= "a"
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_prev_row() "{{{
|
||||
let cmd = "\<ESC>k"
|
||||
let cmd .= ":call search('.\\(".s:rxSep."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
|
||||
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
|
||||
let cmd .= "a"
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
@ -408,7 +411,7 @@ 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)
|
||||
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
|
||||
@ -432,7 +435,7 @@ function! s:kbd_goto_prev_col(jumpup) "{{{
|
||||
let cmd .= "$"
|
||||
endif
|
||||
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
|
||||
" let cmd .= ":call search('\\(".s:rxSep."\\)\\zs', 'b', line('.'))\<CR>"
|
||||
" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'b', line('.'))\<CR>"
|
||||
" let cmd .= "a"
|
||||
"echomsg "DEBUG kbd_goto_prev_col> ".cmd
|
||||
return cmd
|
||||
@ -487,6 +490,9 @@ function! vimwiki#tbl#kbd_shift_tab() "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#format(lnum, ...) "{{{
|
||||
if !(&filetype == 'vimwiki')
|
||||
return
|
||||
endif
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_table(line)
|
||||
return
|
||||
@ -506,7 +512,7 @@ function! vimwiki#tbl#format(lnum, ...) "{{{
|
||||
let row = repeat(' ', indent).row
|
||||
call setline(lnum, row)
|
||||
endfor
|
||||
|
||||
|
||||
let &tw = s:textwidth
|
||||
endfunction "}}}
|
||||
|
||||
@ -541,7 +547,7 @@ function! vimwiki#tbl#create(...) "{{{
|
||||
for r in range(rows - 1)
|
||||
call add(lines, row)
|
||||
endfor
|
||||
|
||||
|
||||
call append(line('.'), lines)
|
||||
endfunction "}}}
|
||||
|
||||
@ -554,11 +560,14 @@ function! vimwiki#tbl#align_or_cmd(cmd) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#tbl#reset_tw(lnum) "{{{
|
||||
if !(&filetype == 'vimwiki')
|
||||
return
|
||||
endif
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
let s:textwidth = &tw
|
||||
let &tw = 0
|
||||
endfunction "}}}
|
||||
@ -581,17 +590,17 @@ function! vimwiki#tbl#move_column_left() "{{{
|
||||
endif
|
||||
|
||||
if cur_col > 0
|
||||
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
|
||||
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
|
||||
call cursor(line('.'), 1)
|
||||
|
||||
let sep = '\('.s:rxSep.'\).\zs'
|
||||
let sep = '\('.s:rxSep().'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col-1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
@ -614,17 +623,17 @@ function! vimwiki#tbl#move_column_right() "{{{
|
||||
endif
|
||||
|
||||
if cur_col < s:col_count(line('.'))-1
|
||||
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
|
||||
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
|
||||
call cursor(line('.'), 1)
|
||||
|
||||
let sep = '\('.s:rxSep.'\).\zs'
|
||||
let sep = '\('.s:rxSep().'\).\zs'
|
||||
let mpos = -1
|
||||
let col = -1
|
||||
while col < cur_col+1
|
||||
let mpos = match(line, sep, mpos+1)
|
||||
if mpos != -1
|
||||
let col += 1
|
||||
else
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
223
doc/vimwiki.txt
223
doc/vimwiki.txt
@ -9,7 +9,7 @@
|
||||
|___| |___| |_| |_||__| |__||___| |___| |_||___| ~
|
||||
|
||||
|
||||
Version: 2.0.1 'stu'
|
||||
Version: 2.1
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *vimwiki-contents*
|
||||
@ -251,7 +251,7 @@ NORMAL MODE *vimwiki-local-mappings*
|
||||
:nmap <Leader>wt <Plug>VimwikiTabnewLink
|
||||
<
|
||||
*vimwiki_<Backspace>*
|
||||
<Backspace> Go back to previous wiki page.
|
||||
<Backspace> Go back to previous wiki page.
|
||||
Maps to |:VimwikiGoBackLink|.
|
||||
To remap: >
|
||||
:nmap <Leader>wb <Plug>VimwikiGoBackLink
|
||||
@ -300,7 +300,7 @@ NORMAL MODE *vimwiki-local-mappings*
|
||||
:nmap -- <Plug>VimwikiRemoveHeaderLevel
|
||||
<
|
||||
*vimwiki_+*
|
||||
+ Create and/or decorate links. Depending on the
|
||||
+ Create and/or decorate links. Depending on the
|
||||
context, this command will: convert words into
|
||||
Wikilinks; convert raw URLs into Wikilinks; and add
|
||||
placeholder text to Wiki- or Weblinks that are missing
|
||||
@ -375,7 +375,7 @@ INSERT MODE *vimwiki-table-mappings*
|
||||
*vimwiki_i_<CR>*
|
||||
<CR> Go to the table cell beneath the current one, create
|
||||
a new row if on the last one.
|
||||
|
||||
|
||||
*vimwiki_i_<Tab>*
|
||||
<Tab> Go to the next table cell, create a new row if on the
|
||||
last cell.
|
||||
@ -488,7 +488,7 @@ ic An inner column in a table.
|
||||
|
||||
*:VimwikiBacklinks*
|
||||
*:VWB*
|
||||
Search for wikilinks to the [[current wiki page]]
|
||||
Search for wikilinks to the [[current wiki page]]
|
||||
in all files of current wiki.
|
||||
To display all matches use |:lopen| command.
|
||||
To display next match use |:lnext| command.
|
||||
@ -497,10 +497,10 @@ ic An inner column in a table.
|
||||
|
||||
*:VimwikiTable*
|
||||
Create a table with 5 cols and 2 rows.
|
||||
|
||||
|
||||
:VimwikiTable cols rows
|
||||
Create a table with the given cols and rows
|
||||
|
||||
|
||||
:VimwikiTable cols
|
||||
Create a table with the given cols and 2 rows
|
||||
|
||||
@ -528,7 +528,7 @@ ic An inner column in a table.
|
||||
|--------|--------|--------|--------|--------|
|
||||
| value2 | value3 | value1 | value4 | value5 |
|
||||
<
|
||||
|
||||
|
||||
Commands are mapped to <A-Left> and <A-Right> respectively.
|
||||
|
||||
|
||||
@ -552,7 +552,7 @@ ic An inner column in a table.
|
||||
|
||||
|
||||
There are a lot of different wikies out there. Most of them have their own
|
||||
syntax and vimwiki's default syntax is not an exception here.
|
||||
syntax and vimwiki's default syntax is not an exception here.
|
||||
|
||||
Vimwiki has evolved its own syntax that closely resembles google's wiki
|
||||
markup. This syntax is described in detail below.
|
||||
@ -608,7 +608,7 @@ Raw URLs are also supported: >
|
||||
Markdown Links~
|
||||
|
||||
These links are only available for Markdown syntax. See
|
||||
http://daringfireball.net/projects/markdown/syntax#link.
|
||||
http://daringfireball.net/projects/markdown/syntax#link.
|
||||
|
||||
Inline link: >
|
||||
[Looks like this](URL)
|
||||
@ -620,21 +620,21 @@ The URL can be anything recognized by vimwiki as a raw URL.
|
||||
|
||||
|
||||
Reference-style links: >
|
||||
a) [Link Name][Id]
|
||||
a) [Link Name][Id]
|
||||
b) [Id][], using the "implicit link name" shortcut
|
||||
|
||||
|
||||
Reference style links must always include *two* consecutive pairs of
|
||||
[-brackets, and field entries can not use "[" or "]".
|
||||
|
||||
|
||||
NOTE: (in Vimwiki's current implementation) Reference-style links are a hybrid
|
||||
of Vimwiki's default "Wikilink" and the tradition reference-style link.
|
||||
of Vimwiki's default "Wikilink" and the tradition reference-style link.
|
||||
|
||||
If the Id is defined elsewhere in the source, as per the Markdown standard: >
|
||||
[Id]: URL
|
||||
|
||||
then the URL is opened with the system default handler. Otherwise, Vimwiki
|
||||
treats the reference-sytle link as a Wikilink, interpreting the Id field as a
|
||||
treats the reference-style link as a Wikilink, interpreting the Id field as a
|
||||
wiki page name.
|
||||
|
||||
Highlighting of existing links when |vimwiki-option-maxhi| is activated
|
||||
@ -876,7 +876,7 @@ have two *alternative* options:
|
||||
1. using the MathJax server for rendering (needs an internet connection).
|
||||
Add to your HTML template the following line:
|
||||
|
||||
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
|
||||
2. installing MathJax locally (faster, no internet required). Choose a
|
||||
folder on your hard drive and save MathJax in it. Then add to your HTML
|
||||
@ -971,7 +971,7 @@ absolute paths and extensions: >
|
||||
Schemeless:~
|
||||
|
||||
Schemeless URLs, which are the default, are treated internally as "wiki#:"
|
||||
URLs in all respects except when converted to Html.
|
||||
URLs in all respects except when converted to Html.
|
||||
|
||||
Schemeless links convert to plain relative path URLs, nearly verbatim: >
|
||||
relpath/wikipage.html
|
||||
@ -990,12 +990,12 @@ as regular links even if the files to which they refer do not exist.
|
||||
Transclusion (Wiki-Include) Links~
|
||||
|
||||
Links that use "{{" and "}}" delimiters signify content that is to be
|
||||
included into the Html output, rather than referenced via hyperlink.
|
||||
included into the Html output, rather than referenced via hyperlink.
|
||||
|
||||
Wiki-include URLs may use any of the supported schemes, may be absolute or
|
||||
relative, and need not end with an extension.
|
||||
|
||||
The primary purpose for wiki-include links is to include images.
|
||||
The primary purpose for wiki-include links is to include images.
|
||||
|
||||
Transclude from a local URL: >
|
||||
{{local:../../images/vimwiki_logo.png}}
|
||||
@ -1005,19 +1005,19 @@ or from a universal URL: >
|
||||
Transclude image with alternate text: >
|
||||
{{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png|Vimwiki}}
|
||||
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="Vimwiki"/>
|
||||
|
||||
Transclude image with alternate text and some style: >
|
||||
{{http://.../vimwiki_logo.png|cool stuff|style="width:150px; height: 120px;"}}
|
||||
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"/>
|
||||
|
||||
Transclude image _without_ alternate text and with css class: >
|
||||
{{http://.../vimwiki_logo.png||class="center flow blabla"}}
|
||||
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="" class="center flow blabla"/>
|
||||
|
||||
A trial feature allows you to supply your own handler for wiki-include links.
|
||||
@ -1042,9 +1042,10 @@ in HTML: >
|
||||
==============================================================================
|
||||
6. Folding/Outline *vimwiki-folding*
|
||||
|
||||
Vimwiki can fold or outline headers and list items.
|
||||
Vimwiki can fold or outline sections using headers and preformatted blocks.
|
||||
Alternatively, one can fold list subitems instead.
|
||||
|
||||
Example:
|
||||
Example for list folding:
|
||||
= My current task =
|
||||
* [ ] Do stuff 1
|
||||
* [ ] Do substuff 1.1
|
||||
@ -1186,19 +1187,19 @@ between [ ] depends on the percentage of toggled child items (see also
|
||||
It is possible to toggle several list items using visual mode.
|
||||
|
||||
*vimwiki-list-manipulation*
|
||||
The indentation and bullet symbols for list items can be manipulated using
|
||||
The indentation and bullet symbols for list items can be manipulated using
|
||||
several mappings. Examples below demonstrate this behavior for the 'default'
|
||||
syntax and with |vimwiki-option-list_margin| = 1. >
|
||||
|
||||
Mapping | Input | Output
|
||||
Mapping | Input | Output
|
||||
----------------------------------------------------
|
||||
glm | ^item | ^ - item
|
||||
glm | ^ item | ^ - item
|
||||
gll | ^ - item | ^item
|
||||
glm | ^ # item | ^ item
|
||||
gl* | ^ item | ^ * item
|
||||
gl- | ^ item | ^ - item
|
||||
gl3 | ^ item | ^ # item
|
||||
glm | ^item | ^ - item
|
||||
glm | ^ item | ^ - item
|
||||
gll | ^ - item | ^item
|
||||
glm | ^ # item | ^ item
|
||||
gl* | ^ item | ^ * item
|
||||
gl- | ^ item | ^ - item
|
||||
gl3 | ^ item | ^ # item
|
||||
|
||||
See |vimwiki_gll|, |vimwiki_glm|, |vimwiki_glstar|, |vimwiki_gl8|
|
||||
|vimwiki_gl#|, |vimwiki_gl3|, |vimwiki_gl-|, |vimwiki_gl1|
|
||||
@ -1207,7 +1208,7 @@ See |vimwiki_gll|, |vimwiki_glm|, |vimwiki_glstar|, |vimwiki_gl8|
|
||||
|
||||
Use the :VimwikiTable command to create a default table with 5 columns and 2
|
||||
rows: >
|
||||
|
||||
|
||||
| | | | | |
|
||||
|---|---|---|---|---|
|
||||
| | | | | |
|
||||
@ -1281,7 +1282,7 @@ See |g:vimwiki_use_calendar| option to turn it off/on.
|
||||
11. Options *vimwiki-options*
|
||||
|
||||
There are global options and local (per-wiki) options available to tune
|
||||
vimwiki.
|
||||
vimwiki.
|
||||
|
||||
Global options are configured via global variables. For a complete list of
|
||||
them, see |viwmiki-global-options|.
|
||||
@ -1339,7 +1340,7 @@ For clarity, in your .vimrc file you can define wiki options using separate
|
||||
|
||||
|
||||
The creation of temporary wikis allows you to open files that would not
|
||||
normally be recognized by vimwiki.
|
||||
normally be recognized by vimwiki.
|
||||
|
||||
If a file with a registered wiki extension (see |vimwiki-register-extension|)
|
||||
is opened in a directory that: 1) is not listed in |g:vimwiki_list|, and 2) is
|
||||
@ -1438,7 +1439,7 @@ default, Markdown, and MediaWiki), but only vimwiki's default markup will be
|
||||
converted to HTML at the moment.
|
||||
|
||||
To use Markdown's wiki markup: >
|
||||
let g:vimwiki_list = [{'path': '~/my_site/',
|
||||
let g:vimwiki_list = [{'path': '~/my_site/',
|
||||
\ 'syntax': 'markdown', 'ext': '.md'}]
|
||||
<
|
||||
|
||||
@ -1475,12 +1476,12 @@ Each template could look like: >
|
||||
</body>
|
||||
</html>
|
||||
|
||||
where
|
||||
where
|
||||
%title% is replaced by a wiki page name or by a |vimwiki-title|
|
||||
%root_path% is replaced by a count of ../ for pages buried in subdirs:
|
||||
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
|
||||
%root_path% is replaced by '../../../'.
|
||||
|
||||
|
||||
%content% is replaced by a wiki file content.
|
||||
|
||||
|
||||
@ -1630,7 +1631,7 @@ custom_wiki2html ''
|
||||
Description~
|
||||
The full path to an user-provided script that converts a wiki page to HTML.
|
||||
Vimwiki calls the provided |vimwiki-option-custom_wiki2html| script from the
|
||||
command-line, using '!' invocation.
|
||||
command-line, using '!' invocation.
|
||||
|
||||
The following arguments, in this order, are passed to the
|
||||
|vimwiki-option-custom_wiki2html| script:
|
||||
@ -1641,13 +1642,24 @@ The following arguments, in this order, are passed to the
|
||||
4. output_dir : the full path of the output directory, i.e. 'path_html'
|
||||
5. input_file : the full path of the wiki page
|
||||
6. css_file : the full path of the css file for this wiki
|
||||
7. template_path : the full path to the wiki's templates
|
||||
8. template_default : the default template name
|
||||
9. template_ext : the extension of template files
|
||||
10. root_path : a count of ../ for pages buried in subdirs
|
||||
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
|
||||
%root_path% is replaced by '../../../'.
|
||||
|
||||
Options 7-10 are experimental and may change in the future. If any of these
|
||||
parameters is empty, then a hyphen "-" is passed to the script in its place.
|
||||
|
||||
For an example and further instructions, refer to the following script:
|
||||
|
||||
$VIMHOME/autoload/vimwiki/customwiki2html.sh
|
||||
|
||||
To use the internal wiki2html converter, use an empty string (the default).
|
||||
An alternative converter was developed by Jason6Anderson, and can
|
||||
be located at http://code.google.com/p/vimwiki/issues/detail?id=384
|
||||
|
||||
To use the internal wiki2html converter, use an empty string (the default).
|
||||
|
||||
*vimwiki-option-list_margin*
|
||||
------------------------------------------------------------------------------
|
||||
@ -1659,7 +1671,7 @@ Width of left-hand margin for lists. When negative, the current |shiftwidth|
|
||||
is used. This affects the behavior of the list manipulation commands
|
||||
|VimwikiListChangeLevel| and local mappings |vimwiki_gll|, |vimwiki_glm|,
|
||||
|vimwiki_glstar|, |vimwiki_gl8|, |vimwiki_gl#|, |vimwiki_gl3|,
|
||||
|vimwiki_gl-| and |vimwiki_gl1|.
|
||||
|vimwiki_gl-| and |vimwiki_gl1|.
|
||||
|
||||
|
||||
|
||||
@ -1714,7 +1726,7 @@ Value Description~
|
||||
|
||||
If your preferred wiki extension is .txt then you can >
|
||||
let g:vimwiki_global_ext = 0
|
||||
to restrict vimwiki's operation to only those paths listed in g:vimwiki_list.
|
||||
to restrict vimwiki's operation to only those paths listed in g:vimwiki_list.
|
||||
Other text files wouldn't be treated as wiki pages.
|
||||
|
||||
Default: 1
|
||||
@ -1724,10 +1736,10 @@ Default: 1
|
||||
*g:vimwiki_ext2syntax* *vimwiki-register-extension*
|
||||
|
||||
A many-to-one map between file extensions and syntaxes whose purpose is to
|
||||
register the extensions with vimwiki.
|
||||
register the extensions with vimwiki.
|
||||
|
||||
E.g.: >
|
||||
let g:vimwiki_ext2syntax = {'.md': 'markdown',
|
||||
let g:vimwiki_ext2syntax = {'.md': 'markdown',
|
||||
\ '.mkd': 'markdown',
|
||||
\ '.wiki': 'media'}
|
||||
|
||||
@ -1736,7 +1748,7 @@ An extension that is registered with vimwiki can trigger creation of a
|
||||
|g:vimwiki_list| are automatically registered with vimwiki using the default
|
||||
syntax.
|
||||
|
||||
Default: {'.md': 'markdown'}
|
||||
Default: {}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_auto_checkbox*
|
||||
@ -1796,26 +1808,22 @@ Default: 0
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_folding*
|
||||
|
||||
Enable/disable vimwiki's folding/outline functionality. Folding in vimwiki
|
||||
uses the 'expr' foldmethod which is very flexible but really slow.
|
||||
Enable/disable vimwiki's folding (outline) functionality. Folding in vimwiki
|
||||
can uses either the 'expr' or the 'syntax' |foldmethod| of Vim.
|
||||
|
||||
Value Description~
|
||||
0 Disable folding.
|
||||
1 Enable folding.
|
||||
'' 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: 0
|
||||
Default: ''
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_fold_lists*
|
||||
|
||||
Enable/disable folding of list subitems.
|
||||
|
||||
Value Description~
|
||||
0 Disable list subitem's folding.
|
||||
1 Enable list subitem's folding.
|
||||
|
||||
Default: 0
|
||||
Limitations:
|
||||
- Opening very large files may be slow when folding is enabled.
|
||||
- 'list' folding is particularly slow with larger files.
|
||||
- 'list' is intended to work with lists nicely indented with 'shiftwidth'.
|
||||
- 'syntax' is only available for the default syntax so far.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
@ -1849,17 +1857,17 @@ Default: 1
|
||||
|
||||
A customizable link handler, |VimwikiLinkHandler|, can be defined to override
|
||||
Vimwiki's opening of links. Each recognized link, whether it is a wikilink,
|
||||
wiki-include link or a weblink, is first passed to |VimwikiLinkHandler| to see
|
||||
if it can be handled. The return value 1/0 indicates success.
|
||||
wiki-include link or a weblink, is first passed to |VimwikiLinkHandler| to see
|
||||
if it can be handled. The return value 1/0 indicates success.
|
||||
|
||||
If the link is not handled successfully, the behaviour of Vimwiki depends on
|
||||
the scheme. Wiki:, diary: or schemeless links are opened in Vim. All others,
|
||||
including local: and file: schemes, are opened with a system default handler;
|
||||
i.e. Linux (!xdg-open), Mac (!open), and Windows (!start).
|
||||
i.e. Linux (!xdg-open), Mac (!open), and Windows (!start).
|
||||
|
||||
You can redefine |VimwikiLinkHandler| function to do something else: >
|
||||
|
||||
function! VimwikiLinkHandler(link)
|
||||
function! VimwikiLinkHandler(link)
|
||||
try
|
||||
let browser = 'C:\Program Files\Firefox\firefox.exe'
|
||||
execute '!start "'.browser.'" ' . a:link
|
||||
@ -1868,7 +1876,7 @@ You can redefine |VimwikiLinkHandler| function to do something else: >
|
||||
echo "This can happen for a variety of reasons ..."
|
||||
endtry
|
||||
return 0
|
||||
endfunction
|
||||
endfunction
|
||||
|
||||
A second example handles two new schemes, 'vlocal:' and 'vfile:', which behave
|
||||
similar to 'local:' and 'file:' schemes, but are always opened with Vim: >
|
||||
@ -1883,7 +1891,7 @@ similar to 'local:' and 'file:' schemes, but are always opened with Vim: >
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
let [idx, scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(link, 0)
|
||||
if g:vimwiki_debug
|
||||
echom 'LinkHandler: idx='.idx.', scheme=[v]'.scheme.', path='.path.
|
||||
@ -1915,7 +1923,7 @@ cannot otherwise convert the link. A customized handler might look like this: >
|
||||
" complete URL
|
||||
let url_0 = matchstr(str, g:vimwiki_rxWikiInclMatchUrl)
|
||||
" URL parts
|
||||
let [scheme, path, subdir, lnk, ext, url] =
|
||||
let [scheme, path, subdir, lnk, ext, url] =
|
||||
\ vimwiki#base#resolve_scheme(url_0, VimwikiGet('ext'))
|
||||
let arg1 = matchstr(str, VimwikiWikiInclMatchArg(1))
|
||||
let arg2 = matchstr(str, VimwikiWikiInclMatchArg(2))
|
||||
@ -1974,7 +1982,7 @@ Default: ''
|
||||
*g:vimwiki_CJK_length*
|
||||
|
||||
Use special method to calculate correct length of the strings with double-wide
|
||||
characters (to align table cells properly).
|
||||
characters (to align table cells properly).
|
||||
|
||||
Value Description~
|
||||
0 Do not use it.
|
||||
@ -2042,14 +2050,14 @@ Default: 0
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_html_header_numbering_sym*
|
||||
|
||||
Ending symbol for |g:vimwiki_html_header_numbering|.
|
||||
Ending symbol for |g:vimwiki_html_header_numbering|.
|
||||
|
||||
Value Description~
|
||||
'.' Dot will be added after a header's number.
|
||||
')' Closing bracket will be added after a header's number.
|
||||
etc.
|
||||
|
||||
With
|
||||
With
|
||||
let g:vimwiki_html_header_numbering_sym = '.'
|
||||
headers would look like: >
|
||||
1. Header1
|
||||
@ -2068,7 +2076,7 @@ Default: '' (empty)
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_valid_html_tags*
|
||||
|
||||
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 vimwiki.
|
||||
|
||||
Default: 'b,i,s,u,sub,sup,kbd,br,hr'
|
||||
|
||||
@ -2097,30 +2105,46 @@ a new tab or window, it would be set to default value.
|
||||
Vimwiki sets |conceallevel| to g:vimwiki_conceallevel everytime vimwiki buffer
|
||||
is entered.
|
||||
|
||||
With default settings, Vimwiki conceals one-character markers, shortens long
|
||||
URLs and hides markers and URL for links that have a description.
|
||||
|
||||
Default: 2
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_url_mingain*
|
||||
*g:vimwiki_autowriteall*
|
||||
|
||||
The minimum number of characters that should be gained by concealing URLs. If
|
||||
the length of the concealed part of the URL would be less than
|
||||
|g:vimwiki_url_mingain|, the URL is not concealed at all.
|
||||
The conceal feature works only with vim >= 7.3.
|
||||
In vim |autowriteall| is a global setting. With g:vimwiki_autowriteall vimwiki
|
||||
makes it local to its buffers.
|
||||
|
||||
Default: 12
|
||||
Value Description~
|
||||
0 autowriteall is off
|
||||
1 autowriteall is on
|
||||
|
||||
Default: 1
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_url_maxsave*
|
||||
|
||||
The maximum number of characters that is retained at the end after concealing
|
||||
URLs. At most there will be |g:vimwiki_url_maxsave| characters left at the end of the URL.
|
||||
However, it could be less when one of /,#,? can be found at the end.
|
||||
In that case the URL will be concealed right before the last occurrence of one
|
||||
of these characters.
|
||||
The conceal feature works only with vim >= 7.3. Beware: when using the default
|
||||
'wrap' option, the effect is not always pleasing.
|
||||
Setting the value of |g:vimwiki_url_maxsave| to 0 will prevent any link
|
||||
shortening: you will see the full URL in all types of links, with no parts
|
||||
being concealed. Concealing of one-character markers is not affected.
|
||||
|
||||
When positive, the value determines the maximum number of characters that
|
||||
are retained at the end after concealing the middle part of a long URL.
|
||||
It could be less: in case one of the characters /,#,? is found near the end,
|
||||
the URL will be concealed up to the last occurrence of that character.
|
||||
|
||||
Note:
|
||||
* The conceal feature works only with Vim >= 7.3.
|
||||
* When using the default |wrap| option of Vim, the effect of concealed links
|
||||
is not always pleasing, because the visible text on longer lines with
|
||||
a lot of concealed parts may appear to be strangely broken across several
|
||||
lines. This is a limitation of Vim's |conceal| feature.
|
||||
* Many color schemes do not define an unobtrusive color for the Conceal
|
||||
highlight group - this might be quite noticeable on shortened URLs.
|
||||
|
||||
|
||||
Default: 15
|
||||
|
||||
@ -2137,6 +2161,7 @@ Value Description~
|
||||
|
||||
Default: 0
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_diary_months*
|
||||
|
||||
@ -2145,15 +2170,15 @@ uses it.
|
||||
|
||||
Redefine it in your .vimrc to get localized months in your diary:
|
||||
let g:vimwiki_diary_months = {
|
||||
\ 1: 'Январь', 2: 'Февраль', 3: 'Март',
|
||||
\ 1: 'Январь', 2: 'Февраль', 3: 'Март',
|
||||
\ 4: 'Апрель', 5: 'Май', 6: 'Июнь',
|
||||
\ 7: 'Июль', 8: 'Август', 9: 'Сентябрь',
|
||||
\ 10: 'Октябрь', 11: 'Ноябрь', 12: 'Декабрь'
|
||||
\ }
|
||||
|
||||
Default:
|
||||
Default:
|
||||
let g:vimwiki_diary_months = {
|
||||
\ 1: 'January', 2: 'February', 3: 'March',
|
||||
\ 1: 'January', 2: 'February', 3: 'March',
|
||||
\ 4: 'April', 5: 'May', 6: 'June',
|
||||
\ 7: 'July', 8: 'August', 9: 'September',
|
||||
\ 10: 'October', 11: 'November', 12: 'December'
|
||||
@ -2186,6 +2211,22 @@ Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226
|
||||
==============================================================================
|
||||
14. Changelog *vimwiki-changelog*
|
||||
|
||||
2.1~
|
||||
|
||||
* Concealing of links can be turned off - set |g:vimwiki_url_maxsave| to 0.
|
||||
The option g:vimwiki_url_mingain was removed
|
||||
* |g:vimwiki_folding| also accepts value 'list'; with 'expr' both sections
|
||||
and code blocks folded, g:vimwiki_fold_lists option was removed
|
||||
* Issue 261: Syntax folding is back. |g:vimwiki_folding| values are
|
||||
changed to '', 'expr', 'syntax'.
|
||||
* Issue 372: Ignore case in g:vimwiki_valid_html_tags
|
||||
* Issue 374: Make autowriteall local to vimwiki. It is not 100% local
|
||||
though.
|
||||
* Issue 384: Custom_wiki2html script now receives templating arguments
|
||||
* Issue 393: Custom_wiki2html script path can contain tilde character
|
||||
* Issue 392: Custom_wiki2html arguments are quoted, e.g names with spaces
|
||||
* Various small bug fixes.
|
||||
|
||||
2.0.1 'stu'~
|
||||
|
||||
* Follow (i.e. open target of) markdown reference-style links.
|
||||
@ -2195,7 +2236,7 @@ Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226
|
||||
2.0 'stu'~
|
||||
|
||||
This release is partly incompatible with previous.
|
||||
*
|
||||
|
||||
Summary ~
|
||||
|
||||
* Quick page-link creation.
|
||||
@ -2221,7 +2262,7 @@ Summary ~
|
||||
* Table syntax change. Row separator uses | instead of +.
|
||||
* Fold multilined list items.
|
||||
* Custom wiki to HTML converters. See |vimwiki-option-custom_wiki2html|.
|
||||
* Conceal long weblinks. See |g:vimwiki_url_mingain|.
|
||||
* Conceal long weblinks. See g:vimwiki_url_mingain.
|
||||
* Option to disable table mappings. See |g:vimwiki_table_mappings|.
|
||||
|
||||
For detailed information see issues list on
|
||||
@ -2250,7 +2291,7 @@ http://code.google.com/p/vimwiki/issues/list
|
||||
* Fix of g:vimwiki_stripsym = '' (i.e. an empty string) -- it removes bad
|
||||
symbols from filenames.
|
||||
* Issue 145: With modeline 'set ft=vimwiki' links are not correctly
|
||||
highlighted when open wiki files.
|
||||
highlighted when open wiki files.
|
||||
* Issue 146: Filetype difficulty with ".txt" as a vimwiki extension.
|
||||
* Issue 148: There are no mailto links.
|
||||
* Issue 151: Use location list instead of quickfix list for :VimwikiSearch
|
||||
|
@ -12,18 +12,16 @@ let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
||||
" Reset the following options to undo this plugin.
|
||||
let b:undo_ftplugin = "setlocal ".
|
||||
\ "suffixesadd< isfname< comments< ".
|
||||
\ "autowriteall< ".
|
||||
\ "formatoptions< foldtext< ".
|
||||
\ "foldmethod< foldexpr< commentstring< "
|
||||
" UNDO }}}
|
||||
|
||||
" MISC STUFF {{{
|
||||
|
||||
setlocal autowriteall
|
||||
setlocal commentstring=%%%s
|
||||
|
||||
if g:vimwiki_conceallevel && exists("+conceallevel")
|
||||
let &conceallevel = g:vimwiki_conceallevel
|
||||
let &l:conceallevel = g:vimwiki_conceallevel
|
||||
endif
|
||||
|
||||
" MISC }}}
|
||||
@ -63,56 +61,8 @@ endif
|
||||
" COMMENTS }}}
|
||||
|
||||
" FOLDING for headers and list items using expr fold method. {{{
|
||||
function! VimwikiFoldLevel(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
|
||||
" Header folding...
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#u#count_first_sym(line)
|
||||
return '>'.n
|
||||
endif
|
||||
|
||||
let base_level = s:get_base_level(a:lnum)
|
||||
|
||||
" List item folding...
|
||||
if g:vimwiki_fold_lists
|
||||
let nnline = getline(a:lnum + 1)
|
||||
|
||||
let rx_list_item = '\('.
|
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||
\ '\)'
|
||||
|
||||
|
||||
if line =~ rx_list_item
|
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum)
|
||||
let level = s:get_li_level(a:lnum)
|
||||
let leveln = s:get_li_level(nnum)
|
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, a:lnum))
|
||||
|
||||
if leveln > level
|
||||
return ">".(base_level+leveln-adj)
|
||||
" check if multilined list item
|
||||
elseif (nnum-a:lnum) > 1
|
||||
\ && nline =~ rx_list_item && nnline !~ '^\s*$'
|
||||
return ">".(base_level+level+1-adj)
|
||||
else
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
else
|
||||
" process multilined list items
|
||||
let [pnum, pline] = s:find_backward(rx_list_item, a:lnum)
|
||||
if pline =~ rx_list_item
|
||||
if indent(a:lnum) >= indent(pnum) && line !~ '^\s*$'
|
||||
let level = s:get_li_level(pnum)
|
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, pnum))
|
||||
return (base_level+level+1-adj)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return base_level
|
||||
endfunction "}}}
|
||||
" Folding list items using expr fold method. {{{
|
||||
|
||||
function! s:get_base_level(lnum) "{{{
|
||||
let lnum = a:lnum - 1
|
||||
@ -177,23 +127,137 @@ function! s:get_start_list(rx_item, lnum) "{{{
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! VimwikiFoldText() "{{{
|
||||
let line = substitute(getline(v:foldstart), '\t',
|
||||
\ repeat(' ', &tabstop), 'g')
|
||||
return line.' ['.(v:foldend - v:foldstart).']'
|
||||
function! VimwikiFoldListLevel(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
|
||||
"" XXX Disabled: Header/section folding...
|
||||
"if line =~ g:vimwiki_rxHeader
|
||||
" return '>'.vimwiki#u#count_first_sym(line)
|
||||
"endif
|
||||
|
||||
"let nnline = getline(a:lnum+1)
|
||||
|
||||
"" Unnecessary?
|
||||
"if nnline =~ g:vimwiki_rxHeader
|
||||
" return '<'.vimwiki#u#count_first_sym(nnline)
|
||||
"endif
|
||||
"" Very slow when called on every single line!
|
||||
"let base_level = s:get_base_level(a:lnum)
|
||||
|
||||
"FIXME does not work correctly
|
||||
let base_level = 0
|
||||
|
||||
if line =~ g:vimwiki_rxListItem
|
||||
let [nnum, nline] = s:find_forward(g:vimwiki_rxListItem, a:lnum)
|
||||
let level = s:get_li_level(a:lnum)
|
||||
let leveln = s:get_li_level(nnum)
|
||||
let adj = s:get_li_level(s:get_start_list(g:vimwiki_rxListItem, a:lnum))
|
||||
|
||||
if leveln > level
|
||||
return ">".(base_level+leveln-adj)
|
||||
" check if multilined list item
|
||||
elseif (nnum-a:lnum) > 1
|
||||
\ && (nline =~ g:vimwiki_rxListItem || nnline !~ '^\s*$')
|
||||
return ">".(base_level+level+1-adj)
|
||||
else
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
else
|
||||
" process multilined list items
|
||||
let [pnum, pline] = s:find_backward(g:vimwiki_rxListItem, a:lnum)
|
||||
if pline =~ g:vimwiki_rxListItem
|
||||
if indent(a:lnum) >= indent(pnum) && line !~ '^\s*$'
|
||||
let level = s:get_li_level(pnum)
|
||||
let adj = s:get_li_level(s:get_start_list(g:vimwiki_rxListItem, pnum))
|
||||
return (base_level+level+1-adj)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return base_level
|
||||
endfunction "}}}
|
||||
" Folding list items }}}
|
||||
|
||||
" Folding sections and code blocks using expr fold method. {{{
|
||||
function! VimwikiFoldLevel(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
|
||||
" Header/section folding...
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
return '>'.vimwiki#u#count_first_sym(line)
|
||||
" Code block folding...
|
||||
elseif line =~ '^\s*'.g:vimwiki_rxPreStart
|
||||
return 'a1'
|
||||
elseif line =~ '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
|
||||
return 's1'
|
||||
else
|
||||
return "="
|
||||
endif
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
" Constants used by VimwikiFoldText {{{
|
||||
" use \u2026 and \u21b2 (or \u2424) if enc=utf-8 to save screen space
|
||||
let s:ellipsis = (&enc ==? 'utf-8') ? "\u2026" : "..."
|
||||
let s:ell_len = strlen(s:ellipsis)
|
||||
let s:newline = (&enc ==? 'utf-8') ? "\u21b2 " : " "
|
||||
let s:tolerance = 5
|
||||
" }}}
|
||||
|
||||
function! s:shorten_text_simple(text, len) "{{{ unused
|
||||
let spare_len = a:len - len(a:text)
|
||||
return (spare_len>=0) ? [a:text,spare_len] : [a:text[0:a:len].s:ellipsis, -1]
|
||||
endfunction "}}}
|
||||
|
||||
" s:shorten_text(text, len) = [string, spare] with "spare" = len-strlen(string)
|
||||
" for long enough "text", the string's length is within s:tolerance of "len"
|
||||
" (so that -s:tolerance <= spare <= s:tolerance, "string" ends with s:ellipsis)
|
||||
function! s:shorten_text(text, len) "{{{ returns [string, spare]
|
||||
let spare_len = a:len - strlen(a:text)
|
||||
if (spare_len + s:tolerance >= 0)
|
||||
return [a:text, spare_len]
|
||||
endif
|
||||
" try to break on a space; assumes a:len-s:ell_len >= s:tolerance
|
||||
let newlen = a:len - s:ell_len
|
||||
let idx = strridx(a:text, ' ', newlen + s:tolerance)
|
||||
let break_idx = (idx + s:tolerance >= newlen) ? idx : newlen
|
||||
return [a:text[0:break_idx].s:ellipsis, newlen - break_idx]
|
||||
endfunction "}}}
|
||||
|
||||
function! VimwikiFoldText() "{{{
|
||||
let line = getline(v:foldstart)
|
||||
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
|
||||
let [main_text, spare_len] = s:shorten_text(main_text, 50)
|
||||
return main_text.len_text
|
||||
else
|
||||
" fold-text for code blocks: use one or two of the starting lines
|
||||
let [main_text, spare_len] = s:shorten_text(main_text, 24)
|
||||
let line1 = substitute(getline(v:foldstart+1), '^\s*', ' ', '')
|
||||
let [content_text, spare_len] = s:shorten_text(line1, spare_len+20)
|
||||
if spare_len > s:tolerance && fold_len > 3
|
||||
let line2 = substitute(getline(v:foldstart+2), '^\s*', s:newline, '')
|
||||
let [more_text, spare_len] = s:shorten_text(line2, spare_len+12)
|
||||
let content_text .= more_text
|
||||
endif
|
||||
return main_text.len_text.content_text
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" Folding sections and code blocks }}}
|
||||
" FOLDING }}}
|
||||
|
||||
" COMMANDS {{{
|
||||
command! -buffer Vimwiki2HTML
|
||||
\ silent w <bar>
|
||||
\ silent w <bar>
|
||||
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
\<bar>
|
||||
\ if res != '' | echo 'Vimwiki: HTML conversion is done.' | endif
|
||||
command! -buffer Vimwiki2HTMLBrowse
|
||||
\ silent w <bar>
|
||||
\ silent w <bar>
|
||||
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
|
||||
\ expand(VimwikiGet('path_html')),
|
||||
\ expand('%')))
|
||||
@ -455,7 +519,7 @@ nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
||||
if VimwikiGet('auto_export')
|
||||
" Automatically generate HTML on page write.
|
||||
augroup vimwiki
|
||||
au BufWritePost <buffer>
|
||||
au BufWritePost <buffer>
|
||||
\ call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
augroup END
|
||||
|
@ -69,6 +69,8 @@ function! s:setup_buffer_leave() "{{{
|
||||
echom " Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
|
||||
let &autowriteall = s:vimwiki_autowriteall
|
||||
|
||||
" Set up menu
|
||||
if g:vimwiki_menu != ""
|
||||
exe 'nmenu disable '.g:vimwiki_menu.'.Table'
|
||||
@ -195,13 +197,17 @@ function! s:setup_buffer_enter() "{{{
|
||||
" 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
|
||||
" insist vimwiki folding here.
|
||||
if g:vimwiki_folding == 2 && &fdm != 'expr'
|
||||
" User-defined fold-expression, and fold-text
|
||||
endif
|
||||
if g:vimwiki_folding == 1
|
||||
if g:vimwiki_folding == 'expr'
|
||||
setlocal fdm=expr
|
||||
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
elseif g:vimwiki_folding == 'list' || g:vimwiki_folding == 'lists'
|
||||
setlocal fdm=expr
|
||||
setlocal foldexpr=VimwikiFoldListLevel(v:lnum)
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
elseif g:vimwiki_folding == 'syntax'
|
||||
setlocal fdm=syntax
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
endif
|
||||
|
||||
" And conceal level too.
|
||||
@ -228,6 +234,10 @@ 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 !exists("s:vimwiki_autowriteall")
|
||||
let s:vimwiki_autowriteall = &autowriteall
|
||||
endif
|
||||
let &autowriteall = g:vimwiki_autowriteall
|
||||
endfunction "}}}
|
||||
|
||||
function! s:setup_cleared_syntax() "{{{ highlight groups that get cleared
|
||||
@ -238,7 +248,7 @@ function! s:setup_cleared_syntax() "{{{ highlight groups that get cleared
|
||||
hi def VimwikiUnderline gui=underline
|
||||
if g:vimwiki_hl_headers == 1
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
endfunction "}}}
|
||||
@ -288,7 +298,7 @@ endfunction "}}}
|
||||
function! VimwikiSet(option, value, ...) "{{{
|
||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
||||
|
||||
if has_key(s:vimwiki_defaults, a:option) ||
|
||||
if has_key(s:vimwiki_defaults, a:option) ||
|
||||
\ has_key(g:vimwiki_list[idx], a:option)
|
||||
let g:vimwiki_list[idx][a:option] = a:value
|
||||
elseif exists('b:vimwiki_list')
|
||||
@ -372,12 +382,10 @@ let s:vimwiki_defaults.list_margin = -1
|
||||
call s:default('list', [s:vimwiki_defaults])
|
||||
call s:default('auto_checkbox', 1)
|
||||
call s:default('use_mouse', 0)
|
||||
call s:default('folding', 0)
|
||||
call s:default('fold_trailing_empty_lines', 0)
|
||||
call s:default('fold_lists', 0)
|
||||
call s:default('folding', '')
|
||||
call s:default('menu', 'Vimwiki')
|
||||
call s:default('global_ext', 1)
|
||||
call s:default('ext2syntax', {'.md': 'markdown'}) " syntax map keyed on extension
|
||||
call s:default('ext2syntax', {}) " syntax map keyed on extension
|
||||
call s:default('hl_headers', 0)
|
||||
call s:default('hl_cb_checked', 0)
|
||||
call s:default('list_ignore_newline', 1)
|
||||
@ -390,17 +398,17 @@ call s:default('CJK_length', 0)
|
||||
call s:default('dir_link', '')
|
||||
call s:default('valid_html_tags', 'b,i,s,u,sub,sup,kbd,br,hr,div,center,strong,em')
|
||||
call s:default('user_htmls', '')
|
||||
call s:default('autowriteall', 1)
|
||||
|
||||
call s:default('html_header_numbering', 0)
|
||||
call s:default('html_header_numbering_sym', '')
|
||||
call s:default('conceallevel', 2)
|
||||
call s:default('url_mingain', 12)
|
||||
call s:default('url_maxsave', 15)
|
||||
call s:default('debug', 0)
|
||||
|
||||
call s:default('diary_months',
|
||||
call s:default('diary_months',
|
||||
\ {
|
||||
\ 1: 'January', 2: 'February', 3: 'March',
|
||||
\ 1: 'January', 2: 'February', 3: 'March',
|
||||
\ 4: 'April', 5: 'May', 6: 'June',
|
||||
\ 7: 'July', 8: 'August', 9: 'September',
|
||||
\ 10: 'October', 11: 'November', 12: 'December'
|
||||
@ -418,9 +426,9 @@ call s:default('web_schemes1', 'http,https,file,ftp,gopher,telnet,nntp,ldap,'.
|
||||
\ 'rsync,imap,pop,irc,ircs,cvs,svn,svn+ssh,git,ssh,fish,sftp')
|
||||
call s:default('web_schemes2', 'mailto,news,xmpp,sip,sips,doi,urn,tel')
|
||||
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\|'.
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').
|
||||
\ '\)'
|
||||
|
||||
|
@ -49,6 +49,9 @@ execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
let time0 = vimwiki#u#time(starttime) "XXX
|
||||
|
||||
let g:vimwiki_rxListItem = '\('.
|
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||
\ '\)'
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
@ -57,15 +60,15 @@ let g:vimwiki_rxWikiLinkPrefix = '[['
|
||||
let g:vimwiki_rxWikiLinkSuffix = ']]'
|
||||
let g:vimwiki_rxWikiLinkSeparator = '|'
|
||||
" [[URL]]
|
||||
let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
" [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\]'
|
||||
let valid_chars = '[^\\\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLinkPrefix = escape(g:vimwiki_rxWikiLinkPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSuffix = escape(g:vimwiki_rxWikiLinkSuffix, magic_chars)
|
||||
@ -104,13 +107,15 @@ let g:vimwiki_rxWikiInclSuffix = '}}'
|
||||
let g:vimwiki_rxWikiInclSeparator = '|'
|
||||
"
|
||||
" '{{__LinkUrl__}}'
|
||||
let g:vimwiki_WikiInclTemplate1 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
let g:vimwiki_WikiInclTemplate1 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
" '{{__LinkUrl____LinkDescription__}}'
|
||||
let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
|
||||
let valid_chars = '[^\\\}]'
|
||||
|
||||
let g:vimwiki_rxWikiInclPrefix = escape(g:vimwiki_rxWikiInclPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSuffix = escape(g:vimwiki_rxWikiInclSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSeparator = escape(g:vimwiki_rxWikiInclSeparator, magic_chars)
|
||||
@ -122,7 +127,7 @@ let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_r
|
||||
" *. {{URL}[{...}]} - i.e. {{URL}}, {{URL|ARG1}}, {{URL|ARG1|ARG2}}, etc.
|
||||
" *a) match {{URL}[{...}]}
|
||||
let g:vimwiki_rxWikiIncl = g:vimwiki_rxWikiInclPrefix.
|
||||
\ g:vimwiki_rxWikiInclUrl.
|
||||
\ g:vimwiki_rxWikiInclUrl.
|
||||
\ g:vimwiki_rxWikiInclArgs. g:vimwiki_rxWikiInclSuffix
|
||||
" *b) match URL within {{URL}[{...}]}
|
||||
let g:vimwiki_rxWikiInclMatchUrl = g:vimwiki_rxWikiInclPrefix.
|
||||
@ -138,7 +143,7 @@ let g:vimwiki_rxWikiInclSuffix1 = g:vimwiki_rxWikiInclArgs.
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink regexps {{{
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
||||
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
||||
" Maxim:
|
||||
@ -155,7 +160,7 @@ let g:vimwiki_rxWeblinkMatchDescr = ''
|
||||
|
||||
|
||||
" LINKS: Setup anylink regexps {{{
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
\ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink
|
||||
" }}}
|
||||
|
||||
@ -249,8 +254,8 @@ call s:add_target_syntax_ON(g:vimwiki_rxWeblink, 'VimwikiLink')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
@ -281,6 +286,8 @@ if g:vimwiki_symH
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__ '.repeat(g:vimwiki_rxH, i)
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.i.'}\s*$'
|
||||
let g:vimwiki_rxH{i}_Start = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.i.'}\s*$'
|
||||
let g:vimwiki_rxH{i}_End = '^\s*'.g:vimwiki_rxH.'\{1,'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{1,'.i.'}\s*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']\ze\1\s*$'
|
||||
else
|
||||
@ -288,6 +295,8 @@ else
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__'
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
let g:vimwiki_rxH{i}_Start = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
let g:vimwiki_rxH{i}_End = '^\s*'.g:vimwiki_rxH.'\{1,'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*\ze$'
|
||||
endif
|
||||
@ -295,29 +304,53 @@ endif
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,@Spell'
|
||||
execute 'syntax region VimwikiH'.i.'Folding start=/'.g:vimwiki_rxH{i}_Start.
|
||||
\ '/ end=/'.g:vimwiki_rxH{i}_End.'/me=s-1 transparent fold'
|
||||
endfor
|
||||
|
||||
|
||||
" }}}
|
||||
|
||||
" concealed chars " {{{
|
||||
let cchar = ''
|
||||
if exists("+conceallevel")
|
||||
syntax conceal on
|
||||
let cchar = ' cchar=~ '
|
||||
endif
|
||||
" possibly concealed chars " {{{
|
||||
let conceal = exists("+conceallevel") ? ' conceal' : ''
|
||||
|
||||
syntax spell toplevel
|
||||
execute 'syn match VimwikiEqInChar contained /'.g:vimwiki_char_eqin.'/'.conceal
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'.conceal
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'.conceal
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'.conceal
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/'.conceal
|
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/'.conceal
|
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/'.conceal
|
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/'.conceal
|
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'.conceal
|
||||
" }}}
|
||||
|
||||
" concealed link parts " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom 'WikiLink Prefix: '.g:vimwiki_rxWikiLinkPrefix1
|
||||
echom 'WikiLink Suffix: '.g:vimwiki_rxWikiLinkSuffix1
|
||||
echom 'WikiLink Prefix: '.g:vimwiki_rxWikiLinkPrefix
|
||||
echom 'WikiLink Suffix: '.g:vimwiki_rxWikiLinkSuffix
|
||||
echom 'WikiLink Prefix1: '.g:vimwiki_rxWikiLinkPrefix1
|
||||
echom 'WikiLink Suffix1: '.g:vimwiki_rxWikiLinkSuffix1
|
||||
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
|
||||
|
||||
let options = ' contained transparent contains=NONE'
|
||||
"
|
||||
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
||||
" VimwikiLinkRest group is left undefined if link shortening is not desired
|
||||
if exists("+conceallevel") && g:vimwiki_url_maxsave > 0
|
||||
let options .= conceal
|
||||
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
|
||||
\.'\%([/#?]\w\|\S\{'.g:vimwiki_url_maxsave.'}\)`'.' cchar=~'.options
|
||||
endif
|
||||
|
||||
" VimwikiLinkChar is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
let options = ' contained transparent contains=NONE'
|
||||
|
||||
" conceal wikilinks
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix.'/'.options
|
||||
@ -329,24 +362,6 @@ execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix1.'/'.options
|
||||
|
||||
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
||||
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\{'
|
||||
\.g:vimwiki_url_mingain.',}\ze\%([/#?]\w\|\S\{'
|
||||
\.g:vimwiki_url_maxsave.'}\)`'.cchar.options
|
||||
|
||||
execute 'syn match VimwikiEqInChar contained /'.g:vimwiki_char_eqin.'/'
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/'
|
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/'
|
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/'
|
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/'
|
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" non concealed chars " {{{
|
||||
@ -371,7 +386,7 @@ execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/'
|
||||
" main syntax groups {{{
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiNoExistsLinkT,
|
||||
@ -387,7 +402,7 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ VimwikiCodeT,
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
syntax match VimwikiCellSeparator
|
||||
syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
" List items
|
||||
@ -476,20 +491,21 @@ if g:vimwiki_hl_headers == 0
|
||||
execute 'hi def link VimwikiHeader'.i.' Title'
|
||||
endfor
|
||||
else
|
||||
" default colors when headers of different levels are highlighted differently
|
||||
" default colors when headers of different levels are highlighted differently
|
||||
" not making it yet another option; needed by ColorScheme autocommand
|
||||
let g:vimwiki_hcolor_guifg_light = ['#aa5858','#507030','#1030a0','#103040','#505050','#636363']
|
||||
let g:vimwiki_hcolor_ctermfg_light = ['DarkRed','DarkGreen','DarkBlue','Black','Black','Black']
|
||||
let g:vimwiki_hcolor_guifg_dark = ['#e08090','#80e090','#6090e0','#c0c0f0','#e0e0f0','#f0f0f0']
|
||||
let g:vimwiki_hcolor_ctermfg_dark = ['Red','Green','Blue','White','White','White']
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
|
||||
hi def link VimwikiMarkers Normal
|
||||
|
||||
@ -578,24 +594,28 @@ hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
|
||||
let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
let nested = VimwikiGet('nested_syntaxes')
|
||||
if !empty(nested)
|
||||
for [hl_syntax, vim_syntax] in items(nested)
|
||||
call vimwiki#base#nested_syntax(vim_syntax,
|
||||
call vimwiki#base#nested_syntax(vim_syntax,
|
||||
\ '^\s*'.g:vimwiki_rxPreStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*'.g:vimwiki_rxPreEnd, 'VimwikiPre')
|
||||
endfor
|
||||
endif
|
||||
" LaTeX
|
||||
call vimwiki#base#nested_syntax('tex',
|
||||
call vimwiki#base#nested_syntax('tex',
|
||||
\ '^\s*'.g:vimwiki_rxMathStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ '\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*'.g:vimwiki_rxMathEnd, 'VimwikiMath')
|
||||
"}}}
|
||||
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
let timeend = vimwiki#u#time(starttime) "XXX
|
||||
call VimwikiLog_extend('timing',['syntax:scans',timescans],['syntax:regexloaded',time0],['syntax:beforeHLexisting',time01],['syntax:afterHLexisting',time02],['syntax:end',timeend])
|
||||
|
@ -35,10 +35,10 @@ let g:vimwiki_rxWikiLink1Suffix = ']'
|
||||
let g:vimwiki_rxWikiLink1Separator = ']['
|
||||
|
||||
" [URL][]
|
||||
let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'.
|
||||
let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Separator. g:vimwiki_rxWikiLink1Suffix
|
||||
" [DESCRIPTION][URL]
|
||||
let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescription__'.
|
||||
let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Suffix
|
||||
"
|
||||
@ -108,7 +108,7 @@ let g:vimwiki_rxWikiLinkMatchDescr = ''.
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink0 regexps {{{
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
let g:vimwiki_rxWeblink0 = g:vimwiki_rxWeblink
|
||||
" 0a) match URL within URL
|
||||
let g:vimwiki_rxWeblinkMatchUrl0 = g:vimwiki_rxWeblinkMatchUrl
|
||||
@ -121,7 +121,7 @@ let g:vimwiki_rxWeblink1Prefix = '['
|
||||
let g:vimwiki_rxWeblink1Suffix = ')'
|
||||
let g:vimwiki_rxWeblink1Separator = ']('
|
||||
" [DESCRIPTION](URL)
|
||||
let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription__'.
|
||||
let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWeblink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWeblink1Suffix
|
||||
|
||||
@ -135,7 +135,7 @@ let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
||||
|
||||
"
|
||||
" " 2012-02-04 TODO not starting with [[ or ][ ? ... prefix = '[\[\]]\@<!\['
|
||||
" " 2012-02-04 TODO not starting with [[ or ][ ? ... prefix = '[\[\]]\@<!\['
|
||||
" 1. [DESCRIPTION](URL)
|
||||
" 1a) match [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1 = g:vimwiki_rxWeblink1Prefix.
|
||||
@ -176,7 +176,7 @@ let g:vimwiki_rxWeblinkMatchDescr = ''.
|
||||
|
||||
|
||||
" LINKS: Setup anylink regexps {{{
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
\ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink
|
||||
" }}}
|
||||
|
||||
@ -289,8 +289,8 @@ call s:add_target_syntax_ON(g:vimwiki_rxWeblink1, 'VimwikiWeblink1')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
@ -352,7 +352,7 @@ endif
|
||||
" main syntax groups {{{
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiWeblink1T,
|
||||
@ -377,7 +377,7 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
"}}}
|
||||
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
" syntax group highlighting "{{{
|
||||
hi def link VimwikiWeblink1 VimwikiLink
|
||||
hi def link VimwikiWeblink1T VimwikiLink
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user