Merge remote-tracking branch 'upstream/dev' into 'upstream/tags'

Conflicts:
	autoload/vimwiki/base.vim
This commit is contained in:
Ivan Tishchenko 2015-03-25 21:33:19 +03:00
commit 28114d8c85
16 changed files with 228 additions and 158 deletions

View File

@ -1,7 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Author: Maxim Kim <habamax@gmail.com> " Desc: Basic functionality
" Home: http://code.google.com/p/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
if exists("g:loaded_vimwiki_auto") || &cp if exists("g:loaded_vimwiki_auto") || &cp
finish finish
@ -224,6 +224,143 @@ function! vimwiki#base#invsubdir(subdir) " {{{
return substitute(a:subdir, '[^/\.]\+/', '../', 'g') return substitute(a:subdir, '[^/\.]\+/', '../', 'g')
endfunction " }}} endfunction " }}}
" Returns: the number of the wiki a file belongs to
function! vimwiki#base#find_wiki(path) "{{{
let path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(a:path))
let idx = 0
while idx < len(g:vimwiki_list)
let idx_path = expand(VimwikiGet('path', idx))
let idx_path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(idx_path))
if vimwiki#path#is_equal(
\ vimwiki#path#path_common_pfx(idx_path, path), idx_path)
return idx
endif
let idx += 1
endwhile
" an orphan page has been detected
return -1
endfunction "}}}
" THE central function of Vimwiki. Extract infos about the target from a link.
" If the second parameter is present, which should be an absolute file path, it
" is assumed that the link appears in that file. Without it, the current file
" is used.
function! vimwiki#base#resolve_link(link_text, ...) "{{{
if a:0
let source_wiki = vimwiki#base#find_wiki(a:1)
let source_file = a:1
else
let source_wiki = g:vimwiki_current_idx
let source_file = expand('%:p')
endif
let link_text = a:link_text
" if link is schemeless add wikiN: scheme
if link_text !~# g:vimwiki_rxSchemeUrl
let link_text = 'wiki'.source_wiki.':'.link_text
endif
let link_infos = {
\ 'index': -1,
\ 'scheme': '',
\ 'filename': '',
\ 'anchor': '',
\ }
" extract scheme
let link_infos.scheme = matchstr(link_text, g:vimwiki_rxSchemeUrlMatchScheme)
if !(link_infos.scheme =~# '\mwiki\d\+' || link_infos.scheme ==# 'diary' ||
\ link_infos.scheme ==# 'local' || link_infos.scheme ==# 'file')
let link_infos.filename = '' " malformed link
return link_infos
endif
let link_text = matchstr(link_text, g:vimwiki_rxSchemeUrlMatchUrl)
let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' ||
\ link_infos.scheme ==# 'diary'
" extract anchor
if is_wiki_link
let split_lnk = split(link_text, '#', 1)
let link_text = split_lnk[0]
if len(split_lnk) > 1 && split_lnk[-1] != ''
let link_infos.anchor = join(split_lnk[1:], '#')
endif
if link_text == '' " because the link was of the form '#anchor'
let link_text = fnamemodify(source_file, ':p:t:r')
endif
endif
" check if absolute or relative path
if is_wiki_link && link_text[0] == '/'
let link_text = link_text[1:]
let is_relative = 0
elseif !is_wiki_link && (link_text[0] == '/' ||
\ (link_text =~? '\m^\a:' && vimwiki#u#is_windows()))
let is_relative = 0
else
let is_relative = 1
let root_dir = fnamemodify(source_file, ':p:h') . '/'
endif
" extract the other items depending on the scheme
if link_infos.scheme =~# '\mwiki\d\+'
let link_infos.index = eval(matchstr(link_infos.scheme, '\D\+\zs\d\+\ze'))
if link_infos.index < 0 || link_infos.index >= len(g:vimwiki_list)
let link_infos.filename = ''
return link_infos
endif
if !is_relative || link_infos.index != source_wiki
let root_dir = VimwikiGet('path', link_infos.index)
endif
let link_infos.filename = root_dir . link_text
if vimwiki#path#is_link_to_dir(link_text)
if g:vimwiki_dir_link != ''
let link_infos.filename .= g:vimwiki_dir_link .
\ VimwikiGet('ext', link_infos.index)
endif
else
let link_infos.filename .= VimwikiGet('ext', link_infos.index)
endif
elseif link_infos.scheme ==# 'diary'
let link_infos.index = source_wiki
let link_infos.filename =
\ VimwikiGet('path', link_infos.index) .
\ VimwikiGet('diary_rel_path', link_infos.index) .
\ link_text .
\ VimwikiGet('ext', link_infos.index)
elseif (link_infos.scheme ==# 'file' && is_relative) ||
\ link_infos.scheme ==# 'local'
let link_infos.filename = root_dir . link_text
else " absolute file link
" collapse repeated leading "/"'s within a link
let link_text = substitute(link_text, '\m^/*', '/', '')
" convert "/~..." into "~..." for fnamemodify
let link_text = substitute(link_text, '\m^/\~', '\~', '')
" convert /C: to C: (or fnamemodify(...":p:h") interpret it as C:\C:)
if vimwiki#u#is_windows()
let link_text = substitute(link_text, '\m^/\ze[[:alpha:]]:', '', '')
endif
let link_infos.filename = link_text
endif
let link_infos.filename = vimwiki#path#normalize(link_infos.filename)
return link_infos
endfunction "}}}
" vimwiki#base#resolve_scheme " vimwiki#base#resolve_scheme
function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
let quiet = a:0 && a:1 ? 1 : 0 let quiet = a:0 && a:1 ? 1 : 0
@ -405,31 +542,22 @@ endfunction "}}}
" vimwiki#base#open_link " vimwiki#base#open_link
function! vimwiki#base#open_link(cmd, link, ...) "{{{ function! vimwiki#base#open_link(cmd, link, ...) "{{{
let [idx, scheme, path, subdir, lnk, ext, url, anchor] = let link_infos = vimwiki#base#resolve_link(a:link)
\ vimwiki#base#resolve_scheme(a:link, 0)
" wikilinks of the form [[#anchor]] if g:vimwiki_debug
if url == '' && anchor != '' echom 'open_link:' string(link_infos)
let lnk = expand('%:t:r')
let url = path.subdir.lnk.ext
endif endif
if url == '' if link_infos.filename == ''
if g:vimwiki_debug
echom 'open_link: idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url.', anchor='.anchor
endif
echom 'Vimwiki Error: Unable to resolve link!' echom 'Vimwiki Error: Unable to resolve link!'
return return
endif endif
let update_prev_link = ( (scheme == '' || scheme =~# 'wiki' || scheme =~# 'diary') let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+'
\ && !vimwiki#path#is_equal(lnk, expand('%:t:r')) \ || link_infos.scheme =~# 'diary'
\ ? 1 : 0)
let use_system_open = ( let update_prev_link = is_wiki_link &&
\ scheme == '' || \ !vimwiki#path#is_equal(link_infos.filename, expand('%:p'))
\ scheme =~# 'wiki' ||
\ scheme =~# 'diary' ? 0 : 1)
let vimwiki_prev_link = [] let vimwiki_prev_link = []
" update previous link for wiki pages " update previous link for wiki pages
@ -442,19 +570,15 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
endif endif
" open/edit " open/edit
if g:vimwiki_debug if is_wiki_link
echom 'open_link: idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url.'anchor='.anchor call vimwiki#base#edit_file(a:cmd, link_infos.filename, link_infos.anchor,
endif
if use_system_open
call vimwiki#base#system_open_link(url)
else
call vimwiki#base#edit_file(a:cmd, url, anchor,
\ vimwiki_prev_link, update_prev_link) \ vimwiki_prev_link, update_prev_link)
if idx != g:vimwiki_current_idx if link_infos.index != g:vimwiki_current_idx
" this call to setup_buffer_state may not be necessary " this call to setup_buffer_state may not be necessary
call vimwiki#base#setup_buffer_state(idx) call vimwiki#base#setup_buffer_state(link_infos.index)
endif endif
else
call vimwiki#base#system_open_link(link_infos.filename)
endif endif
endfunction " }}} endfunction " }}}
@ -481,7 +605,7 @@ endfunction " }}}
" vimwiki#base#generate_links " vimwiki#base#generate_links
function! vimwiki#base#generate_links() "{{{ function! vimwiki#base#generate_links() "{{{
let links = vimwiki#base#get_wikilinks(g:vimwiki_current_idx) let links = vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 0)
call append(line('$'), substitute(g:vimwiki_rxH1_Template, '__Header__', 'Generated Links', '')) call append(line('$'), substitute(g:vimwiki_rxH1_Template, '__Header__', 'Generated Links', ''))
@ -562,9 +686,11 @@ function! vimwiki#base#find_files(wiki_nr, directories_only)
return split(globpath(root_directory, pattern), '\n') return split(globpath(root_directory, pattern), '\n')
endfunction endfunction
" Returns: a list containing the links to all wiki files for the given wiki " Returns: a list containing the links to get from the current file to all wiki
" If the given wiki number is negative, the diary of the current wiki is used " files in the given wiki.
function! vimwiki#base#get_wikilinks(wiki_nr) " If the given wiki number is negative, the diary of the current wiki is used.
" If also_absolute_links is nonzero, also return links of the form /file
function! vimwiki#base#get_wikilinks(wiki_nr, also_absolute_links)
let files = vimwiki#base#find_files(a:wiki_nr, 0) let files = vimwiki#base#find_files(a:wiki_nr, 0)
if a:wiki_nr == g:vimwiki_current_idx if a:wiki_nr == g:vimwiki_current_idx
let cwd = vimwiki#path#wikify_path(expand('%:p:h')) let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
@ -579,21 +705,38 @@ function! vimwiki#base#get_wikilinks(wiki_nr)
let wikifile = vimwiki#path#relpath(cwd, wikifile) let wikifile = vimwiki#path#relpath(cwd, wikifile)
call add(result, wikifile) call add(result, wikifile)
endfor endfor
if a:also_absolute_links
for wikifile in files
if a:wiki_nr == g:vimwiki_current_idx
let cwd = VimwikiGet('path')
elseif a:wiki_nr < 0
let cwd = VimwikiGet('path').VimwikiGet('diary_rel_path')
endif
let wikifile = fnamemodify(wikifile, ':r') " strip extension
let wikifile = '/'.vimwiki#path#relpath(cwd, wikifile)
call add(result, wikifile)
endfor
endif
return result return result
endfunction endfunction
" Returns: a list containing " Returns: a list containing the links to all directories from the current file
function! vimwiki#base#get_wiki_directories(wiki_nr) function! vimwiki#base#get_wiki_directories(wiki_nr)
let dirs = vimwiki#base#find_files(a:wiki_nr, 1) let dirs = vimwiki#base#find_files(a:wiki_nr, 1)
if a:wiki_nr == g:vimwiki_current_idx if a:wiki_nr == g:vimwiki_current_idx
let cwd = vimwiki#path#wikify_path(expand('%:p:h')) let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
let root_dir = VimwikiGet('path')
else else
let cwd = VimwikiGet('path', a:wiki_nr) let cwd = VimwikiGet('path', a:wiki_nr)
endif endif
let result = ['./'] let result = ['./']
for wikidir in dirs for wikidir in dirs
let wikidir = vimwiki#path#relpath(cwd, wikidir).'/' let wikidir_relative = vimwiki#path#relpath(cwd, wikidir).'/'
call add(result, wikidir) call add(result, wikidir_relative)
if a:wiki_nr == g:vimwiki_current_idx
let wikidir_absolute = '/'.vimwiki#path#relpath(root_dir, wikidir).'/'
call add(result, wikidir_absolute)
endif
endfor endfor
return result return result
endfunction endfunction
@ -699,50 +842,6 @@ function! s:jump_to_anchor(anchor) "{{{
endfor endfor
endfunction "}}} endfunction "}}}
" Returns: the absolute file path (and possibly an anchor) of the target file,
" if a link with the given link text appears in the given wiki file, which
" belongs to the given wiki nr
function! s:link_target(source_file, wiki_nr, link_text) "{{{
let [target_idx, scheme, path, subdir, lnk, ext, url, anchor] =
\ vimwiki#base#resolve_scheme(a:link_text, 0, 1)
let source_dir = fnamemodify(a:source_file, ':p:h').'/'
if lnk =~# '/$' " link to a directory
return []
elseif url == '' && anchor != '' " only anchor
return [fnamemodify(a:source_file, ':p'), anchor]
elseif scheme ==# 'file'
return [url, '']
elseif scheme ==# 'local'
return [vimwiki#path#normalize(source_dir.lnk), '']
elseif target_idx >= len(g:vimwiki_list) " a malformed link
return ['', '']
elseif scheme !~# '^wiki\d\+\|diary' " unknown scheme
return []
endif
if scheme ==# 'diary'
let root_dir = VimwikiGet('path',a:wiki_nr).
\ VimwikiGet('diary_rel_path', a:wiki_nr)
let ext = VimwikiGet('ext', a:wiki_nr)
else
" a schemeless link is like a link to the current wiki
if a:link_text !~# '^wiki\d\+:'
let target_idx = a:wiki_nr
endif
if target_idx == a:wiki_nr
let root_dir = source_dir
else
let root_dir = VimwikiGet('path', target_idx)
endif
let ext = VimwikiGet('ext', target_idx)
endif
let target_file = root_dir . lnk . ext
return [vimwiki#path#normalize(target_file), anchor]
endfunction "}}}
" Params: full path to a wiki file and its wiki number " Params: full path to a wiki file and its wiki number
" Returns: a list of all links inside the wiki file " Returns: a list of all links inside the wiki file
" Every list item has the form " Every list item has the form
@ -768,11 +867,9 @@ function! s:get_links(wikifile, idx) "{{{
break break
endif endif
let link_count += 1 let link_count += 1
let target = s:link_target(a:wikifile, a:idx, link_text) let target = vimwiki#base#resolve_link(link_text, a:wikifile)
if !empty(target) if target.filename != ''
call add(target, lnum) call add(links, [target.filename, target.anchor, lnum, col])
call add(target, col)
call add(links, target)
endif endif
endwhile endwhile
endfor endfor
@ -804,11 +901,18 @@ function! vimwiki#base#check_links() "{{{
\'text': "there is no such anchor: ".target_anchor}) \'text': "there is no such anchor: ".target_anchor})
endif endif
else else
if filereadable(target_file) " maybe it's a non-wiki file if target_file =~ '/$' " maybe it's a link to a directory
let anchors_of_files[target_file] = [] if !isdirectory(target_file)
call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
\'text': "there is no such directory: ".target_file})
endif
else else
call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col, if filereadable(target_file) " maybe it's a non-wiki file
\'text': "there is no such file: ".target_file}) let anchors_of_files[target_file] = []
else
call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
\'text': "there is no such file: ".target_file})
endif
endif endif
endif endif
endfor endfor

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Desc: Handle diary notes " Desc: Handle diary notes
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" Load only once {{{ " Load only once {{{
if exists("g:loaded_vimwiki_diary_auto") || &cp if exists("g:loaded_vimwiki_diary_auto") || &cp

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Export to HTML " Desc: Export to HTML
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" TODO: We need vimwiki abstract syntax tree. If properly designed it wourld " TODO: We need vimwiki abstract syntax tree. If properly designed it wourld
" greatly symplify different syntax to HTML generation. " greatly symplify different syntax to HTML generation.

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Everything concerning bulleted and numbered lists and checkboxes " Desc: Everything concerning lists and checkboxes
" Author: Daniel Schemala <istjanichtzufassen@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
if exists("g:loaded_vimwiki_list_auto") || &cp if exists("g:loaded_vimwiki_list_auto") || &cp
finish finish

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Desc: Link functions for markdown syntax " Desc: Link functions for markdown syntax
" Author: Stuart Andrews <stu.andrews@gmail.com> (.. i.e. don't blame Maxim!) " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" MISC helper functions {{{ " MISC helper functions {{{
@ -17,7 +16,8 @@ function! vimwiki#markdown_base#scan_reflinks() " {{{
let mkd_refs = {} let mkd_refs = {}
" construct list of references using vimgrep " construct list of references using vimgrep
try try
execute 'vimgrep #'.g:vimwiki_rxMkdRef.'#j %' " Why noautocmd? Because https://github.com/vimwiki/vimwiki/issues/121
noautocmd execute 'vimgrep #'.g:vimwiki_rxMkdRef.'#j %'
catch /^Vim\%((\a\+)\)\=:E480/ " No Match catch /^Vim\%((\a\+)\)\=:E480/ " No Match
"Ignore it, and move on to the next file "Ignore it, and move on to the next file
endtry endtry

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Path manipulation functions " Desc: Path manipulation functions
" Author: Daniel Schemala <istjanichtzufassen@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
function! vimwiki#path#chomp_slash(str) "{{{ function! vimwiki#path#chomp_slash(str) "{{{
@ -50,10 +49,7 @@ endfunction "}}}
function! vimwiki#path#is_link_to_dir(link) "{{{ function! vimwiki#path#is_link_to_dir(link) "{{{
" Check if link is to a directory. " Check if link is to a directory.
" It should be ended with \ or /. " It should be ended with \ or /.
if a:link =~# '.\+[/\\]$' return a:link =~# '\m[/\\]$'
return 1
endif
return 0
endfunction "}}} endfunction "}}}
function! vimwiki#path#abs_path_of_link(link) "{{{ function! vimwiki#path#abs_path_of_link(link) "{{{

View File

@ -5,8 +5,7 @@
" |--------|------------|-------|--------|---------| " |--------|------------|-------|--------|---------|
" | Have | fun! | Drink | tea | Period. | " | Have | fun! | Drink | tea | Period. |
" "
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" Load only once {{{ " Load only once {{{
if exists("g:loaded_vimwiki_tbl_auto") || &cp if exists("g:loaded_vimwiki_tbl_auto") || &cp

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file " Vimwiki autoload plugin file
" Utility functions " Desc: Utility functions
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
function! vimwiki#u#trim(string, ...) "{{{ function! vimwiki#u#trim(string, ...) "{{{
let chars = '' let chars = ''

View File

@ -1,7 +1,6 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki filetype plugin file " Vimwiki filetype plugin file
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
finish finish
@ -95,7 +94,7 @@ function! Complete_wikifiles(findstart, base)
let scheme = '' let scheme = ''
endif endif
let links = vimwiki#base#get_wikilinks(wikinumber) let links = vimwiki#base#get_wikilinks(wikinumber, 0)
let result = [] let result = []
for wikifile in links for wikifile in links
if wikifile =~ '^'.vimwiki#u#escape(prefix) if wikifile =~ '^'.vimwiki#u#escape(prefix)
@ -109,9 +108,9 @@ function! Complete_wikifiles(findstart, base)
let segments = split(a:base, '#', 1) let segments = split(a:base, '#', 1)
let given_wikifile = segments[0] == '' ? expand('%:t:r') : segments[0] let given_wikifile = segments[0] == '' ? expand('%:t:r') : segments[0]
let link_infos = vimwiki#base#resolve_scheme(given_wikifile.'#', 0, 1) let link_infos = vimwiki#base#resolve_link(given_wikifile.'#')
let wikifile = link_infos[6] let wikifile = link_infos.filename
let syntax = VimwikiGet('syntax', link_infos[0]) let syntax = VimwikiGet('syntax', link_infos.index)
let anchors = vimwiki#base#get_anchors(wikifile, syntax) let anchors = vimwiki#base#get_anchors(wikifile, syntax)
let filtered_anchors = [] let filtered_anchors = []

View File

@ -1,7 +1,6 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki plugin file " Vimwiki plugin file
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki " GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
if exists("g:loaded_vimwiki") || &cp if exists("g:loaded_vimwiki") || &cp
@ -32,23 +31,6 @@ function! s:default(varname, value) "{{{
endif endif
endfunction "}}} endfunction "}}}
function! s:find_wiki(path) "{{{
" XXX: find_wiki() does not (yet) take into consideration the ext
let path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(a:path))
let idx = 0
while idx < len(g:vimwiki_list)
let idx_path = expand(VimwikiGet('path', idx))
let idx_path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(idx_path))
if vimwiki#path#is_equal(
\ vimwiki#path#path_common_pfx(idx_path, path), idx_path)
return idx
endif
let idx += 1
endwhile
return -1
" an orphan page has been detected
endfunction "}}}
function! s:path_html(idx) "{{{ function! s:path_html(idx) "{{{
let path_html = VimwikiGet('path_html', a:idx) let path_html = VimwikiGet('path_html', a:idx)
if !empty(path_html) if !empty(path_html)
@ -115,8 +97,7 @@ function! s:setup_filetype() "{{{
let time0 = reltime() " start the clock "XXX let time0 = reltime() " start the clock "XXX
" Find what wiki current buffer belongs to. " Find what wiki current buffer belongs to.
let path = expand('%:p:h') let path = expand('%:p:h')
" XXX: find_wiki() does not (yet) take into consideration the ext let idx = vimwiki#base#find_wiki(path)
let idx = s:find_wiki(path)
if g:vimwiki_debug == 3 if g:vimwiki_debug == 3
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx()."" echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
endif endif
@ -167,8 +148,7 @@ function! s:setup_buffer_enter() "{{{
" buffer's path and ext. " buffer's path and ext.
" Else set g:vimwiki_current_idx to that wiki index. " Else set g:vimwiki_current_idx to that wiki index.
let path = expand('%:p:h') let path = expand('%:p:h')
" XXX: find_wiki() does not (yet) take into consideration the ext let idx = vimwiki#base#find_wiki(path)
let idx = s:find_wiki(path)
if g:vimwiki_debug ==3 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()."" echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki syntax file " Vimwiki syntax file
" Syntax definitions which are always available " Desc: Syntax definitions which are always available
" Author: Daniel Schemala <istjanichtzufassen@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" Define Regexes of anchors for every syntax. " Define Regexes of anchors for every syntax.

View File

@ -1,7 +1,6 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki syntax file " Vimwiki syntax file
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" Quit if syntax file is already loaded " Quit if syntax file is already loaded
if version < 600 if version < 600
@ -13,7 +12,8 @@ endif
"TODO do nothing if ...? (?) "TODO do nothing if ...? (?)
let g:starttime = reltime() " start the clock let g:starttime = reltime() " start the clock
if VimwikiGet('maxhi') if VimwikiGet('maxhi')
let b:existing_wikifiles = vimwiki#base#get_wikilinks(g:vimwiki_current_idx) let b:existing_wikifiles =
\ vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 1)
let b:existing_wikidirs = let b:existing_wikidirs =
\ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx) \ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx)
endif endif

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki syntax file " Vimwiki syntax file
" Default syntax " Desc: Defines default syntax
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" text: $ equation_inline $ " text: $ equation_inline $
let g:vimwiki_rxEqIn = '\$[^$`]\+\$' let g:vimwiki_rxEqIn = '\$[^$`]\+\$'

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki syntax file " Vimwiki syntax file
" Default syntax " Desc: Defines markdown syntax
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" text: $ equation_inline $ " text: $ equation_inline $
let g:vimwiki_rxEqIn = '\$[^$`]\+\$' let g:vimwiki_rxEqIn = '\$[^$`]\+\$'

View File

@ -1,7 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki syntax file " Vimwiki syntax file
" Author: Stuart Andrews <stu.andrews@gmail.com> " Desc: Special stuff for markdown syntax
" Home: http://code.google.com/p/vimwiki/ " Home: https://github.com/vimwiki/vimwiki/
" LINKS: assume this is common to all syntaxes "{{{ " LINKS: assume this is common to all syntaxes "{{{

View File

@ -1,8 +1,7 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki syntax file " Vimwiki syntax file
" MediaWiki syntax " Desc: Defines mediaWiki syntax
" Author: Maxim Kim <habamax@gmail.com> " Home: https://github.com/vimwiki/vimwiki/
" Home: http://code.google.com/p/vimwiki/
" text: $ equation_inline $ " text: $ equation_inline $
let g:vimwiki_rxEqIn = '\$[^$`]\+\$' let g:vimwiki_rxEqIn = '\$[^$`]\+\$'