:help index explains that only exact matches are returned. How would you add a predicate to the search, so that we could find the first element that matches that?
I want to write this:
let i = 0 let commit = '' while i < len(l:state.commits) let commit = l:state.commits[i] if predicate(commit) then break fi i += 1 endwhile
but much simpler, as:
let commit = index(l:state.commits, predicate)
Can this be done in vimscript?