I searched a little for a global
function that would act as the :g
command but in a more Function-style.
Like the substitute command which has a function associated :
:h substitute()
:h :substitute
Do you know if such exists ?
No there is no such function and it would not make much sense. If you need to do something for each item in a list, you can loop around it.
substitute()
acts on a string - are you looking for aglobal()
function that acts on a string? If not, you are not looking for a:g
equivalent in the same waysubstitute()
is associated with:substitute
.:help function-list
will show you all the built-in functions with short descriptions and should help you find something that meets your needs. Also, it's common in scripts to put a while loop around a call to search() and then perform the desired editing operation (e.g., substitute()) on the lines found.