1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 06:10:05 +08:00

Enable bash complete for vim8

Using SpaceVim's api to support vim8
This commit is contained in:
wsdjeg 2017-11-03 21:32:14 +08:00
parent 852aaa7e1f
commit a22fa9b423

View File

@ -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