comparison runtime/doc/change.txt @ 170:8c60f65311fa v7.0052

updated for version 7.0052
author vimboss
date Sat, 26 Feb 2005 23:04:13 +0000
parents 4d9eabb1396e
children da182deebec7
comparison
equal deleted inserted replaced
169:0e902b8f511f 170:8c60f65311fa
1 *change.txt* For Vim version 7.0aa. Last change: 2005 Feb 21 1 *change.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
525 {not in Vi} 525 {not in Vi}
526 526
527 527
528 4.2 Substitute *:substitute* 528 4.2 Substitute *:substitute*
529 *:s* *:su* 529 *:s* *:su*
530 :[range]s[ubstitute]/{pattern}/{string}/[&][#][c][e][g][p][r][i][I] [count] 530 :[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
531 For each line in [range] replace a match of {pattern} 531 For each line in [range] replace a match of {pattern}
532 with {string}. 532 with {string}.
533 For the {pattern} see |pattern|. 533 For the {pattern} see |pattern|.
534 {string} can be a literal string, or something 534 {string} can be a literal string, or something
535 special; see |sub-replace-special|. 535 special; see |sub-replace-special|.
537 current line only. 537 current line only.
538 When [count] is given, replace in [count] lines, 538 When [count] is given, replace in [count] lines,
539 starting with the last line in [range]. When [range] 539 starting with the last line in [range]. When [range]
540 is omitted start in the current line. 540 is omitted start in the current line.
541 Also see |cmdline-ranges|. 541 Also see |cmdline-ranges|.
542 See |:s_flags| for the flags. 542 See |:s_flags| for [flags].
543 543
544 :[range]s[ubstitute] [#][c][e][g][p][r][i][I] [count] 544 :[range]s[ubstitute] [flags] [count]
545 :[range]&[&][#][c][e][g][p][r][i][I] [count] *:&* 545 :[range]&[&][flags] [count] *:&*
546 Repeat last :substitute with same search pattern and 546 Repeat last :substitute with same search pattern and
547 substitute string, but without the same flags. You 547 substitute string, but without the same flags. You
548 may add extra flags (see |:s_flags|). 548 may add [flags], see |:s_flags|.
549 Note that after ":substitute" the '&' flag can't be 549 Note that after ":substitute" the '&' flag can't be
550 used, it's recognized as a pattern separator. 550 used, it's recognized as a pattern separator.
551 The space between ":substitute" and the 'c', 'g' and 551 The space between ":substitute" and the 'c', 'g' and
552 'r' flags isn't required, but in scripts it's a good 552 'r' flags isn't required, but in scripts it's a good
553 idea to keep it to avoid confusion. 553 idea to keep it to avoid confusion.
554 554
555 :[range]~[&][#][c][e][g][p][r][i][I] [count] *:~* 555 :[range]~[&][flags] [count] *:~*
556 Repeat last substitute with same substitute string 556 Repeat last substitute with same substitute string
557 but with last used search pattern. This is like 557 but with last used search pattern. This is like
558 ":&r". See |:s_flags| for the flags. 558 ":&r". See |:s_flags| for [flags].
559 559
560 *&* 560 *&*
561 & Synonym for ":s//~/" (repeat last substitute). Note 561 & Synonym for ":s//~/" (repeat last substitute). Note
562 that the flags are not remembered, thus it might 562 that the flags are not remembered, thus it might
563 actually work differently. You can use ":&&" to keep 563 actually work differently. You can use ":&&" to keep
564 the flags. 564 the flags.
565 565
566 *g&* 566 *g&*
567 g& Synonym for ":%s//~/&" (repeat last substitute on all 567 g& Synonym for ":%s//~/&" (repeat last substitute on all
568 lines with the same flags). 568 lines with the same flags).
569 Mnemonic: global substitute. {not in Vi} 569 Mnemonic: global substitute. {not in Vi}
570 570
571 *:snomagic* *:sno* 571 *:snomagic* *:sno*
626 {not in Vi} 626 {not in Vi}
627 627
628 [I] Don't ignore case for the pattern. The 'ignorecase' and 'smartcase' 628 [I] Don't ignore case for the pattern. The 'ignorecase' and 'smartcase'
629 options are not used. 629 options are not used.
630 {not in Vi} 630 {not in Vi}
631
632 [n] Report the number of matches, do not actually substitute. The [c]
633 flag is ignored. The matches are reported as if 'report' is zero.
634 Useful to |count-items|.
631 635
632 [p] Print the line containing the last substitute. 636 [p] Print the line containing the last substitute.
633 637
634 [#] Like [p] and prepend the line number. 638 [#] Like [p] and prepend the line number.
635 639