VI Advanced Command Highlights

xiaoxiao2021-03-06  107

VI senior command highlights http://www.chinaunix.net Author: jazy Posted: 2002-09-17 09:41:00

[This post was finally edited by Jazy at 2002/09/17 10:00 AM] In view of the strangeness when you use VI, you will give a gift from the brothers [shell]. Senior skills about VI programming I hope to learn Unix to learn Unix, and I hope that everyone can further expand these experiences combined with the experience of using HPUX. 1. Exchange two character locations XP2. Convert DDP3 on two lines. Conversion of file content: g / ^ / m0 / (not passed) 4. Merge J5 on two lines. Delete all lines DG6. Delete from the current location to the line Tail D $ 7. Copying from the current location Y $ If you want to paste to other places, you can use the VI to build in EX, so when you type: When you type:, it comes to the ex command status 8.:Ab string strings For example : AB USA United States of America As shown in each line: SET NU 11. In the command state, NYY indicates that the copy from the lower N row content from the cursor row, p represents the PASTE, and the content that can be copied is pasted below at the cursor.

12. Single character replaces R, overwriting multiple characters with R, replacing a character with multiple characters with S, replacement S13.:% s / old_word / new_word / g This instruction is to replace throughout the file Specific string 14. Cursor control k: upward NK moving N row J: downward NJ moving N row to move the cursor to the nth line, press MK to move the cursor to the MR line, press "Ay'k is about to The routines n to m to the A register, push, B, c ........ Register, etc., you can paste your usual need to be multi-use in different registers in alternate to stick To somewhere, move the cursor to a place, press the 'AP, in this type, B, c ........ register, etc., in the current screen h, hop to the first line M jump to the middle One line L jumped to the last row 15. Table 8-2 Delete command Delete command operation D Delete the current character (the same as the x command function) D 0 Delete the start position of a certain row D ^ Delete the first character position of a certain line (Do not include space or ta b character) D w Delete the end position of a word D 3 W Deleted to the end position of the third word D b Deleted to a word start position D w Delete to a space The end position of the word of the separator is deleted to one of the starting position D 7 B deleted to the front 7 spaces as a space as a separator as a space as a space. Location D 4) Delete the end position of the fourth statement D (Deleting the start position D} of a statement D} Delete to a paragraph's end position D {Delete to a paragraph start position D 7 {Delete to the current paragraph The 7th paragraph position D D before the start position D D deletes the current line D / T e x t delete the position specified in "TE E X T" in the text, which is always until the next word appears. The content D fc between positions (but excluding this font) deletes the position of the character "c" in the text, always until the position of the next character (including the character) between the next character (including this character) delete The current row until the next character "c" appears, the content D deletes the end of a row D $ deleted to the end of a row 5 d D Delete the 5 line content D l from the current line until the top of the screen The content D h deleted until the content D g of the first line on the screen until the content D 1 G of the end of the work cache is deleted until the content modification command operation C l changes the current character c w Modified to a certain The end of the word C 3 w Modified the end position of the third word C B Modified to a word starting position C w Modified to a space of the word as a separator C B Modified to a certain The start position of the word of the separator word C 7 B modified to the beginning position C 0 modified to a single line as a single word C 0 in the previous position C) modified to the end position of a statement C 4) modification To the end position of the fourth statement C (Modify the start position C} of a statement C} Modified to the end of a paragraph C {Modified to a beginning position of a paragraph C7 {Modified to the current paragraph start position Seventh paragraph location C TC Modify the current line until the next character C appears to appear C C C C Modified the current line 5 C C to modify the 5 line content starting from the current line. Repeat One revision! Table 8-4 Replacement Command Replacement Command Operation S Replace the current character to one or more character s to replace the current line to one or more characters 5 S will replace 5 characters start from the current character to one or more characters Vi Replacement Rule :: G / S1 / S / S2 / S3 / G First G indicates that each of the rows including S1 is replaced, and the second G represents all S2 of each line including S1, all S2 is used. Replace S means replace, S2 is a string to be replaced, he can be the same as S1 (if the same is used // instead),

S3 is a replacement string 16.FX moves to the right to X character to move to the left to the X character to move to the X character before tx move to the x character (Note: In the above four commands, where X is typed characters); semicolon, and t f with use, repeat, commas, and t f with use, repeat the opposite direction 17. vi environment options Solaris kshnoautoindent nomodelines noshowmodeautoprint nonumber noslowopennoautowrite nonovice tabstop = 8nobeautify nooptimize taglength = 0directory = / var / tmp paragraphs = IPLPPPQPP LIpplpipnpbtags = tags / usr / lib / tagsnoedcompatible prompt tagstacknoerrorbells noreadonly term = vt100noexrc redraw noterseflash remap timeouthardtabs = 8 report = 5 ttytype = vt100noignorecase scroll = 11 warnnolisp sections = NHSHH HUuhsh c window = 23nolist shell = / BIN / KSH wrapscanmagic shiftwidth = 8 wrapmargin = 0mesg noshowmatch nowriteany For C-Shell: setenv EXINIT "set nu" For Bourne or Korn Shell: EXINIT = "set nu"; export EXINIT For Korn Shell Only (alternate method): typeset -x EXINIT = " Set Nu Sets the environment options for VI in .profile, all the above test 18. Tag text Mchar Mark the current cursor position` CHAR moved to the CHAR Script of CHAR Moved to the beginning of the CHAR mark Move to the current line (after the cursor movement) - a dual quotation number '' moved to the beginning of the row of the first position on the current line (after the cursor movement) - two single quotes 19. At the same time Vi multiple files, Ctrl-Shift-6 returns to the previous file, switch between this VI file and the last VI file.

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

New Post(0)