From 75a9232fd584dc0ad8c8dedde6d7c2634f4617f2 Mon Sep 17 00:00:00 2001 From: Tinmarino Date: Tue, 21 Jul 2020 10:20:06 -0400 Subject: [PATCH] Fix: #913: VimwikiGoto completion aafter [in input() prompt] Issue #913: :VimwikiGoto tab completion only works when written in-line, not when called from \wn #913 PR #785 adds completion to :VimwikiGoto, however it works only when you try to type the filename after the command, e.g. --- Dockerfile | 20 ++++++++++---------- autoload/vimwiki/base.vim | 4 +++- test/command_goto.vader | 18 +++++++++++++++++- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index b6ffdd0..48c5638 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ -FROM testbed/vim:17 +FROM testbed/vim:latest -# add packages -RUN apk --no-cache add bash=~5.0 -RUN apk --no-cache add git=~2.22 -RUN apk --no-cache add python3=~3.7 +# Add packages +RUN apk --no-cache add bash +RUN apk --no-cache add git +RUN apk --no-cache add python3 -# get vint for linting -RUN pip3 install vim-vint==0.3.21 +# Get vint for linting +RUN pip3 install vim-vint -# get vader for unit tests +# Get vader for unit tests RUN git clone -n https://github.com/junegunn/vader.vim /vader WORKDIR /vader RUN git checkout de8a976f1eae2c2b680604205c3e8b5c8882493c -# build vim and neovim versions we want to test -# TODO uncomment nvim tag +# Build vim and neovim versions we want to test +# TODO add nvim tag WORKDIR / RUN install_vim -tag v7.3.429 -name vim_7.3.429 -build \ -tag v7.4.1099 -name vim_7.4.1099 -build \ diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 9aad8bc..9c47c78 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -455,7 +455,9 @@ endfunction " Jump to other wikifile, specified on command mode " Called: by command VimwikiGoto (Exported) function! vimwiki#base#goto(...) abort - let key = a:0 > 0 ? a:1 : input('Enter name: ') + let key = a:0 > 0 ? a:1 : input('Enter name: ', '', + \ 'customlist,vimwiki#base#complete_links_escaped') + let anchor = a:0 > 1 ? a:2 : '' " Save current file pos diff --git a/test/command_goto.vader b/test/command_goto.vader index 60e66c8..258bc65 100644 --- a/test/command_goto.vader +++ b/test/command_goto.vader @@ -1,3 +1,7 @@ +# Note: I dont know why is inserting a Tab. +# Well better than to insert a Chair, but it should trigger completion +# So I used C-L + Include: vader_includes/vader_setup.vader @@ -17,7 +21,19 @@ Do (VimwikiGoto buzz_bozz && Assert): buzz_bozz\ :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\ -Execute (:VimwikiGoto + Completion): +Do (VimwikiGoto + Completion(cmdline) && Assert): + :VimwikiIndex 2\ + :VimwikiGoto buzz_bo\\ + :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\ + +Do (VimwikiGoto buzz_bo + Completion(input()) && Assert): + :VimwikiIndex 2\ + :VimwikiGoto\ + buzz_bo\\ + :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\ + + +Execute (:VimwikiGoto + Completion (API)): VimwikiIndex 2 AssertEqual $HOME . '/testmarkdown/index.md', expand('%') let s_complete=string(vimwiki#base#get_globlinks_escaped())