I recently learned of the -w
option to record inputs. Trying to "play them back" with -s
, it seems the playback doesn't perfectly reproduce the edits in at least one way
- backspaces,
<80>kb
, are inserted instead of deleting characters.
I'm curious if autoindents are also reproduced, though I can't contrive of an example of such an inconsistency.
Question
How can I reproduce a sequence of edits exactly? Is there an order to .vimrc or other scripts that need to be loaded before interpreting?
Example
I'll edit the file a.c
with vim -w edits a.c
. This results in the edits
file
Aint main() {^Mabc<80>kb<80>kb<80>kbprintf("abc\n");^[o}^[:wq^M
where <80>kb
is pressing backspace, and ^M
and ^[
are pressing return. The resulting a.c
appears as
int main() {
printf("abc\n");
}
while running vim -s edits a.d
results in
int main() {
abc<80>kb<80>kb<80>kbprintf("abc\n");
}
Evidently the <80>
's haven't clobbered the preceding characters, and the kb
's have appeared in the final file. It's the same result with :source! edits
.