The document describes the vi text editor. It discusses vi's two modes: command mode, where keys are treated as commands, and insert mode, where text can be inserted. Some key commands covered include moving the cursor, deleting or changing text, exiting vi, and scrolling. Modes are changed using commands like i to enter insert mode or Esc to exit insert mode. The document also provides summaries of commands for horizontal and vertical moves, deleting, undoing, saving and exiting, and more.
The document describes the vi text editor. It discusses vi's two modes: command mode, where keys are treated as commands, and insert mode, where text can be inserted. Some key commands covered include moving the cursor, deleting or changing text, exiting vi, and scrolling. Modes are changed using commands like i to enter insert mode or Esc to exit insert mode. The document also provides summaries of commands for horizontal and vertical moves, deleting, undoing, saving and exiting, and more.
The document describes the vi text editor. It discusses vi's two modes: command mode, where keys are treated as commands, and insert mode, where text can be inserted. Some key commands covered include moving the cursor, deleting or changing text, exiting vi, and scrolling. Modes are changed using commands like i to enter insert mode or Esc to exit insert mode. The document also provides summaries of commands for horizontal and vertical moves, deleting, undoing, saving and exiting, and more.
The document describes the vi text editor. It discusses vi's two modes: command mode, where keys are treated as commands, and insert mode, where text can be inserted. Some key commands covered include moving the cursor, deleting or changing text, exiting vi, and scrolling. Modes are changed using commands like i to enter insert mode or Esc to exit insert mode. The document also provides summaries of commands for horizontal and vertical moves, deleting, undoing, saving and exiting, and more.
Irina Lomonosov, Instructor, Department of Computer Science, Hiram College, http://cs.hiram.edu/~irina/ Editor Concepts Editing includes both creating a new file and modifying an existing file. An editor is a utility that facilitates the editing task. A text editor differs from a word processor in that it does not perform formatting such that bolding, centering, underlining. The vi Editor When you invoke the vi editor, it copies the content of a file to a memory space known as a buffer. The editor presents a screen full of the buffer to the user for editing. The vi has two modes: the command mode and the text mode. Command Mode When the vi editor is in the command mode, any key that is pressed by a user is considered to be a command. Commands used to move the cursor, to delete or change part of the test, etc. As soon is the command is entered , it is executed the Return key is not required. Changing Modes To invoke vi, you type vi filename The filename is the name of the file that already exists or the name of the file you want to create. When you invoke vi, you are always in the command mode. To exit vi you must be in command mode. There are six commands that take you to the text mode (a, A, i, I, o, and O). When you are in the text mode, you press the Escape key (esc) to go to the command mode. Text Mode When the vi editor is in the text mode, any key that is pressed by a user is considered text. The characters are inserted into the text at the cursor. To add the test in a document, we should place the cursor at the desired location, which can be done in command mode. Then we switch to the text mode and edit the text. vi Modes A Small File in vi Insert Text Before the Cursor and Line i inserts text before the current character I inserts text at the beginning of the current line Insert Text After the Cursor and Line a appends text after the current character. A appends text at the end of the current line. Insert New Line o opens an empty text line for new text after the current line O opens an empty text line for new text before the current line Horizontal Moves Horizontal Moves Vertical Moves Vertical Moves Delete Commands The join Command ctrl+b scrolls up the whole screen ctrl+f scrolls down the whole screen Scrolling Scrolling (cont) ctrl+u scrolls up half a screen ctrl+d scrolls down half a screen ctrl+y scrolls up one line ctrl+e scrolls down one line Undo Commands Saving and Exit Commands saves the contents of the buffer without quitting vi writes contents of the buffer to new files and continues saves the content of the buffer and exits saves the content of the buffer and exits Exits the vi (if buffer changed will not exit) Exits the vi without saving :w :w filename ZZ :wq :q :q! TEMEL KOMUTLAR Ok tular mle (cursor) hareketi h j k l Ok tular yerine imle hareketi i<text>Esc bir metini araya girme cw<yeni>Esc bir szc deitirme x bir karakter silme dw bir szck silme dd bir satr silme u son ilemi geri alma ZZ vi editorden saklayarak kma :q! vi editrden saklamadan kma ^D ^B ^F ileri ve geri sayfa kaydrma KTK LEMLER w kte yazma :w! kt ezerek yazma :q editrden kma :q! Deiiklikleri atarak editrden kma :e <ad> ad adl kt edit etme :e + <ad> ad adl kt sonundan edit etme :e + n kt n. satrdan edit etme :e # baka bir kt edit etme :e! # deiiklikleri atarak baka bir kt edit etme :w <ad> ad adl kte yazma :w!<ad> ad adl ktn zerine yazma :sh shell komutuna gei (exit ile geri dnlr). :!<komut> bir komutu altrma ve editre geri dnme :n bir sonraki kt edit ortamna alma ^G ktk adn ve imlein satr numarasn grntleme vi EDTRDE mle YERN DETRME KOMUTLARI ^F Bir sayfa ileri kaydr. ^B Bir sayfa geri kaydr. ^D Yarm sayfa ileri kaydr. ^U Yarm sayfa geri kaydr. /pat verilen karakter dizisini ileriye doru arama ?pat verilen karakter dizisini geri doru arama N arama ynn deitirme /pat/+n ileriye doru aranan ilk diziden n satr sonrasna gitme ?pat/-n geriye doru aranan ilk diziden n satr ncesine gitme ]] bir sonraki ileve gitme [[ bir nceki ilev gitme ( cmlenin bana gitme ) cmlenin sonuna gitme { paragraf balangcna gitme } paragraf sonuna gitme % birbirine kart gelen { } veya ( ) ikilisini bulma EKRAN AYARLARINA LKN KOMUTLAR ^L sayfay tekrar grntle ^R sayfay tekrar grntle (^L almaz ise) z imle satr en stte olacak ekilde sayfay yeniden grntle z- imle satr en altta olacak ekilde sayfay yeniden grntle z. imle satr ortada olacak ekilde sayfay yeniden grntle /pat/z- pat ile bulunan satr en altta olacak ekilde sayfay yeniden grntle. zn. n satrlk pencere kullan. ^E bir satr aaya kaydr. ^Y bir satr yukarya kaydr. SATIR AYARLAMA KOMUTLARI H imlei ekrandaki ilk satra gtr. L imlei ekrandaki son satra gtr. M imlei ekrandaki orta satra gtr. + bir sonraki satra git. - bir nceki satra git. CR bir sonraki satrn bana git. Aa Ok j bir sonraki satrn ayn kolonuna git. Yukar Ok k bir nceki satrn ayn kolonuna git. KARAKTER AYARLAMA KOMUTLARI ^ satrdaki ilk boluk olmayan karaktere git. 0 satr bana git $ satr sonuna git l Sa Ok bir karakter saa git h Sol Ok bir karakter sola git ^H bir karakter geri git boluk bir karakter saa git Fx/fx bir nceki/sonraki x karaterini bul tx x karakterinden nceki karaktere git. Tx x den sonraki karaktere git. ; Fx, tx veya Tx ilemini tekrarla , Fx, tx veya Tx ileminin tersini tekrarla n| n. kolona git % karkl { } veya ( ) tipi parantezlere git n<Return> or nG n. Satra git SZCK, CMLE, BLM ve PARAGRAF AYARLAMA KOMUTLARI w b e sonraki szce, nceki szce, szck sonuna git ) ( sonraki cmleye, nceki cmleye git. } { sonraki paragrafa, nceki paragrafa git W B E sonraki, nceki bolukla ayrlm szce git bolukla ayrlm szcn son karakterine git. GR KONUMU DZELTMELER ^H Backspace ^W bir szck silme \ "erase", "kill" karakteri iin balang Esc, Del giri konumundan k ^D bir karakter geri git. ^^D 0^D (^) iaretinden sonra ^D sat bana git demektir. ^T satr bana ierlek boluk brak ^V yazlamayan karakterleri grntlemek veya girmek iin balang GR ve DZELTME KONUMU KOMUTLARI a imle sonuna ekle A satr sonuna ekle i imle yerine gir I satr bana ilk boluk olmayan karakterden sonra gir o imle altna bir bo satr a O imle zerine bir bo satr a rx imle karakterini x karakteri ile deitir R<text>Esc imle yerinden text kadar metni deitirme. LEMLER d sil c deitir y bir satr bellee al < sola kaydr > saa kaydr Type: To: x delete single character; 5x deletes 5 characters dw delete word; 5dw deletes 5 words dd delete line; 5dd deletes ... well you get the idea! cw delete word, leaves you in insert mode (i.e. change word) cc change line -- delete line and start insert mode s change character -- delete character and start insert mode D delete from cursor to end of line C change from cursor to end of line -- delete and start insert mode ZEL LEMLER C satrn kalann deitir D satrn kalann sil s bir karakteri deitir S satrlar deitir J satrlar birletir x bir karakter sil X imleden nceki karakteri sil Y satrlar bellee al KES ve YAPITIR KOMUTLARI <n>yy n satr bellee al <n>yl n karakteri bellee al p imlein devamna bellektekini kopyala P imlein nne bellektekini koplaya "xp x belleindekini kopyala "xy x belleine al "xd silerken x belleine al y} yank paragraph Type: To: xp transpose two characters (two commands, x followed by p) yy yank (i.e. copy) one line into a general buffer (5yy to yank 5 lines) "ayy yank into the buffer named a P put the general buffer back before the current line "aP put from buffer a before current line p put the general buffer back after the current line "ap put from buffer a after the current line GER ALMA ve YNELEME KOMUTLARI u son deiiklik ilemini geri al U son satr eski haline getir . son deiiklii tekrarla "dp sondan d satr nceki satr silmeyi geri getir. SATIR EDTR KOMUTLARI Genelde, bir satr editrnde komut : ,s/eski/yeni/g biimindedir. Bu rnekte editr eski karakter dizisini yenisi ile deitirir. Genel satr editr komutlar kalb : [adres [,adres]]komut[parameterler] biimindedir. Bu kalptaki adres'ler ilemin yaplaca satrlarn numaralarn gsterir. :n,m w!dosya_ad :n,ms/eski/yeni/g :%s/eski/yeni/g :r dosya_ad dosyay allmakta olan dosyann iine al :set nu satr numaralarn gster :set nonu satr numaralarn kaldr mx x olarak imlein bulunduu noktay iaretle x x olarak iaretlenen noktaya git :help yardm dosyasn arr, kmak iin :quit :ed dosya dosya isimli ikinci dosyay a :ed# dier dosyaya gei yap :e! Son kayt yaplan duruma geri dn