Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 2
    Great answer! In the function ... range, you should actually use execute a:firstline . "," . a:lastline . "copy '>" in the body, which actually works with the range that was passed, instead of the range of the last visual selection. That would make :1,5call Foo() or :%call Foo() work. See also this answer which expands on range functions a bit. Commented Apr 17, 2022 at 3:33
  • 1
    Right, that would be a nice improvement to handle various scenarios. Thanks! Commented Apr 18, 2022 at 0:03