I'm trying to make a List variable that contains all the globbed files's filename as it's value.

so far, I'm able to get the file names but I can't seem to make a List out of it. here's my code:

let g:test = {}
let g:test+=glob("~/Projects/js/*")

What seems to be wrong?


1 Answer 1


See :h glob()

If you see a third optional parameter named {list}, then your version of Vim can directly return a List. If you pass 1 here, you'll have a list.

If not, you'll have to :split() glob() result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.