comparison runtime/doc/cmdline.txt @ 31053:39f96b1e7b8d v9.0.0861

patch 9.0.0861: solution for "!!sort" in closed fold is not optimal Commit: https://github.com/vim/vim/commit/9954dc39ea090cee6bf41c888c41e60d9f52c3b8 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 11 22:58:36 2022 +0000 patch 9.0.0861: solution for "!!sort" in closed fold is not optimal Problem: Solution for "!!sort" in closed fold is not optimal. Solution: Use a different range instead of the subtle difference in handling a range with an offset. (issue #11487)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Nov 2022 00:00:04 +0100
parents 5acd6f02ea35
children 20cf2080f1ee
comparison
equal deleted inserted replaced
31052:2187b5ee2e89 31053:39f96b1e7b8d
734 % equal to 1,$ (the entire file) *:%* 734 % equal to 1,$ (the entire file) *:%*
735 't position of mark t (lowercase) *:'* 735 't position of mark t (lowercase) *:'*
736 'T position of mark T (uppercase); when the mark is in 736 'T position of mark T (uppercase); when the mark is in
737 another file it cannot be used in a range 737 another file it cannot be used in a range
738 /{pattern}[/] the next line where {pattern} matches *:/* 738 /{pattern}[/] the next line where {pattern} matches *:/*
739 also see |:range-pattern| below
739 ?{pattern}[?] the previous line where {pattern} matches *:?* 740 ?{pattern}[?] the previous line where {pattern} matches *:?*
741 also see |:range-pattern| below
740 \/ the next line where the previously used search 742 \/ the next line where the previously used search
741 pattern matches 743 pattern matches
742 \? the previous line where the previously used search 744 \? the previous line where the previously used search
743 pattern matches 745 pattern matches
744 \& the next line where the previously used substitute 746 \& the next line where the previously used substitute
745 pattern matches 747 pattern matches
746 748
749 *:range-offset*
747 Each may be followed (several times) by '+' or '-' and an optional number. 750 Each may be followed (several times) by '+' or '-' and an optional number.
748 This number is added or subtracted from the preceding line number. If the 751 This number is added or subtracted from the preceding line number. If the
749 number is omitted, 1 is used. If there is nothing before the '+' or '-' then 752 number is omitted, 1 is used. If there is nothing before the '+' or '-' then
750 the current line is used. 753 the current line is used.
751 754 *:range-closed-fold*
755 When a line number after the comma is in a closed fold it is adjusted to the
756 last line of the fold, thus the whole fold is included.
757
758 When a number is added this is done after the adjustment to the last line of
759 the fold. This means these lines are additionally included in the range. For
760 example: >
761 :3,4+2print
762 On this text:
763 1 one ~
764 2 two ~
765 3 three ~
766 4 four FOLDED ~
767 5 five FOLDED ~
768 6 six ~
769 7 seven ~
770 8 eight ~
771 Where lines four and five are a closed fold, ends up printing lines 3 to 7.
772 The 7 comes from the "4" in the range, which is adjusted to the end of the
773 closed fold, which is 5, and then the offset 2 is added.
774
775 An example for subtracting (which isn't very useful): >
776 :2,4-1print
777 On this text:
778 1 one ~
779 2 two ~
780 3 three FOLDED~
781 4 four FOLDED ~
782 5 five FOLDED ~
783 6 six FOLDED ~
784 7 seven ~
785 8 eight ~
786 Where lines three to six are a closed fold, ends up printing lines 2 to 6.
787 The 6 comes from the "4" in the range, which is adjusted to the end of the
788 closed fold, which is 6, and then 1 is subtracted, then this is still in the
789 closed fold and the last line of that fold is used, which is 6.
790
791 *:range-pattern*
752 The "/" and "?" after {pattern} are required to separate the pattern from 792 The "/" and "?" after {pattern} are required to separate the pattern from
753 anything that follows. 793 anything that follows.
754 794
755 The "/" and "?" may be preceded with another address. The search starts from 795 The "/" and "?" may be preceded with another address. The search starts from
756 there. The difference from using ';' is that the cursor isn't moved. 796 there. The difference from using ';' is that the cursor isn't moved.