1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 15:20:06 +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: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 " this is for vim command completion
function! s:self.complete(ArgLead, CmdLine, CursorPos) abort function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
if a:CmdLine =~ '^[^ ]*$' if a:CmdLine =~ '^[^ ]*$'
return systemlist('compgen -c ' . a:CmdLine) return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif endif
let result = systemlist([s:completer, a:CmdLine]) let result = s:COP.systemlist([s:completer, a:CmdLine])
return map(result, 'substitute(v:val, "[ ]*$", "", "g")') return map(result, 'substitute(v:val, "[ ]*$", "", "g")')
endfunction endfunction
@ -17,9 +19,9 @@ endfunction
function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort
if a:CmdLine =~ '^[^ ]*$' if a:CmdLine =~ '^[^ ]*$'
return systemlist('compgen -c ' . a:CmdLine) return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif endif
let result = systemlist([s:completer, a:CmdLine]) let result = s:COP.systemlist([s:completer, a:CmdLine])
if a:ArgLead == '' if a:ArgLead == ''
let result = map(result, 'a:CmdLine . v:val') let result = map(result, 'a:CmdLine . v:val')
else else