I'm trying to make a vimscript that will read the .gitignore
file, return it's values as a List and check for paths that has wildcards eg: /vim/snippets/*
, vim/**/*
.
let g:ignored = readfile("/home/user/Projects/dotfiles/.gitignore")
let c=0
while c < len(g:ignored)
let g:ignoredPath = ignored[c]
let c += 1
echo g:ignoredPath
endwhile
I want to check g:ignored
variable for possible values with wildcards but how can I do that? I'm guessing I have to use regex in an execute or something. But I don't know the right syntax at all.
match()
function to check which item matches a certain regexmatch()
(correct me if i'm wrong) as it only returns integer.:h matchstr
then.