Yanking text between two markers into a named buffer

14 views
Skip to first unread message

Frans Grotepass

unread,
Nov 5, 2009, 10:45:26 AM11/5/09
to vim...@googlegroups.com
Hi,

As the title states, is there a way to yank the text between two markers into
a named buffer?

Thx,

Frans

Christian Brabandt

unread,
Nov 5, 2009, 11:04:48 AM11/5/09
to vim...@googlegroups.com
On Thu, November 5, 2009 4:45 pm, Frans Grotepass wrote:
> As the title states, is there a way to yank the text between two markers
> into a named buffer?

Well I first thought, this could be done using :copy, but obviously the
range or address cannot be given as mark in another buffer, so this did
not work.

What worked was this:
call append(1,getbufline("filename", line("'A"), line("'B")))

For obvious reasons, this only works with uppercase marks.

regards,
Christian
--
:wq!

Jürgen Krämer

unread,
Nov 5, 2009, 1:13:51 PM11/5/09
to vim...@googlegroups.com

Hi,

Frans Grotepass wrote:
>
> As the title states, is there a way to yank the text between two markers into
> a named buffer?

'a"ry'b

yanks the text between and including markers a and b into register r.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

Gary Johnson

unread,
Nov 6, 2009, 1:16:29 AM11/6/09
to vim...@googlegroups.com
On 2009-11-05, Jürgen Krämer wrote:
> Hi,
>
> Frans Grotepass wrote:
> >
> > As the title states, is there a way to yank the text between two markers into
> > a named buffer?
>
> 'a"ry'b
>
> yanks the text between and including markers a and b into register r.

As does

:'a,'by r

Regards,
Gary


Tony Mechelynck

unread,
Dec 1, 2009, 10:21:55 PM12/1/09
to vim...@googlegroups.com
On 05/11/09 19:13, J�rgen Kr�mer wrote:
>
>
> Hi,
>
> Frans Grotepass wrote:
>>
>> As the title states, is there a way to yank the text between two markers into
>> a named buffer?
>
> 'a"ry'b
>
> yanks the text between and including markers a and b into register r.
>
> Regards,
> J�rgen
>

...and if you want it to work characterwise, use backticks rather than
apostrophes:

`a"ry`b

which decomposes into

`a go to mark a (characterwise)
"r the next operation will use register r
y yank...
`b ...to mark b (characterwise)


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
212. Your Internet group window has more icons than your Accessories window.
Reply all
Reply to author
Forward
0 new messages