What is the shortest way that one can 1) set a mark (m<some_char>
), 2) move the cursor to arbitrary position, and change between 1) and 2)?
Is there an equivalent ciw
, ci'
, etc. for the above?
(Using vim 8.1.3741, but would appreciate vi-only solution even more.)
Considering ciw
, ci'
, etc. as individual commands to memorize independently from each other is a trap lots of Vim users fall into, especially if they skip the user manual.
Case in point, ciw
and ci'
are not things of their own; they are nothing more than an operator: c
(:help c
), followed by a motion: iw
(:help iw
) or i'
(:help i'
).
What you really are after is not "How to change from X to Y?" but "What motion to use to move to Y?".
Now that you have placed a mark somewhere in your buffer, all you need to do is c
, followed by the motion to that mark:
ma
<move around>
c`aI learned something today.<Esc>
Which, of course, works with every other operator.