Move anchor and cursor together

I’ve solved this exact problem for ̶a̶u̶t̶o̶-pairs release :

H<a-;>H<a-;>

and same with L. I’m not sure it works as well with j and k but I didn’t need it.

For your use case though, what I’d do is probably use a combination of

  • the & key which allows to align selections by adding spaces
  • C or <a-C> to Copy selection from one line to another, keeping alignement and size

Step by step :

/25<ret>Z
To quickly go to the pipe you want to align to and mark the selection
kk<a-C>
To select the beginning of V and B.length
<a-z>a&
To append back the 25 pipe to the selection and align the selections, inserting spaces
uUr.
Undo redo to select what’s just been added and replace it with points
/B\.O<ret>Ed
To select B.Offset and yankdelete it
(\.)\.
Or anything that gets you back to the beginning of …B.Length

Then you have a lot of options :

  • simply insert B.Offset, delete the dot and realign B.length with V using the & and uUr tricks. It is the most particular and hardest to turn into a mapping solution, but it may be fast enough that we don’t even need a mapping, especially if we think of aligning B.Length, V and 25 last rather than first.
  • Use an intermediate line to put work with what you copy, & and C
  • Shell out to get the length of the yank register (${#varl} or something, idk), and craft a selection accordingly, that you can then R replace.
  • plenty of other ways probably

Because I like solution 2 the most, here is my jab at it (remember, the cursor is at the beginning of what we want to replace) :
\<a-o>
to insert a new line without hook, so as to not trigger automatic indentation
ZjP<a-z>a
to save the selection, go to the empty line and paste what we want to insert, selecting it and append back our previous selection
<a-:><a-;>&
To align. We have to ensure the cursor is at the beginning of each selection, as & aligns cursors.
,
To keep only what we just pasted as selection
<a-C>
to select the corresponding chunk on the line to make the insertion on (with undesired consequences if there is no room ! There is probably a more robust and much more lengthy solution than <a-C> using <a-z>u)
<a-(>
to exchange the selections.
,x<a-d>
To clear the temporary line.
<a-U>(,
to select what you just inserted.