Merge remote-tracking branch 'upstream/dev' into 'upstream/tags'
Conflicts: autoload/vimwiki/base.vim
This commit is contained in:
commit
28114d8c85
@ -1,7 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Basic functionality
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
if exists("g:loaded_vimwiki_auto") || &cp
|
||||
finish
|
||||
@ -224,6 +224,143 @@ function! vimwiki#base#invsubdir(subdir) " {{{
|
||||
return substitute(a:subdir, '[^/\.]\+/', '../', 'g')
|
||||
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
|
||||
function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
let quiet = a:0 && a:1 ? 1 : 0
|
||||
@ -405,31 +542,22 @@ endfunction "}}}
|
||||
|
||||
" vimwiki#base#open_link
|
||||
function! vimwiki#base#open_link(cmd, link, ...) "{{{
|
||||
let [idx, scheme, path, subdir, lnk, ext, url, anchor] =
|
||||
\ vimwiki#base#resolve_scheme(a:link, 0)
|
||||
let link_infos = vimwiki#base#resolve_link(a:link)
|
||||
|
||||
" wikilinks of the form [[#anchor]]
|
||||
if url == '' && anchor != ''
|
||||
let lnk = expand('%:t:r')
|
||||
let url = path.subdir.lnk.ext
|
||||
if g:vimwiki_debug
|
||||
echom 'open_link:' string(link_infos)
|
||||
endif
|
||||
|
||||
if url == ''
|
||||
if g:vimwiki_debug
|
||||
echom 'open_link: idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url.', anchor='.anchor
|
||||
endif
|
||||
if link_infos.filename == ''
|
||||
echom 'Vimwiki Error: Unable to resolve link!'
|
||||
return
|
||||
endif
|
||||
|
||||
let update_prev_link = ( (scheme == '' || scheme =~# 'wiki' || scheme =~# 'diary')
|
||||
\ && !vimwiki#path#is_equal(lnk, expand('%:t:r'))
|
||||
\ ? 1 : 0)
|
||||
let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+'
|
||||
\ || link_infos.scheme =~# 'diary'
|
||||
|
||||
let use_system_open = (
|
||||
\ scheme == '' ||
|
||||
\ scheme =~# 'wiki' ||
|
||||
\ scheme =~# 'diary' ? 0 : 1)
|
||||
let update_prev_link = is_wiki_link &&
|
||||
\ !vimwiki#path#is_equal(link_infos.filename, expand('%:p'))
|
||||
|
||||
let vimwiki_prev_link = []
|
||||
" update previous link for wiki pages
|
||||
@ -442,19 +570,15 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
|
||||
endif
|
||||
|
||||
" open/edit
|
||||
if g:vimwiki_debug
|
||||
echom 'open_link: idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url.'anchor='.anchor
|
||||
endif
|
||||
|
||||
if use_system_open
|
||||
call vimwiki#base#system_open_link(url)
|
||||
else
|
||||
call vimwiki#base#edit_file(a:cmd, url, anchor,
|
||||
if is_wiki_link
|
||||
call vimwiki#base#edit_file(a:cmd, link_infos.filename, link_infos.anchor,
|
||||
\ 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
|
||||
call vimwiki#base#setup_buffer_state(idx)
|
||||
call vimwiki#base#setup_buffer_state(link_infos.index)
|
||||
endif
|
||||
else
|
||||
call vimwiki#base#system_open_link(link_infos.filename)
|
||||
endif
|
||||
endfunction " }}}
|
||||
|
||||
@ -481,7 +605,7 @@ endfunction " }}}
|
||||
|
||||
" 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', ''))
|
||||
|
||||
@ -562,9 +686,11 @@ function! vimwiki#base#find_files(wiki_nr, directories_only)
|
||||
return split(globpath(root_directory, pattern), '\n')
|
||||
endfunction
|
||||
|
||||
" Returns: a list containing the links to all wiki files for the given wiki
|
||||
" If the given wiki number is negative, the diary of the current wiki is used
|
||||
function! vimwiki#base#get_wikilinks(wiki_nr)
|
||||
" Returns: a list containing the links to get from the current file to all wiki
|
||||
" files in the given wiki.
|
||||
" 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)
|
||||
if a:wiki_nr == g:vimwiki_current_idx
|
||||
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)
|
||||
call add(result, wikifile)
|
||||
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
|
||||
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)
|
||||
let dirs = vimwiki#base#find_files(a:wiki_nr, 1)
|
||||
if a:wiki_nr == g:vimwiki_current_idx
|
||||
let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
|
||||
let root_dir = VimwikiGet('path')
|
||||
else
|
||||
let cwd = VimwikiGet('path', a:wiki_nr)
|
||||
endif
|
||||
let result = ['./']
|
||||
for wikidir in dirs
|
||||
let wikidir = vimwiki#path#relpath(cwd, wikidir).'/'
|
||||
call add(result, wikidir)
|
||||
let wikidir_relative = vimwiki#path#relpath(cwd, 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
|
||||
return result
|
||||
endfunction
|
||||
@ -699,50 +842,6 @@ function! s:jump_to_anchor(anchor) "{{{
|
||||
endfor
|
||||
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
|
||||
" Returns: a list of all links inside the wiki file
|
||||
" Every list item has the form
|
||||
@ -768,11 +867,9 @@ function! s:get_links(wikifile, idx) "{{{
|
||||
break
|
||||
endif
|
||||
let link_count += 1
|
||||
let target = s:link_target(a:wikifile, a:idx, link_text)
|
||||
if !empty(target)
|
||||
call add(target, lnum)
|
||||
call add(target, col)
|
||||
call add(links, target)
|
||||
let target = vimwiki#base#resolve_link(link_text, a:wikifile)
|
||||
if target.filename != ''
|
||||
call add(links, [target.filename, target.anchor, lnum, col])
|
||||
endif
|
||||
endwhile
|
||||
endfor
|
||||
@ -804,11 +901,18 @@ function! vimwiki#base#check_links() "{{{
|
||||
\'text': "there is no such anchor: ".target_anchor})
|
||||
endif
|
||||
else
|
||||
if filereadable(target_file) " maybe it's a non-wiki file
|
||||
let anchors_of_files[target_file] = []
|
||||
if target_file =~ '/$' " maybe it's a link to a directory
|
||||
if !isdirectory(target_file)
|
||||
call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
|
||||
\'text': "there is no such directory: ".target_file})
|
||||
endif
|
||||
else
|
||||
call add(errors, {'filename':wikifile, 'lnum':lnum, 'col':col,
|
||||
\'text': "there is no such file: ".target_file})
|
||||
if filereadable(target_file) " maybe it's a non-wiki 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
|
||||
endfor
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Handle diary notes
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_diary_auto") || &cp
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Export to HTML
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Export to HTML
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" TODO: We need vimwiki abstract syntax tree. If properly designed it wourld
|
||||
" greatly symplify different syntax to HTML generation.
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Everything concerning bulleted and numbered lists and checkboxes
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Everything concerning lists and checkboxes
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
if exists("g:loaded_vimwiki_list_auto") || &cp
|
||||
finish
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Link functions for markdown syntax
|
||||
" Author: Stuart Andrews <stu.andrews@gmail.com> (.. i.e. don't blame Maxim!)
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
" MISC helper functions {{{
|
||||
@ -17,7 +16,8 @@ function! vimwiki#markdown_base#scan_reflinks() " {{{
|
||||
let mkd_refs = {}
|
||||
" construct list of references using vimgrep
|
||||
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
|
||||
"Ignore it, and move on to the next file
|
||||
endtry
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Path manipulation functions
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Path manipulation functions
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
function! vimwiki#path#chomp_slash(str) "{{{
|
||||
@ -50,10 +49,7 @@ endfunction "}}}
|
||||
function! vimwiki#path#is_link_to_dir(link) "{{{
|
||||
" Check if link is to a directory.
|
||||
" It should be ended with \ or /.
|
||||
if a:link =~# '.\+[/\\]$'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
return a:link =~# '\m[/\\]$'
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#path#abs_path_of_link(link) "{{{
|
||||
|
@ -5,8 +5,7 @@
|
||||
" |--------|------------|-------|--------|---------|
|
||||
" | Have | fun! | Drink | tea | Period. |
|
||||
"
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_tbl_auto") || &cp
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki autoload plugin file
|
||||
" Utility functions
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Utility functions
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
function! vimwiki#u#trim(string, ...) "{{{
|
||||
let chars = ''
|
||||
|
@ -1,7 +1,6 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki filetype plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
@ -95,7 +94,7 @@ function! Complete_wikifiles(findstart, base)
|
||||
let scheme = ''
|
||||
endif
|
||||
|
||||
let links = vimwiki#base#get_wikilinks(wikinumber)
|
||||
let links = vimwiki#base#get_wikilinks(wikinumber, 0)
|
||||
let result = []
|
||||
for wikifile in links
|
||||
if wikifile =~ '^'.vimwiki#u#escape(prefix)
|
||||
@ -109,9 +108,9 @@ function! Complete_wikifiles(findstart, base)
|
||||
|
||||
let segments = split(a:base, '#', 1)
|
||||
let given_wikifile = segments[0] == '' ? expand('%:t:r') : segments[0]
|
||||
let link_infos = vimwiki#base#resolve_scheme(given_wikifile.'#', 0, 1)
|
||||
let wikifile = link_infos[6]
|
||||
let syntax = VimwikiGet('syntax', link_infos[0])
|
||||
let link_infos = vimwiki#base#resolve_link(given_wikifile.'#')
|
||||
let wikifile = link_infos.filename
|
||||
let syntax = VimwikiGet('syntax', link_infos.index)
|
||||
let anchors = vimwiki#base#get_anchors(wikifile, syntax)
|
||||
|
||||
let filtered_anchors = []
|
||||
|
@ -1,7 +1,6 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
||||
|
||||
if exists("g:loaded_vimwiki") || &cp
|
||||
@ -32,23 +31,6 @@ function! s:default(varname, value) "{{{
|
||||
endif
|
||||
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) "{{{
|
||||
let path_html = VimwikiGet('path_html', a:idx)
|
||||
if !empty(path_html)
|
||||
@ -115,8 +97,7 @@ function! s:setup_filetype() "{{{
|
||||
let time0 = reltime() " start the clock "XXX
|
||||
" Find what wiki current buffer belongs to.
|
||||
let path = expand('%:p:h')
|
||||
" XXX: find_wiki() does not (yet) take into consideration the ext
|
||||
let idx = s:find_wiki(path)
|
||||
let idx = vimwiki#base#find_wiki(path)
|
||||
if g:vimwiki_debug == 3
|
||||
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
endif
|
||||
@ -167,8 +148,7 @@ function! s:setup_buffer_enter() "{{{
|
||||
" buffer's path and ext.
|
||||
" Else set g:vimwiki_current_idx to that wiki index.
|
||||
let path = expand('%:p:h')
|
||||
" XXX: find_wiki() does not (yet) take into consideration the ext
|
||||
let idx = s:find_wiki(path)
|
||||
let idx = vimwiki#base#find_wiki(path)
|
||||
|
||||
if g:vimwiki_debug ==3
|
||||
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Syntax definitions which are always available
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Syntax definitions which are always available
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
|
||||
" Define Regexes of anchors for every syntax.
|
||||
|
@ -1,7 +1,6 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" Quit if syntax file is already loaded
|
||||
if version < 600
|
||||
@ -13,7 +12,8 @@ endif
|
||||
"TODO do nothing if ...? (?)
|
||||
let g:starttime = reltime() " start the clock
|
||||
if VimwikiGet('maxhi')
|
||||
let b:existing_wikifiles = vimwiki#base#get_wikilinks(g:vimwiki_current_idx)
|
||||
let b:existing_wikifiles =
|
||||
\ vimwiki#base#get_wikilinks(g:vimwiki_current_idx, 1)
|
||||
let b:existing_wikidirs =
|
||||
\ vimwiki#base#get_wiki_directories(g:vimwiki_current_idx)
|
||||
endif
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Default syntax
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Defines default syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Default syntax
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Defines markdown syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
|
@ -1,7 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Author: Stuart Andrews <stu.andrews@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Special stuff for markdown syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" LINKS: assume this is common to all syntaxes "{{{
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" MediaWiki syntax
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" Desc: Defines mediaWiki syntax
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
|
Loading…
Reference in New Issue
Block a user