vim
provides a nice way to complete the Ex commands, which uses the -complete=custom,Func
or complete=customlist,Func
. It also provides many predefined completion methods such as -complete=dir
.
Is is it possible to reuse these predefined completion methods in a user defined complete method? For example, I want to first extract the list of possible command and suffix them with a user defined string suffix
. Example:
command -nargs=1 -complete=customlist,UserComplete CreateGitFile
function! UserComplete(ArgLead, CmdLine, CursorPos)
let list = GetCompletionListFor_Dir() " <--- what to do here
let list1 = map(copy(list), 'v:val . "/.gitignore"')
let list2 = map(copy(list), 'v:val . "/.gitconfig"')
return list1 + list2
endfunction