On Wed, Jan 30, 2002 at 04:59:41PM -0800, Jamie Harrell wrote:
> Everyones got their own nitch in the editor market....

vi for dummies and for people who don't think that vi has logic in it:

movement:       h-j-k-l         = left-down-up-right
                H-L             = begin of page-end of page
                0-$             = begin of line-end of line

                ...other ones not used in examples...
                ^F-^B           = jump one page forwards-backwards
                w-b             = jump one word forwards-backwards
                e               = jump to end of word
                [-]             = jump beginning-end of text
                {-}             = jump beginning-end of paragraph
                (-)             = jump beginning-end of textual line

insert:         i               = insert
                a               = append
                I               = insert at the beginning of the line
                A               = append at the end of line

labels:         m<label>        = mark line
                '<label>        = jump to mark

search:         /<string>       = search for string (regular expression)
                ?<string>       = search backwards
                n               = search next

deletion:       x               = this character
                d<direction>
                direction=h     = delete one char left,
                direction=j     = delete this line and line down,
                direction=k     = delete this line and line up,
                direction=l     = delete one char right
                direction=0     = delete this beginning of line
                direction=$     = delete this end of line
                direction=n     = delete till next occurance of string
                dd              = delete this line
                D               = delete until end of line
                d'<label>       = delete till that marked line
                d/<string>      = delete till that string


change:         r<new character>= replace this character
                R<new charactrs>= replace multiple characters
                c<direction><new characters>
                direction=h     = change the character left 
                direction=j     = delete this line and line down,
                direction=k     = change this line and line up,
                direction=l     = change one char right
                direction=0     = change from beginning of line
                direction=$     = change till end of line
                direction=n     = change till next occurance of string
                cc              = change this line
                C<new characters> = change until end of line
                c'<label>       = change till that marked line
                c/<string>      = change till that string

replace         :s/<oldstring>/<new string>             = replace on this line
                :s/<oldstring>/<new string>/g           = replace all on this 
line
                :%s/<oldstring>/<new string>/g          = replace everywhere
                :'a,'b s/<oldstring>/<new string>/g     = replace between marks

copy and paste  y<direction>
                direction=h     = yank character before the cursor
                direction=j     = yank this line and one down
                direction=k     = yank this line and one up
                direction=l     = yank character after the cursor
                direction=0     = yank from beginning of line
                direction=$     = yank till end of line
                direction=n     = yank till next occurance of string
                yy              = yank this line
                y'<label>       = yank till that label
                y/<string>      = yank till that string
                p               = paste after this line
                P               = paste before this line

easy things:    ^G              which line are you on
                :<number>       jump to that linenumber
                .               repeat last command
                ZZ              save and quit
                J               join two lines (capslock alert)
                escape          go back to command mode
                real <-real >   shift lines left-right
                <number><command>       execute command number times
                !<direction><unix command>
                                execute unix command with this text
                                as input and replace the output it
                                with the input.


As you see, there is a lot of (programmers) logic in the way vi
works for movement in regard of deletion, replacing, copy and paste.

If you remember the movement characters (four basic ones, six
entended ones), you can use them in the commands (five basic ones).

That's 15 things you have to remember to use worlds most powerfull
editor successfully.

Bill Joy lives!
Edwin

-- 
Edwin Groothuis   |              Personal website: http://www.MavEtJu.org
[EMAIL PROTECTED] |           Interested in MUDs? Visit Fatal Dimensions:
------------------+                       http://www.FatalDimensions.org/

Reply via email to