0x00 replace the contents of the current row
:s/from/to/ # s即substitude
: S / from / to / # current in the first row from, replaced to. If the current line contains a plurality of from, will only replace the first one of them. : S / from / to / G # all from the current row are replaced to. : S / from / to / GC # all from the current row are replaced of to, but alternatively prior to each requesting user will be asked to confirm the operation. # Note: This can be from and to any string, which can also be from regular expressions.
0x01 replace the contents of a row
: 33S / from / to / G # replace the first 33 rows of text
: .s / from / to / G # replacement operation in the current line : 33S / from / to / G # replacement operation on line 33 is : S $ / from / to / G # replacement operation in the last row
0x02 replace the contents of some of the rows
: 10,20s / from / to / G # to replace the specified row
: 10,20s / from / to / G # on line 10 to replace the contents of the first 20 lines : . 1, $ S / from / to / G # to replace the first row (i.e., the entire text of the last line ) : . 1, .s / from / to / G # of the first row to replace the current contents of the line :., $ S / from / to / G # of the contents of the current row to the last row to be replaced : ' a, ' BS / from / to / G # of lines (including the line where a and b) between a and b mark the replacement. Wherein a and b are labeled by m before command does.
0x03 replace the contents of all rows
:% S / from / to / G # G as global Global abbreviation
:% S / from / to / G # to replace the content of all the rows.
0x04 replace the full form of the command
: [Range] S / from / to / [the flags] # [Range] and [the flags] Note reference to the following
S / from / to / # replace from string to string into the designated designated, from a regular expression may be
# [The Range] # There are a number of representations: # do not write range: default cursor line. # : Cursor line. # 1: The first line. # $: The last line. # 33: Line 33. # 'A: where a marked line (ma done prior to using the tag). # + 1: The current cursor line the following line. # $ -1: penultimate line. (Here that we can add and subtract a certain value on a line to # obtain the relative row). # 22,33: 22 to 33 lines. # 1, $: the first row to the last row. # 1 ,.: Line 1 to the current line. # , $: Current line to the last line. # 'A,' b: a mark row where is located the marked line b. # # %: All lines (and 1, $ equivalent). # # Chapter:?? Search up from the current location, find the line of the first chapter is located. ( # Where chapter can be any string or a regular expression. # / Chapter /: Search down from the current location, find the line of the first chapter where (. # Where chapter can be any string or a regular expression. # # Note that all of the above range are for representation by +, - operations to set the relative biasing # shift amount.
# [Flags] # where available flags are: # # No: only the first match will be replaced within a specified range. # G: for all occurrences of the specified range will be replaced. # C: before requesting the user to confirm the replacement. # E: Ignore errors during execution. # Note: All flags above are used in combination, such gc expressed within the specified range # all occurrences to be replaced, and will be replaced before each Please confirm.
0x00 replace the contents of the current row
:s/from/to/ # s即substitude
: S / from / to / # current in the first row from, replaced to. If the current line contains a plurality of from, will only replace the first one of them. : S / from / to / G # all from the current row are replaced to. : S / from / to / GC # all from the current row are replaced of to, but alternatively prior to each requesting user will be asked to confirm the operation. # Note: This can be from and to any string, which can also be from regular expressions.
0x01 replace the contents of a row
: 33S / from / to / G # replace the first 33 rows of text
: .s / from / to / G # replacement operation in the current line : 33S / from / to / G # replacement operation on line 33 is : S $ / from / to / G # replacement operation in the last row
0x02 replace the contents of some of the rows
: 10,20s / from / to / G # to replace the specified row
: 10,20s / from / to / G # on line 10 to replace the contents of the first 20 lines : . 1, $ S / from / to / G # to replace the first row (i.e., the entire text of the last line ) : . 1, .s / from / to / G # of the first row to replace the current contents of the line :., $ S / from / to / G # of the contents of the current row to the last row to be replaced : ' a, ' BS / from / to / G # of lines (including the line where a and b) between a and b mark the replacement. Wherein a and b are labeled by m before command does.
0x03 replace the contents of all rows
:% S / from / to / G # G as global Global abbreviation
:% S / from / to / G # to replace the content of all the rows.
0x04 replace the full form of the command
: [Range] S / from / to / [the flags] # [Range] and [the flags] Note reference to the following
S / from / to / # replace from string to string into the designated designated, from a regular expression may be
# [The Range] # There are a number of representations: # do not write range: default cursor line. # : Cursor line. # 1: The first line. # $: The last line. # 33: Line 33. # 'A: where a marked line (ma done prior to using the tag). # + 1: The current cursor line the following line. # $ -1: penultimate line. (Here that we can add and subtract a certain value on a line to # obtain the relative row). # 22,33: 22 to 33 lines. # 1, $: the first row to the last row. # 1 ,.: Line 1 to the current line. # , $: Current line to the last line. # 'A,' b: a mark row where is located the marked line b. # # %: All lines (and 1, $ equivalent). # # Chapter:?? Search up from the current location, find the line of the first chapter is located. ( # Where chapter can be any string or a regular expression. # / Chapter /: Search down from the current location, find the line of the first chapter where (. # Where chapter can be any string or a regular expression. # # Note that all of the above range are for representation by +, - operations to set the relative biasing # shift amount.
# [Flags] # where available flags are: # # No: only the first match will be replaced within a specified range. # G: for all occurrences of the specified range will be replaced. # C: before requesting the user to confirm the replacement. # E: Ignore errors during execution. # Note: All flags above are used in combination, such gc expressed within the specified range # all occurrences to be replaced, and will be replaced before each Please confirm.