LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vi help, how to modify previous command (https://www.linuxquestions.org/questions/linux-newbie-8/vi-help-how-to-modify-previous-command-667800/)

ufmale 09-05-2008 12:06 PM

vi help, how to modify previous command
 
Is there a way to get the command in vi that I typed in previously? I am sure there must be, but I just don't know how to get it. :)

Here is an example,
I typed following command to modify the word outputofthisfile from a file

Code:

:%s/outputofthisfile/output of this file/g
After executed, it reported that it could not find that word.. Well I realized that it should be /inputofthisfile/ instead.

I want to modify the /outputofthisfile/ to /inputofthisfile/ instead of writing the whole thing again.

Hewson 09-05-2008 12:20 PM

use colon ( : ) to enter extended mode, then press the up arrow. vim (assuming you are actually using vim not vi) lets you see a history of commands you have run in the past.

Good luck =0)


All times are GMT -5. The time now is 01:06 AM.