In insert mode, typing normally moves the cursor right and pushes text to the right of the cursor farther to the right on the line. I am typing some right-aligned text and am wondering - is there a way to tell vim to leave the cursor where it is while inserting, and move text preceding the cursor to the left? (Discarding whatever falls off the beginning of the line is fine.) I can't find a way on SO or wikia, and there may not be one, but I thought I'd check.
The closest thing I have found is gR<Ctl-D>
(virtual replace mode), but that lets me blithely overwrite what is past the cursor position where I started.
Use case: I have this situation:
<line of source code that does something> <tricky part>
comment explaining tricky part(*) ^^^^^^^^^^^^^
and want to add text at the place marked (*)
without moving the ^^^^^^^^^^^^^
, by pushing comment explaining tricky part
to the left.
:help arabic
it is possible to write text right aligned when the option+arabic
is enabled, maybe you could search for something this way... (Also I tend to think that if your purpose is just commenting code, you might not need a right-aligned presentation and write it in a regular way but thats only my opinion ;-) ) – statox Jul 1 '15 at 15:17set rightleft
does that, but that also means that everything is reversed; soHello, world
becomesdlrow ,olleH
;-) – Martin Tournoij Jul 1 '15 at 17:20