Insert Keys Canceling

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

vi-Editor vi (visual) is a display oriented text editor based on an underlying line editor ex.

When using vi, changes you make to the file are reflected in what see you on your terminal screen. The position of the curser on the screen indicates the position within the file. There are two modes Edit/insert mode and command mode. To go in the edit/insert mode from command mode use edit/insert keys described below and to go in command use ESC key. % vi filename filename describes the name of file you want to edit. Insert keys- a, A, i, I, o, O, c, C, s, R. Canceling: ESC- End insert or incomplete command. DEL- Delete or rubout interrupts. Sample Commands: Arrow keys moves the curser. h, j, k, l : Same as arrow keys. itextESC cwnewESC x dw dd 3dd u zz : q! /text ^u ^d F ^b ^D ^U nG ^E ^Y insert text change word to new delete a character delete a word delete a line delete 3 lines undo previous changes exit vi; saving changes quit, discarding changes search for text scroll up or down Forward screen Backward screen Scroll down half screen Scroll up half screen Go to the beginning of the specified line, where n is the line number. Scroll window down one line. Scroll window up one line.

Positioning within the file:

Commands to save the changes: :w :zz :w! :q :q! :e name :e! :e + name : e +n edit :e# :e! # :w name :w! name :sh mx x x H L M + write back changes. if file modified, write and exit Forced write, if permission originally not valid. quit quit discard changes Edit filename reedit, discard changes edit, starting at end edit starting at line n edit alternate files edit alternate file, discard changes write file name overwrite file name run shell then return move cursor to previous context move curser to first nonwhite space in line mark current position with the ASCII lower case letter x move curser to mark x move cursor to first non-white space in line marked by x Top line on screen. Last line on screen. Middile line on screen. Next line, at first non-white space character Previous line, at first non-white space character Next line, same column. Previous line, same column Forward Backward

Marking and returning:

Line positioning:

Down arrow or j Up arrow or k Right arrow or l Left arrow or h

Character Positioning: ^ o first non-white space character beginning of line

$ fx Fx tx Tx

end of line find next x find previous x move to character following the next x move to character following the previous x.

Insert and replace: a A i I o O rx RtextESC Operators: d-delete c-change y-yank lines to buffer <- left shift >- right shift !- filter through command X-delete characters before cursor (dh) Read command (r): It copies one copys contents to the other. Eg. If we are having two files in a directory for example file test1 and test2 in directory path /mnt/home/vinay/unixtest, and I want to copy the contents of file test1 to the file test2 % vi test2 .. : r /mnt/home/vinay/unixtest/test1 C- change rest of line(c$) D-delete rest of line(d$) s- substitute character(cl) S- substitute lines(cc) j-join lines x- delete characters(dl) Y-yank lines(yy) append after curser. append at end of line. insert before cursor. insert before first non-blanck. open line below. open line above. replace single character with x replace characters

You might also like