Synfire's Quick Guide to Linux

VI and VIM:

Now we get to the most important skill in using a computer, Text Editing.

Think about it if you can't use the text editor how are you going to be able to write programs, or texts. Some of you might say "Well, Linux has emacs with it's friendly user interface!". That is true but not everyone that installs a system installs emacs. See the thing about vi is that almost every Linux installation installs it by default. And vi and vim really isn't that hard to use.

So, lets begin. To start type 'vi [filename]' or just 'vi' if you haven't decided what the filename should be. Now you should be in vi, vim, or nvi. vim and nvi are just upgrades to vi, they run off the same commands they just have thier own extra commands. When you use vi you have to get aquainted with the different modes. There are 3 modes in vi: command, insert, and replace. Basically, command mode is where you enter commands for vi, such as Save and Exit, Save as.., etc. Insert mode is for, you guessed it, inserting characters into your document. And replace mode is like insert mode except your not adding characters your overwriting them. Here are the basic and most common commands for vi:

Command Mode Commands:

            l ................. Move Right
            h ................. Move Left
            k ................. Move Up
            j ................. Move Down
            dd ................ Delete Current Line
            x ................. Delete Current Letter
            i ................. Switch to Insert Mode
            u ................. Undo
            <CTRL-R> .......... Redo
            :w ................ Save
            :w [filename] ..... Save as...
            :qa ............... Exit Without Save
            :wqa .............. Save and Exit
            [X]Y .............. Copy Current Line and X lines below
            [X]p .............. Paste between Current and Next line
                                X number of times.
            
Insert Mode Commands:

            <CTRL-W> .......... Delete Previous Word
            <BACKSPACE> ....... Delete Previous Letter
            <DELETE> .......... Delete Next Letter
            <ESC> ............. Switch to Command Mode

< < < Lesson 2: Commands | Lesson 4.1: Shell Scripts part 1 > > >