Here at work they considered me as Vi expert, hahaha! Every time they need something in Vi they will ask me. I used Vi for 10 years now, and really it is my editor of choice, maybe because I was not exposed to other *nix editor like Emacs, nano and even the graphical gedit - very rare you will see me using it in even I'm in GNOME.
Vi is a terminal-based plain text editor loved by most *nixers. It is most known as a "programmer's text editor," Vi is full of keyboard shortcuts that make it really useful for editing system files and plain text.
Most beginners find that Vi has a hefty learning curve – maybe because they are not really trying to remember those keyboard shortcuts. This learning curve often leaves Vi completely untouched by new Linux users.
I found an excellent introductory Vi guide in UCSD and I’m sure this guide will get you proficient in no time.
Let me quickly quote here Searching and Replacing text as this is the most asked help to me:
/the — Finds the next occurence of "the". This will also find "their", "them", "another", etc.
?the — Finds the previous occurence of "the".
n — Repeats the last search command. Finds the Next occurence.
d/the — Deletes until the next occurence of "the". This is to demonstrate how the delete prefix can be used with any cursor movement command.
:g/oldword/s//newword/gc — This will find all occurences of "oldword" and replace them with "newword". The optional "c" at the end of the command tells vi that you would like to "confirm" each change. Vi will want you to type in "y" to make the change or "n" to skip that replacement. Great for spelling fixes.
Comments
Vi in Gnome
Want to have Vi in GNOME?
Install by using this command in Ubuntu or Debian: