Home > development, shell > vi basics

vi basics

There are two competing editors in the *nix world: vi and Emacs. They look simple, but they are really mighty. And they have a reputation of being overly complex and unusable for non-nerds.

Currently I am using vi most of the time, but that’s just because I am playing with equipment that is running BusyBox now and then. I guess you are not surprised that I am telling you that using vi is not  very hard.

Enough chatting, let’s get our hands dirty!
There are hundreds of vi cheat sheets and tutorials out there. But let’s keep this one simple :)

You might know that vi is all about modes. In other words, you can either view the text or edit it – no further magic.
These are the most basic commands you need to know when using vi:
vi somefile.txt – start vi and open the file somefile.txt
i – enter the edit mode (“Insert”)
<ESC> – pressing the escape key ends the editing mode and sends you back to read-only
u – revert your last changes (“Undo”)
:w – save the file (“Write”)
:q – exit vi (“Quit”)

So you can open, edit and save files. This might not look like much, but these 5 basic commands are nearly all you need.

Tags:
  1. No comments yet.
  1. No trackbacks yet.

 
Performance Optimization WordPress Plugins by W3 EDGE