:: [DNG] vi for beginners
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Rob Owens
Ημερομηνία:  
Προς: dng
Αντικείμενο: [DNG] vi for beginners
I noted some people saying they were confused by vi. Here are basic
instructions to get you far enough that you can install your editor of
choice. I am deliberately leaving out things like cutting and pasting.
If your goal is just to get a different editor installed, these
instructions should suffice.

Note that many distros symlink /bin/vi to some other vi-like editor
(vim-tiny, for instance). I am attempting to give instructions for
the most basic vi.

1) To edit a file, type:

vi /etc/apt/sources.list

Note: vi starts in "command mode". You cannot insert text in this
mode.

2) Use cursor keys to navigate. If they don't work in your version
of vi, use the keys h, j, k, and l to navigate.

3) The "x" key is used to delete.

4) Hit "i" to go into insert mode. The Insert key may also work.
Typing at this point inserts text. The delete and backspace keys
may not work (depends on the version of vi).

5) Hit Escape to leave insert mode and enter command mode.

6) Type the following, followed by hitting <enter>, in order to save
and quit:

:wq

The colon indicates that you are entering a command. "w" is short
for "write", and "q" is short for "quit".

7) To save without quitting, use this command:

:w

8) To save as a different filename, use this command:

:w /path/to/myfile

9) To quit without saving, use this command:

:q!

The exclamation point indicates that you know you have unsaved
changes, but you want to quit anyway. Without it, vi will refuse
to quit if there are unsaved changes.