How can I write a function to get the content between mark 1 and mark 2 for further processing? mark can be a string, or a function call, it doesn't matter.mark 1foo1foo2foo3mark 2
How to get the content between two specific lines in vimscript?
vimscript;search
See :h getbufline():getbufline({expr}, {lnum} [, {end}])Return a List with the lines starting from {lnum} to {end}  (inclusive) in the buffer {expr}.  If {end} is omitted, a  List with only the line {lnum} is returned.To get the line numbers you're looking for you can use :search() for example. See :h search().For example in this file:mark 1foo1foo2foo3mark 2The command:echo getbufline(bufnr('%'), 1, 7)Will return the following list:['mark 1', '', 'foo1', 'foo2', 'foo3', '', 'mark 2']You might even want to wrap it in a function:function! SearchForLines(pattern1, pattern2)    let line1 = search(a:pattern1)    let line2 = search(a:pattern2)    return getbufline(bufnr('%'), line1, line2)endfunctionThis way to get the list of the lines between mark 1 and mark 2 you can simply do::echo SearchForLines('mark 1', 'mark 2')Edit Note that as @Christian Brabandt noted in the comments, the function getline() can also be used and in some circumstances may be easier to use. See :h getline().