There's a command in VIM where you can say how many chars to replace, and VIM will put a "$" at that many characters out, and you can type in the replacement for those characters. The original and new text can be different lengths. What's the command for this?
+1
A:
It is the behavior of c
command when 'cpoptions'
contains $
(so it is a default behavior for vi and some configurations of Vim).
wRAR
2010-03-14 18:12:29
I just tried '`:set cpoptions="aABceFs$"`' (to add '$' to what was already there) and it didn't seem to make any difference. Is that what was expected to make the difference. (Vim 7.2 on MacOS X 10.6.2.)
Jonathan Leffler
2010-03-14 18:23:38
Works here. Check that 'cpoptions' still contains $.
wRAR
2010-03-14 18:27:38
You shouldn't use quotes in the value, here your command just cleared `'cpoptions'`.
wRAR
2010-03-14 18:28:49
This is correct, and if you want to simply try adding $, use set cpoptions+=$4c will now work as requested.
Sarah
2010-03-14 22:47:05
@Sarah (and wRAR): thanks - when I used `cpoptions+=$`, then it worked.
Jonathan Leffler
2010-03-18 02:13:37
A:
The nearest I can think of is '6s'; that deletes the next 6 characters and leaves you in insert mode, but it doesn't show a '$' at the end - it just removes the material.
Jonathan Leffler
2010-03-14 18:14:47
Depending on your terminal and version of vi(m), it used to be that the editor wouldn't go to the trouble of sliding the rest of the text to the left right away, and would place a `$` at the end of what you were changing. When you left insert mode, then the remaining text would be redrawn to match the amount you typed. These days I usually only see that on old `vi` installations.
Greg Hewgill
2010-03-14 18:50:35
That sounds plausible and faintly familiar...vi over a 14.4 kilobaud/s connection? 9.6 kb? There were advantages to 'ed' at those speeds. And yes, I did sometimes work over such slow connections, but it was a long time ago.
Jonathan Leffler
2010-03-14 19:49:58