I remember trying to use vi, again, six months ago. I started typing, and the app exploded once again.
While configuring my Ubuntu server today, I have no choice but to use vi (I usually fallback on TextMate’s mate on my Mac). Just using the following, I was able to do everything I needed to do without leveraging vi’s other strengths:
- Bring up vi for your file (e.g., vi file_I_want_to_edit).
- Realize that you are in ‘command mode’; thus, do not try to edit your file, yet.
- Position the cursor to where you want to do some editing.
- Hit ‘i’ to edit before the cursor, or ‘a’ to edit after it. You should see “—INSERT—” on the bottom left of the screen.
- Edit away. Add new text, delete, or paste in things until finished – be creative! ;)
- Hit the ESC key, which moves you back into ‘command mode’ (“—INSERT—” is now gone).
- To save the file, hold the shift key down and hit ‘z’ twice.
While I did not take advantage of vi, I was able to do the basic editing I needed to do. Enjoy!