-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 11-Jul-2019 10:45 +0200, Paul Jolly wrote:

> Thanks, Tony.
> 
> Your response has helped me understand that my substitute solution 
> will not work here either.
> 
> Reason that neither solution will work is that it requires moving
> the cursor, and that's not at all desirable in this case.

I would not generally rule out cursor moves; within a function, Vim
doesn't update the screen, and you can save and restore the original
view via:

    let l:save_view = winsaveview()
    " Your moves here
    call winrestview(l:save_view)

Many plugins use this.

> Effectively what I'm after here is a byte-offset based equivalents
> of bufsetline(), appendbufline() and deletebufline().

Given that Vim is a text editor, and text is organized in lines, I
don't think there's enough demand for such variants, especially since
workarounds should exist (see above).

- -- regards, ingo

> On Thu, 11 Jul 2019 at 09:32, Tony Mechelynck
> <[email protected]> wrote:
>> 
>> On Thu, Jul 11, 2019 at 9:55 AM Paul Jolly <[email protected]>
>> wrote:
>>> 
>>> Hi all,
>>> 
>>> I've tried various permutations of search terms, but so far
>>> turned up a blank.
>>> 
>>> Is there a function/similar that will allow me to set buffer
>>> contents between a start and end byte offset?
>>> 
>>> If there isn't, I have a "backup" in the form of a :substitute
>>> like:
>>> 
>>> %s/\%3l\%1c\_.*\%4l\%1c/hello\r/g
>>> 
>>> (because I'm also deriving the line and col whilst deriving the
>>> byte offset) but I suspect the byte-offset based approach will
>>> be considerable more efficient if available.
>> 
>> see :help go :help v_c
>> 
>> You could "go" to your starting point, set Visual mode, go to
>> your ending point, and then "c"hange or "s"ubstitute.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJdJxbFAAoJEA7ziXlAzQ/vg8gH/RkwflvA7kH7gXkteAsqVrez
Ar7o0i3NGHJCpIwuStII5fg3s+IGqDrbNsZYtSs9W1srzdC6TnkMuLza3cbeVoh0
SE/+oQyhTaWdcblDgfb/xAgRwW2nYGw8ag6OSIkEAkjgnW38pr7Tk4q3M1eRjdra
d1pVj0Fhd9OocRq/gq03NCE7ob19y1cCBMDvBXiu0BXT5b8G5M5AWZ6xsRt83mMv
NTFO9Rq9LwrvqHJk9u0FhFitXhe5n+FR1N8Ckg8YSS16WloiCIyMm3BLTcbxcYYG
rMcELFjOopUsziG+g09nEFf0Y/A/pl+oTqC2HbeqREb8Dfbw4yzUMuGEzkwCo+k=
=SrdA
-----END PGP SIGNATURE-----

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/ff85b092-f2f2-c37d-8547-c217215be216%40ingo-karkat.de.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui