Reputation: 528
I use the following to yank text from mark a
up to mark b
in register r
:
`a"ry`b
It excludes the character on the position of mark b
.
Example :
1234500000
^ ^
a b
I get 1234
in register r
.
I would like to include the character at mark b
position when I yank.
So I would like to get 12345
in register r
.
How would I do it ? (I would like to avoid positioning b
to the next 0)
Upvotes: 2
Views: 1031
Reputation: 22734
Another easy way is to just add v
right after y
, no setting or Visual mode selection necessary.
`a"ryv`b
y`b
yanks to mark b excluding the character under mark b, whereas yv`b
yanks to mark b including the character under it.
See :h o_v
for more info.
Upvotes: 6
Reputation: 31439
Easiest would probably be to visually select the region before doing the yank.
`av`b"ry
The selection setting should also be set to inclusive. (set selection?
should return selection=inclusive
(which is the default)). If it is set to exclusive you would need to move the cursor the left one after selecting the visual section.
`av`bl"ry
Upvotes: 2