Você está na página 1de 5

Vi Editor-Features Vi is a full screen editor It works in three modes Input mode Ex mode Command mode It makes complete use

te use of the keyboard, where practically every key has a function Provides find and replace Provides cut, copy and paste facilities Multiple files can be opened William Bill developed this program at Berkely, California. There are three modes of vi When you start vi then cursor appear at top, left corner and you are in command mode. In this mode pressing a key doesnt show it on screen, but performs some command In input mode you can type text in the editor In ex mode or line mode you can enter command at last line of editor Pressing i in command mode brings you to insert mode Pressing esc key brings you in command mode if you are in input mode. Pressing esc followed by typing of colon brings you in ex mode. Vi commands-Cursor Movement Move cursor left, right, up, down: h,j,l,k Move cursor word by word left and right:b,w Move cursor to beginning of line, end of line: ^, $ Move cursor to nth line nG Move cursor to beginning, end of file 1G, G Move cursor to beginning, end of sentence ), ( Move cursor to beginning, end of paragraph }, { Vi commands-Scrolling Scroll full page forward, backward control+f, control+b Vi commands-Pattern Searching search from the beginning of file /pat search from the end of file ?pat Repeat search in same direction n Repeat search in reverse direction N

Vi commands-Pattern Replacement In ex mode ( at colon prompt) Replace every occurrence of director with member :1,$s/director/member/g Replace every occurrence of director with member for line no. 1 to 3 :1,3s/director/member/g Replace every occurrence of director with member for line no. 1 to 3 with confirmation :1,3s/director/member/gc Vi commands Misc. Insert line above current line O Insert line below current line o Join line j Insert before, after cursor i,a Append to end of line A Insert at beginning of line I Undo U Redo Control+r Delete n no. of lines ndd Vi commands working with files Save and resume :w Save a new file :w filename Save and exit :wq Quit without saving :q! Edit another file :e filename Restore last saved version of current file :e! Edit next file :n

Edit next file without saving changes of current file :n! Vi commands cut, copy and paste Moving or copying text in same file Position cursor at beginning of text then use mx Position at last of the text then use dx to cut yx to copy Position cursor at desired location and use p for paste Moving or copying text in different file Open source file and position cursor at beginning of text then use mx Position at last of the text then use bdx to cut byx to copy To save current file use :w :e targetfile Position cursor then use bp Vi commands vi environments Setting Options Setting showmode :set showmode Unsetting showmode :set noshowmode Setting Auto Indent :set ai Unsetting AutoIndent :set noai Setting Line no. :set nu Unsetting line no. :set nonu Introduction to exrc file This is a file normally kept in home directory of user. It can have command macros and set options. Each time vi starts it reads exrc file to set its environment. Suppose we open exrc file and add following lines in it

set au set nu set noshowmode Then we start vi. Now vi will work in different environment Vi commands running shell command within vi Read in content of file after cursor :r file Read in output from command after current line :r !command Run command then return to vi :! Command Repeat last system command !! Replace current line with output of command !! Command Emacs-Feature 1. Extremely useful undo facility 2. Autosaving fo files every 300 characters 3. A lot of online help 4. Modes for diddferent assignment such as html, c, lisp 5. Spell checking facility 6. Powerful macros 7. Incremental search and replacement One buffer corresponds to one file Region means selected text Point means insertion point. emacs commands-Cursor Movement Move cursor left, right, up, down: control+b,control+f,control+p,control+n Move cursor word by word left and right:alter+b, alter+f Move cursor to beginning of line, end of line: control+a,control+e Move to beginning of file,end of file Alter+ >, alter+< Move cursor to beginning, end of sentence Alter+a, alter+e Move cursor to beginning, end of paragraph Alter+},alter+{ commands-Scrolling Scroll full page forward, backward control+v, alter+v

commands working with files saving buffer in emacs Open file Control+x control+f Save and resume Control+x control+s Save and exit Control+x control+c Copy and paste text Place at beginning of section and press control+@ Position cursor at last of section and use Alter+w for copy, use control+w for cut Position cursor Use control+y for paste commands Misc. Delete previous character Del Delete current character control+d Delete current word alter+d Delete current sentence Alter+k Undo last edit Control+x control+u

Você também pode gostar