Vi Quick Strue Manual (from www.talug.org)

xiaoxiao2021-03-06  78

original:

http://www.talug.org/howto/viquickref.html

Author:

www.talug.org

Vi Quick Reference

By The Toledo Area Linux Uses Group

Two Modes VI consists of two modes, command and insert. In command mode, anything typed is taken as an editing command. In insert mode, typed text is inserted into the current document. In both cases, will either end a partial command or exit insert mode Insert Mode In insert mode, the keyboard behaves like a typewriter Keystrokes appear as screen text after typing any of the following commands I -... Insert text at the beginning of the line i - Insert text at the cursor A - Append text at the end of the line a - append method after the cursor o - Open a new line of text Above the cursor o - Open a new line of text below the cursor - exit insert mode, Enter Command Mode Command Mode in command mode, keystrokes perform functions such as moving the cursor, searching for patterns, or quitting from the document All commands are referenced from the current cursor position Cursor Movement Arrow Keys Move one space in any direction h, j, kl.. - Move Left, Down, Up, Right Re Spectively g - Go to the laast line in the file ng - Go to line nw - move forward to the next Word B - Move Backwards to the previous word $ - move to the end of the line 0 or | - Move To the Beginning of Of The Line N | - Move to Position N on The Current Line D - Scroll Down 1/2 Screen U - Scroll Up 1/2 Screen B - Scroll Up Full

f - Scroll down Full Searching / string - Search for a string (pattern) of characters n - Search for the next occurrence of the string N - Search for the previous occurrence of the string:% s / str1 / str2 / g - Replace all occurrences of str1 with str2 Copying text yy - Copy a line to the buffer nyy - Copy an n number of lines to the buffer P - Paste text from the buffer above current line p - Paste text from the buffer below current line Changing text r - Mark A Single Character for Replacement R - Go Into over-Write Mode CW - Mark A Word for Changing CC - Mark A Line for Changing ~ - Change The Case of The Current Letter Miscellaneous Commands J - Join A Line with The One Below IT! CMD - EXECUTE A UNIX Command: R - File Read A File Into VI: R! (CMD) - INSERTS The Results of a UNIX Command. - Repeat The Last Command U - undo the last command / change v - Insert Non -Printing Control Character G - Show FileName and Current Line Saving and Exitation: W - WRI TE (Save) The File: W! - Force Overwrite: WQ - Write (Save) and Quit The Editor: Q! - Quit The File without Saving Changes ZZ - Write (save) The File and Quit Vi: n, MWFile Write Lines Numbered n through m to file: n, mw >>

File Append Lines Numbered N thxt x - Delete a single character dw - delete a word dd - delete an entire line ndd - delete an N Number of Lines D $ or D - delete from the cursor to the end of the line Entering vi vi filename (s) - edit a file or files vi -r filename - retrieve saved version of file after crash vi -x filename - edit encrypted file vi -wn filename - set default window size to n Setting Options Options are either toggled on and off, or given values ​​When editing, set options for a file with the set command:.. set all - displays all option settings on your terminal: set - displays settings set by any current changes: set option - sets option: set option = n - sets option and assigns it the value of n: set nooption - unsets option:? set option - displays setting of option on status lineOption Name Default What Option Does autoindent (ai) noai provides automatic indentation during text entry AutoWrite (AW) NoAw Automatic Saves F ile (write) before searches, control codes, sh escapes ignorecase (ic) noic ignore case during searchs number (nu) nonu show line numbers readonly (ro) noro make file status read only redraw (re) nore simulate smart terminal showmatch (sm ) NOSM Show matching (or {when) OR} Is Entered Term $ TERM Name of Terminal Being Used Warn Warn if No Write Before! CMD

http://www.talug.org

转载请注明原文地址:https://www.9cbs.com/read-120599.html

New Post(0)