Alan Becker wrote:
Also, if you
want to know an editor that is on every linux system
More like, every Unix like system. Solaris, SunOS, HP-UX, AIX,
Irix, *BSD, and all linux distros have vi.
The same goes for learning sh (not bash, but real Bourne SH).
without exception, vi (AKA vim) is the one. It doesn't
take much time to learn a few basic commands (less than
20) and you could be functional with a tool that will
handle practically any editing task.
Just be careful not to get used to the X version of vim.
Also, vim supports a lot of extras, that othe unix versions
of vi do have. One that gets me a lot is, vim allows you
to move around in edit mode using the cursor keys, but
real vi doesn't. You must enter command mode to move.
Basic commands to know:
<ESC> switch to command mode
:q quit
:q! quit without saving
:w write file
j move cusor down
k move cusor up
h move cusor left
l move cusor right
i insert (before cursor)
I insert at beginning of line
A append at end of line
x delete char under cursor
dd delete line
u undo last edit
Those 13 will do most work. Other make life easier, like
<number><comamnd> do <command> <number> times
10dd = delete 10 lines
handy shortcuts
:wq or :ZZ save and exit
. repeat last command
-Thomas