280 likes | 444 Views
Linux II - vi editor-. 황 강 욱 Division of Applied Mathematics KAIST. Entering vi. To call the VI editor and begin an editing session, type at the UNIX prompt ($): $ vi file_name. ~ ~ ~ ~ ~ ~ ~ “ file_name ” [new file]. Exiting the editor. retaining the changes.
E N D
Linux II- vi editor- 황 강 욱 Division of Applied Mathematics KAIST
Entering vi • To call the VI editor and begin an editing session, type at the UNIX prompt ($): $ vi file_name ~ ~ ~ ~ ~ ~ ~ “file_name” [new file] Next Generation Communication Networks Lab.
Exiting the editor • retaining the changes Next Generation Communication Networks Lab.
Keeping changes and the original text Next Generation Communication Networks Lab.
Inside vi • Command mode vs. Text input mode Next Generation Communication Networks Lab.
Positioning text on the screen • scrolling the screen Next Generation Communication Networks Lab.
goto : 1G, 100G, G • search n N Next Generation Communication Networks Lab.
the cursor movement in the screen • 3H, 5L, M in the screen • left, right, up, down or the usual arrow keys Next Generation Communication Networks Lab.
the cursor movement in the line Next Generation Communication Networks Lab.
Text Insertion • Append Command (a) Next Generation Communication Networks Lab.
Append Command (A) Next Generation Communication Networks Lab.
Insert Command (i) Next Generation Communication Networks Lab.
Insert Command (I) Next Generation Communication Networks Lab.
Open Command (o, O) Next Generation Communication Networks Lab.
Read Command (:r) (already existing file) Next Generation Communication Networks Lab.
Correcting Text • Delete Text (d, D) Next Generation Communication Networks Lab.
Change Text (c, C) Next Generation Communication Networks Lab.
Replace Command (r, R) Next Generation Communication Networks Lab.
Erase Command (x, X) Next Generation Communication Networks Lab.
Transposition Command (xp) Next Generation Communication Networks Lab.
Undo Command (u, U) • search and replace commands • :-1,$s/찾을문자/대치문자/gc 현재 라인부터, 확인메세지(y) • :,$s/찾을문자/대치문자/gc 다음 라인부터, 확인메세지(y) • :$8,22s/찾을문자/대치문자/g 라인8~22까지, 확인 없음 • :%s/\<찾을단어\>/대치문자/g 전체파일에서, 확인 없음 Next Generation Communication Networks Lab.
Copying Text and Moving the Copy Next Generation Communication Networks Lab.
Deleting Text and Moving It Next Generation Communication Networks Lab.
Named Buffers • copy or delete: “g7yy or “g7dd • paste : “gp • creating line numbering • :set number • :set nonu buffer name (a~z) Next Generation Communication Networks Lab.