vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit ac4f66586a5c154ef9defd6e32efba0d5a343c6f
parent 42f427e718e5bfe55418d8e9adb63014d45bbb03
Author: EinfachToll <istjanichtzufassen@googlemail.com>
Date:   Mon,  9 Feb 2015 21:40:17 +0100

col('.') inside the omnicompletion function returns garbage

so use a workaround

Diffstat:
Mftplugin/vimwiki.vim | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim @@ -43,26 +43,30 @@ function! Complete_wikifiles(findstart, base) let line = getline('.')[:column] let startoflink = match(line, '\[\[\zs[^\\[]*$') if startoflink != -1 + let s:line_context = '[' return startoflink endif if VimwikiGet('syntax') == 'markdown' let startofinlinelink = match(line, '\[.*\](\zs.*$') if startofinlinelink != -1 + let s:line_context = '[' return startofinlinelink endif endif let startoftag = match(line, ':\zs[^:[:space:]]*$') if startoftag != -1 + let s:line_context = ':' return startoftag endif + let s:line_context = '' return -1 else - " Completion works for wikilinks/anchors, and for tags. So first we have - " to find out what we're about to complete. - let column = col('.') - let line = getline('.')[:(column - len(a:base))] - let char_before_start = line[-1:-1] - if char_before_start == ':' + " Completion works for wikilinks/anchors, and for tags. s:line_content + " tells us, which string came before a:base. There seems to be no easier + " solution, because calling col('.') here returns garbage. + if s:line_context == '' + return [] + elseif s:line_context == ':' " Tags completion let metadata = vimwiki#base#load_tags_metadata() let tags = vimwiki#base#get_tags(metadata)