Monday, July 27, 2015

Custom command completion

Hi,

I am trying to write a plugin, where the `b:Sdir` will take the directories with source code. I am trying to achieve autocompletion as:

"MakeMake: Generate Makefile.gen
function! MakeMake()
let b:Rdir = input("Project root folder: ", ".", 'file')
exe ":lchdir ".b:Rdir

" More than 1 files can be choosed
let b:Sdir = input("Choose source dir: ", ".", "customlist,CFile")
endfunction

function! CFile(A,L,P)
return split(globpath(b:Rdir, a:A),"\n")
endfunction

But this is not working.
As normal, if I use "split(globpath(b:Rdir, "*"),"\n")" in CFile, it will show ALL files in the directory available, but not filter the files.

How can I achieve completion for this?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: