The Vi Editor
- IT IS AN INTERACTIVE EDITOR THAT IS USED TO CREATE AND/OR MODIFY TEXT FILES.
- NO MOUSE FUNCTIONS ARE AVAILABLE WITHIN Vi.
- Vi EDITING IS DONE WITHIN A BUFFER; CHANGES CAN BE WRITTEN TO THE DISK OR DISCARDED.
- IT IS THE ONLY FULL SCREEN EDITOR THAT CAN BE USED TO EDIT CRUCIAL SYSTEM FILES.
Starting Vi
Vi FILENAME EDIT NAMED NEW FILE OR EXISTING FILE VIEW FILENAME READ EXISTING FILE IN READ-ONLY MODE Vi -r EDIT LAST SAVED VERSION OF FILE AFTER SYSTEM OR EDITOR CRASH vedit FILENAME EDIT FILE WITH NOVICE MODE FEATURES ENABLED vi +N FILENAME EDIT FILE WITH CURSOR PLACED AT LINE N
Vi MODES
Vi FILENAME EDIT NAMED NEW FILE OR EXISTING FILE COMMAND MODE DEFAULT MODE WHEN YOU OPEN A FILE; WHERE ALL COMMANDS ARE INITIATED ENTRY MODE REQUIRED IN ORDER TO ENTER TEXT LAST-LINE MODE FOR ADVANCED EDITING; PUTS CURSOR AT BOTTOM OF SCREEN
POSITIONING COMMANDS
h, left arrow or backspace MOVE LEFT ONE CHARACTER j or down arrow MOVE DOWN ONE LINE k or up arrow MOVE UP ONE LINE l, right arrow or space bar MOVE RIGHT ONE CHARACTER w MOVE FORWARD ONE WORD b MOVE BACK ONE WORD e MOVE TO END OF CURRENT WORD $ MOVE TO END OF LINE 0 (zero) MOVE TO BEGINNING OF LINE return MOVE TO BEGINNING OF NEXT LINE H MOVE TO TOP OF SCREEN M MOVE TO MIDDLE OF SCREEN L MOVE TO BOTTOM OF SCREEN control -f PAGE FORWARD ONE SCREEN control -d SCROLL DOWN ONE HALF OF SCREEN control -b PAGE BACK ONE SCREEN control -u SCROLL UP ONE HALF OF SCREEN
INPUT COMMANDS
a APPEND TEXT AFTER CURSOR A APPEND TEXT AT THE END OF THE LINE I INSERT TEXT AT BEGINNING OF LINE o OPEN A NEW LINE BELOW THE CURSOR O OPEN A NEW LINE ABOVE THE CURSOR
DELETING TEXT
x DELETE CHARACTER AT THE CURSOR X DELETE CHARACTER TO LEFT OF CURSOR dw DELETE WORD TO RIGHT OF CURSOR 3dw DELETE THREE WORDS dd DELETE LINE CONTAINING THE CURSOR 3dd DELETE 3 LINES D DELETE FROM CURSOR POSITION TO END OF LINE dG DELETE TO END OF FILE d1G DELETE FROM BEGINNING OF FILE TO CURSOR :5,10d DELETE LINES 5 THROUGH TO 10
SAVING AND QUITTING
:w SAVE CHANGES (WRITE TO BUFFER) :w NEW_FILENAME WRITE BUFFER TO NEW_FILENAME :wq SAVE CHANGES AND QUIT Vi ZZ SAVE CHANGES AND QUIT Vi :q! QUIT AND DISCARD CHANGES :wq! SAVE CHANGES AND QUIT Vi (OVERRIDING READ ONLY PERMISSIONS IF YOU ARE OWNER)
Next'��`�[email protected]'��`�