The vi Editor - Worth the Effort

Currently Under Construction -- Be Patient

Quick Tips

Why reach for escape to leave insert or overwrite mode, Ctrl-[ (control key plus left square bracket key) will do it for you and you never have to move your hands out of place.

Special Searches

Open a text document that has been edited or saved in DOS and you will be presented with a document with ^M characters scattered throughout the document. The character sequence isn't simply an '^' followed by an 'M' but instead a carriage return produced the DOS's use of CRLF for line termination. To remove them you simply need to search and replace the escaped control sequence. Searching and replacing control sequences and escapes is handled easily in vi -- once you learn the trick.

In Linux/Unix, you create the escape sequence by typing CTRL+v and then typing the control + the character being escaped, in this case 'm'. Thus to get the ^M sequence, you type CTRL+v CTRL+m

Now the search and replace to get rid of all those carriage returns is nothing more than a normal global search and replace using the control sequence CTRL+v CTRL+m as your search phrase and nothing as the replace phrase. So in vi:


:%s/CTRL+v CTRL+m//g



Note: the 'g' option added to the end of the /search/replace/g command to make the replacement 'global', meaning that it will replace every occurrance of ^M found in a line not just the first instance.

Then simply hit return and your task is complete.

Developed in KDE3:

Quanta+ from KDE3 KDE3 now developed as Trinity Desktop