Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can someone tell me how do i retrieve the previous replacement command i type in vi.
For example:
while editing a file in vi, i type
:%s/star/stark/gNow i realise that it should be starch instead of stark, so i did like to retrieve the old typed command just like retrieving the command from history in shell.
This thing is particularly helpful while writing lenghthy subsitution statments and for a single mistake you dont have to retype the whole command.
Any help would be welcome.

I don't think there's a way to do it.
I deal with it by using 3 monitors attached to one PC (then, I have more screen space to use) and open a notepad to use it as a job recorder.
For example:
In order to do the job you described above I type:
%s/star/starch/g
in the notepad and copy/paste it to viIf I need to modify it, I modify it in the notepad and copy/paste it to vi:
...
%s/star/stach/g
%s/star/stark/gAfter the job is done I save this notepad as an archive file for future reference.
Luke Chi

![]() |
Awk to parse and output
|
sort data
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |