From a22fa9b4236500796c6097a6eb3ccb9a2406e3b1 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 3 Nov 2017 21:32:14 +0800 Subject: [PATCH] Enable bash complete for vim8 Using SpaceVim's api to support vim8 --- autoload/SpaceVim/api/bash/complete.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload/SpaceVim/api/bash/complete.vim b/autoload/SpaceVim/api/bash/complete.vim index f40225413..816586861 100644 --- a/autoload/SpaceVim/api/bash/complete.vim +++ b/autoload/SpaceVim/api/bash/complete.vim @@ -2,13 +2,15 @@ let s:self = {} let s:completer = fnamemodify(g:Config_Main_Home, ':p:h:h') . '/autoload/SpaceVim/bin/get_complete' +let s:COP = SpaceVim#api#import('vim#compatible') + " this is for vim command completion function! s:self.complete(ArgLead, CmdLine, CursorPos) abort if a:CmdLine =~ '^[^ ]*$' - return systemlist('compgen -c ' . a:CmdLine) + return s:COP.systemlist('compgen -c ' . a:CmdLine) endif - let result = systemlist([s:completer, a:CmdLine]) + let result = s:COP.systemlist([s:completer, a:CmdLine]) return map(result, 'substitute(v:val, "[ ]*$", "", "g")') endfunction @@ -17,9 +19,9 @@ endfunction function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort if a:CmdLine =~ '^[^ ]*$' - return systemlist('compgen -c ' . a:CmdLine) + return s:COP.systemlist('compgen -c ' . a:CmdLine) endif - let result = systemlist([s:completer, a:CmdLine]) + let result = s:COP.systemlist([s:completer, a:CmdLine]) if a:ArgLead == '' let result = map(result, 'a:CmdLine . v:val') else